File tree Expand file tree Collapse file tree 8 files changed +67
-0
lines changed Expand file tree Collapse file tree 8 files changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Currently we have following images -
2222 - [ c] ( containers/c )
2323 - [ cpp] ( containers/cpp )
2424 - [ c#] ( containers/csharp )
25+ - [ golang] ( containers/golang )
2526 - [ java8] ( containers/java8 )
2627 - [ nodejs6] ( containers/nodejs6 )
2728 - [ nodejs] ( containers/nodejs8 )
Original file line number Diff line number Diff line change 1+ FROM frolvlad/alpine-go
2+
3+ RUN apk add --no-cache bash
4+
5+ COPY ./compile.sh /bin/compile.sh
6+ COPY ./run.sh /bin/run.sh
7+
8+ RUN chmod 777 /bin/compile.sh; \
9+ chmod 777 /bin/run.sh
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ chmod 777 program.go
4+ go run program.go < run.stdin 1> run.stdout 2> run.stderr
Original file line number Diff line number Diff line change 1212 bash tests/csharp/test_worker.sh
1313}
1414
15+ @test " test golang" {
16+ bash tests/golang/test_worker.sh
17+ }
18+
1519@test " test java8" {
1620 bash tests/java8/test_worker.sh
1721}
Original file line number Diff line number Diff line change 1+ package main;
2+
3+ import "fmt" ;
4+
5+ func main () {
6+ var input string
7+ fmt .Scanf ("%s" , & input )
8+ fmt .Println ("Hello " + input )
9+ }
Original file line number Diff line number Diff line change 1+ World
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ pushd $( dirname " $0 " )
3+ DIR=$( pwd)
4+ RUNBOX=" ${DIR} /runbox"
5+
6+ echo $RUNBOX
7+ # Create runbox
8+ mkdir -p $RUNBOX
9+
10+ # Copy source to runbox
11+ cp $DIR /program.go $RUNBOX /program.go
12+ cp $DIR /run.stdin $RUNBOX /run.stdin
13+
14+ # Test Compile
15+ docker run \
16+ --cpus=" 1" \
17+ --memory=" 100m" \
18+ --ulimit nofile=64:64 \
19+ --rm \
20+ --read-only \
21+ -v " $RUNBOX " :/usr/src/runbox \
22+ -v " $RUNBOX " :/tmp \
23+ -w /usr/src/runbox codingblocks/judge-worker-golang \
24+ bash -c " /bin/compile.sh && /bin/run.sh"
25+
26+ ls -lh ${RUNBOX}
27+
28+ expected=" Hello World"
29+ actual=" $( cat ${RUNBOX} /run.stdout) "
30+ if [ " $expected " == " $actual " ] ; then
31+ :
32+ else
33+ echo " MISMATCH: Expected = $expected ; Actual = $actual "
34+ exit 1
35+ fi
36+
37+ # Delete runbox
38+ rm -rf $RUNBOX
You can’t perform that action at this time.
0 commit comments