CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
107 lines
2.7 KiB
Python
Executable File
107 lines
2.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# ===----------------------------------------------------------------------===##
|
|
#
|
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
# See https://llvm.org/LICENSE.txt for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
#
|
|
# ===----------------------------------------------------------------------===##
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
|
|
cur_dir = os.path.dirname(os.path.realpath(__file__))
|
|
bisect_script = os.path.join(cur_dir, "..", "rsp_bisect.py")
|
|
test1 = os.path.join(cur_dir, "test_script.py")
|
|
test2 = os.path.join(cur_dir, "test_script_inv.py")
|
|
rsp = os.path.join(cur_dir, "rsp")
|
|
|
|
|
|
def run_bisect(success, test_script):
|
|
args = [
|
|
bisect_script,
|
|
"--test",
|
|
test_script,
|
|
"--rsp",
|
|
rsp,
|
|
"--other-rel-path",
|
|
"../Other",
|
|
]
|
|
res = subprocess.run(args, capture_output=True, encoding="UTF-8")
|
|
if len(sys.argv) > 1 and sys.argv[1] == "-v":
|
|
print("Ran {} with return code {}".format(args, res.returncode))
|
|
print("Stdout:")
|
|
print(res.stdout)
|
|
print("Stderr:")
|
|
print(res.stderr)
|
|
if res.returncode != (0 if success else 1):
|
|
print(res.stdout)
|
|
print(res.stderr)
|
|
raise AssertionError("unexpected bisection return code for " + str(args))
|
|
return res.stdout
|
|
|
|
|
|
# Test that an empty rsp file fails.
|
|
with open(rsp, "w") as f:
|
|
pass
|
|
|
|
run_bisect(False, test1)
|
|
|
|
# Test that an rsp file without any paths fails.
|
|
with open(rsp, "w") as f:
|
|
f.write("hello\nfoo\n")
|
|
|
|
run_bisect(False, test1)
|
|
|
|
# Test that an rsp file with one path succeeds.
|
|
with open(rsp, "w") as f:
|
|
f.write("./foo\n")
|
|
|
|
output = run_bisect(True, test1)
|
|
assert "./foo" in output
|
|
|
|
# Test that an rsp file with one path and one extra arg succeeds.
|
|
with open(rsp, "w") as f:
|
|
f.write("hello\n./foo\n")
|
|
|
|
output = run_bisect(True, test1)
|
|
assert "./foo" in output
|
|
|
|
# Test that an rsp file with three paths and one extra arg succeeds.
|
|
with open(rsp, "w") as f:
|
|
f.write("hello\n./foo\n./bar\n./baz\n")
|
|
|
|
output = run_bisect(True, test1)
|
|
assert "./foo" in output
|
|
|
|
with open(rsp, "w") as f:
|
|
f.write("hello\n./bar\n./foo\n./baz\n")
|
|
|
|
output = run_bisect(True, test1)
|
|
assert "./foo" in output
|
|
|
|
with open(rsp, "w") as f:
|
|
f.write("hello\n./bar\n./baz\n./foo\n")
|
|
|
|
output = run_bisect(True, test1)
|
|
assert "./foo" in output
|
|
|
|
output = run_bisect(True, test2)
|
|
assert "./foo" in output
|
|
|
|
with open(rsp + ".0", "r") as f:
|
|
contents = f.read()
|
|
assert " ../Other/./foo" in contents
|
|
|
|
with open(rsp + ".1", "r") as f:
|
|
contents = f.read()
|
|
assert " ./foo" in contents
|
|
|
|
os.remove(rsp)
|
|
os.remove(rsp + ".0")
|
|
os.remove(rsp + ".1")
|
|
|
|
print("Success!")
|