Skip to content

Commit 2d93fb3

Browse files
committed
Move to /opt/exercism/gdscript/test-runner/
Keeps Docker vs. native more consistent while avoiding collisions on native systems
1 parent b2056d2 commit 2d93fb3

3 files changed

Lines changed: 55 additions & 6 deletions

File tree

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ RUN wget https://github.com/godotengine/godot/releases/download/4.4.1-stable/God
1212
mv Godot_v4.4.1-stable_linux.x86_64 /usr/bin/godot && \
1313
rm Godot_v4.4.1-stable_linux.x86_64.zip
1414

15-
WORKDIR /opt/test-runner
15+
WORKDIR /opt/exercism/gdscript/test-runner
1616
COPY . .
17-
ENTRYPOINT ["/opt/test-runner/bin/run.sh"]
17+
ENTRYPOINT ["/opt/exercism/gdscript/test-runner/bin/run.sh"]

bin/run-tests-in-docker.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ docker run \
2323
--rm \
2424
--network none \
2525
--read-only \
26-
--mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests \
26+
--mount type=bind,src="${PWD}/tests",dst=/opt/exercism/gdscript/test-runner/tests \
2727
--mount type=tmpfs,dst=/tmp \
28-
--volume "${PWD}/bin/run-tests.sh:/opt/test-runner/bin/run-tests.sh" \
29-
--workdir /opt/test-runner \
30-
--entrypoint /opt/test-runner/bin/run-tests.sh \
28+
--volume "${PWD}/bin/run-tests.sh:/opt/exercism/gdscript/test-runner/bin/run-tests.sh" \
29+
--workdir /opt/exercism/gdscript/test-runner \
30+
--entrypoint /opt/exercism/gdscript/test-runner/bin/run-tests.sh \
3131
exercism/test-runner
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# Script for testing a student's local solution to a single GDScript exercise.
5+
#
6+
# This script is intended to be run from any exercise subdirectory from the
7+
# Exercism GDScript track, but can live one directory higher than the
8+
# exercise subdirectories for convenience.
9+
10+
slug=$(basename "$(pwd)")
11+
missing_gd_msg="Normally, the exercise subdirectory created by the exercism download command should contain this file."
12+
general_help_msg="Please see https://exercism.org/docs/tracks/gdscript/tests for details."
13+
if [ ! -f "${slug//-/_}_test.gd" ]; then
14+
echo "Missing test file: ${slug//-/_}_test.gd"
15+
echo $missing_gd_msg
16+
echo $general_help_msg
17+
exit 1
18+
fi
19+
if [ ! -f "${slug//-/_}.gd" ]; then
20+
echo "Missing solution file: ${slug//-/_}.gd"
21+
echo $missing_gd_msg
22+
echo $general_help_msg
23+
exit 1
24+
fi
25+
if [ ! -f "/opt/exercism/gdscript/test-runner/bin/run.sh" ]; then
26+
echo "Missing test runner file: /opt/exercism/gdscript/test-runner/bin/run.sh"
27+
echo $general_help_msg
28+
exit 1
29+
fi
30+
31+
solution_dir="$(pwd)"
32+
output_dir="${solution_dir}/.test-output"
33+
results_file="${output_dir}/results.json"
34+
mkdir -p "${output_dir}"
35+
36+
(cd /opt/exercism/gdscript/test-runner && bin/run.sh "$slug" "$solution_dir" "$output_dir") || {
37+
echo "Test runner script failed."
38+
exit 1
39+
}
40+
41+
test_status="$(jq -r '.status' "${results_file}")"
42+
if [ "$test_status" != "pass" ]; then
43+
echo "Tests for $slug have failed:"
44+
cat "${results_file}"
45+
exit 1
46+
else
47+
echo
48+
echo "Tests for $slug passed!"
49+
fi

0 commit comments

Comments
 (0)