Skip to content

Commit 79289d4

Browse files
committed
[GR-21590] Update imports
PullRequest: graalpython/2817
2 parents 9e09a55 + abefb4b commit 79289d4

File tree

4 files changed

+31
-37
lines changed

4 files changed

+31
-37
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "b676f3e9a8ed96de8f3df5b9f20677e5d15586a9" }
1+
{ "overlay": "1d05a5fbcb17e942af2c50382364c94b82bc7f85" }

graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
else:
5151
TAGS_DIR = "null"
5252

53-
TIMEOUT = 90 * 60
53+
RUN_TIMEOUT = 90 * 60
54+
RETAG_TIMEOUT = 20 * 60
5455
RUNNER = os.path.join(os.path.dirname(__file__), "run_cpython_test.py")
5556
LINE = "=" * 80
5657

@@ -107,14 +108,16 @@ def test_tagged():
107108
if os.environ.get("ENABLE_THREADED_GRAALPYTEST") == "true":
108109
run_serialize_out(cmd)
109110
else:
110-
rcode = run_with_timeout(cmd).returncode
111+
rcode = run_with_timeout(cmd, timeout=RUN_TIMEOUT).returncode
111112
if rcode:
112113
raise subprocess.CalledProcessError(rcode, cmd)
113114
print(working_test[0], "was finished.")
114115

