Skip to content

Commit a9de62c

Browse files
committed
Tidy up shell scripts in bin/
1 parent 6616d81 commit a9de62c

4 files changed

Lines changed: 13 additions & 15 deletions

File tree

bin/run-in-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# ./bin/run-in-docker.sh two-fer /absolute/path/to/two-fer/solution/folder/ /absolute/path/to/output/directory/
1818

1919
# If any required arguments is missing, print the usage and exit
20-
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
20+
if (( $# != 3 )); then
2121
echo "usage: ./bin/run-in-docker.sh exercise-slug /absolute/path/to/solution/folder/ /absolute/path/to/output/directory/"
2222
exit 1
2323
fi

bin/run-tests-in-docker.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22

33
# Synopsis:
44
# Test the test runner Docker image by running it against a predefined set of
@@ -21,12 +21,10 @@ docker build --rm -t exercism/go-test-runner .
2121
# TODO: allow image to work with --read-only filesystem
2222

2323
# Run the Docker image using the settings mimicking the production environment
24-
docker run \
25-
--rm \
26-
--network none \
27-
--mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests \
28-
--mount type=volume,dst=/tmp \
29-
--volume "${PWD}/bin/run-tests.sh:/opt/test-runner/bin/run-tests.sh" \
30-
--workdir /opt/test-runner \
31-
--entrypoint /opt/test-runner/bin/run-tests.sh \
32-
exercism/go-test-runner
24+
args=(--rm --network none)
25+
args+=( --mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests )
26+
args+=( --mount type=volume,dst=/tmp )
27+
args+=( --volume "${PWD}/bin/run-tests.sh:/opt/test-runner/bin/run-tests.sh" )
28+
args+=( --workdir /opt/test-runner )
29+
args+=( --entrypoint /opt/test-runner/bin/run-tests.sh )
30+
docker run "${args[@]}" exercism/go-test-runner

bin/run-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22

33
# Synopsis:
44
# Test the test runner by running it against a predefined set of solutions
@@ -37,9 +37,9 @@ for test_dir in tests/*; do
3737
echo "${test_dir_name}: comparing results.json to expected_results.json"
3838
diff "${results_file_path}" "${expected_results_file_path}"
3939

40-
if [ $? -ne 0 ]; then
40+
if (( $? != 0 )); then
4141
exit_code=1
4242
fi
4343
done
4444

45-
exit ${exit_code}
45+
exit "${exit_code}"

bin/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
# ./run.sh two-fer twofer outdir
1111

1212
cd "$2" || exit
13-
/opt/test-runner/bin/test-runner $2 $3
13+
/opt/test-runner/bin/test-runner "$2" "$3"

0 commit comments

Comments
 (0)