Skip to content

Commit

Permalink
[8.1.0] Actually run the client integration tests. (#25094)
Browse files Browse the repository at this point in the history
This requires fixing preexisting test cases that weren't actually
passing.

PiperOrigin-RevId: 705082633
Change-Id: Ia00a30d0c8fc758148446029f635b2863d4a76e2
  • Loading branch information
tjgq authored Jan 27, 2025
1 parent cc3e7b1 commit 76b0f75
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/test/shell/bazel/client_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ source "${CURRENT_DIR}/../integration_test_setup.sh" \
LOCK_HELPER="$(rlocation io_bazel/src/test/java/com/google/devtools/build/lib/testutil/external_file_system_lock_helper)"

function test_product_name_with_bazel_info() {
cat > WORKSPACE <<EOF
workspace(name = 'blerp')
EOF
touch MODULE.bazel

bazel info >& "$TEST_log" || fail "Expected zero exit"

expect_log "^bazel-bin:.*_bazel.*bazel-out.*bin\$"
expect_log "^bazel-genfiles:.*_bazel.*bazel-out.*genfiles\$"
expect_log "^bazel-testlogs:.*_bazel.*bazel-out.*testlogs\$"
expect_log "^output_path:.*/execroot/blerp/bazel-out\$"
expect_log "^execution_root:.*/execroot/blerp\$"
expect_log "^bazel-bin:.*/execroot/_main/bazel-out/.*/bin\$"
expect_log "^bazel-genfiles:.*/execroot/_main/bazel-out/.*/bin\$"
expect_log "^bazel-testlogs:.*/execroot/_main/bazel-out/.*/testlogs\$"
expect_log "^output_path:.*/execroot/_main/bazel-out\$"
expect_log "^execution_root:.*/execroot/_main\$"
expect_log "^server_log:.*/java\.log.*\$"
}

Expand All @@ -42,21 +41,28 @@ EOF
function test_server_process_name_has_workspace_name() {
mkdir foobarspace
cd foobarspace
ps -o cmd= "$(bazel info server_pid)" &>"$TEST_log"
touch MODULE.bazel
ps -o args "$(bazel info server_pid)" &>"$TEST_log"
expect_log "^bazel(foobarspace)"
bazel shutdown
}

function test_install_base_lock() {
# Start the server and get the location of the install base.
local -r install_base="$(bazel info install_base)"
# Use a custom install base location to ensure that it's not shared with other
# server instances (e.g. when running multiple tests in parallel on BazelCI).
local -r install_base="$TEST_TMPDIR/test_install_base_lock"

# Start the server.
bazel --install_base="${install_base}" info || fail "Expected success"

# Try to get an exclusive lock on the install base, which should fail.
"$LOCK_HELPER" "${install_base}.lock" exclusive exit && fail "Expected failure"

# Shut down the server.
bazel shutdown
bazel --install_base="${install_base}" shutdown || fail "Expected success"

# Try to get an exclusive lock on the install base, which should succeed.
"$LOCK_HELPER" "${install_base}.lock" exclusive exit || fail "Expected success"
}

run_suite "client_test"

0 comments on commit 76b0f75

Please sign in to comment.