Fix bazel_toolchain_test This time for real. This rolls back bea9c01592a5, my previous attempt to fix the test. What happened: Before fdba19031961: The BUILD file was referencing the data as a directory, and the sandbox implementation was symlinking the entire directory (not individual files). As a result, the chmod call was succeeding, but *it was modifying the source tree*! After fdba19031961, before bea9c01592a5: The BUILD file was using a glob to enumerate individual files, and the individual symlinks in the sandbox are in a read-only file system. The chmod call was failing. After bea9c01592a5: Without the chmod call, the test passed because the files were still marked as executable *in the source tree* due to the pre-fdba19031961 code. However, it failed in a clean checkout. Solution: Reinstate the chmod call, but make sure all the files are copied into a temporary *empty* directory. Fixes #2891. PiperOrigin-RevId: 154436636
diff --git a/src/test/shell/bazel/BUILD b/src/test/shell/bazel/BUILD index 2b0b4f36..26b92f3 100644 --- a/src/test/shell/bazel/BUILD +++ b/src/test/shell/bazel/BUILD
@@ -154,7 +154,6 @@ "//conditions:default": ["//src/test/shell/bazel/testdata:bazel_toolchain_test_project_pkg"], }), tags = [ - "noci", # TODO(ulfjack): Re-enable for CI once https://github.com/bazelbuild/bazel/issues/2891 is fixed. "requires-network", ], )
diff --git a/src/test/shell/bazel/bazel_toolchain_test.sh b/src/test/shell/bazel/bazel_toolchain_test.sh index d7e8e31..cb5a8bf 100755 --- a/src/test/shell/bazel/bazel_toolchain_test.sh +++ b/src/test/shell/bazel/bazel_toolchain_test.sh
@@ -27,8 +27,14 @@ exit 0 fi +# Run in a temporary directory! +mkdir -p "${TEST_TMPDIR}/TEMP_TEMP_TEMP" +cd "${TEST_TMPDIR}/TEMP_TEMP_TEMP" + # Copy the project package here -cp -r ${testdata_path}/bazel_toolchain_test_data/* . +# We must use -L here; the files may be symlinks into the source tree, which we +# could inadvertantly modify below. +cp -rL ${testdata_path}/bazel_toolchain_test_data/* . # Rename WORKSPACE.linaro file to WORKSPACE # (Did not include the file WORKSPACE in the test because source tree under @@ -40,6 +46,9 @@ mv "$i" "$(dirname "$i")/BUILD" done +# Make sure that the wrapper scripts have the execution permission +chmod +x tools/arm_compiler/linaro_linux_gcc/arm-linux-gnueabihf-* + bazel clean --expunge bazel build --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a \ --spawn_strategy=standalone hello || fail "Should build"