From 50da8734d52f1f9c4b00310e49cd54f37a672d03 Mon Sep 17 00:00:00 2001 From: LiYang Date: Tue, 11 Jul 2017 12:36:02 +0800 Subject: [PATCH] add demo --- demo/1.in | 1 + demo/demo.py | 27 +++++++++++++++++++++++++++ demo/main.c | 8 ++++++++ 3 files changed, 36 insertions(+) create mode 100644 demo/1.in create mode 100644 demo/demo.py create mode 100644 demo/main.c diff --git a/demo/1.in b/demo/1.in new file mode 100644 index 0000000..216e97c --- /dev/null +++ b/demo/1.in @@ -0,0 +1 @@ +World diff --git a/demo/demo.py b/demo/demo.py new file mode 100644 index 0000000..c5f0684 --- /dev/null +++ b/demo/demo.py @@ -0,0 +1,27 @@ +import _judger +import os + +if os.system("gcc main.c -o main"): + print("compile error") + exit(1) + +ret = _judger.run(max_cpu_time=1000, + max_real_time=2000, + max_memory=128 * 1024 * 1024, + max_process_number=200, + max_output_size=10000, + max_stack=32 * 1024 * 1024, + # five args above can be _judger.UNLIMITED + exe_path="main", + input_path="1.in", + output_path="/dev/stdout", + error_path="/dev/stderr", + args=[], + # can be empty list + env=[], + log_path="judger.log", + # can be None + seccomp_rule_name="c_cpp", + uid=0, + gid=0) +print(ret) diff --git a/demo/main.c b/demo/main.c new file mode 100644 index 0000000..14bff03 --- /dev/null +++ b/demo/main.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) { + char input[1000]; + scanf("%s", input); + printf("Hello %s\n", input); + return 0; +} \ No newline at end of file