Skip to content

Commit

Permalink
Fix permissions with test host and tree artifacts
Browse files Browse the repository at this point in the history
Previously because the `cp` was acting on a symlink, the TMP_DIR would
only contain copies of the symlinks. Then when we ran `chmod` on them,
they wouldn't change the permissions at all. Using `-L` forces them to
copy the directories, instead of the symlinks.

This problem caused xctestrunner to not be able to write directories
inside the test host:

```
OSError: [Errno 13] Permission denied: '/tmp/test_runner_work_dir.0XWONr/TEST_ROOT/TestHost.app/Frameworks/XCTest.framework'
```
  • Loading branch information
keith committed May 10, 2019
1 parent 952dde8 commit 177b01a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apple/testing/default_runner/ios_test_runner.template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [[ "$TEST_BUNDLE_PATH" == *.xctest ]]; then
# Need to copy the bundle outside of the Bazel execroot since the test runner
# needs to make some modifications to its contents.
# TODO(kaipi): Improve xctestrunner to account for Bazel permissions.
cp -R "$TEST_BUNDLE_PATH" "$TMP_DIR"
cp -RL "$TEST_BUNDLE_PATH" "$TMP_DIR"
chmod -R 777 "${TMP_DIR}/$(basename "$TEST_BUNDLE_PATH")"
runner_flags+=("--test_bundle_path=${TEST_BUNDLE_PATH}")
else
Expand All @@ -53,7 +53,7 @@ if [[ -n "$TEST_HOST_PATH" ]]; then
# Need to copy the bundle outside of the Bazel execroot since the test
# runner needs to make some modifications to its contents.
# TODO(kaipi): Improve xctestrunner to account for Bazel permissions.
cp -R "$TEST_HOST_PATH" "$TMP_DIR"
cp -RL "$TEST_HOST_PATH" "$TMP_DIR"
chmod -R 777 "${TMP_DIR}/$(basename "$TEST_HOST_PATH")"
runner_flags+=("--app_under_test_path=${TMP_DIR}/$(basename "$TEST_HOST_PATH")")
else
Expand Down

0 comments on commit 177b01a

Please sign in to comment.