Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
VibhorCodecianGupta
authored and
VibhorCodecianGupta
committed
Aug 2, 2018
1 parent
8286ae7
commit 4aa5813
Showing
14 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM alpine:3.6 | ||
|
||
RUN apk add --no-cache perl="5.24.4-r0" bash | ||
|
||
COPY ./compile.sh /bin/compile.sh | ||
COPY ./run.sh /bin/run.sh | ||
|
||
RUN chmod 777 /bin/compile.sh; \ | ||
chmod 777 /bin/run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#!/usr/bin/env bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
perl script.pl < run.stdin 1> run.stdout 2> run.stderr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM alpine:3.6 | ||
|
||
RUN apk add --no-cache musl-dev bash rust="1.17.0-r2" | ||
|
||
COPY ./compile.sh /bin/compile.sh | ||
COPY ./run.sh /bin/run.sh | ||
|
||
RUN chmod 777 /bin/compile.sh; \ | ||
chmod 777 /bin/run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
rustc script.rs 2> compile.stderr 1> compile.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
chmod 777 script.rs | ||
./script < run.stdin 1> run.stdout 2> run.stderr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,7 @@ | |
@test "test ruby" { | ||
bash tests/ruby/test_worker.sh | ||
} | ||
|
||
@test "test rust" { | ||
bash tests/rust/test_worker.sh | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
World |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$input = <STDIN>; | ||
print "Hello ${input}"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
pushd $(dirname "$0") | ||
DIR=$(pwd) | ||
RUNBOX="${DIR}/runbox" | ||
|
||
echo $RUNBOX | ||
# Remove RUNBOX | ||
rm -rf $RUNBOX | ||
|
||
# Create runbox | ||
mkdir -p $RUNBOX | ||
|
||
# Copy source to runbox | ||
cp -fv $DIR/script.pl $RUNBOX/script.pl | ||
cp -fv $DIR/run.stdin $RUNBOX/run.stdin | ||
|
||
# Test Compile | ||
docker run \ | ||
--cpus="0.5" \ | ||
--memory="20m" \ | ||
--ulimit nofile=64:64 \ | ||
--rm \ | ||
--read-only \ | ||
-v "$RUNBOX":/usr/src/runbox \ | ||
-v "$RUNBOX":/tmp \ | ||
-w /usr/src/runbox codingblocks/judge-worker-perl \ | ||
bash -c "/bin/compile.sh && /bin/run.sh" | ||
|
||
ls -lh ${RUNBOX} | ||
|
||
expected="Hello World" | ||
actual="$(cat ${RUNBOX}/run.stdout)" | ||
if [ "$expected" == "$actual" ] ;then | ||
: | ||
else | ||
echo "MISMATCH: Expected = $expected; Actual = $actual" | ||
exit 1 | ||
fi | ||
|
||
# Delete runbox | ||
rm -rf $RUNBOX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
World |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use std::io; | ||
|
||
fn main() { | ||
let mut input = String::new(); | ||
|
||
io::stdin().read_line(&mut input) | ||
.ok() | ||
.expect("Couldn't read line"); | ||
|
||
println!("Hello {}", input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
pushd $(dirname "$0") | ||
DIR=$(pwd) | ||
RUNBOX="${DIR}/runbox" | ||
|
||
echo $RUNBOX | ||
# Remove RUNBOX | ||
rm -rf $RUNBOX | ||
|
||
# Create runbox | ||
mkdir -p $RUNBOX | ||
|
||
# Copy source to runbox | ||
cp $DIR/script.rs $RUNBOX/script.rs | ||
cp $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-rust \ | ||
bash -c "/bin/compile.sh && /bin/run.sh" | ||
|
||
ls -lh ${RUNBOX} | ||
|
||
expected="Hello World" | ||
actual="$(cat ${RUNBOX}/run.stdout)" | ||
if [ "$expected" == "$actual" ] ;then | ||
: | ||
else | ||
echo "MISMATCH: Expected = $expected; Actual = $actual" | ||
exit 1 | ||
fi | ||
|
||
# Delete runbox | ||
rm -rf $RUNBOX |