Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1354474 - RFE: highlight "command not found" error in output
Summary: RFE: highlight "command not found" error in output
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Dalibor Pospíšil
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2016-07-11 11:59 UTC by David Jež
Modified: 2018-01-29 23:55 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:

Attachments (Terms of Use)
Sniplet from postgresql library (deleted)
2016-07-11 13:49 UTC, Jakub Prokes
no flags Details

Description David Jež 2016-07-11 11:59:52 UTC

It would be great to highlight "command not found" errors in beakerlib output. For some cases like miss typo in run / assert commands etc as it could be found easier in output with highlighting.

I personally use following temporary handler in my tests, but it would be nice keep it in lib instead of test scenario. Following handler highlights the error message red:

command_not_found_handle () {
        echo -e "\e[31m$1: command not found\e[0m"

Comment 1 Jakub Prokes 2016-07-11 13:49:36 UTC
Created attachment 1178418 [details]
Sniplet from postgresql library

In postgresql Library I use this, which is probably what David wants, but bit more general. I'm not sure if it should be part of beakerlib and/or if it should be enabled by default for some error codes.

Comment 2 Dalibor Pospíšil 2016-09-22 15:05:29 UTC
I guest you would like to see it in rlRun.
Simply grepping output for string 'command not found' is bad idea. Using trap as Kuba suggested is much better solution. Anyway I do not think it is good idea to enable it generally.

Comment 3 Dalibor Pospíšil 2016-10-03 09:01:34 UTC
After discussion with David, I got better look at the this. I like the idea but we need to agree how to implement it and whether to enable it by default.

Risk of enabling by default: there should no be many tests which execute non-existing commands by design. So enabling it by default should not affect many cases.

We should provide a way for disabling it for test where it is expected. For other tests it could help discover typos and possibly false positive tests.

Note You need to log in before you can comment on or make changes to this bug.