|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
#!/bin/sh |
|
|
|
|
|
|
|
|
|
set -o noglob |
|
|
|
|
set -o errexit |
|
|
|
|
set -o nounset |
|
|
|
|
IFS=' |
|
|
|
@ -13,7 +14,7 @@ if test "$REPOSITORY"; then
|
|
|
|
|
git clone --quiet --depth=1 --shallow-submodules http://root:"${password}"@"$REPOSITORY" . |
|
|
|
|
else |
|
|
|
|
first_file=$(echo "$EXPECTED_FILES" | cut -d' ' -f1) |
|
|
|
|
mkdir -p "$(dirname $first_file)" |
|
|
|
|
mkdir -p "$(dirname "$first_file")" |
|
|
|
|
cat > "$first_file" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
@ -28,6 +29,7 @@ fi
|
|
|
|
|
# Check restrictions |
|
|
|
|
if test "$ALLOWED_FUNCTIONS"; then |
|
|
|
|
for file in $EXPECTED_FILES; do |
|
|
|
|
# shellcheck disable=SC2086 |
|
|
|
|
rc "$file" $ALLOWED_FUNCTIONS |
|
|
|
|
done |
|
|
|
|
fi |
|
|
|
@ -35,11 +37,11 @@ fi
|
|
|
|
|
# Compile and run test |
|
|
|
|
cd |
|
|
|
|
GOPATH=$HOME:$GOPATH |
|
|
|
|
if command -v "$EXERCISE"_test &>/dev/null; then |
|
|
|
|
if command -v "${EXERCISE}_test" >/dev/null 2>&1; then |
|
|
|
|
# The exercise is a program |
|
|
|
|
go build "student/$EXERCISE" |
|
|
|
|
"$EXERCISE"_test |
|
|
|
|
go build "./src/student/$EXERCISE" |
|
|
|
|
"${EXERCISE}_test" |
|
|
|
|
else |
|
|
|
|
# The exercise is a function |
|
|
|
|
go run "$EXERCISE"_test |
|
|
|
|
go run "func/${EXERCISE}_test" |
|
|
|
|
fi |
|
|
|
|