Skip to content

Commit b1915e7

Browse files
committed
Add 'tapetests' argument to (regression) test case functions to inform them whether the test case is run in a tapetest stage or not.
1 parent 0fb8b29 commit b1915e7

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

TestCases/TestCase.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ def __init__(self,tag_in):
108108
# multizone problem
109109
self.multizone = False
110110

111+
# Indicate tapetest mode
112+
self.enabled_with_tapetests = False
113+
111114
# The test condition. These must be set after initialization
112115
self.test_iter = 1
113116
self.ntest_vals = 4
@@ -128,9 +131,10 @@ def __init__(self,tag_in):
128131
self.reference_file_aarch64 = ""
129132
self.test_file = "of_grad.dat"
130133

131-
def run_test(self, with_tsan=False, with_asan=False):
134+
def run_test(self, with_tsan=False, with_asan=False, with_tapetests=False):
132135

133-
if not self.is_enabled(with_tsan, with_asan):
136+
# Check whether this test is valid and can be continued
137+
if not self.is_enabled(with_tsan, with_asan, with_tapetests):
134138
return True
135139

136140
print('==================== Start Test: %s ===================='%self.tag)
@@ -284,9 +288,9 @@ def run_test(self, with_tsan=False, with_asan=False):
284288
os.chdir(workdir)
285289
return passed
286290

287-
def run_filediff(self, with_tsan=False, with_asan=False):
291+
def run_filediff(self, with_tsan=False, with_asan=False, with_tapetests=False):
288292

289-
if not self.is_enabled(with_tsan, with_asan):
293+
if not self.is_enabled(with_tsan, with_asan, with_tapetests):
290294
return True
291295

292296
print('==================== Start Test: %s ===================='%self.tag)
@@ -481,9 +485,9 @@ def run_filediff(self, with_tsan=False, with_asan=False):
481485
os.chdir(workdir)
482486
return passed
483487

484-
def run_opt(self, with_tsan=False, with_asan=False):
488+
def run_opt(self, with_tsan=False, with_asan=False, with_tapetests=False):
485489

486-
if not self.is_enabled(with_tsan, with_asan):
490+
if not self.is_enabled(with_tsan, with_asan, with_tapetests):
487491
return True
488492

489493
print('==================== Start Test: %s ===================='%self.tag)
@@ -606,9 +610,9 @@ def run_opt(self, with_tsan=False, with_asan=False):
606610
os.chdir(workdir)
607611
return passed
608612

609-
def run_geo(self, with_tsan=False, with_asan=False):
613+
def run_geo(self, with_tsan=False, with_asan=False, with_tapetests=False):
610614

611-
if not self.is_enabled(with_tsan, with_asan):
615+
if not self.is_enabled(with_tsan, with_asan, with_tapetests):
612616
return True
613617

614618
print('==================== Start Test: %s ===================='%self.tag)
@@ -746,9 +750,9 @@ def run_geo(self, with_tsan=False, with_asan=False):
746750
os.chdir(workdir)
747751
return passed
748752

749-
def run_def(self, with_tsan=False, with_asan=False):
753+
def run_def(self, with_tsan=False, with_asan=False, with_tapetests=False):
750754

751-
if not self.is_enabled(with_tsan, with_asan):
755+
if not self.is_enabled(with_tsan, with_asan, with_tapetests):
752756
return True
753757

754758
print('==================== Start Test: %s ===================='%self.tag)
@@ -971,19 +975,24 @@ def disable_restart(self):
971975

972976
return
973977

974-
def is_enabled(self, with_tsan=False, with_asan=False):
978+
def is_enabled(self, with_tsan=False, with_asan=False, with_tapetests=False):
975979
is_enabled_on_arch = self.cpu_arch in self.enabled_on_cpu_arch
976980

977981
if not is_enabled_on_arch:
978982
print('Ignoring test "%s" because it is not enabled for the current CPU architecture: %s' % (self.tag, self.cpu_arch))
979983

984+
# A test case is valid to be continued if neither of the special modes (tsan, asan, tapetests) is active, or if so, the corresponding test case is enabled, too.
980985
tsan_compatible = not with_tsan or self.enabled_with_tsan
981986
asan_compatible = not with_asan or self.enabled_with_asan
987+
tapetests_compatible = not with_tapetests or self.enabled_with_tapetests
982988

983989
if not tsan_compatible:
984990
print('Ignoring test "%s" because it is not enabled to run with the thread sanitizer.' % self.tag)
985991

986-
return is_enabled_on_arch and tsan_compatible and asan_compatible
992+
if not tapetests_compatible:
993+
print('Ignoring test "%s" because it is not enabled to run a test of the tape.' % self.tag)
994+
995+
return is_enabled_on_arch and tsan_compatible and asan_compatible and tapetests_compatible and tapetests_compatible
987996

988997
def adjust_test_data(self):
989998

TestCases/serial_regression_AD.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def main():
234234
if test.tol == 0.0:
235235
test.tol = 0.00001
236236

237-
pass_list = [ test.run_test(args.tsan, args.asan) for test in test_list ]
237+
pass_list = [ test.run_test(args.tsan, args.asan, args.tapetests) for test in test_list ]
238238

