From 6b3a1999711d67c60c3d5317b12017680d4be214 Mon Sep 17 00:00:00 2001 From: tgerdes Date: Sat, 30 Mar 2024 08:39:50 -0500 Subject: [PATCH] fix unit tests --- tests/test_perf_analyzer.py | 14 ++++++++------ tests/test_results.py | 18 +++++++++--------- tests/test_run_config.py | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/test_perf_analyzer.py b/tests/test_perf_analyzer.py index e95f0d4a1..488cc71e3 100755 --- a/tests/test_perf_analyzer.py +++ b/tests/test_perf_analyzer.py @@ -132,7 +132,7 @@ def test_perf_analyzer_config(self): def test_perf_analyzer_boolean_args(self): """Test that only positive boolean args get added""" - expected_cli_str = "-m test_model --measurement-interval=1000 --binary-search --measurement-request-count=50" + expected_cli_str = "-m test_model -b 1 --measurement-interval=1000 --binary-search --measurement-request-count=50" self.config["async"] = "False" self.config["binary-search"] = "True" @@ -141,7 +141,7 @@ def test_perf_analyzer_boolean_args(self): def test_perf_analyzer_additive_args(self): shape = ["name1:1,2,3", "name2:4,5,6"] - expected_cli_str = "-m test_model --measurement-interval=1000 --shape=name1:1,2,3 --shape=name2:4,5,6 --measurement-request-count=50" + expected_cli_str = "-m test_model -b 1 --measurement-interval=1000 --shape=name1:1,2,3 --shape=name2:4,5,6 --measurement-request-count=50" self.config["shape"] = shape[:] @@ -149,7 +149,7 @@ def test_perf_analyzer_additive_args(self): self.assertEqual(self.config.to_cli_string(), expected_cli_str) shape = "name1:1,2,3" - expected_cli_str = "-m test_model --measurement-interval=1000 --shape=name1:1,2,3 --measurement-request-count=50" + expected_cli_str = "-m test_model -b 1 --measurement-interval=1000 --shape=name1:1,2,3 --measurement-request-count=50" self.config["shape"] = shape self.assertEqual(self.config.to_cli_string(), expected_cli_str) @@ -177,7 +177,7 @@ def test_perf_analyzer_ssl_args(self): ssl_https_private_key_file = "h" expected_cli_str = ( - f"-m test_model --measurement-interval=1000 --measurement-request-count=50 --ssl-grpc-use-ssl " + f"-m test_model -b 1 --measurement-interval=1000 --measurement-request-count=50 --ssl-grpc-use-ssl " f"--ssl-grpc-root-certifications-file=a --ssl-grpc-private-key-file=b --ssl-grpc-certificate-chain-file=c " f"--ssl-https-verify-peer=1 --ssl-https-verify-host=2 --ssl-https-ca-certificates-file=d --ssl-https-client-certificate-type=e " f"--ssl-https-client-certificate-file=f --ssl-https-private-key-type=g --ssl-https-private-key-file=h" @@ -241,7 +241,7 @@ def test_perf_analyzer_ssl_args(self): self.config["ssl-grpc-use-ssl"] = ssl_grpc_use_ssl self.assertEqual(self.config["ssl-grpc-use-ssl"], ssl_grpc_use_ssl) expected_cli_str = ( - f"-m test_model --measurement-interval=1000 --measurement-request-count=50 " + f"-m test_model -b 1 --measurement-interval=1000 --measurement-request-count=50 " f"--ssl-grpc-root-certifications-file=a --ssl-grpc-private-key-file=b --ssl-grpc-certificate-chain-file=c " f"--ssl-https-verify-peer=1 --ssl-https-verify-host=2 --ssl-https-ca-certificates-file=d --ssl-https-client-certificate-type=e " f"--ssl-https-client-certificate-file=f --ssl-https-private-key-type=g --ssl-https-private-key-file=h" @@ -651,6 +651,8 @@ def test_get_cmd_single_model(self): "perf_analyzer", "-m", "test_model", + "-b", + "1", "--measurement-interval", "1000", "--measurement-request-count", @@ -688,7 +690,7 @@ def test_get_cmd_multi_model(self): expected_cmd = [ 'mpiexec', '--allow-run-as-root', '--tag-output', '-n', '1', 'perf_analyzer', '--enable-mpi', - '-m', 'MultiModel1', + '-m', 'MultiModel1', '-b', '1', '--measurement-interval', '1000', '--measurement-request-count', '50', ':', '-n', '1', 'perf_analyzer', '--enable-mpi', diff --git a/tests/test_results.py b/tests/test_results.py index 2fc45162b..5bdf6b11a 100755 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -179,23 +179,23 @@ def _construct_results(self): self._measurements = [] self._measurements.append( { - "model_config_0 -m key_A": "1", - "model_config_0 -m key_B": "2", - "model_config_0 -m key_C": "3", + "model_config_0 -m key_A -b 1": "1", + "model_config_0 -m key_B -b 1": "2", + "model_config_0 -m key_C -b 1": "3", } ) self._measurements.append( { - "model_config_1 -m key_D": "4", - "model_config_1 -m key_E": "5", - "model_config_1 -m key_F": "6", + "model_config_1 -m key_D -b 1": "4", + "model_config_1 -m key_E -b 1": "5", + "model_config_1 -m key_F -b 1": "6", } ) self._measurements.append( { - "model_config_2 -m key_G": "7", - "model_config_2 -m key_H": "8", - "model_config_2 -m key_I": "9", + "model_config_2 -m key_G -b 1": "7", + "model_config_2 -m key_H -b 1": "8", + "model_config_2 -m key_I -b 1": "9", } ) diff --git a/tests/test_run_config.py b/tests/test_run_config.py index 03dc53c9f..4aaea7e63 100755 --- a/tests/test_run_config.py +++ b/tests/test_run_config.py @@ -91,7 +91,7 @@ def test_representation_mrc_removal(self): "model1", ModelConfigVariant(MagicMock(), "model1_config_0"), pc ) - expected_representation = "model1_config_0 -m TestModel1" + expected_representation = "model1_config_0 -m TestModel1 -b 1" self.assertEqual(mrc.representation(), expected_representation) def test_cpu_only(self):