Let integration tests reuse the pkg directory of earlier tests (#953) Tests in the same shard of `cc_integration_test` share the scratch workspace, and some leave a `pkg` directory behind. For example, `test_cc_toolchain_asan_feature` does so on macOS, where it assumes libasan is installed. Four tests still created it with a plain `mkdir pkg`, so they failed with `mkdir: pkg: File exists` whenever a test like that ran before them in the same shard. Which tests share a shard depends on the number of tests, so adding an unrelated test can trigger this. That happened in #948, where `test_env_inherit_cc_test` started failing on macOS. This uses `mkdir -p pkg` in those tests, like the rest of the file. Closes #953 COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_cc/pull/953 from chrisburr:integration-test-mkdir-p 2d8bb3ee20f8189cf215226c5cf8ca9dc105499c PiperOrigin-RevId: 1008964294 Change-Id: Idfd3b277f5d93684c5033d5916889382544fed07
diff --git a/tests/integration/cc_integration_test.sh b/tests/integration/cc_integration_test.sh index b46d7b5..4b7e396 100755 --- a/tests/integration/cc_integration_test.sh +++ b/tests/integration/cc_integration_test.sh
@@ -1476,7 +1476,7 @@ function test_env_inherit_cc_test() { - mkdir pkg + mkdir -p pkg cat > pkg/BUILD <<EOF load("@rules_cc//cc:cc_test.bzl", "cc_test") cc_test( @@ -1504,7 +1504,7 @@ function test_env_attr_cc_binary() { - mkdir pkg + mkdir -p pkg cat > pkg/BUILD <<EOF load("@rules_cc//cc:cc_binary.bzl", "cc_binary") cc_binary( @@ -1942,7 +1942,7 @@ __is_installed "lib$feature" || return 0 - mkdir pkg + mkdir -p pkg cat > pkg/BUILD <<EOF load("@rules_cc//cc:cc_binary.bzl", "cc_binary") cc_binary( @@ -1979,7 +1979,7 @@ __is_installed "lib$feature" || return 0 - mkdir pkg + mkdir -p pkg cat > pkg/BUILD <<EOF load("@rules_cc//cc:cc_binary.bzl", "cc_binary") cc_binary(