2020
2121# Save pwd
2222base_dir=$( pwd)
23- solution_dir=$( realpath " $2 " )
24- output_dir=$( realpath " $3 " )
23+ solution_dir=$( realpath $2 )
24+ output_dir=$( realpath $3 )
2525
2626# Copy solution to /tmp
2727tmp_sol=$( mktemp -d /tmp/solution_XXXXXXXXXX)
28- cp -r " ${solution_dir} " /* " ${tmp_sol} "
29- solution_dir=" ${tmp_sol} "
28+ cp -r ${solution_dir} /* ${tmp_sol}
29+ solution_dir=${tmp_sol}
3030
3131printf " transforming %q\n" " ${solution_dir} /mix.exs"
3232./bin/exercism_test_helper --transform-mix " ${solution_dir} /mix.exs:${solution_dir} /mix.exs"
3333
3434# Find the exercise test files
35- find " ${solution_dir} /test" -type f -name ' *.exs' | while read -r file; do
35+ find " ${solution_dir} /test" -type f -name ' *.exs' | while read file; do
3636 # Skip the test_helper
3737 if [[ $( basename " $file " ) == ' test_helper.exs' ]]; then
3838 continue
@@ -46,15 +46,15 @@ find "${solution_dir}/test" -type f -name '*.exs' | while read -r file; do
4646done
4747
4848# Change directory to the solution folder
49- cd " ${ solution_dir} "
49+ cd $ solution_dir
5050
5151# Compile solution
5252compile_step=$( MIX_ENV=test mix compile 2>&1 )
5353
5454# On compilation error, create results.json with compile error, halt script with error
5555if [ $? -ne 0 ]; then
5656 jo version=3 status=error message=" ${compile_step} " tests=" []" > " ${output_dir} /results.json"
57- printf " Compilation contained error, see %s /results.json\n" " ${output_dir} "
57+ printf " Compilation contained error, see ${output_dir} /results.json\n"
5858 exit 0
5959fi
6060
@@ -63,16 +63,16 @@ export JSON_PRINT_FILE=1
6363export JSON_REPORT_DIR=" ${solution_dir} "
6464
6565elixir \
66- -pa " ${base_dir} /exercism_test_helper/_build/test/lib/exercism_test_helper/ebin" \
67- -pa " ${base_dir} /exercism_test_helper/_build/test/lib/jason/ebin" \
66+ -pa ${base_dir} /exercism_test_helper/_build/test/lib/exercism_test_helper/ebin \
67+ -pa ${base_dir} /exercism_test_helper/_build/test/lib/jason/ebin \
6868 -S mix test \
6969 --seed 0 \
7070 --no-deps-check \
7171 --exclude slow \
7272 --formatter JSONFormatter \
7373 > " ${solution_dir} /output" 2> " ${solution_dir} /error_log"
7474
75- cd " ${ base_dir} "
75+ cd $ base_dir
7676
7777# Convert the output log to json
7878./bin/exercism_test_helper --log-to-json " ${solution_dir} /output:${solution_dir} /output.json"
@@ -81,6 +81,6 @@ cd "${base_dir}"
8181./bin/exercism_test_helper --combine " ${solution_dir} /results.json:${solution_dir} /metadata.json:${solution_dir} /output.json"
8282
8383# Copy result to output directory if required
84- if [[ " ${ solution_dir} " != " ${ output_dir} " ]]; then
84+ if [[ $ solution_dir != $ output_dir ]]; then
8585 cp " ${solution_dir} /results.json" " ${output_dir} /results.json"
8686fi
0 commit comments