blob: 35fd7845be1b2c4fe15ff53aa3b9c49feb7ff9dc [file] [log] [blame]
Tobias Werthf33e8c02016-09-12 09:09:45 +00001#!/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 Duquefa389062016-10-18 14:28:42 +000019# Load the test setup defined in the parent directory
20CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21source "${CURRENT_DIR}/../integration_test_setup.sh" \
22 || { echo "integration_test_setup.sh not found!" >&2; exit 1; }
Tobias Werthf33e8c02016-09-12 09:09:45 +000023
24function test_different_startup_options() {
25 pid=$(bazel info server_pid 2> $TEST_log)
Luis Fernando Pino Duquefa389062016-10-18 14:28:42 +000026 [[ -n $pid ]] || fail "Couldn't run ${PRODUCT_NAME}"
Tobias Werthd85fd982016-09-12 14:04:08 +000027 newpid=$(bazel --batch info server_pid 2> $TEST_log)
Tobias Werthf33e8c02016-09-12 09:09:45 +000028 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 Werth1971ea72016-09-12 14:51:51 +000032 true
Tobias Werthf33e8c02016-09-12 09:09:45 +000033}
34
Luis Fernando Pino Duqued5e008c2016-12-08 16:59:16 +000035# Regression test for Issue #1659
36function 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 Duquefa389062016-10-18 14:28:42 +000042run_suite "${PRODUCT_NAME} startup options test"