Browse Source

Adapt for new version of sandbox-rootfs

master
Menci 6 years ago
parent
commit
f72e215504
  1. 2
      src/languages/cpp.ts
  2. 47
      src/languages/cpp17.ts
  3. 2
      src/languages/java.ts
  4. 2
      src/languages/ocaml.ts
  5. 6
      src/languages/python2.ts
  6. 6
      src/languages/python3.ts

2
src/languages/cpp.ts

@ -10,7 +10,7 @@ export const lang = {
// write a shell script or some other stuff,
// and put it to your sandbox.
executable: "/usr/bin/g++",
parameters: ["g++", sourcePath, "-o", `${outputDirectory}/a.out`, "-O2", "-fdiagnostics-color=always", "-DONLINE_JUDGE", "-mx32"],
parameters: ["g++", sourcePath, "-o", `${outputDirectory}/a.out`, "-std=c++03", "-O2", "-fdiagnostics-color=always", "-DONLINE_JUDGE", "-mx32"],
time: 5000,
memory: 1024 * 1024 * 1024,
process: 10,

47
src/languages/cpp17.ts

@ -0,0 +1,47 @@
export const lang = {
name: "cpp17",
sourceFileName: "a.cpp",
fileExtension: "cpp",
binarySizeLimit: 5000 * 1024,
// Note that these two paths are in the sandboxed environment.
compile: (sourcePath, outputDirectory) => ({
// To customize the compilation process,
// write a shell script or some other stuff,
// and put it to your sandbox.
executable: "/usr/bin/g++",
parameters: ["g++", sourcePath, "-o", `${outputDirectory}/a.out`, "-std=c++17", "-O2", "-fdiagnostics-color=always", "-DONLINE_JUDGE", "-mx32"],
time: 5000,
memory: 1024 * 1024 * 1024,
process: 10,
// This is just a redirection. You can simply ignore this
// if you can specify custom location for message output
// in the parameter of the compiler, or have redirected the compilation
// message to somewhere.
// An example will be available soon.
stderr: `${outputDirectory}/message.txt`,
// We will read this file for message in the output directory.
messageFile: 'message.txt',
workingDirectory: outputDirectory
}),
run: (binaryDirectory: string,
workingDirectory: string,
time: number,
memory: number,
stdinFile = null,
stdoutFile = null,
stderrFile = null
) => ({
executable: `${binaryDirectory}/a.out`,
parameters: [],
time: time,
memory: memory,
stackSize: memory,
process: 1,
stdin: stdinFile,
stdout: stdoutFile,
stderr: stderrFile,
workingDirectory: workingDirectory
})
};

2
src/languages/java.ts

@ -37,7 +37,7 @@ export const lang = {
parameters: ["run"],
time: time,
memory: memory,
process: 15,
process: 25,
stdin: stdinFile,
stdout: stdoutFile,
stderr: stderrFile,

2
src/languages/ocaml.ts

@ -13,7 +13,7 @@ export const lang = {
parameters: ["compile-ocaml", sourcePath, outputDirectory],
time: 5000,
memory: 1024 * 1024 * 1024,
process: 10,
process: 20,
// This is just a redirection. You can simply ignore this
// if you can specify custom location for message output
// in the parameter of the compiler, or have redirected the compilation

6
src/languages/python2.ts

@ -10,7 +10,7 @@ export const lang = {
// write a shell script or some other stuff,
// and put it to your sandbox.
executable: "/usr/bin/compile-script",
parameters: ["compile-script", sourcePath, outputDirectory, "python2 -m py_compile a.py"],
parameters: ["compile-script", sourcePath, outputDirectory, "pypy -m py_compile a.py"],
time: 5000,
memory: 1024 * 1024 * 1024,
process: 10,
@ -33,8 +33,8 @@ export const lang = {
stdoutFile = null,
stderrFile = null
) => ({
executable: "/usr/bin/python2",
parameters: ["python2", `${binaryDirectory}/a.py`],
executable: "/usr/bin/pypy",
parameters: ["pypy", `${binaryDirectory}/a.py`],
time: time,
memory: memory,
process: 1,

6
src/languages/python3.ts

@ -10,7 +10,7 @@ export const lang = {
// write a shell script or some other stuff,
// and put it to your sandbox.
executable: "/usr/bin/compile-script",
parameters: ["compile-script", sourcePath, outputDirectory, "python3 -m py_compile a.py"],
parameters: ["compile-script", sourcePath, outputDirectory, "pypy3 -m py_compile a.py"],
time: 5000,
memory: 1024 * 1024 * 1024,
process: 10,
@ -33,8 +33,8 @@ export const lang = {
stdoutFile = null,
stderrFile = null
) => ({
executable: "/usr/bin/python3",
parameters: ["python3", `${binaryDirectory}/a.py`],
executable: "/usr/bin/pypy3",
parameters: ["pypy3", `${binaryDirectory}/a.py`],
time: time,
memory: memory,
process: 1,

Loading…
Cancel
Save