diff --git a/.travis.yml b/.travis.yml index 2f435c5..9d76004 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,4 @@ install: - cmake .. && make && sudo make install - cd ../bindings/Python && sudo python setup.py install script: - - cd ../../tests && sudo python test.py \ No newline at end of file + - cd ../../tests/Python_and_core && sudo python test.py diff --git a/runtest.sh b/runtest.sh new file mode 100755 index 0000000..93885b0 --- /dev/null +++ b/runtest.sh @@ -0,0 +1,3 @@ +rm -rf build && mkdir build && cd build && cmake .. && make && make install +cd ../bindings/Python && rm -rf build && python setup.py install || exit 1 +cd ../../tests/Python_and_core && python test.py diff --git a/tests/__init__.py b/tests/Python_and_core/__init__.py similarity index 100% rename from tests/__init__.py rename to tests/Python_and_core/__init__.py diff --git a/tests/test.py b/tests/Python_and_core/test.py similarity index 100% rename from tests/test.py rename to tests/Python_and_core/test.py diff --git a/tests/testcase/__init__.py b/tests/Python_and_core/testcase/__init__.py similarity index 100% rename from tests/testcase/__init__.py rename to tests/Python_and_core/testcase/__init__.py diff --git a/tests/testcase/base.py b/tests/Python_and_core/testcase/base.py similarity index 100% rename from tests/testcase/base.py rename to tests/Python_and_core/testcase/base.py diff --git a/tests/testcase/integration/__init__.py b/tests/Python_and_core/testcase/integration/__init__.py similarity index 100% rename from tests/testcase/integration/__init__.py rename to tests/Python_and_core/testcase/integration/__init__.py diff --git a/tests/testcase/integration/test.py b/tests/Python_and_core/testcase/integration/test.py similarity index 97% rename from tests/testcase/integration/test.py rename to tests/Python_and_core/testcase/integration/test.py index ac7a660..7e76c72 100644 --- a/tests/testcase/integration/test.py +++ b/tests/Python_and_core/testcase/integration/test.py @@ -27,7 +27,7 @@ class IntegrationTest(base.BaseTestCase): self.workspace = self.init_workspace("integration") def _compile_c(self, src_name, extra_flags=None): - return super(IntegrationTest, self)._compile_c("integration/" + src_name, extra_flags) + return super(IntegrationTest, self)._compile_c("../../test_src/integration/" + src_name, extra_flags) def _compile_cpp(self, src_name): return super(IntegrationTest, self)._compile_cpp("integration/" + src_name) @@ -254,7 +254,7 @@ class IntegrationTest(base.BaseTestCase): def test_gcc_random(self): config = self.config config["exe_path"] = "/usr/bin/gcc" - config["args"] = [os.path.join(os.path.dirname(os.path.abspath(__file__)), "gcc_random.c"), + config["args"] = ["../test_src/integration/gcc_random.c", "-o", os.path.join(self.workspace, "gcc_random")] result = _judger.run(**config) self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED) @@ -265,7 +265,7 @@ class IntegrationTest(base.BaseTestCase): config = self.config config["exe_path"] = "/usr/bin/g++" config["max_memory"] = 1024 * 1024 * 1024 - config["args"] = [os.path.join(os.path.dirname(os.path.abspath(__file__)), "cpp_meta.cpp"), + config["args"] = ["../test_src/integration/cpp_meta.cpp", "-o", os.path.join(self.workspace, "cpp_meta")] result = _judger.run(**config) self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED) diff --git a/tests/testcase/seccomp/__init__.py b/tests/Python_and_core/testcase/seccomp/__init__.py similarity index 100% rename from tests/testcase/seccomp/__init__.py rename to tests/Python_and_core/testcase/seccomp/__init__.py diff --git a/tests/testcase/seccomp/test.py b/tests/Python_and_core/testcase/seccomp/test.py similarity index 97% rename from tests/testcase/seccomp/test.py rename to tests/Python_and_core/testcase/seccomp/test.py index 503188e..ffb74d5 100644 --- a/tests/testcase/seccomp/test.py +++ b/tests/Python_and_core/testcase/seccomp/test.py @@ -27,7 +27,7 @@ class SeccompTest(base.BaseTestCase): self.workspace = self.init_workspace("integration") def _compile_c(self, src_name, extra_flags=None): - return super(SeccompTest, self)._compile_c("seccomp/" + src_name, extra_flags) + return super(SeccompTest, self)._compile_c("../../test_src/seccomp/" + src_name, extra_flags) def test_fork(self): config = self.config diff --git a/tests/testcase/integration/args.c b/tests/test_src/integration/args.c similarity index 100% rename from tests/testcase/integration/args.c rename to tests/test_src/integration/args.c diff --git a/tests/testcase/integration/child_proc_cpu_time_limit.c b/tests/test_src/integration/child_proc_cpu_time_limit.c similarity index 100% rename from tests/testcase/integration/child_proc_cpu_time_limit.c rename to tests/test_src/integration/child_proc_cpu_time_limit.c diff --git a/tests/testcase/integration/child_proc_real_time_limit.c b/tests/test_src/integration/child_proc_real_time_limit.c similarity index 100% rename from tests/testcase/integration/child_proc_real_time_limit.c rename to tests/test_src/integration/child_proc_real_time_limit.c diff --git a/tests/testcase/integration/cpp_meta.cpp b/tests/test_src/integration/cpp_meta.cpp similarity index 100% rename from tests/testcase/integration/cpp_meta.cpp rename to tests/test_src/integration/cpp_meta.cpp diff --git a/tests/testcase/integration/env.c b/tests/test_src/integration/env.c similarity index 100% rename from tests/testcase/integration/env.c rename to tests/test_src/integration/env.c diff --git a/tests/testcase/integration/gcc_random.c b/tests/test_src/integration/gcc_random.c similarity index 100% rename from tests/testcase/integration/gcc_random.c rename to tests/test_src/integration/gcc_random.c diff --git a/tests/testcase/integration/math.c b/tests/test_src/integration/math.c similarity index 100% rename from tests/testcase/integration/math.c rename to tests/test_src/integration/math.c diff --git a/tests/testcase/integration/memory1.c b/tests/test_src/integration/memory1.c similarity index 100% rename from tests/testcase/integration/memory1.c rename to tests/test_src/integration/memory1.c diff --git a/tests/testcase/integration/memory2.c b/tests/test_src/integration/memory2.c similarity index 100% rename from tests/testcase/integration/memory2.c rename to tests/test_src/integration/memory2.c diff --git a/tests/testcase/integration/memory3.c b/tests/test_src/integration/memory3.c similarity index 100% rename from tests/testcase/integration/memory3.c rename to tests/test_src/integration/memory3.c diff --git a/tests/testcase/integration/normal.c b/tests/test_src/integration/normal.c similarity index 100% rename from tests/testcase/integration/normal.c rename to tests/test_src/integration/normal.c diff --git a/tests/testcase/integration/output_size.c b/tests/test_src/integration/output_size.c similarity index 100% rename from tests/testcase/integration/output_size.c rename to tests/test_src/integration/output_size.c diff --git a/tests/testcase/integration/re1.c b/tests/test_src/integration/re1.c similarity index 100% rename from tests/testcase/integration/re1.c rename to tests/test_src/integration/re1.c diff --git a/tests/testcase/integration/re2.c b/tests/test_src/integration/re2.c similarity index 100% rename from tests/testcase/integration/re2.c rename to tests/test_src/integration/re2.c diff --git a/tests/testcase/integration/sleep.c b/tests/test_src/integration/sleep.c similarity index 100% rename from tests/testcase/integration/sleep.c rename to tests/test_src/integration/sleep.c diff --git a/tests/testcase/integration/stdout_stderr.c b/tests/test_src/integration/stdout_stderr.c similarity index 100% rename from tests/testcase/integration/stdout_stderr.c rename to tests/test_src/integration/stdout_stderr.c diff --git a/tests/testcase/integration/uid_gid.c b/tests/test_src/integration/uid_gid.c similarity index 100% rename from tests/testcase/integration/uid_gid.c rename to tests/test_src/integration/uid_gid.c diff --git a/tests/testcase/integration/while1.c b/tests/test_src/integration/while1.c similarity index 100% rename from tests/testcase/integration/while1.c rename to tests/test_src/integration/while1.c diff --git a/tests/testcase/seccomp/execve.c b/tests/test_src/seccomp/execve.c similarity index 100% rename from tests/testcase/seccomp/execve.c rename to tests/test_src/seccomp/execve.c diff --git a/tests/testcase/seccomp/fork.c b/tests/test_src/seccomp/fork.c similarity index 100% rename from tests/testcase/seccomp/fork.c rename to tests/test_src/seccomp/fork.c diff --git a/tests/testcase/seccomp/write_file.c b/tests/test_src/seccomp/write_file.c similarity index 100% rename from tests/testcase/seccomp/write_file.c rename to tests/test_src/seccomp/write_file.c