MarkDacek | 055a120 | 2023-10-05 21:55:55 +0000 | [diff] [blame] | 1 | #!/bin/bash -eu |
| 2 | |
| 3 | # This file tests the creation of bazel commands for b usage |
| 4 | set -o pipefail |
| 5 | source "$(dirname "$0")/../../bazel/lib.sh" |
| 6 | |
| 7 | BES_UUID="blank" |
| 8 | OUT_DIR="arbitrary_out" |
| 9 | b_args=$(formulate_b_args "build --config=nonsense foo:bar") |
| 10 | |
| 11 | if [[ $b_args != "build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=metrics_data --config=nonsense foo:bar" ]]; then |
| 12 | echo "b args are malformed" |
| 13 | echo "Expected : build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=metrics_data --config=nonsense foo:bar" |
| 14 | echo "Actual: $b_args" |
| 15 | exit 1 |
| 16 | fi |
| 17 | |
| 18 | b_args=$(formulate_b_args "build --config=nonsense --disable_bes --package_path \"my package\" foo:bar") |
| 19 | |
| 20 | 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 |
| 21 | echo "b args are malformed" |
| 22 | echo "Expected : build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=nonsense --package_path \"my package\" foo:bar" |
| 23 | echo "Actual: $b_args" |
| 24 | exit 1 |
| 25 | fi |
| 26 | |
| 27 | # Test with startup option |
| 28 | b_args=$(formulate_b_args "--batch build --config=nonsense --disable_bes --package_path \"my package\" foo:bar") |
| 29 | 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 |
| 30 | echo "b args are malformed" |
| 31 | echo "Expected : --batch build --profile=$OUT_DIR/bazel_metrics-profile --config=bp2build --invocation_id=$BES_UUID --config=nonsense --package_path \"my package\" foo:bar" |
| 32 | echo "Actual: $b_args" |
| 33 | exit 1 |
| 34 | fi |
| 35 | |
| 36 | OUT_DIR="mock_out" |
| 37 | TEST_PROFILE_OUT=$(get_profile_out_dir) |
| 38 | if [[ $TEST_PROFILE_OUT != "mock_out" ]]; then |
| 39 | echo "Profile Out is malformed." |
| 40 | echo "Expected: mock_out" |
| 41 | echo "Actual: $TEST_PROFILE_OUT" |
| 42 | exit 1 |
| 43 | fi |