Skip to content

Commit

Permalink
Update tests to avoid --noexperimental_ui
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 247602666
  • Loading branch information
ulfjack authored and copybara-github committed May 10, 2019
1 parent c963ba2 commit f20f622
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 32 deletions.
32 changes: 15 additions & 17 deletions src/test/shell/bazel/bazel_test_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -571,38 +571,36 @@ EOF
chmod +x true.sh flaky.sh false.sh

# We do not use sandboxing so we can trick to be deterministically flaky
# TODO(b/37617303): make test UI-independent
bazel --nomaster_bazelrc test --noexperimental_ui --spawn_strategy=standalone //:flaky &> $TEST_log \
bazel --nomaster_bazelrc test --experimental_ui_debug_all_events \
--spawn_strategy=standalone //:flaky &> $TEST_log \
|| fail "//:flaky should have passed with flaky support"
[ -f "${FLAKE_FILE}" ] || fail "Flaky test should have created the flake-file!"

expect_log_once "FAIL: //:flaky (.*/flaky/test_attempts/attempt_1.log)"
expect_log_once "PASS: //:flaky"
expect_log_once "FLAKY"
expect_log_once "FAIL.*: //:flaky (.*/flaky/test_attempts/attempt_1.log)"
expect_log_once "PASS.*: //:flaky"
expect_log_once "FLAKY: //:flaky"
cat bazel-testlogs/flaky/test_attempts/attempt_1.log &> $TEST_log
assert_equals "fail" "$(awk "NR == $(wc -l < $TEST_log)" $TEST_log)"
assert_equals 1 $(ls bazel-testlogs/flaky/test_attempts/*.log | wc -l)
cat bazel-testlogs/flaky/test.log &> $TEST_log
assert_equals "pass" "$(awk "NR == $(wc -l < $TEST_log)" $TEST_log)"

# TODO(b/37617303): make test UI-independent
bazel --nomaster_bazelrc test --noexperimental_ui //:pass &> $TEST_log \
|| fail "//:pass should have passed"
expect_log_once "PASS: //:pass"
expect_log_once PASSED
bazel --nomaster_bazelrc test --experimental_ui_debug_all_events //:pass \
&> $TEST_log || fail "//:pass should have passed"
expect_log_once "PASS.*: //:pass"
expect_log_once "PASSED"
[ ! -d bazel-test_logs/pass/test_attempts ] \
|| fail "Got test attempts while expected non for non-flaky tests"
cat bazel-testlogs/flaky/test.log &> $TEST_log
assert_equals "pass" "$(tail -1 bazel-testlogs/flaky/test.log)"

# TODO(b/37617303): make test UI-independent
bazel --nomaster_bazelrc test --noexperimental_ui //:fail &> $TEST_log \
&& fail "//:fail should have failed" \
bazel --nomaster_bazelrc test --experimental_ui_debug_all_events //:fail \
&> $TEST_log && fail "//:fail should have failed" \
|| true
expect_log_n "FAIL: //:fail (.*/fail/test_attempts/attempt_..log)" 2
expect_log_once "FAIL: //:fail (.*/fail/test.log)"
expect_log_once "FAILED"
expect_log_once ".*/fail/test.log$"
expect_log_n "FAIL.*: //:fail (.*/fail/test_attempts/attempt_..log)" 2
expect_log_once "FAIL.*: //:fail (.*/fail/test.log)"
expect_log_once "FAILED: //:fail"
expect_log_n ".*/fail/test.log$" 2
cat bazel-testlogs/fail/test_attempts/attempt_1.log &> $TEST_log
assert_equals "fail" "$(awk "NR == $(wc -l < $TEST_log)" $TEST_log)"
assert_equals 2 $(ls bazel-testlogs/fail/test_attempts/*.log | wc -l)
Expand Down
8 changes: 4 additions & 4 deletions src/test/shell/bazel/workspace_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,12 @@ EOF
cd tree

# Do initial load of the packages
bazel query --noexperimental_ui \
bazel query --experimental_ui_debug_all_events \
//oak:all >& "$TEST_log" || fail "Expected success"
expect_log "Loading package: oak"
expect_log "//oak:oak"

bazel query --noexperimental_ui \
bazel query --experimental_ui_debug_all_events \
@flower//daisy:all >& "$TEST_log" || fail "Expected success"
expect_log "Loading package: @flower//daisy"
expect_log "@flower//daisy:daisy"
Expand All @@ -369,13 +369,13 @@ local_repository(
EOF

# Test that packages in the tree workspace are not affected
bazel query --noexperimental_ui \
bazel query --experimental_ui_debug_all_events \
//oak:all >& "$TEST_log" || fail "Expected success"
expect_not_log "Loading package: oak"
expect_log "//oak:oak"

# Test that packages in the flower workspace are reloaded
bazel query --noexperimental_ui \
bazel query --experimental_ui_debug_all_events \
@flower//daisy:all >& "$TEST_log" || fail "Expected success"
expect_log "Loading package: @flower//daisy"
expect_log "@flower//daisy:daisy"
Expand Down
12 changes: 4 additions & 8 deletions src/test/shell/integration/loading_phase_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,30 +325,26 @@ function test_no_package_loading_on_benign_workspace_file_changes() {

echo 'workspace(name="wsname1")' > WORKSPACE
echo 'sh_library(name="shname1")' > $pkg/foo/BUILD
# TODO(b/37617303): make tests UI-independent
bazel query --noexperimental_ui //$pkg/foo:all >& "$TEST_log" \
bazel query --experimental_ui_debug_all_events //$pkg/foo:all >& "$TEST_log" \
|| fail "Expected success"
expect_log "Loading package: $pkg/foo"
expect_log "//$pkg/foo:shname1"

echo 'sh_library(name="shname2")' > $pkg/foo/BUILD
# TODO(b/37617303): make tests UI-independent
bazel query --noexperimental_ui //$pkg/foo:all >& "$TEST_log" \
bazel query --experimental_ui_debug_all_events //$pkg/foo:all >& "$TEST_log" \
|| fail "Expected success"
expect_log "Loading package: $pkg/foo"
expect_log "//$pkg/foo:shname2"

# Test that comment changes do not cause package reloading
echo '#benign comment' >> WORKSPACE
# TODO(b/37617303): make tests UI-independent
bazel query --noexperimental_ui //$pkg/foo:all >& "$TEST_log" \
bazel query --experimental_ui_debug_all_events //$pkg/foo:all >& "$TEST_log" \
|| fail "Expected success"
expect_not_log "Loading package: $pkg/foo"
expect_log "//$pkg/foo:shname2"

echo 'workspace(name="wsname2")' > WORKSPACE
# TODO(b/37617303): make tests UI-independent
bazel query --noexperimental_ui //$pkg/foo:all >& "$TEST_log" \
bazel query --experimental_ui_debug_all_events //$pkg/foo:all >& "$TEST_log" \
|| fail "Expected success"
expect_log "Loading package: $pkg/foo"
expect_log "//$pkg/foo:shname2"
Expand Down
6 changes: 3 additions & 3 deletions src/test/shell/integration/output_filter_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ EOF

chmod +x $pkg/foo/bar/test.sh

# TODO(b/37617303): make tests UI-independent
bazel test --noexperimental_ui --output_filter="dummy" $pkg/foo/bar:test >&"$TEST_log" || fail
expect_log "PASS: //$pkg/foo/bar:test"
bazel test --experimental_ui_debug_all_events --output_filter="dummy" \
$pkg/foo/bar:test >&"$TEST_log" || fail
expect_log "PASS.*: //$pkg/foo/bar:test"
}

function test_output_filter_build() {
Expand Down

0 comments on commit f20f622

Please sign in to comment.