Bug 31912 - stdout and stderr correlation lost in ucs-test output
stdout and stderr correlation lost in ucs-test output
Status: CLOSED FIXED
Product: UCS Test
Classification: Unclassified
Component: Framework
unspecified
Other Linux
: P5 normal (vote)
: ---
Assigned To: Philipp Hahn
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-08 10:23 CEST by Arvid Requate
Modified: 2023-03-25 06:50 CET (History)
3 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Requate univentionstaff 2013-07-08 10:23:48 CEST
In Jenkins the test output is separated in stdout an stderr, loosing all temporal correlation. ucs-test framework should maybe redirect stderr (also) to stdout.

Example:
===============================================================================
Standard Ausgabe (STDOUT)

## create the GPO 'lY2yuuma' on remote DC master095.autotest095.local
## GPO was created on master095.autotest095.local with ID {AC5DE684-CE47-4AB7-B67A-4EAE0434EEE9}
## check whether the directory has been created on remote DC master095.autotest095.local
## check whether samba-tool lists the GPO on remote DC master095.autotest095.local
## check whether the directory for the GPO has been replicated to the local system (waiting about 300 seconds)
## Note: to speed things up for interactive tests, you may run /usr/share/univention-samba4/scripts/sysvol-sync.sh manually now.

GPO {AC5DE684-CE47-4AB7-B67A-4EAE0434EEE9} deleted.

Standard Fehler (STDERR)

error 2013-07-07 20:35:17	 Directory for GPO has not been created
error 2013-07-07 20:35:17	 **************** Test failed above this line (1) ****************
===============================================================================
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2014-05-12 09:14:11 CEST
I second this proposal.
Comment 2 Philipp Hahn univentionstaff 2014-05-12 09:25:24 CEST
Shell: exec 2>&1
Python: import os,sys;os.dup2(sys.stderr.fileno(), sys.stdout.fileno())

PS: see "Ariane 5 Flight 501" for why that its is generally a bad idea to mix it: STDOUT is for expected output/for other processes to process, STDERR is unexpected output/for diagnostics.
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2014-05-12 09:32:13 CEST
(In reply to Philipp Hahn from comment #2)
> PS: see "Ariane 5 Flight 501" for why that its is generally a bad idea to
> mix it: STDOUT is for expected output/for other processes to process, STDERR
> is unexpected output/for diagnostics.

For other programs I would agree. But in this case, the whole output of the script (out+err) is important for debugging/diagnostics. Solutions:
1) Always write to stdout
2) Always write to stderr
3) Merge stdout+stderr into one stream

I think solution 3) would be more generic and means less changes to existing code.
Comment 4 Philipp Hahn univentionstaff 2015-03-31 15:06:16 CEST
r59512 | Bug #31912 test: Merge stdout and stderr in output
Comment 5 Dmitry Galkin univentionstaff 2015-04-14 12:25:34 CEST
(In reply to Philipp Hahn from comment #4)
> r59512 | Bug #31912 test: Merge stdout and stderr in output

Seems like it breaks the output when an iterable is printed like print
 "Foo is:", some_list

I see the following:

[  0.575]Installed Apps are:
[  0.575] 
[  0.575][
[  0.575]'
[  0.575]k
[  0.575]o
[  0.576]l
[  0.576]a
[  0.576]b
[  0.576]-
[  0.576]e
[  0.576]n
[  0.576]t
[  0.576]e
[  0.576]r
[  0.576]p
[  0.576]r
[  0.576]i
[  0.576]s
[  0.576]e
[  0.576]'
[  0.576]]
[  0.576]
Comment 6 Philipp Hahn univentionstaff 2015-04-14 15:57:54 CEST
This is the failed test: <http://jenkins.knut.univention.de:8080/job/UCS-4.0/job/UCS-4.0-1/job/UCS%204.0%20App%20Autotest%20MultiEnv/lastCompletedBuild/SambaVersion=s4,Systemrolle=master/testReport/20_appcenter/18_check_app_links/test/>

r59787 | Bug #31912 test: Merge stdout and stderr in output
    Collect continuous output of up to .1s.    
    Use absolute time stamp instead of relative delta.
Comment 7 Philipp Hahn univentionstaff 2015-04-29 10:40:29 CEST
r60277 | Bug #31912 test: Fix merged stdout and stderr reading
 Fixed deadlock reading wrong PIPE

Package: ucs-test
Version: 5.0.147-1.1043.201504291033
Branch: ucs_4.0-0
Scope: errata4.0-1
Comment 8 Stefan Gohmann univentionstaff 2016-10-12 07:48:43 CEST
For this bug is no separate QA needed.