From 01244de9b0789a4ce8fdb8182a6e1482cbc3e330 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Wed, 11 Sep 2024 17:16:25 +0200 Subject: [PATCH] Fix bazel_skylib with Bazel@HEAD (#538) --- tests/diff_test/diff_test_tests.sh | 22 ++++++++++++++++++---- tests/unittest_test.sh | 12 +++++++++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/tests/diff_test/diff_test_tests.sh b/tests/diff_test/diff_test_tests.sh index 9fffcc6..8f72c47 100755 --- a/tests/diff_test/diff_test_tests.sh +++ b/tests/diff_test/diff_test_tests.sh @@ -112,7 +112,21 @@ local_repository( path = "../ext2", ) eof - + cat >"$ws/main/MODULE.bazel" <<'eof' +local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository") +local_repository( + name = "bzl", + path = "../bzl", +) +local_repository( + name = "ext1", + path = "../ext1", +) +local_repository( + name = "ext2", + path = "../ext2", +) +eof # @ext1 has source files touch "$ws/ext1/WORKSPACE" echo 'exports_files(["foo.txt"])' >"$ws/ext1/foo/BUILD" @@ -181,17 +195,17 @@ eof (cd "$ws/main" && \ bazel test ${flags} //:different1 --test_output=errors 1>"$TEST_log" 2>&1 \ && fail "expected failure" || true) - expect_log 'FAIL: files "external/ext1/foo/foo.txt" and "external/ext2/foo/bar.txt" differ' + expect_log 'FAIL: files "external/.*ext1/foo/foo.txt" and "external/.*ext2/foo/bar.txt" differ' (cd "$ws/main" && \ bazel test ${flags} //:different2 --test_output=errors 1>"$TEST_log" 2>&1 \ && fail "expected failure" || true) - expect_log 'FAIL: files "external/ext1/foo/foo.txt" and "ext1/foo/foo.txt" differ' + expect_log 'FAIL: files "external/.*ext1/foo/foo.txt" and "ext1/foo/foo.txt" differ' (cd "$ws/main" && \ bazel test ${flags} //:different3 --test_output=errors 1>"$TEST_log" 2>&1 \ && fail "expected failure" || true) - expect_log 'FAIL: files "ext2/foo/foo.txt" and "external/ext2/foo/foo.txt" differ' + expect_log 'FAIL: files "ext2/foo/foo.txt" and "external/.*ext2/foo/foo.txt" differ' } function test_simple_diff_test_with_legacy_external_runfiles() { diff --git a/tests/unittest_test.sh b/tests/unittest_test.sh index 271f156..e0454f9 100755 --- a/tests/unittest_test.sh +++ b/tests/unittest_test.sh @@ -49,13 +49,19 @@ function create_pkg() { local -r pkg="$1" mkdir -p "$pkg" cd "$pkg" - cat > WORKSPACE < MODULE.bazel <