Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0.1] Print embedded label / version when starting Bazel. #24650

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/main/cpp/blaze.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -1060,12 +1061,12 @@ static ATTRIBUTE_NORETURN void RunClientServerMode(
const StartupOptions &startup_options, LoggingInfo *logging_info,
const std::optional<DurationMillis> extract_data_duration,
const std::optional<DurationMillis> 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
Expand Down Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/integration/bazel_command_log_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand Down
12 changes: 6 additions & 6 deletions src/test/shell/integration/client_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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"
}

Expand All @@ -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"
}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down
Loading