Bug 547665

Summary: [RFE] option for rlRun output to the log only when it fails
Product: [Fedora] Fedora Reporter: Jan Hutař <jhutar>
Component: beakerlibAssignee: Jan Hutař <jhutar>
Status: CLOSED RAWHIDE QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: pmuller, psplicha, qa-errata-list
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 893053 (view as bug list) Environment:
Last Closed: 2013-06-27 16:33:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 893053    
Attachments:
Description Flags
Added -c option for rlRun and tests for that
none
Series of patches to implement bug 547665
none
Add -c option to rlRun and unit-tests for it
none
rlRun logging limit, improvements and test cleanup none

Description Jan Hutař 2009-12-15 11:04:12 UTC
Description of problem:
As rlRun now have -l option, it would be nice to have it's variant, something like -c (conditionaly) to include output only when command executed by rlRun fails.


Version-Release number of selected component (if applicable):
beaker-lib-0.4.64-0.el5.noarch


Steps to Reproduce:
1. rlRun -c "blablabla"


Expected results:
If command failed, include output as with -l.


Additional info:
This will not add so big amount of data to journal as -l.

Comment 1 Jan Hutař 2009-12-15 12:08:36 UTC
Created attachment 378483 [details]
Added -c option for rlRun and tests for that

Comment 2 Jan Hutař 2009-12-15 12:38:37 UTC
Fixing bug state.

Comment 3 Petr Muller 2011-04-29 14:25:50 UTC
I like the idea (it's a pity this was overlooked for so long), but the patch no longer applies. I've removed "Patch" keyword, I'll implement this in the next iteration if anything applying is not submitted again.

Comment 4 Jan Hutař 2011-07-18 11:34:51 UTC
Created attachment 513599 [details]
Series of patches to implement bug 547665

Comment 5 Jan Hutař 2011-07-18 11:50:19 UTC
Created attachment 513601 [details]
Add -c option to rlRun and unit-tests for it

Comment 6 Jan Hutař 2011-07-18 11:51:08 UTC
Re-implemented against current git and added nice tests.

Comment 7 Petr Muller 2011-07-22 16:59:39 UTC
Reviewed and tested a bit, good to go. Thanks!

I've did some follow-up work when testing this change: I've imposed a 50 line limit on the outputs (last 50 lines are logged) to avoid having huge logs in the journal: large logs should be analysed in separated files. The size of the limit is open to discussion, the existence of it is not :)

Additionally, I've changed the way how the lines are logged, and cleaned some tests up.

Previous result:
rlRun -c 'notexists', during execution:
gcc: error: notexists: No such file or directory
gcc: fatal error: no input files
compilation terminated.
:: [18:56:48] :: [ INFO    ] :: rlRun: command = 'gcc notexists'; exitcode = 4; expected = 0
:: [18:56:48] ::  gcc notexists
gcc: error: notexists: No such file or directory
gcc: fatal error: no input files
compilation terminated.
:: [   FAIL   ] :: Running 'gcc notexists' (Expected 0, got 4)

rlRun -c 'notexists', in rlJournalPrintText:
:: [   INFO   ] :: rlRun: command = 'gcc notexists'; exitcode = 4; expected = 0
:: [   LOG    ] :: gcc notexists\ngcc: error: notexists: No such file or directory
:: [   LOG    ] :: gcc: fatal error: no input files
:: [   LOG    ] :: compilation terminated.
:: [   FAIL   ] :: Running 'gcc notexists' (Expected 0, got 4)


New result:
rlRun -c 'notexists', during execution:
gcc: error: notexists: No such file or directory
gcc: fatal error: no input files
compilation terminated.
:: [18:58:25] :: [ INFO    ] :: rlRun: command = 'gcc notexists'; exitcode = 4; expected = 0
:: [18:58:26] ::  Output of 'gcc notexists':
:: [18:58:26] ::  --------------- OUTPUT START ---------------
:: [18:58:26] ::  gcc: error: notexists: No such file or directory
:: [18:58:26] ::  gcc: fatal error: no input files
:: [18:58:26] ::  compilation terminated.
:: [18:58:26] ::  ---------------  OUTPUT END  ---------------
:: [   FAIL   ] :: Running 'gcc notexists' (Expected 0, got 4)

rlRun -c 'notexists', in rlJournalPrintText:
:: [   INFO   ] :: rlRun: command = 'gcc notexists'; exitcode = 4; expected = 0
:: [   LOG    ] :: Output of 'gcc notexists':
:: [   LOG    ] :: --------------- OUTPUT START ---------------
:: [   LOG    ] :: gcc: error: notexists: No such file or directory
:: [   LOG    ] :: gcc: fatal error: no input files
:: [   LOG    ] :: compilation terminated.
:: [   LOG    ] :: ---------------  OUTPUT END  ---------------
:: [   FAIL   ] :: Running 'gcc notexists' (Expected 0, got 4)

Comment 8 Petr Muller 2011-07-22 17:00:48 UTC
Created attachment 514744 [details]
rlRun logging limit, improvements and test cleanup

Comment 12 Petr Muller 2013-01-08 14:24:17 UTC
beakerlib-1.6-1 is already in fedora