From 52b11c3cb8efb541e6bee7a6c8d199cffca8b815 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 19 Jan 2023 15:10:18 -0800 Subject: [PATCH] Fix lit_autoupdate to use consistent relative paths in FileCheck stanzas regardless of where it's run from. (#2538) Avoids putting absolute paths in FileCheck lines, resulting in tests which fail when run in a different checkout. --- bazel/testing/lit_autoupdate_base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bazel/testing/lit_autoupdate_base.py b/bazel/testing/lit_autoupdate_base.py index 372de530b9c2..c38b3e6061db 100755 --- a/bazel/testing/lit_autoupdate_base.py +++ b/bazel/testing/lit_autoupdate_base.py @@ -431,10 +431,11 @@ def main() -> None: parsed_args = parse_args() # Remaining script logic should be relative to the repository root. - os.chdir(Path(__file__).parent.parent.parent) + root = Path(__file__).parent.parent.parent + os.chdir(root) if parsed_args.tests: - tests = set(parsed_args.tests) + tests = {test.relative_to(root) for test in parsed_args.tests} else: print("HINT: run `update_checks.py f1 f2 ...` to update specific tests") tests = get_tests(parsed_args.testdata)