File tree Expand file tree Collapse file tree 7 files changed +61
-3
lines changed Expand file tree Collapse file tree 7 files changed +61
-3
lines changed Original file line number Diff line number Diff line change 1+ FROM swiftdocker/swift:latest
2+
3+ COPY ./compile.sh /bin/compile.sh
4+ COPY ./run.sh /bin/run.sh
5+
6+ RUN chmod 777 /bin/compile.sh; \
7+ 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 script.swift
4+ swift script.swift < run.stdin 1> run.stdout 2> run.stderr
Original file line number Diff line number Diff line change 44 bash tests/c/test_worker.sh
55}
66
7- # @test "test cpp" {
8- # bash tests/cpp/test_worker.sh
9- # }
7+ @test " test cpp" {
8+ bash tests/cpp/test_worker.sh
9+ }
1010
1111@test " test csharp" {
1212 bash tests/csharp/test_worker.sh
3636 bash tests/ruby/test_worker.sh
3737}
3838
39+ @test " test swift" {
40+ bash tests/swift/test_worker.sh
41+ }
Original file line number Diff line number Diff line change 1+ World
Original file line number Diff line number Diff line change 1+ import Foundation
2+
3+ let input = readLine ( )
4+ if let input = input { print ( " Hello " , input) }
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 -fv $DIR /script.swift $RUNBOX /script.swift
12+ cp -fv $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-swift \
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+ sudo rm -rf $RUNBOX
You can’t perform that action at this time.
0 commit comments