-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift support #20
base: master
Are you sure you want to change the base?
Swift support #20
Changes from all commits
3ae489c
32f8196
19345c8
c87c2fc
1f21bcf
f4faae3
8abcb4a
b45db98
943dbea
3aee16f
1856918
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM swiftdocker/swift:latest | ||
|
||
COPY ./compile.sh /bin/compile.sh | ||
COPY ./run.sh /bin/run.sh | ||
|
||
RUN chmod 777 /bin/compile.sh; \ | ||
chmod 777 /bin/run.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#!/usr/bin/env bash |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
chmod 777 script.swift | ||
swift script.swift < run.stdin 1> run.stdout 2> run.stderr |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
World |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Foundation | ||
|
||
if let input = readLine(){ print("Hello \(input)") } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
pushd $(dirname "$0") | ||
DIR=$(pwd) | ||
RUNBOX="${DIR}/runbox" | ||
|
||
echo $RUNBOX | ||
# Create runbox | ||
mkdir -p $RUNBOX | ||
|
||
# Copy source to runbox | ||
cp -fv $DIR/script.swift $RUNBOX/script.swift | ||
cp -fv $DIR/run.stdin $RUNBOX/run.stdin | ||
|
||
# Test Compile | ||
docker run \ | ||
--cpus="1" \ | ||
--memory="100m" \ | ||
--ulimit nofile=64:64 \ | ||
--rm \ | ||
--read-only \ | ||
-v "$RUNBOX":/usr/src/runbox \ | ||
-v "$RUNBOX":/tmp \ | ||
-w /usr/src/runbox codingblocks/judge-worker-swift \ | ||
bash -c "/bin/compile.sh && /bin/run.sh" | ||
|
||
ls -lh ${RUNBOX} | ||
|
||
expected="Hello World" | ||
actual="$(cat ${RUNBOX}/run.stdout)" | ||
if [ "$expected" == "$actual" ] ;then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how is it coming out to be "Hello World" when according to your source code it should be "HelloWorld" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @championswimmer fixed this, updated |
||
: | ||
else | ||
echo "MISMATCH: Expected = $expected; Actual = $actual" | ||
exit 1 | ||
fi | ||
|
||
# Delete runbox | ||
sudo rm -rf $RUNBOX | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Travis fails with 'No permission to rm runbox'. Hence sudo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. strange. how does it work for every other worker ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @championswimmer Here is the error. Perhaps it has something to do with the permissions granted from where we are pulling our docker image? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Local tests and travis passing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used https://github.com/swiftdocker/docker-swift for the docker image.