Skip to content

Commit 6b3a199

Browse files
committed
fix unit tests
1 parent 71e7a90 commit 6b3a199

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

tests/test_perf_analyzer.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_perf_analyzer_config(self):
132132

133133
def test_perf_analyzer_boolean_args(self):
134134
"""Test that only positive boolean args get added"""
135-
expected_cli_str = "-m test_model --measurement-interval=1000 --binary-search --measurement-request-count=50"
135+
expected_cli_str = "-m test_model -b 1 --measurement-interval=1000 --binary-search --measurement-request-count=50"
136136

137137
self.config["async"] = "False"
138138
self.config["binary-search"] = "True"
@@ -141,15 +141,15 @@ def test_perf_analyzer_boolean_args(self):
141141

142142
def test_perf_analyzer_additive_args(self):
143143
shape = ["name1:1,2,3", "name2:4,5,6"]
144-
expected_cli_str = "-m test_model --measurement-interval=1000 --shape=name1:1,2,3 --shape=name2:4,5,6 --measurement-request-count=50"
144+
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"
145145

146146
self.config["shape"] = shape[:]
147147

148148
self.assertEqual(self.config["shape"], shape)
149149
self.assertEqual(self.config.to_cli_string(), expected_cli_str)
150150

151151
shape = "name1:1,2,3"
152-
expected_cli_str = "-m test_model --measurement-interval=1000 --shape=name1:1,2,3 --measurement-request-count=50"
152+
expected_cli_str = "-m test_model -b 1 --measurement-interval=1000 --shape=name1:1,2,3 --measurement-request-count=50"
153153
self.config["shape"] = shape
154154

155155
self.assertEqual(self.config.to_cli_string(), expected_cli_str)
@@ -177,7 +177,7 @@ def test_perf_analyzer_ssl_args(self):
177177
ssl_https_private_key_file = "h"
178178

179179
expected_cli_str = (
180-
f"-m test_model --measurement-interval=1000 --measurement-request-count=50 --ssl-grpc-use-ssl "
180+
f"-m test_model -b 1 --measurement-interval=1000 --measurement-request-count=50 --ssl-grpc-use-ssl "
181181
f"--ssl-grpc-root-certifications-file=a --ssl-grpc-private-key-file=b --ssl-grpc-certificate-chain-file=c "
182182
f"--ssl-https-verify-peer=1 --ssl-https-verify-host=2 --ssl-https-ca-certificates-file=d --ssl-https-client-certificate-type=e "
183183
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):
241241
self.config["ssl-grpc-use-ssl"] = ssl_grpc_use_ssl
242242
self.assertEqual(self.config["ssl-grpc-use-ssl"], ssl_grpc_use_ssl)
243243
expected_cli_str = (
244-
f"-m test_model --measurement-interval=1000 --measurement-request-count=50 "
244+
f"-m test_model -b 1 --measurement-interval=1000 --measurement-request-count=50 "
245245
f"--ssl-grpc-root-certifications-file=a --ssl-grpc-private-key-file=b --ssl-grpc-certificate-chain-file=c "
246246
f"--ssl-https-verify-peer=1 --ssl-https-verify-host=2 --ssl-https-ca-certificates-file=d --ssl-https-client-certificate-type=e "
247247
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):
651651
"perf_analyzer",
652652
"-m",
653653
"test_model",
654+
"-b",
655+
"1",
654656
"--measurement-interval",
655657
"1000",
656658
"--measurement-request-count",
@@ -688,7 +690,7 @@ def test_get_cmd_multi_model(self):
688690
expected_cmd = [
689691
'mpiexec', '--allow-run-as-root', '--tag-output',
690692
'-n', '1', 'perf_analyzer', '--enable-mpi',
691-
'-m', 'MultiModel1',
693+
'-m', 'MultiModel1', '-b', '1',
692694
'--measurement-interval', '1000',
693695
'--measurement-request-count', '50',
694696
':', '-n', '1', 'perf_analyzer', '--enable-mpi',

tests/test_results.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,23 +179,23 @@ def _construct_results(self):
179179
self._measurements = []
180180
self._measurements.append(
181181
{
182-
"model_config_0 -m key_A": "1",
183-
"model_config_0 -m key_B": "2",
184-
"model_config_0 -m key_C": "3",
182+
"model_config_0 -m key_A -b 1": "1",
183+
"model_config_0 -m key_B -b 1": "2",
184+
"model_config_0 -m key_C -b 1": "3",
185185
}
186186
)
187187
self._measurements.append(
188188
{
189-
"model_config_1 -m key_D": "4",
190-
"model_config_1 -m key_E": "5",
191-
"model_config_1 -m key_F": "6",
189+
"model_config_1 -m key_D -b 1": "4",
190+
"model_config_1 -m key_E -b 1": "5",
191+
"model_config_1 -m key_F -b 1": "6",
192192
}
193193
)
194194
self._measurements.append(
195195
{
196-
"model_config_2 -m key_G": "7",
197-
"model_config_2 -m key_H": "8",
198-
"model_config_2 -m key_I": "9",
196+
"model_config_2 -m key_G -b 1": "7",
197+
"model_config_2 -m key_H -b 1": "8",
198+
"model_config_2 -m key_I -b 1": "9",
199199
}
200200
)
201201

tests/test_run_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_representation_mrc_removal(self):
9191
"model1", ModelConfigVariant(MagicMock(), "model1_config_0"), pc
9292
)
9393

94-
expected_representation = "model1_config_0 -m TestModel1"
94+
expected_representation = "model1_config_0 -m TestModel1 -b 1"
9595
self.assertEqual(mrc.representation(), expected_representation)
9696

9797
def test_cpu_only(self):

0 commit comments

Comments
 (0)