From d0c8cf02b656ad64436a39553dac2c45a3d50119 Mon Sep 17 00:00:00 2001 From: Sam Delmerico Date: Thu, 22 Sep 2022 14:10:40 -0400 Subject: [PATCH] re-enable b run commands in test suite Zsh has some incompatibilties that we've been trying to work around in the b command. Hopefully this prevents future issues. Bug: 242759256 Test: build/make/tests/roboleaf_tests.sh Change-Id: I5e887932e943112377d38e77a77a0f294b43d9b6 --- envsetup.sh | 14 ++++++-------- tests/b_tests.sh | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/envsetup.sh b/envsetup.sh index ea72ca7657..a31dce5c09 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -1844,6 +1844,11 @@ function _trigger_build() # Convenience entry point (like m) to use Bazel in AOSP. function b() ( + # zsh breaks posix by not doing string-splitting on unquoted args by default. + # See https://zsh.sourceforge.io/Guide/zshguide05.html section 5.4.4. + # Tell it to emulate Bourne shell for this function. + if [ -n "$ZSH_VERSION" ]; then emulate -L sh; fi + # Look for the --run-soong-tests flag and skip passing --skip-soong-tests to Soong if present local bazel_args="" local skip_tests="--skip-soong-tests" @@ -1883,14 +1888,7 @@ function b() fi # Call Bazel. - if [ -n "$ZSH_VERSION" ]; then - # zsh breaks posix by not doing string-splitting on unquoted args - # by default. Explicitly use the "=" flag to split. - # See https://zsh.sourceforge.io/Guide/zshguide05.html section 5.4.4. - bazel ${=bazel_args_with_config} - else - bazel ${bazel_args_with_config[@]} - fi + bazel ${bazel_args_with_config[@]} fi ) diff --git a/tests/b_tests.sh b/tests/b_tests.sh index 8dd426061e..6bc6519985 100755 --- a/tests/b_tests.sh +++ b/tests/b_tests.sh @@ -25,4 +25,4 @@ b build "$test_target" --run-soong-tests b build --run-soong-tests "$test_target" b --run-soong-tests build "$test_target" b cquery 'kind(test, //build/bazel/examples/android_app/...)' --config=android -#TODO(b/242759256) add some 'b run' command examples +b run $test_target -- --help >/dev/null