Fix bazel_skylib with Bazel@HEAD (#538)
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 @@ 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 @@ (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,14 +49,20 @@ local -r pkg="$1" mkdir -p "$pkg" cd "$pkg" - cat > WORKSPACE <<EOF workspace(name = 'bazel_skylib') - load("//lib:unittest.bzl", "register_unittest_toolchains") - register_unittest_toolchains() EOF + touch WORKSPACE.bzlmod + cat > MODULE.bazel <<EOF +module(name="bazel_skylib_test", repo_name="bazel_skylib") +bazel_dep(name = "platforms", version = "0.0.10") +register_toolchains( + "//toolchains/unittest:cmd_toolchain", + "//toolchains/unittest:bash_toolchain", +) +EOF # Copy relevant skylib sources into the current workspace. mkdir -p tests