Skip to content

Commit

Permalink
Replace py with sh testing --incompatible_autoload_externally
Browse files Browse the repository at this point in the history
There sh rules are a bit more stable in tests, because they don't have a dependency on proto rules like Python rules.

PiperOrigin-RevId: 694450548
Change-Id: I1791d361c7ab8d9436856a029f66cc95b3156a9a
  • Loading branch information
comius authored and copybara-github committed Nov 8, 2024
1 parent a0471c7 commit 89e5e4a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/test/shell/integration/load_removed_symbols_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,30 +162,30 @@ function test_existing_rule_is_redirected() {
setup_module_dot_bazel

cat > BUILD << EOF
py_library(
name = 'py_library',
sh_library(
name = 'sh_library',
)
EOF
bazel query --incompatible_autoload_externally=+py_library ':py_library' --output=build >&$TEST_log 2>&1 || fail "build failed"
expect_log "rules_python./python/py_library.bzl"
bazel query --incompatible_autoload_externally=+sh_library ':sh_library' --output=build >&$TEST_log 2>&1 || fail "build failed"
expect_log "rules_shell./shell/private/sh_library.bzl"
}

function test_existing_rule_is_redirected_in_bzl() {
setup_module_dot_bazel

cat > macro.bzl << EOF
def macro():
native.py_library(
name = 'py_library',
native.sh_library(
name = 'sh_library',
)
EOF

cat > BUILD << EOF
load(":macro.bzl", "macro")
macro()
EOF
bazel query --incompatible_autoload_externally=+py_library ':py_library' --output=build >&$TEST_log 2>&1 || fail "build failed"
expect_log "rules_python./python/py_library.bzl"
bazel query --incompatible_autoload_externally=+sh_library ':sh_library' --output=build >&$TEST_log 2>&1 || fail "build failed"
expect_log "rules_shell./shell/private/sh_library.bzl"
}


Expand Down Expand Up @@ -301,16 +301,16 @@ function test_removing_symbol_incompletely() {

cat > symbol.bzl << EOF
def symbol():
a = ProtoInfo
a = CcInfo
EOF

cat > BUILD << EOF
load(":symbol.bzl", "symbol")
symbol()
EOF

bazel build --incompatible_autoload_externally=-ProtoInfo :all >&$TEST_log 2>&1 && fail "build unexpectedly succeeded"
expect_log "Symbol in 'ProtoInfo' can't be removed, because it's still used by:"
bazel build --incompatible_autoload_externally=-CcInfo :all >&$TEST_log 2>&1 && fail "build unexpectedly succeeded"
expect_log "Symbol in 'CcInfo' can't be removed, because it's still used by:"
}

function test_removing_existing_symbol() {
Expand Down Expand Up @@ -453,11 +453,11 @@ function test_whole_repo_flag() {
setup_module_dot_bazel

cat > BUILD << EOF
py_library(
name = 'py_library',
sh_library(
name = 'sh_library',
)
EOF
bazel query --incompatible_autoload_externally=+@rules_python ':py_library' --output=build >&$TEST_log 2>&1 || fail "build failed"
bazel query --incompatible_autoload_externally=+@rules_shell ':sh_library' --output=build >&$TEST_log 2>&1 || fail "build failed"
}

function test_legacy_globals() {
Expand Down

0 comments on commit 89e5e4a

Please sign in to comment.