diff options
author | 2023-10-05 21:55:55 +0000 | |
---|---|---|
committer | 2023-10-11 17:27:29 +0000 | |
commit | 055a1207ad4658521d58cde85f5e6690f2fcaa6b (patch) | |
tree | 36de4f5394215ef8052a25e1fba64632fc2580b9 /tests | |
parent | 69cf8a3221e8ced4f86d915bb4800a775a36c8ab (diff) |
Add b_args_test.
Bug: 303269101
Test: run the test
Change-Id: I2c5e72d25dab601ef7354fb9ad624ce035e64812
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/b_args_test.sh | 43 | ||||
-rwxr-xr-x | tests/run_integration_tests.sh | 1 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/b_args_test.sh b/tests/b_args_test.sh new file mode 100755 index 000000000..0dfbabf6d --- /dev/null +++ b/tests/b_args_test.sh @@ -0,0 +1,43 @@ +#!/bin/bash -eu + +# This file tests the creation of bazel commands for b usage +set -o pipefail +source "$(dirname "$0")/../../bazel/lib.sh" + +BES_UUID="blank" +OUT_DIR="arbitrary_out" +b_args=$(formulate_b_args "build --config=nonsense foo:bar") + +if [[ $b_args != "build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=metrics_data --config=nonsense foo:bar" ]]; then + echo "b args are malformed" + echo "Expected : build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=metrics_data --config=nonsense foo:bar" + echo "Actual: $b_args" + exit 1 +fi + +b_args=$(formulate_b_args "build --config=nonsense --disable_bes --package_path \"my package\" foo:bar") + +if [[ $b_args != "build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=nonsense --package_path \"my package\" foo:bar" ]]; then + echo "b args are malformed" + echo "Expected : build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=nonsense --package_path \"my package\" foo:bar" + echo "Actual: $b_args" + exit 1 +fi + +# Test with startup option +b_args=$(formulate_b_args "--batch build --config=nonsense --disable_bes --package_path \"my package\" foo:bar") +if [[ $b_args != "--batch build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=nonsense --package_path \"my package\" foo:bar" ]]; then + echo "b args are malformed" + echo "Expected : --batch build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=nonsense --package_path \"my package\" foo:bar" + echo "Actual: $b_args" + exit 1 +fi + +OUT_DIR="mock_out" +TEST_PROFILE_OUT=$(get_profile_out_dir) +if [[ $TEST_PROFILE_OUT != "mock_out" ]]; then + echo "Profile Out is malformed." + echo "Expected: mock_out" + echo "Actual: $TEST_PROFILE_OUT" + exit 1 +fi diff --git a/tests/run_integration_tests.sh b/tests/run_integration_tests.sh index 8045591b4..231e18b62 100755 --- a/tests/run_integration_tests.sh +++ b/tests/run_integration_tests.sh @@ -4,6 +4,7 @@ set -o pipefail TOP="$(readlink -f "$(dirname "$0")"/../../..)" "$TOP/build/soong/tests/androidmk_test.sh" +"$TOP/build/soong/tests/b_args_test.sh" "$TOP/build/soong/tests/bootstrap_test.sh" "$TOP/build/soong/tests/mixed_mode_test.sh" "$TOP/build/soong/tests/bp2build_bazel_test.sh" |