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 1354473 - RFE: specify TMP directory for 'rlRun -s ' output files
Summary: RFE: specify TMP directory for 'rlRun -s ' output files
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: Dalibor Pospíšil
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
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:
Environment:
Last Closed:


Attachments (Terms of Use)

Description David Jež 2016-07-11 11:59:21 UTC
BeakerLib with an option 'rlRun -s' create an output file in random directory created by 'mktemp' command by default. It would be really nice either specify that directory or at least top level by some internal variable etc.

Common use case in test scenario:
* set up phase - creating one tmp directory
# TMPDIR=`mktemp`
# cd $TMPDIR

* test phase
...

* clean phase - clean whole working directory
# rm -rf $TMPDIR

Now it is not possible use option '-s' in test phase because each rlRun create its own tmp file stored in $rlRun_LOG variable and that files could not be cleaned in clean up phase because all rlRun calls use same variable for store different paths. And 'rm' after each rlRun - assert is simply ugly.

Comment 1 Dalibor Pospíšil 2016-07-29 08:26:21 UTC
This is intended and documented.

" -s
Store stdout and stderr to a file (mixed together, as the user would see
it on a terminal) and set $rlRun_LOG variable to name of the file. Caller
is responsible for removing the file."

In my POI it needs just one fine-tuning, that is to put some 'rlRun' prefix to the file name to be more obvious from where the file came while asserting.

Comment 2 David Jež 2016-08-10 11:42:33 UTC
There is one problem with $rlRun_LOG - file name in variable is changing each rlRun, so you have to either collect all log files to clean them all in clean up phase or clean them by one in test phase before each rlRun.

My point is that it would be nice to have something like rlRun_PREFIX
 - if exist and it is file, log would be append to it
 - if exist and it is directory, new file in the directory will be created
 - if does not exist die with error
 - if not defined make temp file as usually (compatibility mode)

By this change we could also "make nice file names". Something like PREFIX/output.XXXX instead of XXXXXX random chars would be more intuitive and pretty in test outputs :-)

Comment 3 Jakub Prokes 2016-08-10 17:07:41 UTC
I agree with Dalibor, solution with rlRun_PREFIX I supposed to be over-engineered specially if we were talking about files in /tmp.

Comment 4 Dalibor Pospíšil 2016-08-17 14:43:40 UTC
Definition look complicated but implementation would be pretty simple.
I'm taking back my nack and now see what's others opinion on this.

I would say: nice and simple patch would give us more will to ack this RFE.


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