From 627074d0f908956a5bbfc2a4a014b778586e6893 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 9 Sep 2020 20:01:42 -0700 Subject: [PATCH] tests/int/checkpoint: rm useless code Commit 417f5ff40 added a code to close fds and kill processes, which should have helped in an event of test case failure. In fact, each test case is executed in a subshell, so - any variables set there can't reach teardown(); - all the fds are closed (as the process is gone). Now, I am not sure about the processes, but the code being removed has never worked anyway, so it does not make sense to keep it. Normally, those are waited for. In case of a test case failure, well, the subsequent cases might fail, too. Fixes: 417f5ff40dcdca Signed-off-by: Kir Kolyshkin --- tests/integration/checkpoint.bats | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tests/integration/checkpoint.bats b/tests/integration/checkpoint.bats index ca34adb1c..4bcbbb6a1 100644 --- a/tests/integration/checkpoint.bats +++ b/tests/integration/checkpoint.bats @@ -12,17 +12,6 @@ function setup() { function teardown() { teardown_busybox - local pid fd - - for pid in "${PIDS_TO_KILL[@]}"; do - kill -9 "$pid" || true - done - PIDS_TO_KILL=() - - for fd in "${FDS_TO_CLOSE[@]}"; do - exec {fd}>&- - done - FDS_TO_CLOSE=() } function setup_pipes() { @@ -42,8 +31,6 @@ function setup_pipes() { exec {in_r}/proc/self/fd/$pipe exec {pipe}>&- - # shellcheck disable=SC2206 - FDS_TO_CLOSE=($in_r $in_w $out_r $out_w) } function check_pipes() { @@ -163,13 +150,9 @@ function simple_cr() { # shellcheck disable=SC2094 exec {lazy_r}/proc/self/fd/$pipe exec {pipe}>&- - # shellcheck disable=SC2206 - FDS_TO_CLOSE+=($lazy_r $lazy_w) __runc --criu "$CRIU" checkpoint --lazy-pages --page-server 0.0.0.0:${port} --status-fd ${lazy_w} --work-path ./work-dir --image-path ./image-dir test_busybox & cpt_pid=$! - # shellcheck disable=SC2206 - PIDS_TO_KILL=($cpt_pid) # wait for lazy page server to be ready out=$(timeout 2 dd if=/proc/self/fd/${lazy_r} bs=1 count=1 2>/dev/null | od) @@ -187,8 +170,6 @@ function simple_cr() { # Start CRIU in lazy-daemon mode ${CRIU} lazy-pages --page-server --address 127.0.0.1 --port ${port} -D image-dir & lp_pid=$! - # shellcheck disable=SC2206 - PIDS_TO_KILL+=($lp_pid) # Restore lazily from checkpoint. # The restored container needs a different name as the checkpointed @@ -211,7 +192,6 @@ function simple_cr() { wait $cpt_pid wait $lp_pid - PIDS_TO_KILL=() check_pipes }