OJ沙盒的使用

参考项目

沙盒 设置绝对路径

  • 默认文件存储在内存里,使用 -dir 指定本地目录为文件存储
1
./sandbox  -dir "./temp"

测试 python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
    "cmd": [
        {
            "args": [
                "/usr/bin/python3",
                "1.py"
            ],
            "env": [
                "PATH=/usr/bin:/bin"
            ],
            "files": [
                {
                    "content": ""
                },
                {
                    "name": "stdout",
                    "max": 10240
                },
                {
                    "name": "stderr",
                    "max": 10240
                }
            ],
            "cpuLimit": 3000000000,
            "clockLimit": 4000000000,
            "memoryLimit": 104857600,
            "procLimit": 50,
            "cpuRate": 0.1,
            "copyIn": {
                "1.py": {
                    "content": "print('4444aaaaaa')"
                }
            },
            "copyOut": [
                "stdout?",
                "stderr?"
            ],
           "copyOutCached": ["1.py?", "stdout?"]
            
        }
    ]
}