34
34
TEST_TIMEOUT = 20 * 60
35
35
36
36
37
+ def step_timeout (timeout ):
38
+ # timeout is the regrtest timeout in seconds. If a test runs longer than
39
+ # the timeout, it should be killed by faulthandler. Give 10 minutes to
40
+ # faulthandler to kill the process. Tests should always be shorter than the
41
+ # buildbot step timeout, unless faulthandler fails to kill the process.
42
+ return timeout + 10 * 60
43
+
44
+
37
45
def regrtest_has_cleanup (branch ):
38
46
return branch not in {CUSTOM_BRANCH_NAME }
39
47
@@ -97,8 +105,6 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
97
105
testopts .extend (("--junit-xml" , JUNIT_FILENAME ))
98
106
# Timeout for the buildworker process
99
107
self .test_timeout = self .test_timeout or TEST_TIMEOUT
100
- # Timeout for faulthandler
101
- faulthandler_timeout = self .test_timeout - 5 * 60
102
108
if parallel :
103
109
compile = ["make" , parallel , self .makeTarget ]
104
110
testopts .append (parallel )
@@ -110,8 +116,8 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
110
116
"make" ,
111
117
"buildbottest" ,
112
118
"TESTOPTS=" + " " .join (testopts ) + " ${BUILDBOT_TESTOPTS}" ,
113
- "TESTPYTHONOPTS=" + self .interpreterFlags ,
114
- "TESTTIMEOUT=" + str ( faulthandler_timeout ) ,
119
+ f "TESTPYTHONOPTS={ self .interpreterFlags } " ,
120
+ f "TESTTIMEOUT={ self . test_timeout } " ,
115
121
]
116
122
117
123
self .addStep (Compile (command = compile ,
@@ -127,15 +133,13 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
127
133
** oot_kwargs
128
134
)
129
135
)
130
- self .addStep (
131
- Test (
132
- command = test ,
133
- timeout = self .test_timeout ,
134
- usePTY = test_with_PTY ,
135
- env = self .test_environ ,
136
- ** oot_kwargs
137
- )
138
- )
136
+ self .addStep (Test (
137
+ command = test ,
138
+ timeout = step_timeout (self .test_timeout ),
139
+ usePTY = test_with_PTY ,
140
+ env = self .test_environ ,
141
+ ** oot_kwargs
142
+ ))
139
143
if branch not in ("3" ,) and not has_option ("-R" , self .testFlags ):
140
144
filename = JUNIT_FILENAME
141
145
if self .build_out_of_tree :
@@ -202,7 +206,7 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
202
206
branch = MAIN_BRANCH_VERSION
203
207
elif branch == "custom" :
204
208
branch = "3"
205
- installed_python = "./target/bin/python%s" % branch
209
+ installed_python = f "./target/bin/python{ branch } "
206
210
self .addStep (
207
211
Configure (
208
212
command = ["./configure" , "--prefix" , "$(PWD)/target" ]
@@ -213,11 +217,8 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
213
217
compile = ["make" , self .makeTarget ]
214
218
install = ["make" , self .installTarget ]
215
219
testopts = list (self .defaultTestOpts )
216
- # Timeout for the buildworker process
217
220
self .test_timeout = self .test_timeout or TEST_TIMEOUT
218
- # Timeout for faulthandler
219
- faulthandler_timeout = self .test_timeout - 5 * 60
220
- testopts .append (f"--timeout={ faulthandler_timeout } " )
221
+ testopts .append (f"--timeout={ self .test_timeout } " )
221
222
if parallel :
222
223
compile = ["make" , parallel , self .makeTarget ]
223
224
install = ["make" , parallel , self .installTarget ]
@@ -241,9 +242,11 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
241
242
warnOnFailure = True ,
242
243
)
243
244
)
244
- self .addStep (
245
- Test (command = test , timeout = self .test_timeout , usePTY = test_with_PTY )
246
- )
245
+ self .addStep (Test (
246
+ command = test ,
247
+ timeout = step_timeout (self .test_timeout ),
248
+ usePTY = test_with_PTY ,
249
+ ))
247
250
self .addStep (Uninstall ())
248
251
self .addStep (Clean ())
249
252
@@ -543,8 +546,11 @@ def setup(self, parallel, branch, **kwargs):
543
546
)
544
547
)
545
548
timeout = self .test_timeout if self .test_timeout else TEST_TIMEOUT
546
- test_command .extend (("--timeout" , timeout - (5 * 60 )))
547
- self .addStep (Test (command = test_command , timeout = timeout ))
549
+ test_command .extend (("--timeout" , str (timeout )))
550
+ self .addStep (Test (
551
+ command = test_command ,
552
+ timeout = step_timeout (self .test_timeout ),
553
+ ))
548
554
if branch not in ("3" ,) and not has_option ("-R" , self .testFlags ):
549
555
self .addStep (UploadTestResults (branch ))
550
556
self .addStep (Clean (command = clean_command ))
@@ -721,17 +727,14 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
721
727
if branch in BRANCH_WITH_FAIL_RERUN :
722
728
testopts .append ("--fail-rerun" )
723
729
724
- # Timeout for the buildworker process
725
730
self .test_timeout = self .test_timeout or TEST_TIMEOUT
726
- # Timeout for faulthandler
727
- faulthandler_timeout = self .test_timeout - 5 * 60
728
731
729
732
test = [
730
733
"make" ,
731
734
"buildbottest" ,
732
735
"TESTOPTS=" + " " .join (testopts ) + " ${BUILDBOT_TESTOPTS}" ,
733
- "TESTPYTHONOPTS=" + self .interpreterFlags ,
734
8000
td>
- "TESTTIMEOUT=" + str ( faulthandler_timeout ) ,
736
+ f "TESTPYTHONOPTS={ self .interpreterFlags } " ,
737
+ f "TESTTIMEOUT={ self . test_timeout } " ,
735
738
]
736
739
737
740
if parallel :
@@ -757,15 +760,13 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
757
760
workdir = oot_host_path ,
758
761
)
759
762
)
760
- self .addStep (
761
- Test (
762
- command = test ,
763
- timeout = self .test_timeout ,
764
- usePTY = test_with_PTY ,
765
- env = self .test_environ ,
766
- workdir = oot_host_path ,
767
- )
768
- )
763
+ self .addStep (Test (
764
+ command = test ,
765
+ timeout = step_timeout (self .test_timeout ),
766
+ usePTY = test_with_PTY ,
767
+ env = self .test_environ ,
768
+ workdir = oot_host_path ,
769
+ ))
769
770
if branch not in ("3" ,) and not has_option ("-R" , self .testFlags ):
770
771
filename = os .path .join (oot_host_path , JUNIT_FILENAME )
771
772
self .addStep (UploadTestResults (branch , filename = filename ))
0 commit comments