@@ -582,37 +582,6 @@ function environ_invalidation_test_template() {
582582 assert_equals 6 $( cat " ${execution_file} " )
583583}
584584
585- function environ_invalidation_action_env_test_template() {
586- local startup_flag=" ${1-} "
587- local command_flag=" --noincompatible_repo_env_ignores_action_env"
588- setup_starlark_repository
589-
590- # We use a counter to avoid other invalidation to hide repository
591- # invalidation (e.g., --action_env=K=V will cause all repositories to re-run).
592- local execution_file=" $( setup_invalidation_test) "
593-
594- # Set to FOO=BAZ BAR=FOO
595- FOO=BAZ BAR=FOO bazel ${startup_flag} build " ${command_flag} " @foo//:bar >& $TEST_log \
596- || fail " Failed to build"
597- expect_log " <1> FOO=BAZ BAR=FOO BAZ=undefined"
598- assert_equals 1 $( cat " ${execution_file} " )
599-
600- # Test with changing using --action_env
601- bazel ${startup_flag} build " ${command_flag} " \
602- --action_env FOO=BAZ --action_env BAR=FOO --action_env BEZ=BAR \
603- @foo//:bar >& $TEST_log || fail " Failed to build"
604- assert_equals 1 $( cat " ${execution_file} " )
605- bazel ${startup_flag} build " ${command_flag} " \
606- --action_env FOO=BAZ --action_env BAR=FOO --action_env BAZ=BAR \
607- @foo//:bar >& $TEST_log || fail " Failed to build"
608- assert_equals 1 $( cat " ${execution_file} " )
609- bazel ${startup_flag} build " ${command_flag} " \
610- --action_env FOO=BAR --action_env BAR=FOO --action_env BAZ=BAR \
611- @foo//:bar >& $TEST_log || fail " Failed to build"
612- expect_log " <2> FOO=BAR BAR=FOO BAZ=BAR"
613- assert_equals 2 $( cat " ${execution_file} " )
614- }
615-
616585function test_starlark_repository_environ_invalidation() {
617586 environ_invalidation_test_template
618587}
@@ -622,14 +591,6 @@ function test_starlark_repository_environ_invalidation_batch() {
622591 environ_invalidation_test_template --batch
623592}
624593
625- function test_starlark_repository_environ_invalidation_action_env() {
626- environ_invalidation_action_env_test_template
627- }
628-
629- function test_starlark_repository_environ_invalidation_action_env_batch() {
630- environ_invalidation_action_env_test_template --batch
631- }
632-
633594# Test invalidation based on change to the bzl files
634595function bzl_invalidation_test_template() {
635596 local startup_flag=" ${1-} "
@@ -3016,58 +2977,6 @@ EOF
30162977 @repo//... & > $TEST_log || fail " expected Bazel to succeed"
30172978}
30182979
3019- function test_execute_environment_repo_env_ignores_action_env_off() {
3020- cat >> $( setup_module_dot_bazel) << 'EOF '
3021- my_repo = use_repo_rule("//:repo.bzl", "my_repo")
3022- my_repo(name="repo")
3023- EOF
3024- touch BUILD
3025- cat > repo.bzl << 'EOF '
3026- def _impl(ctx):
3027- st = ctx.execute(
3028- ["env"],
3029- )
3030- if st.return_code:
3031- fail("Command did not succeed")
3032- vars = {line.partition("=")[0]: line.partition("=")[-1] for line in st.stdout.strip().split("\n")}
3033- if vars.get("ACTION_ENV_PRESENT") != "value1":
3034- fail("ACTION_ENV_PRESENT has wrong value: " + vars.get("ACTION_ENV_PRESENT"))
3035- ctx.file("BUILD", "exports_files(['data.txt'])")
3036- my_repo = repository_rule(_impl)
3037- EOF
3038-
3039- bazel build \
3040- --noincompatible_repo_env_ignores_action_env \
3041- --action_env=ACTION_ENV_PRESENT=value1 \
3042- @repo//... & > $TEST_log || fail " expected Bazel to succeed"
3043- }
3044-
3045- function test_execute_environment_repo_env_ignores_action_env_on() {
3046- cat >> $( setup_module_dot_bazel) << 'EOF '
3047- my_repo = use_repo_rule("//:repo.bzl", "my_repo")
3048- my_repo(name="repo")
3049- EOF
3050- touch BUILD
3051- cat > repo.bzl << 'EOF '
3052- def _impl(ctx):
3053- st = ctx.execute(
3054- ["env"],
3055- )
3056- if st.return_code:
3057- fail("Command did not succeed")
3058- vars = {line.partition("=")[0]: line.partition("=")[-1] for line in st.stdout.strip().split("\n")}
3059- if "ACTION_ENV_REMOVED" in vars:
3060- fail("ACTION_ENV_REMOVED should not be in the environment")
3061- ctx.file("BUILD", "exports_files(['data.txt'])")
3062- my_repo = repository_rule(_impl)
3063- EOF
3064-
3065- bazel build \
3066- --incompatible_repo_env_ignores_action_env \
3067- --action_env=ACTION_ENV_REMOVED=value1 \
3068- @repo//... & > $TEST_log || fail " expected Bazel to succeed"
3069- }
3070-
30712980function test_dependency_on_repo_with_invalid_name() {
30722981 cat >> $( setup_module_dot_bazel) << 'EOF '
30732982my_repo = use_repo_rule("//:repo.bzl", "my_repo")
0 commit comments