-
Notifications
You must be signed in to change notification settings - Fork 219
Expand file tree
/
Copy pathwait_for_tests
More file actions
executable file
·197 lines (167 loc) · 5.55 KB
/
wait_for_tests
File metadata and controls
executable file
·197 lines (167 loc) · 5.55 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/usr/bin/env python3
"""
Wait for a queued set of E3SM tests to finish by watching the
TestStatus files. If all tests pass, 0 is returned, otherwise a
non-zero error code is returned. Note that this program waits
for the RUN phase specifically and will not terminate if the
RUN phase didn't happen.
"""
from standard_script_setup import *
import CIME.wait_for_tests
import argparse, sys, os
###############################################################################
def parse_command_line(args, description):
###############################################################################
parser = argparse.ArgumentParser(
usage="""\n{0} [<Path to TestStatus> <Path to TestStatus> ...] [--verbose]
OR
{0} --help
\033[1mEXAMPLES:\033[0m
\033[1;32m# Wait for test in current dir\033[0m
> {0}
\033[1;32m# Wait for test in user specified tests\033[0m
> {0} path/to/testdir
\033[1;32m# Wait for all tests in a test area\033[0m
> {0} path/to/testarea/*/TestStatus
""".format(
os.path.basename(args[0])
),
description=description,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
CIME.utils.setup_standard_logging_options(parser)
parser.add_argument(
"paths",
default=".",
nargs="*",
help="Paths to test directories or status file. Pwd default.",
)
parser.add_argument(
"-n", "--no-wait", action="store_true", help="Do not wait for tests to finish"
)
parser.add_argument(
"--no-run", action="store_true", help="Do not expect run phase to be completed"
)
parser.add_argument(
"-t",
"--check-throughput",
action="store_true",
help="Fail if throughput check fails (fail if tests slow down)",
)
parser.add_argument(
"-m",
"--check-memory",
action="store_true",
help="Fail if memory check fails (fail if tests footprint grows)",
)
parser.add_argument(
"-i",
"--ignore-namelist-diffs",
action="store_true",
help="Do not fail a test if the only problem is diffing namelists",
)
parser.add_argument(
"--ignore-diffs",
action="store_true",
help="Do not fail a test if the only problem is diffing history files",
)
parser.add_argument(
"--ignore-memleak",
action="store_true",
help="Do not fail a test if the only problem is a memleak",
)
parser.add_argument(
"--cdash-force-log-upload",
action="store_true",
help="Always upload logs to cdash, even if test passed",
)
parser.add_argument(
"-b",
"--cdash-build-name",
help="Build name, implies you want results send to Cdash",
)
parser.add_argument(
"-p",
"--cdash-project",
default=CIME.wait_for_tests.E3SM_MAIN_CDASH,
help="The name of the CDash project where results should be uploaded",
)
parser.add_argument(
"--cdash-tmproot",
help="Where to put temporary files needed to do cdash submission. Default=/tmp",
)
parser.add_argument(
"-g",
"--cdash-build-group",
default=CIME.wait_for_tests.CDASH_DEFAULT_BUILD_GROUP,
help="The build group to be used to display results on the CDash dashboard.",
)
parser.add_argument("--timeout", type=int, help="Timeout wait in seconds.")
parser.add_argument(
"--update-success",
action="store_true",
help="Record test success in baselines. Only the nightly process should use this in general.",
)
args = CIME.utils.parse_args_and_handle_standard_logging_options(args, parser)
return (
args.paths,
args.no_wait,
args.check_throughput,
args.check_memory,
args.ignore_namelist_diffs,
args.ignore_diffs,
args.ignore_memleak,
args.cdash_build_name,
args.cdash_project,
args.cdash_tmproot,
args.cdash_build_group,
args.timeout,
args.cdash_force_log_upload,
args.no_run,
args.update_success,
)
###############################################################################
def _main_func(description):
###############################################################################
(
test_paths,
no_wait,
check_throughput,
check_memory,
ignore_namelist_diffs,
ignore_diffs,
ignore_memleak,
cdash_build_name,
cdash_project,
cdash_tmproot,
cdash_build_group,
timeout,
force_log_upload,
no_run,
update_success,
) = parse_command_line(sys.argv, description)
sys.exit(
0
if CIME.wait_for_tests.wait_for_tests(
test_paths,
no_wait=no_wait,
check_throughput=check_throughput,
check_memory=check_memory,
ignore_namelists=ignore_namelist_diffs,
ignore_diffs=ignore_diffs,
ignore_memleak=ignore_memleak,
cdash_build_name=cdash_build_name,
cdash_project=cdash_project,
cdash_tmproot=cdash_tmproot,
cdash_build_group=cdash_build_group,
timeout=timeout,
force_log_upload=force_log_upload,
no_run=no_run,
update_success=update_success,
expect_test_complete=not no_wait,
)
else CIME.utils.TESTS_FAILED_ERR_CODE
)
###############################################################################
if __name__ == "__main__":
_main_func(__doc__)