Tobias Werth | f33e8c0 | 2016-09-12 09:09:45 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright 2016 The Bazel Authors. All rights reserved. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | # Test of Bazel's startup option handling. |
| 18 | |
Luis Fernando Pino Duque | fa38906 | 2016-10-18 14:28:42 +0000 | [diff] [blame] | 19 | # Load the test setup defined in the parent directory |
| 20 | CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 21 | source "${CURRENT_DIR}/../integration_test_setup.sh" \ |
| 22 | || { echo "integration_test_setup.sh not found!" >&2; exit 1; } |
Tobias Werth | f33e8c0 | 2016-09-12 09:09:45 +0000 | [diff] [blame] | 23 | |
| 24 | function test_different_startup_options() { |
| 25 | pid=$(bazel info server_pid 2> $TEST_log) |
Luis Fernando Pino Duque | fa38906 | 2016-10-18 14:28:42 +0000 | [diff] [blame] | 26 | [[ -n $pid ]] || fail "Couldn't run ${PRODUCT_NAME}" |
Tobias Werth | d85fd98 | 2016-09-12 14:04:08 +0000 | [diff] [blame] | 27 | newpid=$(bazel --batch info server_pid 2> $TEST_log) |
Tobias Werth | f33e8c0 | 2016-09-12 09:09:45 +0000 | [diff] [blame] | 28 | expect_log "WARNING: Running B\\(azel\\|laze\\) server needs to be killed, because the startup options are different." |
| 29 | [[ "$newpid" != "$pid" ]] || fail "pid $pid was the same!" |
| 30 | kill -0 $pid 2> /dev/null && fail "$pid not dead" |
| 31 | kill -0 $newpid 2> /dev/null && fail "$newpid not dead" |
Tobias Werth | 1971ea7 | 2016-09-12 14:51:51 +0000 | [diff] [blame] | 32 | true |
Tobias Werth | f33e8c0 | 2016-09-12 09:09:45 +0000 | [diff] [blame] | 33 | } |
| 34 | |
Luis Fernando Pino Duque | d5e008c | 2016-12-08 16:59:16 +0000 | [diff] [blame] | 35 | # Regression test for Issue #1659 |
| 36 | function test_command_args_are_not_parsed_as_startup_args() { |
| 37 | bazel info --bazelrc=bar &> $TEST_log && fail "Should fail" |
| 38 | expect_log "Unrecognized option: --bazelrc=bar" |
| 39 | expect_not_log "Error: Unable to read .bazelrc file" |
| 40 | } |
| 41 | |
Luis Fernando Pino Duque | fa38906 | 2016-10-18 14:28:42 +0000 | [diff] [blame] | 42 | run_suite "${PRODUCT_NAME} startup options test" |