mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-29 00:11:41 +00:00
use docker to run tests
This commit is contained in:
parent
d4e15b7c35
commit
b6414e7a67
24
.travis.yml
24
.travis.yml
@ -1,17 +1,11 @@
|
|||||||
language: python
|
|
||||||
dist: trusty
|
|
||||||
python:
|
|
||||||
- "2.7"
|
|
||||||
- "3.5"
|
|
||||||
sudo: required
|
sudo: required
|
||||||
before_install:
|
|
||||||
- sudo apt-get -qq update
|
services:
|
||||||
- sudo apt-get install libseccomp-dev cmake
|
- docker
|
||||||
install:
|
|
||||||
- mkdir build && cd build
|
|
||||||
- cmake .. && make && sudo make install
|
|
||||||
- cd ../bindings/Python && sudo `which python` setup.py install
|
|
||||||
script:
|
script:
|
||||||
- cd ../../tests/Python_and_core && sudo `which python` test.py
|
- docker build -t judger-test -f tests/Dockerfile-16.04 .
|
||||||
notifications:
|
- docker run -it --rm -v $PWD:/src judger-test /bin/bash -c "chmod +x tests/runtest.sh && ./tests/runtest.sh"
|
||||||
slack: onlinejudgeteam:BzBz8UFgmS5crpiblof17K2W
|
|
||||||
|
- docker build -t judger-test -f tests/Dockerfile-18.04 .
|
||||||
|
- docker run -it --rm -v $PWD:/src judger-test /bin/bash -c "chmod +x tests/runtest.sh && ./tests/runtest.sh"
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
rm -rf build && mkdir build && cd build && cmake ..
|
|
||||||
make || exit 1
|
|
||||||
make install
|
|
||||||
cd ../bindings/Python && rm -rf build
|
|
||||||
python setup.py install || exit 1
|
|
||||||
cd ../../tests/Python_and_core && python test.py
|
|
@ -37,6 +37,9 @@ int c_cpp_seccomp_rules(struct config *_config) {
|
|||||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(open), 1, SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0)) != 0) {
|
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(open), 1, SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0)) != 0) {
|
||||||
return LOAD_SECCOMP_FAILED;
|
return LOAD_SECCOMP_FAILED;
|
||||||
}
|
}
|
||||||
|
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(openat), 1, SCMP_CMP(2, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0)) != 0) {
|
||||||
|
return LOAD_SECCOMP_FAILED;
|
||||||
|
}
|
||||||
if (seccomp_load(ctx) != 0) {
|
if (seccomp_load(ctx) != 0) {
|
||||||
return LOAD_SECCOMP_FAILED;
|
return LOAD_SECCOMP_FAILED;
|
||||||
}
|
}
|
||||||
|
3
tests/Dockerfile-16.04
Normal file
3
tests/Dockerfile-16.04
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM ubuntu:16.04
|
||||||
|
RUN apt-get update && apt-get install -y cmake python python3 libseccomp-dev gcc g++
|
||||||
|
WORKDIR /src
|
3
tests/Dockerfile-18.04
Normal file
3
tests/Dockerfile-18.04
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM ubuntu:18.04
|
||||||
|
RUN apt-get update && apt-get install -y cmake python python3 python3-pip libseccomp-dev gcc g++ strace && pip3 install setuptools --upgrade
|
||||||
|
WORKDIR /src
|
16
tests/runtest.sh
Executable file
16
tests/runtest.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
set -ex
|
||||||
|
dir=$PWD
|
||||||
|
python -V
|
||||||
|
gcc -v
|
||||||
|
g++ -v
|
||||||
|
|
||||||
|
for py in python2 python3; do
|
||||||
|
cd $dir
|
||||||
|
rm -rf build && mkdir build && cd build && cmake ..
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
cd ../bindings/Python && rm -rf build
|
||||||
|
$py setup.py install
|
||||||
|
cd ../../tests/Python_and_core && $py test.py
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user