Skip to content

Commit 14e2e03

Browse files
committed
cpubudget test fixes
- make a more reasonable # of samples to avoid jenkins worker overloading. - fix expected_timeout Signed-off-by: Jack Luar <[email protected]>
1 parent c787974 commit 14e2e03

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

tools/AutoTuner/test/smoke_test_cpubudget.py

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ def setUp(self):
1818
)
1919
self.experiment = f"smoke-test-cpubudget-{self.platform}"
2020

21+
# Tests should fail with such a low budget.
2122
cpu_budget = 1
22-
self.expected_timeout = cpu_budget / os.cpu_count()
23+
self.expected_timeout = cpu_budget / os.cpu_count() * 3600
2324

2425
self.command = (
2526
"python3 distributed.py"
@@ -29,8 +30,9 @@ def setUp(self):
2930
f" --config {self.config}"
3031
f" --cpu_budget 1"
3132
f" --yes"
32-
f" tune --samples 1000"
33+
f" tune --samples 1"
3334
)
35+
self.command = self.command.split()
3436

3537
def test_cpu_budget(self):
3638
raise NotImplementedError(
@@ -44,13 +46,15 @@ class asap7CPUBudgetSmokeTest(BaseCPUBudgetSmokeTest):
4446

4547
def test_cpu_budget(self):
4648
try:
47-
out = subprocess.run(
48-
self.command, shell=True, check=True, timeout=self.expected_timeout
49+
_ = subprocess.run(
50+
self.command,
51+
stderr=subprocess.PIPE,
52+
timeout=self.expected_timeout,
4953
)
50-
successful = out.returncode == 0
54+
failed = False
5155
except subprocess.TimeoutExpired:
52-
successful = False
53-
self.assertFalse(successful)
56+
failed = True
57+
self.assertTrue(failed)
5458

5559

5660
class sky130hdCPUBudgetSmokeTest(BaseCPUBudgetSmokeTest):
@@ -59,13 +63,15 @@ class sky130hdCPUBudgetSmokeTest(BaseCPUBudgetSmokeTest):
5963

6064
def test_cpu_budget(self):
6165
try:
62-
out = subprocess.run(
63-
self.command, shell=True, check=True, timeout=self.expected_timeout
66+
_ = subprocess.run(
67+
self.command,
68+
stderr=subprocess.PIPE,
69+
timeout=self.expected_timeout,
6470
)
65-
successful = out.returncode == 0
71+
failed = False
6672
except subprocess.TimeoutExpired:
67-
successful = False
68-
self.assertFalse(successful)
73+
failed = True
74+
self.assertTrue(failed)
6975

7076

7177
class ihpsg13g2CPUBudgetSmokeTest(BaseCPUBudgetSmokeTest):
@@ -74,13 +80,15 @@ class ihpsg13g2CPUBudgetSmokeTest(BaseCPUBudgetSmokeTest):
7480

7581
def test_cpu_budget(self):
7682
try:
77-
out = subprocess.run(
78-
self.command, shell=True, check=True, timeout=self.expected_timeout
83+
_ = subprocess.run(
84+
self.command,
85+
stderr=subprocess.PIPE,
86+
timeout=self.expected_timeout,
7987
)
80-
successful = out.returncode == 0
88+
failed = False
8189
except subprocess.TimeoutExpired:
82-
successful = False
83-
self.assertFalse(successful)
90+
failed = True
91+
self.assertTrue(failed)
8492

8593

8694
if __name__ == "__main__":

0 commit comments

Comments
 (0)