diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc index 79c433c98ae6ec..9061bc0a7f699c 100644 --- a/src/main/cpp/blaze.cc +++ b/src/main/cpp/blaze.cc @@ -833,7 +833,7 @@ static void StartServerAndConnect( const blaze_util::Path &server_dir, const WorkspaceLayout &workspace_layout, const string &workspace, const OptionProcessor &option_processor, const StartupOptions &startup_options, LoggingInfo *logging_info, - BlazeServer *server) { + BlazeServer *server, const string &build_label) { // Delete the old command_port file if it already exists. Otherwise we might // run into the race condition that we read the old command_port file before // the new server has written the new file and we try to connect to the old @@ -861,7 +861,8 @@ static void StartServerAndConnect( startup_options.io_nice_level); BAZEL_LOG(USER) << "Starting local " << startup_options.product_name - << " server and connecting to it..."; + << " server (" << build_label << ")" + << " and connecting to it..."; BlazeServerStartup *server_startup; const int server_pid = ExecuteDaemon( server_exe, server_exe_args, PrepareEnvironmentForJvm(), @@ -1060,12 +1061,12 @@ static ATTRIBUTE_NORETURN void RunClientServerMode( const StartupOptions &startup_options, LoggingInfo *logging_info, const std::optional extract_data_duration, const std::optional command_wait_duration, - BlazeServer *server) { + BlazeServer *server, const string &build_label) { while (true) { if (!server->Connected()) { StartServerAndConnect(server_exe, server_exe_args, server_dir, workspace_layout, workspace, option_processor, - startup_options, logging_info, server); + startup_options, logging_info, server, build_label); } // Check for the case when the workspace directory deleted and then gets @@ -1473,10 +1474,12 @@ static void RunLauncher(const string &self_path, option_processor, startup_options, logging_info, extract_data_duration, command_wait_duration, blaze_server); } else { + string build_label; + ExtractBuildLabel(self_path, &build_label); RunClientServerMode(server_exe, server_exe_args, server_dir, workspace_layout, workspace, option_processor, startup_options, logging_info, extract_data_duration, - command_wait_duration, blaze_server); + command_wait_duration, blaze_server, build_label); } } diff --git a/src/test/shell/integration/bazel_command_log_test.sh b/src/test/shell/integration/bazel_command_log_test.sh index cd61a58971c9c3..73e446908ffd92 100755 --- a/src/test/shell/integration/bazel_command_log_test.sh +++ b/src/test/shell/integration/bazel_command_log_test.sh @@ -38,7 +38,7 @@ function strip_lines_from_bazel_cc() { -e "/^INFO: Reading 'startup' options from /d" \ -e '/^\$TEST_TMPDIR defined: output root default is/d' \ -e '/^OpenJDK 64-Bit Server VM warning: ignoring option UseSeparateVSpacesInYoungGen; support was removed in 8.0/d' \ - -e '/^Starting local B[azel]* server and connecting to it\.\.\.\.*$/d' \ + -e '/^Starting local B[azel]* server (.*) and connecting to it\.\.\.\.*$/d' \ -e '/^\.\.\. still trying to connect to local B[azel]* server ([1-9][0-9]*) after [1-9][0-9]* seconds \.\.\.\.*$/d' \ -e '/^Killed non-responsive server process/d' \ -e '/server needs to be killed, because the startup options are different/d' \ diff --git a/src/test/shell/integration/client_test.sh b/src/test/shell/integration/client_test.sh index e153042642cb69..afe7812b866a8f 100755 --- a/src/test/shell/integration/client_test.sh +++ b/src/test/shell/integration/client_test.sh @@ -154,14 +154,14 @@ function test_shutdown() { local server_pid2=$(bazel info server_pid 2>$TEST_log) assert_not_equals "$server_pid1" "$server_pid2" expect_not_log "WARNING.* Running B\\(azel\\|laze\\) server needs to be killed" - expect_log "Starting local B\\(azel\\|laze\\) server and connecting to it" + expect_log "Starting local B\\(azel\\|laze\\) server (.*) and connecting to it" } function test_shutdown_different_options() { bazel --host_jvm_args=-Di.am.a=teapot info >& $TEST_log || fail "Expected success" bazel shutdown >& $TEST_log || fail "Expected success" expect_log "WARNING.* Running B\\(azel\\|laze\\) server needs to be killed" - expect_not_log "Starting local B\\(azel\\|laze\\) server and connecting to it" + expect_not_log "Starting local B\\(azel\\|laze\\) server (.*) and connecting to it" } function test_server_restart_due_to_startup_options_with_client_debug_information() { @@ -246,7 +246,7 @@ function test_local_startup_timeout() { sleep 1 done - expect_log "Starting local.*server and connecting to it" + expect_log "Starting local.*server (.*) and connecting to it" expect_log "FATAL: couldn't connect to server" } @@ -269,7 +269,7 @@ function test_max_idle_secs() { done bazel "${options[@]}" info >"$TEST_log" 2>&1 || fail "bazel info failed" - expect_log "Starting local.*server and connecting to it" + expect_log "Starting local.*server (.*) and connecting to it" # Ensure the restart was not triggered by different startup options. expect_not_log "WARNING: Running B\\(azel\\|laze\\) server needs to be killed" } @@ -391,7 +391,7 @@ function test_proxy_settings() { "${TEST_TMPDIR}/server_env" done else - echo "Cannot not test server process environment on this platform" + echo "cannot test server process environment on this platform" fi } @@ -441,7 +441,7 @@ function test_client_is_quiet_by_default() { assert_equals 2 $(cat $TEST_log | wc -l) expect_log "^\$TEST_TMPDIR defined: output root default" - expect_log "^Starting local $capitalized_product_name server and connecting to it...$" + expect_log "^Starting local $capitalized_product_name server (.*) and connecting to it...$" cp stdout $TEST_log || fail "cp failed" strip_lines_from_bazel_cc