diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2022-09-30 09:31:47 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-09-30 11:47:09 +0200 |
commit | bb0f817abf5994602d8ef5bd8568ab129a727a96 (patch) | |
tree | 06e2d923b54a320f06df64dbb045f2bb47e04ee6 /test | |
parent | test: kill the machine on oops/panic/soft_lockup (diff) | |
download | systemd-bb0f817abf5994602d8ef5bd8568ab129a727a96.tar.xz systemd-bb0f817abf5994602d8ef5bd8568ab129a727a96.zip |
test: wait until the unit finishes before checking the log
Otherwise we might read an incomplete log and fail:
```
test_added_after (__main__.ExecutionResumeTest) ... FAIL
test_added_before (__main__.ExecutionResumeTest) ... ok
test_interleaved (__main__.ExecutionResumeTest) ... ok
test_issue_6533 (__main__.ExecutionResumeTest) ... ok
test_no_change (__main__.ExecutionResumeTest) ... ok
test_removal (__main__.ExecutionResumeTest) ... ok
test_swapped (__main__.ExecutionResumeTest) ... ok
======================================================================
FAIL: test_added_after (__main__.ExecutionResumeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/build/./test/test-exec-deserialization.py", line 152, in test_added_after
self.check_output(expected_output)
File "/build/./test/test-exec-deserialization.py", line 107, in check_output
self.assertEqual(output, expected_output)
AssertionError: 'foo\n' != 'foo\nbar\n'
foo
+ bar
----------------------------------------------------------------------
Ran 7 tests in 27.470s
```
Diffstat (limited to 'test')
-rwxr-xr-x | test/test-exec-deserialization.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/test-exec-deserialization.py b/test/test-exec-deserialization.py index eea7ddc8b3..06a7d369f6 100755 --- a/test/test-exec-deserialization.py +++ b/test/test-exec-deserialization.py @@ -101,6 +101,10 @@ class ExecutionResumeTest(unittest.TestCase): def check_output(self, expected_output): for _ in range(15): + # Wait until the unit finishes so we don't check an incomplete log + if subprocess.call(['systemctl', '-q', 'is-active', self.unit]) == 0: + continue + try: with open(self.output_file, 'r', encoding='utf-8') as log: output = log.read() |