33import os
44
55cur_dir = os .path .dirname (os .path .abspath (__file__ ))
6- src_dir = os .path .join (cur_dir , "../src/autotuner" )
7- os .chdir (src_dir )
86
97
108class BaseTimeoutSmokeTest (unittest .TestCase ):
@@ -20,9 +18,8 @@ def setUp(self):
2018
2119 # 0.001 hour translates to 3.6 seconds, which will definitely cause failure.
2220 timeout_flags = ["--timeout 0.001" , "--timeout_per_trial 0.001" ]
23- self .timeout_limit = 60 # 60 second upper limit (Ray needs time to shutdown)
2421 self .commands = [
25- "python3 distributed.py "
22+ "python3 -m autotuner.distributed "
2623 f" --design { self .design } "
2724 f" --platform { self .platform } "
2825 f" --experiment { self .experiment } -{ idx } "
@@ -34,49 +31,28 @@ def setUp(self):
3431 ]
3532
3633 def test_timeout (self ):
37- raise NotImplementedError (
38- "This method needs to be implemented in the derivative classes."
39- )
34+ if not (self .platform and self .design ):
35+ raise unittest .SkipTest ("Platform and design have to be defined" )
36+ for command in self .commands :
37+ out = subprocess .run (command , shell = True , check = False )
38+ failed = out .returncode != 0
39+ self .assertTrue (failed )
4040
4141
4242class asap7TimeoutSmokeTest (BaseTimeoutSmokeTest ):
4343 platform = "asap7"
4444 design = "gcd"
4545
46- def test_timeout (self ):
47- for command in self .commands :
48- out = subprocess .run (
49- command , shell = True , check = False , timeout = self .timeout_limit
50- )
51- failed = out .returncode == 1
52- self .assertTrue (failed )
53-
5446
5547class sky130hdTimeoutSmokeTest (BaseTimeoutSmokeTest ):
5648 platform = "sky130hd"
5749 design = "gcd"
5850
59- def test_timeout (self ):
60- for command in self .commands :
61- out = subprocess .run (
62- command , shell = True , check = False , timeout = self .timeout_limit
63- )
64- failed = out .returncode == 1
65- self .assertTrue (failed )
66-
6751
6852class ihpsg13g2TimeoutSmokeTest (BaseTimeoutSmokeTest ):
6953 platform = "ihp-sg13g2"
7054 design = "gcd"
7155
72- def test_timeout (self ):
73- for command in self .commands :
74- out = subprocess .run (
75- command , shell = True , check = False , timeout = self .timeout_limit
76- )
77- failed = out .returncode == 1
78- self .assertTrue (failed )
79-
8056
8157if __name__ == "__main__" :
8258 unittest .main ()
0 commit comments