Bug 1386769

Summary: [RFE] rlAssertNotDiffer verbose output if files differ
Product: [Fedora] Fedora Reporter: David Jež <djez>
Component: beakerlibAssignee: Dalibor Pospíšil <dapospis>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: rawhideCC: azelinka, dapospis, mkyral, muller
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description David Jež 2016-10-19 15:22:51 UTC
Hi,

In case that files are differ output of rlAssertNotDiffer seems like:
:: [   FAIL   ] :: Files reproducer.expected and output should not differ

which says nothing and it then is really hard to debug what is wrong. So now I temporary use following code in the test which print diff output if files are differ or nothing if files are same:

rlAssertNotDiffer expected.txt output.txt || rlLogWarning "$(diff -u
expected.txt output.txt)"

it would be nice add this verbose output to rlAssertNotDiffer function.

Thanks,
DJ

Comment 1 Dalibor Pospíšil 2016-10-19 19:20:55 UTC
The files can also be kind of binary so the diff should not be printed by default. I propose adding an option which would cause the output to be printed.

Comment 2 David Jež 2016-10-21 08:58:47 UTC
I can not see any problem with binaries, AFAIK diff -u never print any binary output, see e.g.:

$ diff -u David.jpg Image.ashx.jpg
Binary files David.jpg and Image.ashx.jpg differ

$

But in some case output could be really long... So add an option like -v for '... diff | head -200 ' and -vv for diff without head or something like that would be OK.

Comment 3 Dalibor Pospíšil 2016-10-21 10:15:39 UTC
(In reply to David Jež from comment #2)
> But in some case output could be really long... So add an option like -v for
> '... diff | head -200 ' and -vv for diff without head or something like that
> would be OK.

This sound reasonable to me.

Lets wait for others to express their acks.

Comment 4 Ales Zelinka 2016-10-21 13:23:39 UTC
Personally I've always considered rlAssert*Diff to be useless, not having any advantage over rlRun "diff ...". So adding few more useful features to it would, in my eyes, at least make it worth keeping around.

Comment 5 Martin Kyral 2016-11-08 11:07:03 UTC
I deem the feature quite useful -> ack+