From d0bc412302e6f32e65835a83ddefa656c7d7e9ba Mon Sep 17 00:00:00 2001 From: Vladimir Sementsov-Ogievskiy Date: Fri, 29 Jan 2021 19:13:23 +0300 Subject: iotests/297: pylint: ignore too many statements Ignore two complains, which now lead to 297 failure on testenv.py and testrunner.py. Fixes: 2e5a2f57db481f18fcf70be2a36b1417370b8476 Fixes: d74c754c924ca34e90b7c96ce2f5609d82c0e628 Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20210129161323.615027-1-vsementsov@virtuozzo.com> Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/pylintrc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/qemu-iotests') diff --git a/tests/qemu-iotests/pylintrc b/tests/qemu-iotests/pylintrc index cd3702e..7a6c0a9 100644 --- a/tests/qemu-iotests/pylintrc +++ b/tests/qemu-iotests/pylintrc @@ -21,6 +21,8 @@ disable=invalid-name, unsubscriptable-object, # These are temporary, and should be removed: missing-docstring, + too-many-return-statements, + too-many-statements [FORMAT] -- cgit v1.1 From ca502ca60dab85b11a7fad5978ab3de94c296fb6 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 2 Feb 2021 15:28:02 +0100 Subject: iotests: Revert emulator selection to old behaviour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order. This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again. Signed-off-by: Kevin Wolf Message-Id: <20210202142802.119999-1-kwolf@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- tests/qemu-iotests/testenv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/qemu-iotests') diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index b31275f..1fbec85 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -135,7 +135,7 @@ class TestEnv(ContextManager['TestEnv']): if not os.path.exists(self.qemu_prog): pattern = root('qemu-system-*') try: - progs = glob.iglob(pattern) + progs = sorted(glob.iglob(pattern)) self.qemu_prog = next(p for p in progs if isxfile(p)) except StopIteration: sys.exit("Not found any Qemu executable binary by pattern " -- cgit v1.1 From 3ae50942f161e2e8fa6ecd69a9c17b681d419905 Mon Sep 17 00:00:00 2001 From: Vladimir Sementsov-Ogievskiy Date: Mon, 1 Feb 2021 11:50:41 +0300 Subject: iotests: check: return 1 on failure We should indicate failure by exit code, not only output. Reported-by: Peter Maydell Fixes: f203080bbd9f9e5b31041b1f2afcd6040c5aaec5 Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20210201085041.3079-1-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf --- tests/qemu-iotests/check | 5 ++++- tests/qemu-iotests/testrunner.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'tests/qemu-iotests') diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 5190dee..d1c87ce 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -140,4 +140,7 @@ if __name__ == '__main__': else: with TestRunner(env, makecheck=args.makecheck, color=args.color) as tr: - tr.run_tests([os.path.join(env.source_iotests, t) for t in tests]) + paths = [os.path.join(env.source_iotests, t) for t in tests] + ok = tr.run_tests(paths) + if not ok: + sys.exit(1) diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py index 24b3fba..25754e9 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -318,7 +318,7 @@ class TestRunner(ContextManager['TestRunner']): return res - def run_tests(self, tests: List[str]) -> None: + def run_tests(self, tests: List[str]) -> bool: n_run = 0 failed = [] notrun = [] @@ -363,5 +363,7 @@ class TestRunner(ContextManager['TestRunner']): if failed: print('Failures:', ' '.join(failed)) print(f'Failed {len(failed)} of {n_run} iotests') + return False else: print(f'Passed all {n_run} iotests') + return True -- cgit v1.1 From 0212fa2afd1e20c590f740036f5cb837e1177d53 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 1 Feb 2021 17:10:24 +0100 Subject: iotests: Fix -makecheck output For -makecheck, the old 'check' implementation skipped the output when starting a test. It only had the condensed output at the end of a test. testrunner.py prints the normal output when starting a test even for -makecheck. This output contains '\r' at the end so that it can be overwritten with the result at the end of the test. However, for -makecheck this is shorter output in a different format, so effectively we end up with garbled output that mixes both output forms. Revert to the old behaviour of only printing a message after the test had completed in -makecheck mode. Fixes: d74c754c924ca34e90b7c96ce2f5609d82c0e628 Signed-off-by: Kevin Wolf Message-Id: <20210201161024.127921-1-kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Kevin Wolf --- tests/qemu-iotests/testrunner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/qemu-iotests') diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py index 25754e9..1fc61fc 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -301,8 +301,10 @@ class TestRunner(ContextManager['TestRunner']): last_el = self.last_elapsed.get(test) start = datetime.datetime.now().strftime('%H:%M:%S') - self.test_print_one_line(test=test, starttime=start, lasttime=last_el, - end='\r', test_field_width=test_field_width) + if not self.makecheck: + self.test_print_one_line(test=test, starttime=start, + lasttime=last_el, end='\r', + test_field_width=test_field_width) res = self.do_run_test(test) -- cgit v1.1