From dd0b51569116b169a186671a5d7a437b34b007d4 Mon Sep 17 00:00:00 2001 From: xpetit <32063953+xpetit@users.noreply.github.com> Date: Wed, 30 Jun 2021 19:26:59 +0200 Subject: [PATCH] Make it work with non-executable scripts --- sh/tests/cl-camp1_test.sh | 4 ++-- sh/tests/cl-camp3_test.sh | 4 ++-- sh/tests/cl-camp4_test.sh | 4 ++-- sh/tests/cl-camp5_test.sh | 4 ++-- sh/tests/cl-camp6_test.sh | 4 ++-- sh/tests/cl-camp8_test.sh | 4 ++-- sh/tests/explain_test.sh | 4 ++-- sh/tests/now-get-to-work_test.sh | 4 ++-- sh/tests/teacher_test.sh | 5 ++--- 9 files changed, 18 insertions(+), 19 deletions(-) diff --git a/sh/tests/cl-camp1_test.sh b/sh/tests/cl-camp1_test.sh index 808238460..923059101 100755 --- a/sh/tests/cl-camp1_test.sh +++ b/sh/tests/cl-camp1_test.sh @@ -8,8 +8,8 @@ IFS=' script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) challenge() { - submitted=$(cd "$1" && "$script_dirS"/student/mastertheLS) - expected=$(cd "$1" && "$script_dirS"/solutions/mastertheLS) + submitted=$(cd "$1" && bash "$script_dirS"/student/mastertheLS) + expected=$(cd "$1" && bash "$script_dirS"/solutions/mastertheLS) diff <(echo "$submitted") <(echo "$expected") } diff --git a/sh/tests/cl-camp3_test.sh b/sh/tests/cl-camp3_test.sh index 00a5cba41..26a09150b 100755 --- a/sh/tests/cl-camp3_test.sh +++ b/sh/tests/cl-camp3_test.sh @@ -8,8 +8,8 @@ IFS=' script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) challenge() { - submitted=$(cd "$1" && "$script_dirS"/student/look) - expected=$(cd "$1" && "$script_dirS"/solutions/look) + submitted=$(cd "$1" && bash "$script_dirS"/student/look) + expected=$(cd "$1" && bash "$script_dirS"/solutions/look) diff <(echo "$submitted") <(echo "$expected") } diff --git a/sh/tests/cl-camp4_test.sh b/sh/tests/cl-camp4_test.sh index fe38c7025..c7dd907ce 100755 --- a/sh/tests/cl-camp4_test.sh +++ b/sh/tests/cl-camp4_test.sh @@ -9,8 +9,8 @@ echo insecure >> ~/.curlrc caddy start &>/dev/null challenge() { - submitted=$(./student/myfamily.sh) - expected=$(./solutions/myfamily.sh) + submitted=$(bash student/myfamily.sh) + expected=$(bash solutions/myfamily.sh) diff <(echo "$submitted") <(echo "$expected") } diff --git a/sh/tests/cl-camp5_test.sh b/sh/tests/cl-camp5_test.sh index de406c3d2..b141b1138 100755 --- a/sh/tests/cl-camp5_test.sh +++ b/sh/tests/cl-camp5_test.sh @@ -8,8 +8,8 @@ IFS=' script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) challenge() { - submitted=$(cd "$1" && "$script_dirS"/student/lookagain.sh) - expected=$(cd "$1" && "$script_dirS"/solutions/lookagain.sh) + submitted=$(cd "$1" && bash "$script_dirS"/student/lookagain.sh) + expected=$(cd "$1" && bash "$script_dirS"/solutions/lookagain.sh) diff <(echo "$submitted") <(echo "$expected") } diff --git a/sh/tests/cl-camp6_test.sh b/sh/tests/cl-camp6_test.sh index 6e1b76020..3c0faa6a6 100755 --- a/sh/tests/cl-camp6_test.sh +++ b/sh/tests/cl-camp6_test.sh @@ -8,8 +8,8 @@ IFS=' script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) challenge() { - submitted=$(cd "$1" && "$script_dirS"/student/countfiles.sh) - expected=$(cd "$1" && "$script_dirS"/solutions/countfiles.sh) + submitted=$(cd "$1" && bash "$script_dirS"/student/countfiles.sh) + expected=$(cd "$1" && bash "$script_dirS"/solutions/countfiles.sh) diff <(echo "$submitted") <(echo "$expected") } diff --git a/sh/tests/cl-camp8_test.sh b/sh/tests/cl-camp8_test.sh index c40837f0a..3391a2df4 100755 --- a/sh/tests/cl-camp8_test.sh +++ b/sh/tests/cl-camp8_test.sh @@ -7,7 +7,7 @@ IFS=' cd cl-camp8 -submitted=$(../student/skip.sh) -expected=$(../solutions/skip.sh) +submitted=$(bash ../student/skip.sh) +expected=$(bash ../solutions/skip.sh) diff <(echo "$submitted") <(echo "$expected") diff --git a/sh/tests/explain_test.sh b/sh/tests/explain_test.sh index c6e350f96..b5aeba026 100755 --- a/sh/tests/explain_test.sh +++ b/sh/tests/explain_test.sh @@ -5,8 +5,8 @@ set -euo pipefail IFS=' ' -submitted=$(student/explain.sh) -expected=$(solutions/explain.sh) +submitted=$(bash student/explain.sh) +expected=$(bash solutions/explain.sh) if ! diff -q <(echo "$submitted") <(echo "$expected") &>/dev/null; then echo "Wrong answer, detective." diff --git a/sh/tests/now-get-to-work_test.sh b/sh/tests/now-get-to-work_test.sh index 7313f2e1f..efe236a38 100755 --- a/sh/tests/now-get-to-work_test.sh +++ b/sh/tests/now-get-to-work_test.sh @@ -5,8 +5,8 @@ set -euo pipefail IFS=' ' -submitted=$(student/my_answer.sh) -expected=$(solutions/my_answer.sh) +submitted=$(bash student/my_answer.sh) +expected=$(bash solutions/my_answer.sh) if ! diff -q <(echo "$submitted") <(echo "$expected") &>/dev/null; then echo "Wrong answer, detective." diff --git a/sh/tests/teacher_test.sh b/sh/tests/teacher_test.sh index 4dde58bed..ca8153fcd 100755 --- a/sh/tests/teacher_test.sh +++ b/sh/tests/teacher_test.sh @@ -7,10 +7,9 @@ IFS=' script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) - challenge() { - submitted=$(cd "$1" && "$script_dirS"/student/teacher.sh) || (echo "Your script exited with a non-zero status code"; exit 1) - expected=$(cd "$1" && "$script_dirS"/solutions/teacher.sh) + submitted=$(cd "$1" && bash "$script_dirS"/student/teacher.sh) || (echo "Your script exited with a non-zero status code"; exit 1) + expected=$(cd "$1" && bash "$script_dirS"/solutions/teacher.sh) if ! diff -q <(echo "$submitted") <(echo "$expected") &>/dev/null; then echo "??? What ?? Wrong answer, teacher. Did you really do the job previously? Or was is just an \"echo\" of luck??"