[tools][kernel] test suddenly print login words -> script_output used wrong
openQA test in scenario sle-15-Installer-DVD-ppc64le-xfstests_run_for_btrfs@ppc64le fails in
Seems like a random issue.
Last good: Build [368.3]https://openqa.suse.de/tests/1293242
Don't suddenly print login words. Actually it's only stay several seconds before show this login words.
Always latest result in this scenario: latest
#5 Updated by okurz over 3 years ago
- Subject changed from [tools][kernel] test suddenly print login words to [tools][kernel] test suddenly print login words -> script_output used wrong
See #30613. If possible work with bash variables within the SUT, e.g.
assert_script_run('test_log=$(ls /var/log/qa/ctcs2/); tar cjf /tmp/$test_log.tar.bz2 -C /var/log/qa/ctcs2 $test_log'); but as we need the logfile to upload later I could not find a complete solution now.
I think the line "eth0 xxxx" is a minor issue, the point I can't understand is why SUT alway randomly logout and print login information.
I can explain. The code currently is like this:
my $test_log = script_output("ls /var/log/qa/ctcs2/"); my $tarball = "/tmp/$test_log.tar.bz2"; assert_script_run("tar cjf /tmp/$test_log.tar.bz2 -C /var/log/qa/ctcs2 $test_log");
With the first line you "assume" you would get only the output of
ls /var/log/qa/ctcs2/ but instead you get everything what is there at this time on the serial output, e.g. the whole "Welcome to SUSE Linux Enterprise …". And all this content is stored in the variable
$test_log which is then appended in the string "/tmp/$test_log…". Instead of writing just "/tmp/process_stress-2018-…" it writes instead the full content of the variable
$test_log at this point, e.g. "/tmp/Welcome to … … … process_stress-2018…". This is not what you want :)
A not-complete workaround would be to call
my $dummy = wait_serial('', 0); to catch all (useless) content on the serial device into a dummy variable before you execute the next step. But it can still happen that any process in the background is writing something on the serial output confusing your scripts. So you have the following possibilities:
- Rewrite the code to avoid
script_outputat all and rely only on bash variables within the SUT so no return of variables back to the worker
- Cleanup whatever you get back from
script_outputbefore passing it back into a variable, e.g. how https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/lib/btrfs_test.pm#L26 is doing it
- Help to fix script_output in the backend: #30613
#12 Updated by yosun over 3 years ago
- % Done changed from 0 to 50
I pick the solution that not use script_output to assign parameters. e.g. my $para=script_output(foo). Find other API for workaround.
Fixed qa_test_* related test in following PR:
As xfstests change module recently, and it use another set of script which also contain lot of script_output. I'll give another PR for that.
#14 Updated by yosun over 3 years ago
- Status changed from In Progress to Resolved
- % Done changed from 50 to 100
I made some workaround to replace as much as script_output code to other api in execute_test_run and xfstests run scirpt, but some script_output still can't replace by others api. I think I can close this issue for testcase part, and leave remains for tools team in poo#30613.