From 7e5fc407793bf9d2467a448bc1c4e98c50c84bdb Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 18 Jan 2021 14:18:34 +0000 Subject: [PATCH] Ignore number of captures made in D3D11_Swapchain_Zoo --- util/test/rdtest/capture.py | 10 +++++++--- util/test/rdtest/testcase.py | 4 +++- util/test/tests/D3D11/D3D11_Swapchain_Zoo.py | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/util/test/rdtest/capture.py b/util/test/rdtest/capture.py index 721f95157..171299050 100644 --- a/util/test/rdtest/capture.py +++ b/util/test/rdtest/capture.py @@ -144,7 +144,7 @@ def run_executable(exe: str, cmdline: str, return res.ident -def run_and_capture(exe: str, cmdline: str, frame: int, *, frame_count=1, capture_name=None, opts=rd.GetDefaultCaptureOptions(), +def run_and_capture(exe: str, cmdline: str, frame: int, *, frame_count=1, captures_expected=None, capture_name=None, opts=rd.GetDefaultCaptureOptions(), timeout=None, logfile=None): """ Helper function to run an executable with a command line, capture a particular frame, and exit. @@ -167,6 +167,9 @@ def run_and_capture(exe: str, cmdline: str, frame: int, *, frame_count=1, captur if capture_name is None: capture_name = 'capture' + if captures_expected is None: + captures_expected = frame_count + control = TargetControl(run_executable(exe, cmdline, cappath=util.get_tmp_path(capture_name), opts=opts), timeout=timeout) log.print("Queuing capture of frame {}..{} with timeout of {}".format(frame, frame+frame_count, "default" if timeout is None else timeout)) @@ -176,16 +179,17 @@ def run_and_capture(exe: str, cmdline: str, frame: int, *, frame_count=1, captur # Run until we have all expected captures (probably just 1). If the program # exits or times out we will also stop, of course - control.run(keep_running=lambda x: len(x.captures()) < frame_count) + control.run(keep_running=lambda x: len(x.captures()) < captures_expected) captures = control.captures() if logfile is not None and os.path.exists(logfile): log.inline_file('Process output', logfile, with_stdout=True) - if len(captures) != frame_count: + if len(captures) != captures_expected: if len(captures) == 0: raise RuntimeError("No capture made in program") + raise RuntimeError("Expected {} captures, but only got {}".format(frame_count, len(captures))) return captures[0].path diff --git a/util/test/rdtest/testcase.py b/util/test/rdtest/testcase.py index 508897acc..8016c3027 100644 --- a/util/test/rdtest/testcase.py +++ b/util/test/rdtest/testcase.py @@ -135,6 +135,7 @@ class TestCase: demos_test_name = '' demos_frame_cap = 5 demos_frame_count = 1 + demos_captures_expected = None _test_list = {} @staticmethod @@ -204,7 +205,8 @@ class TestCase: if self.demos_test_name != '': logfile = os.path.join(util.get_tmp_dir(), 'demos.log') return capture.run_and_capture(util.get_demos_binary(), self.demos_test_name + " --log " + logfile, - self.demos_frame_cap, frame_count=self.demos_frame_count, logfile=logfile, + self.demos_frame_cap, frame_count=self.demos_frame_count, + captures_expected=self.demos_captures_expected, logfile=logfile, opts=self.get_capture_options(), timeout=util.get_demos_timeout()) raise NotImplementedError("If run() is not implemented in a test, then" diff --git a/util/test/tests/D3D11/D3D11_Swapchain_Zoo.py b/util/test/tests/D3D11/D3D11_Swapchain_Zoo.py index 55020e2bb..3b15ada1f 100644 --- a/util/test/tests/D3D11/D3D11_Swapchain_Zoo.py +++ b/util/test/tests/D3D11/D3D11_Swapchain_Zoo.py @@ -5,7 +5,9 @@ import rdtest class D3D11_Swapchain_Zoo(rdtest.TestCase): demos_test_name = 'D3D11_Swapchain_Zoo' demos_frame_cap = 50 + # Take 10 captures because we don't know the present order, but only expect 1 demos_frame_count = 10 + demos_captures_expected = 1 def check_capture(self): draw = self.find_draw("DrawIndexed")