add env test

This commit is contained in:
virusdefender 2016-01-24 10:00:40 +08:00
parent baa924ec52
commit 92d1f7fb61
6 changed files with 17 additions and 1 deletions

8
tests/9/Main.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
printf("%s\n%s\n", getenv("hello"), getenv("123"));
return 0;
}

1
tests/9/config Normal file
View File

@ -0,0 +1 @@
{"language": "c", "max_cpu_time": 2000, "max_memory": 200000000, "env": ["hello=world", "123=456"]}

0
tests/9/in Normal file
View File

2
tests/9/out Normal file
View File

@ -0,0 +1,2 @@
world
456

1
tests/9/result Normal file
View File

@ -0,0 +1 @@
{"flag": 0, "signal": 0}

View File

@ -23,7 +23,11 @@ class JudgerTest(TestCase):
def test_run(self):
shutil.rmtree(self.tmp_path, ignore_errors=True)
os.mkdir(self.tmp_path)
for i in range(1, 9):
for i in os.listdir("."):
try:
int(i)
except Exception:
continue
test_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), str(i))
exe_path = os.path.join("/tmp/judger_test", str(i))
config = json.loads(open(os.path.join(test_dir, "config")).read())