mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-29 16:31:42 +00:00
重构测试结构
This commit is contained in:
parent
278dbe44f8
commit
db099f584c
@ -10,4 +10,4 @@ install:
|
|||||||
- cmake .. && make && sudo make install
|
- cmake .. && make && sudo make install
|
||||||
- cd ../bindings/Python && sudo python setup.py install
|
- cd ../bindings/Python && sudo python setup.py install
|
||||||
script:
|
script:
|
||||||
- cd ../../tests && sudo python test.py
|
- cd ../../tests/Python_and_core && sudo python test.py
|
||||||
|
3
runtest.sh
Executable file
3
runtest.sh
Executable file
@ -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
|
@ -27,7 +27,7 @@ class IntegrationTest(base.BaseTestCase):
|
|||||||
self.workspace = self.init_workspace("integration")
|
self.workspace = self.init_workspace("integration")
|
||||||
|
|
||||||
def _compile_c(self, src_name, extra_flags=None):
|
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):
|
def _compile_cpp(self, src_name):
|
||||||
return super(IntegrationTest, self)._compile_cpp("integration/" + src_name)
|
return super(IntegrationTest, self)._compile_cpp("integration/" + src_name)
|
||||||
@ -254,7 +254,7 @@ class IntegrationTest(base.BaseTestCase):
|
|||||||
def test_gcc_random(self):
|
def test_gcc_random(self):
|
||||||
config = self.config
|
config = self.config
|
||||||
config["exe_path"] = "/usr/bin/gcc"
|
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")]
|
"-o", os.path.join(self.workspace, "gcc_random")]
|
||||||
result = _judger.run(**config)
|
result = _judger.run(**config)
|
||||||
self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED)
|
self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED)
|
||||||
@ -265,7 +265,7 @@ class IntegrationTest(base.BaseTestCase):
|
|||||||
config = self.config
|
config = self.config
|
||||||
config["exe_path"] = "/usr/bin/g++"
|
config["exe_path"] = "/usr/bin/g++"
|
||||||
config["max_memory"] = 1024 * 1024 * 1024
|
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")]
|
"-o", os.path.join(self.workspace, "cpp_meta")]
|
||||||
result = _judger.run(**config)
|
result = _judger.run(**config)
|
||||||
self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED)
|
self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED)
|
@ -27,7 +27,7 @@ class SeccompTest(base.BaseTestCase):
|
|||||||
self.workspace = self.init_workspace("integration")
|
self.workspace = self.init_workspace("integration")
|
||||||
|
|
||||||
def _compile_c(self, src_name, extra_flags=None):
|
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):
|
def test_fork(self):
|
||||||
config = self.config
|
config = self.config
|
Loading…
Reference in New Issue
Block a user