Skip to content

Commit bff5e2e

Browse files
committed
fix test timeout by timeout check in subprocess.run, also fix typo in cpubudget prompt from hrs->seconds
Signed-off-by: Jack Luar <[email protected]>
1 parent 09a8224 commit bff5e2e

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

tools/AutoTuner/src/autotuner/distributed.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868
TEMPLATE = """
6969
Expected figures for this experiment.
70-
Wall time: {runtime:.5f} hours
70+
Wall time: {runtime:.5f} seconds
7171
Number of Samples:
7272
Samples per minute: {num_samples_per_minute:.5f}
7373
Design runtime of 10 min: {num_samples_10min:.5f}
@@ -79,7 +79,7 @@
7979

8080

8181
def calculate_expected_numbers(runtime, num_samples):
82-
# Runtime - hours
82+
# Runtime - seconds
8383
return TEMPLATE.format(
8484
runtime=runtime,
8585
num_samples_per_minute=num_samples / (runtime * 60),

tools/AutoTuner/test/smoke_test_timeout.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def setUp(self):
2020

2121
# 0.001 hour translates to 3.6 seconds, which will definitely cause failure.
2222
timeout_flags = ["--timeout 0.001", "--timeout_per_trial 0.001"]
23+
self.timeout_limit = 15 # 15 second upper limit
2324
self.commands = [
2425
"python3 distributed.py"
2526
f" --design {self.design}"
@@ -45,9 +46,11 @@ class ASAP7TimeoutSmokeTest(BaseTimeoutSmokeTest):
4546

4647
def test_timeout(self):
4748
for command in self.commands:
48-
out = subprocess.run(command, shell=True, check=True)
49+
out = subprocess.run(
50+
command, shell=True, check=True, timeout=self.timeout_limit
51+
)
4952
successful = out.returncode == 0
50-
self.assertFalse(successful)
53+
self.assertTrue(successful)
5154

5255

5356
class SKY130HDTimeoutSmokeTest(BaseTimeoutSmokeTest):
@@ -56,9 +59,11 @@ class SKY130HDTimeoutSmokeTest(BaseTimeoutSmokeTest):
5659

5760
def test_timeout(self):
5861
for command in self.commands:
59-
out = subprocess.run(command, shell=True, check=True)
62+
out = subprocess.run(
63+
command, shell=True, check=True, timeout=self.timeout_limit
64+
)
6065
successful = out.returncode == 0
61-
self.assertFalse(successful)
66+
self.assertTrue(successful)
6267

6368

6469
class IHPSG13G2TimeoutSmokeTest(BaseTimeoutSmokeTest):
@@ -67,9 +72,11 @@ class IHPSG13G2TimeoutSmokeTest(BaseTimeoutSmokeTest):
6772

6873
def test_timeout(self):
6974
for command in self.commands:
70-
out = subprocess.run(command, shell=True, check=True)
75+
out = subprocess.run(
76+
command, shell=True, check=True, timeout=self.timeout_limit
77+
)
7178
successful = out.returncode == 0
72-
self.assertFalse(successful)
79+
self.assertTrue(successful)
7380

7481

7582
if __name__ == "__main__":

0 commit comments

Comments
 (0)