239239
###################################
240240
### Coupled RHT-CFD Adjoint ###
@@ -251,7 +251,7 @@ def main():
251251
discadj_rht.reference_file_aarch64 = "of_grad_cd_aarch64.csv.ref"
252252
discadj_rht.test_file = "of_grad_cd.csv"
253253
discadj_rht.enabled_with_asan = False
254-
pass_list.append(discadj_rht.run_filediff(args.tsan, args.asan))
254+
pass_list.append(discadj_rht.run_filediff(args.tsan, args.asan, args.tapetests))
255255
test_list.append(discadj_rht)
256256

257257
######################################
@@ -269,7 +269,7 @@ def main():
269269
discadj_euler_py.reference_file_aarch64 = "of_grad_cd_disc_aarch64.dat.ref"
270270
discadj_euler_py.test_file = "of_grad_cd.dat"
271271
discadj_euler_py.enabled_with_asan = False
272-
pass_list.append(discadj_euler_py.run_filediff(args.tsan, args.asan))
272+
pass_list.append(discadj_euler_py.run_filediff(args.tsan, args.asan, args.tapetests))
273273
test_list.append(discadj_euler_py)
274274

275275
# test discrete_adjoint with multiple ffd boxes
@@ -283,7 +283,7 @@ def main():
283283
discadj_multiple_ffd_py.reference_file_aarch64 = "of_grad_cd_aarch64.dat.ref"
284284
discadj_multiple_ffd_py.test_file = "of_grad_cd.dat"
285285
discadj_multiple_ffd_py.enabled_with_asan = False
286-
pass_list.append(discadj_multiple_ffd_py.run_filediff(args.tsan, args.asan))
286+
pass_list.append(discadj_multiple_ffd_py.run_filediff(args.tsan, args.asan, args.tapetests))
287287
test_list.append(discadj_multiple_ffd_py)
288288

289289
# test direct_differentiation.py
@@ -297,7 +297,7 @@ def main():
297297
directdiff_euler_py.reference_file_aarch64 = "of_grad_directdiff_aarch64.dat.ref"
298298
directdiff_euler_py.test_file = "DIRECTDIFF/of_grad_directdiff.dat"
299299
directdiff_euler_py.enabled_with_asan = False
300-
pass_list.append(directdiff_euler_py.run_filediff(args.tsan, args.asan))
300+
pass_list.append(directdiff_euler_py.run_filediff(args.tsan, args.asan, args.tapetests))
301301
test_list.append(directdiff_euler_py)
302302

303303
# test direct_differentiation.py with multiple ffd boxes
@@ -311,7 +311,7 @@ def main():
311311
directdiff_multiple_ffd_py.reference_file_aarch64 = "of_grad_directdiff_aarch64.dat.ref"
312312
directdiff_multiple_ffd_py.test_file = "DIRECTDIFF/of_grad_directdiff.dat"
313313
directdiff_multiple_ffd_py.enabled_with_asan = False
314-
pass_list.append(directdiff_multiple_ffd_py.run_filediff(args.tsan, args.asan))
314+
pass_list.append(directdiff_multiple_ffd_py.run_filediff(args.tsan, args.asan, args.tapetests))
315315
test_list.append(directdiff_multiple_ffd_py)
316316

317317
# test continuous_adjoint.py, with multiple objectives
@@ -338,7 +338,7 @@ def main():
338338
pywrapper_FEA_AD_FlowLoad.new_output = False
339339
pywrapper_FEA_AD_FlowLoad.enabled_with_asan = False
340340
test_list.append(pywrapper_FEA_AD_FlowLoad)
341-
pass_list.append(pywrapper_FEA_AD_FlowLoad.run_test(args.tsan, args.asan))
341+
pass_list.append(pywrapper_FEA_AD_FlowLoad.run_test(args.tsan, args.asan, args.tapetests))
342342

343343
# Flow AD Mesh Displacement Sensitivity
344344
pywrapper_CFD_AD_MeshDisp = TestCase('pywrapper_CFD_AD_MeshDisp')
@@ -352,7 +352,7 @@ def main():
352352
pywrapper_CFD_AD_MeshDisp.new_output = False
353353
pywrapper_CFD_AD_MeshDisp.enabled_with_asan = False
354354
test_list.append(pywrapper_CFD_AD_MeshDisp)
355-
pass_list.append(pywrapper_CFD_AD_MeshDisp.run_test(args.tsan, args.asan))
355+
pass_list.append(pywrapper_CFD_AD_MeshDisp.run_test(args.tsan, args.asan, args.tapetests))
356356

357357

358358
###################################
@@ -369,7 +369,7 @@ def main():
369369
grad_smooth_naca0012.reference_file_aarch64 = "of_hess_aarch64.dat.ref"
370370
grad_smooth_naca0012.test_file = "of_hess.dat"
371371
grad_smooth_naca0012.enabled_with_asan = False
372-
pass_list.append(grad_smooth_naca0012.run_filediff(args.tsan, args.asan))
372+
pass_list.append(grad_smooth_naca0012.run_filediff(args.tsan, args.asan, args.tapetests))
373373
test_list.append(grad_smooth_naca0012)
374374

375375
# Tests summary

0 commit comments

Comments
 (0)