@@ -20,7 +20,7 @@ load("@rules_testing//lib:truth.bzl", "matching")
20
20
load ("@rules_testing//lib:util.bzl" , rt_util = "util" )
21
21
load ("//tests/base_rules:base_tests.bzl" , "create_base_tests" )
22
22
load ("//tests/base_rules:util.bzl" , "WINDOWS_ATTR" , pt_util = "util" )
23
- load ("//tests/support:support.bzl" , "WINDOWS_X86_64" )
23
+ load ("//tests/support:support.bzl" , "LINUX_X86_64" , " WINDOWS_X86_64" )
24
24
25
25
_BuiltinPyRuntimeInfo = PyRuntimeInfo
26
26
@@ -67,6 +67,50 @@ def _test_basic_windows_impl(env, target):
67
67
68
68
_tests .append (_test_basic_windows )
69
69
70
+ def _test_basic_zip (name , config ):
71
+ if rp_config .enable_pystar :
72
+ target_compatible_with = select ({
73
+ # Disable the new test on windows because we have _test_basic_windows.
74
+ "@platforms//os:windows" : ["@platforms//:incompatible" ],
75
+ "//conditions:default" : [],
76
+ })
77
+ else :
78
+ target_compatible_with = ["@platforms//:incompatible" ]
79
+ rt_util .helper_target (
80
+ config .rule ,
81
+ name = name + "_subject" ,
82
+ srcs = ["main.py" ],
83
+ main = "main.py" ,
84
+ )
85
+ analysis_test (
86
+ name = name ,
87
+ impl = _test_basic_zip_impl ,
88
+ target = name + "_subject" ,
89
+ config_settings = {
90
+ # NOTE: The default for this flag is based on the Bazel host OS, not
91
+ # the target platform. For windows, it defaults to true, so force
92
+ # it to that to match behavior when this test runs on other
93
+ # platforms.
94
+ "//command_line_option:build_python_zip" : "true" ,
95
+ "//command_line_option:cpu" : "linux_x86_64" ,
96
+ "//command_line_option:crosstool_top" : Label ("//tests/cc:cc_toolchain_suite" ),
97
+ "//command_line_option:extra_toolchains" : [str (Label ("//tests/cc:all" ))],
98
+ "//command_line_option:platforms" : [LINUX_X86_64 ],
99
+ },
100
+ attr_values = {"target_compatible_with" : target_compatible_with },
101
+ )
102
+
103
+ def _test_basic_zip_impl (env , target ):
104
+ target = env .expect .that_target (target )
105
+ target .runfiles ().contains_predicate (matching .str_endswith (
106
+ target .meta .format_str ("/{name}.zip" ),
107
+ ))
108
+ target .runfiles ().contains_predicate (matching .str_endswith (
109
+ target .meta .format_str ("/{name}" ),
110
+ ))
111
+
112
+ _tests .append (_test_basic_zip )
113
+
70
114
def _test_executable_in_runfiles (name , config ):
71
115
rt_util .helper_target (
72
116
config .rule ,
0 commit comments