-
Notifications
You must be signed in to change notification settings - Fork 108
/
run_tests
executable file
·146 lines (121 loc) · 3.87 KB
/
run_tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/env python3
#
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
#
# SPDX-License-Identifier: BSD-2-Clause
#
import os
import sys
import argparse
import subprocess
# Settings
L4V_ARCH_DEFAULT="ARM"
L4V_ARCH_LIST=["ARM","ARM_HYP","X64","RISCV64", "AARCH64"]
# Fetch directory this script is stored in.
DIR=os.path.dirname(os.path.realpath(__file__))
# Add repo version of Isabelle to our path.
os.environ["PATH"] += os.pathsep + DIR
# Enable tracking stuck tasks, and set report interval to 3 seconds
os.environ["ISABELLE_TIMING_LOG"]="3.0s"
# Enable quick_and_dirty mode for various images
if "QUICK_AND_DIRTY" in os.environ:
os.environ["AINVS_QUICK_AND_DIRTY"]="1"
os.environ["REFINE_QUICK_AND_DIRTY"]="1"
os.environ["CREFINE_QUICK_AND_DIRTY"]="1"
print("Testing with QUICK_AND_DIRTY")
# Lists of excluded tests for different archs
EXCLUDE={}
EXCLUDE["ARM_HYP"]=[
"Access",
"Bisim",
"DRefine",
"RefineOrphanage",
"SimplExportAndRefine"]
EXCLUDE["ARM"]=[]
EXCLUDE["X64"]=[
"Access",
"AutoCorresSEL4",
"CamkesGlueProofs",
"DBaseRefine",
"DSpec",
"RefineOrphanage",
"SimplExportAndRefine",
"AsmRefine"
]
EXCLUDE["RISCV64"]=[
"AutoCorresSEL4",
"DSpec",
"DBaseRefine",
"CamkesGlueProofs",
"AsmRefine"
]
EXCLUDE["AARCH64"]=[
# To be eliminated/refined as development progresses
"ASepSpec",
"Access",
# Tools and unrelated content, removed for development
"AutoCorres",
"CamkesGlueSpec",
"Sep_Algebra",
"Concurrency",
"EVTutorial",
"TakeGrant",
"Bisim",
# Longer-term exclusions
"AutoCorresSEL4",
"DSpec",
"DBaseRefine",
"CamkesGlueProofs",
"AsmRefine",
"SimplExportAndRefine"
]
# Check EXCLUDE is exhaustive over the available architectures
if not set(L4V_ARCH_LIST) <= set(EXCLUDE.keys()):
sys.exit("[INTERNAL ERROR] exclusion lists are non-exhaustive")
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--l4v-arches', metavar='ARCH,...', type=str,
help='test multiple L4V_ARCHs (comma-separated)')
parser.add_argument('--l4v-arch-all', dest='l4v_arches',
action='store_const', const=','.join(L4V_ARCH_LIST),
help='test all L4V_ARCHes')
parser.add_argument('-h', '--help', action='store_true',
help=argparse.SUPPRESS)
args, passthrough_args = parser.parse_known_args()
if args.l4v_arches:
archs = args.l4v_arches.split(',')
elif "L4V_ARCH" in os.environ:
archs = [os.environ["L4V_ARCH"]]
else:
archs = [L4V_ARCH_DEFAULT]
for arch in archs:
if arch not in L4V_ARCH_LIST:
sys.exit("Unknown architecture: %s" % arch)
if args.help:
parser.print_help()
print('Now printing help for main regression script:')
print('--------')
passthrough_args += ['--help']
archs = archs[:1]
returncode = 0
for arch in archs:
features = os.environ.get("L4V_FEATURES", "")
plat = os.environ.get("L4V_PLAT", "")
num_domains = os.environ.get("INPUT_NUM_DOMAINS", "")
print(f"Testing for L4V_ARCH='{arch}', L4V_FEATURES='{features}', L4V_PLAT='{plat}', "
f"INPUT_NUM_DOMAINS='{num_domains}'")
os.environ["L4V_ARCH"] = arch
# Provide L4V_ARCH_IS_ARM for Corres_Test in lib/ROOT
if arch == "ARM":
os.environ["L4V_ARCH_IS_ARM"] = arch
print("Setting L4V_ARCH_IS_ARM")
elif "L4V_ARCH_IS_ARM" in os.environ:
del os.environ["L4V_ARCH_IS_ARM"]
sys.stdout.flush()
# Arguments:
args = ['./misc/regression/run_tests.py'] # Script name
args += [r for t in EXCLUDE[arch] for r in ['-r', t]] # Exclusion list
args += passthrough_args # Other arguments
# Run the tests from the script directory.
# Also collect the last non-zero return code.
returncode = subprocess.call(args, cwd=DIR) or returncode
sys.exit(returncode)