|
| 1 | +load("@rules_shell//shell:sh_test.bzl", "sh_test") |
| 2 | +load("//tests/support:py_reconfig.bzl", "py_reconfig_binary") |
| 3 | + |
| 4 | +# ===== |
| 5 | +# bootstrap_impl=system_python testing |
| 6 | +# ===== |
| 7 | +py_reconfig_binary( |
| 8 | + name = "outer_bootstrap_system_python", |
| 9 | + srcs = ["outer.py"], |
| 10 | + bootstrap_impl = "system_python", |
| 11 | + main = "outer.py", |
| 12 | +) |
| 13 | + |
| 14 | +py_reconfig_binary( |
| 15 | + name = "inner_bootstrap_system_python", |
| 16 | + srcs = ["inner.py"], |
| 17 | + bootstrap_impl = "system_python", |
| 18 | + main = "inner.py", |
| 19 | +) |
| 20 | + |
| 21 | +genrule( |
| 22 | + name = "outer_calls_inner_system_python", |
| 23 | + outs = ["outer_calls_inner_system_python.out"], |
| 24 | + cmd = "RULES_PYTHON_TESTING_TELL_MODULE_SPACE=1 $(location :outer_bootstrap_system_python) $(location :inner_bootstrap_system_python) > $@", |
| 25 | + tools = [ |
| 26 | + ":inner_bootstrap_system_python", |
| 27 | + ":outer_bootstrap_system_python", |
| 28 | + ], |
| 29 | +) |
| 30 | + |
| 31 | +sh_test( |
| 32 | + name = "bootstrap_system_python_test", |
| 33 | + srcs = ["verify_system_python.sh"], |
| 34 | + data = [ |
| 35 | + "verify.sh", |
| 36 | + ":outer_calls_inner_system_python", |
| 37 | + ], |
| 38 | +) |
| 39 | + |
| 40 | +# ===== |
| 41 | +# bootstrap_impl=script testing |
| 42 | +# ===== |
| 43 | +py_reconfig_binary( |
| 44 | + name = "inner_bootstrap_script", |
| 45 | + srcs = ["inner.py"], |
| 46 | + bootstrap_impl = "script", |
| 47 | + main = "inner.py", |
| 48 | +) |
| 49 | + |
| 50 | +py_reconfig_binary( |
| 51 | + name = "outer_bootstrap_script", |
| 52 | + srcs = ["outer.py"], |
| 53 | + bootstrap_impl = "script", |
| 54 | + main = "outer.py", |
| 55 | +) |
| 56 | + |
| 57 | +genrule( |
| 58 | + name = "outer_calls_inner_script_python", |
| 59 | + outs = ["outer_calls_inner_script_python.out"], |
| 60 | + cmd = "RULES_PYTHON_TESTING_TELL_MODULE_SPACE=1 $(location :outer_bootstrap_script) $(location :inner_bootstrap_script) > $@", |
| 61 | + tools = [ |
| 62 | + ":inner_bootstrap_script", |
| 63 | + ":outer_bootstrap_script", |
| 64 | + ], |
| 65 | +) |
| 66 | + |
| 67 | +sh_test( |
| 68 | + name = "bootstrap_script_python_test", |
| 69 | + srcs = ["verify_script_python.sh"], |
| 70 | + data = [ |
| 71 | + "verify.sh", |
| 72 | + ":outer_calls_inner_script_python", |
| 73 | + ], |
| 74 | +) |
0 commit comments