Browse Source

Put back student repository as read-only #3

pull/768/head
xpetit 3 years ago
parent
commit
0d38d78c63
No known key found for this signature in database
GPG Key ID: 97C60669182C17A5
  1. 5
      go/tests/Dockerfile
  2. 9
      go/tests/entrypoint.sh
  3. 2
      go/tests/go.mod

5
go/tests/Dockerfile

@ -5,8 +5,8 @@ RUN apk add --no-cache git
RUN go get golang.org/x/tools/cmd/goimports
RUN mkdir -p /jail/student
RUN touch /jail/student/go.mod
RUN mkdir -p /piscine-go
RUN touch /piscine-go/go.mod
WORKDIR /public/go/tests
COPY go.* ./
@ -17,6 +17,7 @@ COPY lib lib
COPY prog prog
COPY rc rc
RUN go install ./rc ./prog/...
RUN rm -rf /piscine-go
COPY entrypoint.sh /usr/local/bin
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

9
go/tests/entrypoint.sh

@ -2,7 +2,8 @@
set -e
cd student
cp -a student piscine-go
cd piscine-go
if test "$EXAM_MODE"; then
go mod init main 2>/dev/null
@ -10,8 +11,7 @@ if test "$EXAM_MODE"; then
fi
if test "$EXAM_RUN_ONLY" = true; then
go build -o ../exe "./$EXERCISE"
cd ..
go build -o exe "./$EXERCISE"
./exe "$@"
exit
fi
@ -46,8 +46,7 @@ fi
# Compile and run test
if command -v "${EXERCISE}_test" >/dev/null 2>&1; then
# The exercise is a program
go build -o ../exe "./$EXERCISE"
cd ..
go build -o exe "./$EXERCISE"
"${EXERCISE}_test"
else
# The exercise is a function

2
go/tests/go.mod

@ -9,4 +9,4 @@ require (
student v0.0.0
)
replace student => ../../../jail/student
replace student => ../../../piscine-go

Loading…
Cancel
Save