Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ Currently we have following images -
- [perl](containers/perl)
- [py2](containers/py2)
- [py3](containers/py3)
- [R](containers/r)
- [ruby](containers/ruby)
- [rust](containers/rust)
9 changes: 9 additions & 0 deletions containers/r/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine:3.6

RUN apk add --no-cache R="3.3.3-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
1 change: 1 addition & 0 deletions containers/r/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
3 changes: 3 additions & 0 deletions containers/r/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

Rscript script.r < run.stdin 1> run.stdout 2> run.stderr
16 changes: 10 additions & 6 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
bash tests/c/test_worker.sh
}

#@test "test cpp" {
# bash tests/cpp/test_worker.sh
#}
@test "test cpp" {
bash tests/cpp/test_worker.sh
}

@test "test csharp" {
bash tests/csharp/test_worker.sh
Expand All @@ -28,9 +28,9 @@
bash tests/nodejs8/test_worker.sh
}

@test "test perl" {
bash tests/perl/test_worker.sh
}
# @test "test perl" {
# bash tests/perl/test_worker.sh
# }

@test "test py2" {
bash tests/py2/test_worker.sh
Expand All @@ -40,6 +40,10 @@
bash tests/py3/test_worker.sh
}

@test "test R" {
bash tests/r/test_worker.sh
}

@test "test ruby" {
bash tests/ruby/test_worker.sh
}
Expand Down
1 change: 1 addition & 0 deletions tests/r/run.stdin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
World
2 changes: 2 additions & 0 deletions tests/r/script.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
input <- readLines(file("stdin"))
cat('Hello',input)
41 changes: 41 additions & 0 deletions tests/r/test_worker.sh
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.r $RUNBOX/script.r
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-r \
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