-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·37 lines (31 loc) · 989 Bytes
/
Copy pathentrypoint.sh
File metadata and controls
executable file
·37 lines (31 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
set -eo pipefail
IFS='
'
# support both variables CODE_EDITOR_RUN_ONLY and EXAM_RUN_ONLY
CODE_EDITOR_RUN_ONLY="${CODE_EDITOR_RUN_ONLY:-$EXAM_RUN_ONLY}"
# support both variables CODE_EDITOR_MODE and EXAM_MODE
CODE_EDITOR_MODE="${CODE_EDITOR_MODE:-$EXAM_MODE}"
cp -a /app/tests .
cp -a student solutions
if test "$CODE_EDITOR_MODE"; then
cd "solutions/$EXERCISE"
# ! to support both the old and the new version of the runner we
# ! need to check the files in the code editor
if ! echo "$EDITOR_FILES" | tr ',' '\n' | grep -q 'src/main.rs'; then
if test "$CODE_EDITOR_RUN_ONLY"; then
mv src/lib.rs src/main.rs 2>&1 ||:
fi
fi
cargo init
cd
fi
if ! test -f "tests/${EXERCISE}_test/Cargo.toml"; then
echo "No test file found for the exercise : $EXERCISE"
exit 1
fi
if test "$CODE_EDITOR_RUN_ONLY"; then
cargo run --manifest-path "solutions/$EXERCISE/Cargo.toml" -- "$@"
else
cargo test --manifest-path "tests/${EXERCISE}_test/Cargo.toml"
fi