diff options
author | Fabricio Voznika <fvoznika@google.com> | 2018-10-03 20:43:18 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-03 20:44:20 -0700 |
commit | 3f46f2e5017106d1569f759b8d19aee6e9827c58 (patch) | |
tree | 8dfdc15d3af75e808944099ca2b0b85ea6ee12de /kokoro | |
parent | beac59b37a8b0ea834904870e5c236d2627947a2 (diff) |
Fix sandbox chroot
Sandbox was setting chroot, but was not chaging the working
dir. Added test to ensure this doesn't happen in the future.
PiperOrigin-RevId: 215676270
Change-Id: I14352d3de64a4dcb90e50948119dc8328c9c15e1
Diffstat (limited to 'kokoro')
-rwxr-xr-x | kokoro/run_tests.sh | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/kokoro/run_tests.sh b/kokoro/run_tests.sh index 665d63390..3f8841cee 100755 --- a/kokoro/run_tests.sh +++ b/kokoro/run_tests.sh @@ -35,6 +35,11 @@ bazel build //... runtime=runsc_test_$((RANDOM)) sudo -n ./runsc/test/install.sh --runtime ${runtime} +# Best effort to uninstall the runtime +uninstallRuntime() { + sudo -n ./runsc/test/install.sh -u --runtime ${runtime} +} + # Run the tests and upload results. # # We turn off "-e" flag because we must move the log files even if the test @@ -43,6 +48,7 @@ set +e bazel test --test_output=errors //... exit_code=${?} +# Execute local tests that require docker. if [[ ${exit_code} -eq 0 ]]; then # These names are used to exclude tests not supported in certain # configuration, e.g. save/restore not supported with hostnet. @@ -59,8 +65,21 @@ if [[ ${exit_code} -eq 0 ]]; then done fi -# Best effort to uninstall -sudo -n ./runsc/test/install.sh -u --runtime ${runtime} +# Execute local tests that require superuser. +if [[ ${exit_code} -eq 0 ]]; then + bazel build //runsc/test/root:root_test + root_test=$(find -L ./bazel-bin/ -executable -type f -name root_test | grep __main__) + if [[ ! -f "${root_test}" ]]; then + uninstallRuntime + echo "root_test executable not found" + exit 1 + fi + sudo -n -E RUNSC_RUNTIME=${runtime} ${root_test} + exit_code=${?} +fi + +uninstallRuntime + set -e # Find and rename all test xml and log files so that Sponge can pick them up. |