|
| 1 | +load("@rules_shell//shell:sh_test.bzl", "sh_test") |
| 2 | +load("//tests/support:py_reconfig.bzl", "py_reconfig_binary") |
| 3 | +load("//tests/support:support.bzl", "NOT_WINDOWS", "SUPPORTS_BOOTSTRAP_SCRIPT") |
| 4 | + |
| 5 | +# ===== |
| 6 | +# bootstrap_impl=system_python testing |
| 7 | +# ===== |
| 8 | +py_reconfig_binary( |
| 9 | + name = "outer_bootstrap_system_python", |
| 10 | + srcs = ["outer.py"], |
| 11 | + bootstrap_impl = "system_python", |
| 12 | + main = "outer.py", |
| 13 | + tags = ["manual"], |
| 14 | +) |
| 15 | + |
| 16 | +py_reconfig_binary( |
| 17 | + name = "inner_bootstrap_system_python", |
| 18 | + srcs = ["inner.py"], |
| 19 | + bootstrap_impl = "system_python", |
| 20 | + main = "inner.py", |
| 21 | + tags = ["manual"], |
| 22 | +) |
| 23 | + |
| 24 | +genrule( |
| 25 | + name = "outer_calls_inner_system_python", |
| 26 | + outs = ["outer_calls_inner_system_python.out"], |
| 27 | + cmd = "RULES_PYTHON_TESTING_TELL_MODULE_SPACE=1 $(location :outer_bootstrap_system_python) $(location :inner_bootstrap_system_python) > $@", |
| 28 | + tags = ["manual"], |
| 29 | + tools = [ |
| 30 | + ":inner_bootstrap_system_python", |
| 31 | + ":outer_bootstrap_system_python", |
| 32 | + ], |
| 33 | +) |
| 34 | + |
| 35 | +sh_test( |
| 36 | + name = "bootstrap_system_python_test", |
| 37 | + srcs = ["verify_system_python.sh"], |
| 38 | + data = [ |
| 39 | + "verify.sh", |
| 40 | + ":outer_calls_inner_system_python", |
| 41 | + ], |
| 42 | + # The way verify_system_python.sh loads verify.sh doesn't work |
| 43 | + # with Windows for some annoying reason. Just skip windows for now; |
| 44 | + # the logic being test isn't OS-specific, so this should be fine. |
| 45 | + target_compatible_with = NOT_WINDOWS, |
| 46 | +) |
| 47 | + |
| 48 | +# ===== |
| 49 | +# bootstrap_impl=script testing |
| 50 | +# ===== |
| 51 | +py_reconfig_binary( |
| 52 | + name = "inner_bootstrap_script", |
| 53 | + srcs = ["inner.py"], |
| 54 | + bootstrap_impl = "script", |
| 55 | + main = "inner.py", |
| 56 | + tags = ["manual"], |
| 57 | +) |
| 58 | + |
| 59 | +py_reconfig_binary( |
| 60 | + name = "outer_bootstrap_script", |
| 61 | + srcs = ["outer.py"], |
| 62 | + bootstrap_impl = "script", |
| 63 | + main = "outer.py", |
| 64 | + tags = ["manual"], |
| 65 | +) |
| 66 | + |
| 67 | +genrule( |
| 68 | + name = "outer_calls_inner_script_python", |
| 69 | + outs = ["outer_calls_inner_script_python.out"], |
| 70 | + cmd = "RULES_PYTHON_TESTING_TELL_MODULE_SPACE=1 $(location :outer_bootstrap_script) $(location :inner_bootstrap_script) > $@", |
| 71 | + tags = ["manual"], |
| 72 | + tools = [ |
| 73 | + ":inner_bootstrap_script", |
| 74 | + ":outer_bootstrap_script", |
| 75 | + ], |
| 76 | +) |
| 77 | + |
| 78 | +sh_test( |
| 79 | + name = "bootstrap_script_python_test", |
| 80 | + srcs = ["verify_script_python.sh"], |
| 81 | + data = [ |
| 82 | + "verify.sh", |
| 83 | + ":outer_calls_inner_script_python", |
| 84 | + ], |
| 85 | + target_compatible_with = SUPPORTS_BOOTSTRAP_SCRIPT, |
| 86 | +) |
0 commit comments