mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-29 00:11:41 +00:00
add support for writev sys call
This commit is contained in:
parent
817275e13d
commit
3f60f3bb00
@ -32,6 +32,9 @@ int c_cpp_seccomp_rules(struct config *_config) {
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(write), 1, SCMP_A0(SCMP_CMP_LE, 2)) != 0) {
|
||||
return LOAD_SECCOMP_FAILED;
|
||||
}
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(writev), 1, SCMP_A0(SCMP_CMP_LE, 2)) != 0) {
|
||||
return LOAD_SECCOMP_FAILED;
|
||||
}
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(lseek), 1, SCMP_A0(SCMP_CMP_LE, 2)) != 0) {
|
||||
return LOAD_SECCOMP_FAILED;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class IntegrationTest(base.BaseTestCase):
|
||||
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)
|
||||
return super(IntegrationTest, self)._compile_cpp("../../test_src/integration/" + src_name)
|
||||
|
||||
def test_args_validation(self):
|
||||
with self.assertRaisesRegexp(ValueError, "Invalid args and kwargs"):
|
||||
@ -314,4 +314,14 @@ class IntegrationTest(base.BaseTestCase):
|
||||
config["max_stack"] = 128 * 1024 * 1024
|
||||
result = _judger.run(**config)
|
||||
self.assertEqual(result["result"], _judger.RESULT_SUCCESS)
|
||||
self.assertEqual("big stack", self.output_content(config["output_path"]))
|
||||
self.assertEqual("big stack", self.output_content(config["output_path"]))
|
||||
|
||||
def test_writev(self):
|
||||
config = self.config
|
||||
config["exe_path"] = self._compile_cpp("writev.cpp")
|
||||
config["seccomp_rule_name"] = "c_cpp"
|
||||
config["input_path"] = self.make_input("111" * 10000 + "\n")
|
||||
config["output_path"] = config["error_path"] = self.output_path()
|
||||
|
||||
result = _judger.run(**config)
|
||||
self.assertEqual(result["result"], _judger.RESULT_SUCCESS)
|
14
tests/test_src/integration/writev.cpp
Normal file
14
tests/test_src/integration/writev.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
ios::sync_with_stdio(false);
|
||||
string s;
|
||||
cin >> s;
|
||||
cout << s;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user