115116
def run_serialize_out(cmd):
116-
result = run_with_timeout(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
117+
result = run_with_timeout(cmd, timeout=RUN_TIMEOUT, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
117118
append_out = "-v" in sys.argv
119+
if result.returncode == 124:
120+
raise subprocess.TimeoutExpired(cmd=cmd, timeout=RUN_TIMEOUT)
118121
if result.returncode:
119122
message = f"{working_test[0]} failed with exit code {result.returncode}.\n"
120123
append_out = True
@@ -196,14 +199,14 @@ def parse_unittest_output(output):
196199
return
197200

198201

199-
def run_with_timeout(cmd, *args, **kwargs):
202+
def run_with_timeout(cmd, *, timeout, **kwargs):
200203
p = subprocess.getstatusoutput("which timeout" if sys.platform != 'darwin' else "which gtimeout")
201204
if p[0] != 0:
202205
print("Cannot find the 'timeout' GNU tool. Do you have coreutils installed?")
203206
else:
204-
timeout = p[1].strip()
205-
cmd = [timeout, "-s", "9", str(TIMEOUT)] + cmd
206-
return subprocess.run(cmd, *args, **kwargs)
207+
timeout_cmd = p[1].strip()
208+
cmd = [timeout_cmd, "-k", "10", str(timeout)] + cmd
209+
return subprocess.run(cmd, **kwargs)
207210

208211

209212
def main():
@@ -213,21 +216,23 @@ def main():
213216
glob_pattern = os.path.join(os.path.dirname(test.__file__), "test_*.py")
214217
retag = False
215218
maxrepeats = 4
219+
timeout = None
216220
for arg in sys.argv[1:]:
217221
if arg == "--retag":
218222
retag = True
219223
elif arg.startswith("--maxrepeats="):
220224
maxrepeats = int(arg.partition("=")[2])
221225
elif arg.startswith("--timeout="):
222-
global TIMEOUT
223-
TIMEOUT = arg.partition("=")[2]
226+
timeout = int(arg.partition("=")[2])
224227
elif arg == "--help":
225228
print(sys.argv[0] + " [--retag] [--maxrepeats=n] [glob]")
226229
else:
227230
if not (arg.endswith(".py") or arg.endswith("*")):
228231
arg += ".py"
229232
glob_pattern = os.path.join(os.path.dirname(test.__file__), arg)
230233

234+
if not timeout:
235+
timeout = RETAG_TIMEOUT if retag else RUN_TIMEOUT
231236
testfiles = glob.glob(glob_pattern)
232237
testfiles += glob.glob(glob_pattern.replace(".py", "/__init__.py"))
233238

@@ -268,15 +273,15 @@ def main():
268273
cmd.append(testfile)
269274

270275
print(shlex.join(cmd))
271-
p = run_with_timeout(cmd, errors='backslashreplace', **kwargs)
276+
p = run_with_timeout(cmd, timeout=timeout, errors='backslashreplace', **kwargs)
272277
print("*stdout*")
273278
print(p.stdout)
274279
print("*stderr*")
275280
print(p.stderr)
276281

277-
if p.returncode == -9:
282+
if p.returncode == 124:
278283
print(
279-
f"\nTimeout (return code -9)\nyou can try to increase the current timeout {TIMEOUT}s by using --timeout=NNN")
284+
f"\nTimed out\nYou can try to increase the current timeout {timeout}s by using --timeout=NNN")
280285

281286
passing_tests = set()
282287
failing_tests = set()

mx.graalpython/mx_graalpython.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ def retag_unittests(args):
425425
parser.add_argument('--inspect', action='store_true')
426426
parser.add_argument('-debug-java', action='store_true')
427427
parser.add_argument('--jvm', action='store_true')
428+
parser.add_argument('--timeout')
428429
parsed_args, remaining_args = parser.parse_known_args(args)
429430
env = os.environ.copy()
430431
env.update(
@@ -444,6 +445,8 @@ def retag_unittests(args):
444445
'graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py',
445446
'--retag'
446447
]
448+
if parsed_args.timeout:
449+
args += [f'--timeout={parsed_args.timeout}']
447450
vm = python_svm() if not parsed_args.jvm else python_gvm()
448451
if parsed_args.jvm:
449452
args += ['-ea']
@@ -1682,25 +1685,11 @@ def update_import_cmd(args):
16821685
vc.git_command(SUITE.dir, ["checkout", "-b", f"update/GR-21590/{datetime.datetime.now().strftime('%d%m%y')}"])
16831686
current_branch = vc.active_branch(SUITE.dir)
16841687

1685-
suite_py_files = []
1686-
local_names = []
1687-
repos = []
1688-
1689-
# find all relevant other repos that may need updating
1690-
for sibling in os.listdir(os.path.join(SUITE.dir, "..")):
1691-
if sibling.startswith("graalpython"):
1692-
dd = os.path.join(SUITE.dir, "..", sibling)
1693-
jsonnetfile = os.path.join(dd, "ci.jsonnet")
1694-
if os.path.exists(jsonnetfile):
1695-
local_names.append(sibling)
1696-
repos.append(dd)
1697-
for dirpath, dirnames, filenames in os.walk(dd):
1698-
mx_dirs = list(filter(lambda x: x.startswith("mx."), dirnames))
1699-
if mx_dirs:
1700-
dirnames[:] = mx_dirs # don't go deeper once we found some mx dirs
1701-
dirnames[:] = list(filter(lambda x: not (x.startswith(".") or x.startswith("__")), dirnames))
1702-
if "suite.py" in filenames:
1703-
suite_py_files.append(join(dirpath, "suite.py"))
1688+
local_names = ["graalpython", "graalpython-apptests"]
1689+
repos = [os.path.join(SUITE.dir, "..", name) for name in local_names]
1690+
suite_py_files = [os.path.join(SUITE.dir, "..", name, f"mx.{name}", "suite.py") for name in local_names]
1691+
for suite_py in suite_py_files:
1692+
assert os.path.isfile(suite_py), f"Cannot find {suite_py}"
17041693

17051694
# make sure all other repos are clean and on the same branch
17061695
for d in repos:

mx.graalpython/suite.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# METADATA
66
#
77
# --------------------------------------------------------------------------------------------------------------
8-
"mxversion": "6.17.0",
8+
"mxversion": "6.24.0",
99
"name": "graalpython",
1010
"versionConflictResolution": "latest",
1111

@@ -44,31 +44,31 @@
4444
},
4545
{
4646
"name": "sdk",
47-
"version": "27509a3069b251692a860ef13a577832d8260f9f",
47+
"version": "cab859d5d1a6559799cbaf5af441b54531798fda",
4848
"subdir": True,
4949
"urls": [
5050
{"url": "https://github.com/oracle/graal", "kind": "git"},
5151
]
5252
},
5353
{
5454
"name": "tools",
55-
"version": "27509a3069b251692a860ef13a577832d8260f9f",
55+
"version": "cab859d5d1a6559799cbaf5af441b54531798fda",
5656
"subdir": True,
5757
"urls": [
5858
{"url": "https://github.com/oracle/graal", "kind": "git"},
5959
],
6060
},
6161
{
6262
"name": "sulong",
63-
"version": "27509a3069b251692a860ef13a577832d8260f9f",
63+
"version": "cab859d5d1a6559799cbaf5af441b54531798fda",
6464
"subdir": True,
6565
"urls": [
6666
{"url": "https://github.com/oracle/graal", "kind": "git"},
6767
]
6868
},
6969
{
7070
"name": "regex",
71-
"version": "27509a3069b251692a860ef13a577832d8260f9f",
71+
"version": "cab859d5d1a6559799cbaf5af441b54531798fda",
7272
"subdir": True,
7373
"urls": [
7474
{"url": "https://github.com/oracle/graal", "kind": "git"},

0 commit comments

Comments
 (0)