Compare commits
No commits in common. "fca3fc678c97d2b0bdecdfac8627eeffeaec7076" and "05b3d948c2ec864a314ec771465a161f6311dc44" have entirely different histories.
fca3fc678c
...
05b3d948c2
2
.github/workflows/container.yml
vendored
2
.github/workflows/container.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
~/.local/share/containers
|
~/.local/share/containers
|
||||||
~/.config/containers
|
~/.config/containers
|
||||||
key: ${{ runner.os }}-${{ hashFiles('**/*.Dockerfile', 'build_image.sh', 'VERSION') }}
|
key: ${{ runner.os }}
|
||||||
- name: Login to Container Registry
|
- name: Login to Container Registry
|
||||||
uses: redhat-actions/podman-login@v1
|
uses: redhat-actions/podman-login@v1
|
||||||
with:
|
with:
|
||||||
|
@ -68,11 +68,6 @@ func (s *service) Compile(meta *JudgeMeta) (*JudgeStatus, e.Status) {
|
|||||||
Destination: "/woj/problem/judge",
|
Destination: "/woj/problem/judge",
|
||||||
Readonly: true,
|
Readonly: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
// Rust will write intermediate files into source directory instead of /tmp
|
|
||||||
Source: "",
|
|
||||||
Destination: "/woj/user",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Source: sourceFile,
|
Source: sourceFile,
|
||||||
Destination: fmt.Sprintf("/woj/user/%s.%s", meta.Run.User, meta.Run.Lang),
|
Destination: fmt.Sprintf("/woj/user/%s.%s", meta.Run.User, meta.Run.Lang),
|
||||||
@ -114,5 +109,5 @@ func (s *service) Compile(meta *JudgeMeta) (*JudgeStatus, e.Status) {
|
|||||||
// 5. grant permission
|
// 5. grant permission
|
||||||
_ = os.Chmod(targetFile, 0755)
|
_ = os.Chmod(targetFile, 0755)
|
||||||
|
|
||||||
return &JudgeStatus{CompileMessage: msgText}, status
|
return &JudgeStatus{CompileMessage: msgText}, e.Success
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,7 @@ type MountInfo struct {
|
|||||||
|
|
||||||
func (m *MountInfo) Args() []string {
|
func (m *MountInfo) Args() []string {
|
||||||
mapping := m.Source + ":" + m.Destination
|
mapping := m.Source + ":" + m.Destination
|
||||||
if m.Source == "" {
|
if m.Readonly {
|
||||||
// 64MB tmpfs
|
|
||||||
return []string{"-m", "none:" + m.Destination + ":tmpfs:size=67108864"}
|
|
||||||
} else if m.Readonly {
|
|
||||||
return []string{"-R", mapping}
|
return []string{"-R", mapping}
|
||||||
} else {
|
} else {
|
||||||
return []string{"-B", mapping}
|
return []string{"-B", mapping}
|
||||||
@ -115,9 +112,8 @@ func (s *service) JailRun(arg *RunArgs) (RuntimeStatus, error) {
|
|||||||
args := []string{
|
args := []string{
|
||||||
"--quiet",
|
"--quiet",
|
||||||
"--use_cgroupv2",
|
"--use_cgroupv2",
|
||||||
"--disable_rlimits", // Rust requires this
|
"-T", "/tmp",
|
||||||
"-m", "none:/tmp:tmpfs:size=67108864", // 64MB tmpfs
|
"-E", "PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin",
|
||||||
"-E", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
||||||
// following envs must sync with resource/runner
|
// following envs must sync with resource/runner
|
||||||
"-E", "WOJ_LAUNCHER=/woj/framework/scripts/woj_launcher",
|
"-E", "WOJ_LAUNCHER=/woj/framework/scripts/woj_launcher",
|
||||||
"-E", "TEMPLATE=/woj/framework/template",
|
"-E", "TEMPLATE=/woj/framework/template",
|
||||||
|
1
resource/runner/framework/rootfs/.gitignore
vendored
1
resource/runner/framework/rootfs/.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
/full
|
/full
|
||||||
/run
|
/run
|
||||||
*.tar
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
GO=/usr/bin/go
|
GO=/usr/local/go/bin/go
|
||||||
GO_BUILD_FLAGS=-trimpath
|
GO_BUILD_FLAGS=-trimpath
|
@ -1 +0,0 @@
|
|||||||
NODEJS=/usr/bin/node
|
|
@ -1,2 +1,2 @@
|
|||||||
RUSTC = /usr/bin/rustc
|
RUSTC = /root/.cargo/bin/rustc
|
||||||
RUSTFLAGS = -C opt-level=2 -W warnings
|
RUSTFLAGS = -C opt-level=2 -W warnings
|
@ -27,7 +27,7 @@
|
|||||||
"Lang" : "pypy3",
|
"Lang" : "pypy3",
|
||||||
"Judge" : {"Type": "default", "Script": "", "Cmp": "NCMP"},
|
"Judge" : {"Type": "default", "Script": "", "Cmp": "NCMP"},
|
||||||
"Runtime": {
|
"Runtime": {
|
||||||
"Run": {"TimeLimit": 1000, "MemoryLimit": 70, "NProcLimit": 1}
|
"Run": {"TimeLimit": 1000, "MemoryLimit": 80, "NProcLimit": 1}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -31,13 +31,11 @@ include ${TEMPLATE}/c.mk ${TEMPLATE}/Judger.mk
|
|||||||
# 其余通用环境变量,详见 nsjail.go
|
# 其余通用环境变量,详见 nsjail.go
|
||||||
|
|
||||||
compile:
|
compile:
|
||||||
# /woj/user 目录当且仅当 compile 阶段为 RW
|
|
||||||
$(CC) $(CFLAGS) -o $(PREFIX)/user/$(USER_PROG).out $(PREFIX)/user/$(USER_PROG).$(LANG) $(PREFIX)/problem/judge/gadget.c
|
$(CC) $(CFLAGS) -o $(PREFIX)/user/$(USER_PROG).out $(PREFIX)/user/$(USER_PROG).$(LANG) $(PREFIX)/problem/judge/gadget.c
|
||||||
|
|
||||||
judge:
|
judge:
|
||||||
# !! Rename on *.out.usr or *.judge is not allowed !!
|
# !! Rename on *.out.usr or *.judge is not allowed !!
|
||||||
# 自定义评测方式
|
# 自定义评测方式
|
||||||
# 特别注意:整个文件系统为 readonly filesystem,临时文件只能放在 /tmp 下
|
sed '/gadgets/d' $(PREFIX)/user/$(TEST_NUM).out.usr >$(PREFIX)/user/$(TEST_NUM).out.usr1
|
||||||
sed '/gadgets/d' $(PREFIX)/user/$(TEST_NUM).out.usr > /tmp/$(TEST_NUM).out.usr1
|
|
||||||
# 评测结果要求符合 testlib 的格式 -> $(TEST_NUM).judge
|
# 评测结果要求符合 testlib 的格式 -> $(TEST_NUM).judge
|
||||||
$(NCMP) $(PREFIX)/problem/data/input/$(TEST_NUM).input /tmp/$(TEST_NUM).out.usr1 $(PREFIX)/problem/data/output/$(TEST_NUM).output $(PREFIX)/user/$(TEST_NUM).judge -appes
|
$(NCMP) $(PREFIX)/problem/data/input/$(TEST_NUM).input $(PREFIX)/user/$(TEST_NUM).out.usr1 $(PREFIX)/problem/data/output/$(TEST_NUM).output $(PREFIX)/user/$(TEST_NUM).judge -appes
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#include<stdio.h>
|
|
||||||
int main() {
|
|
||||||
long long a, b;
|
|
||||||
scanf("%lld%lld", &a, &b);
|
|
||||||
printf("%lld\n", a + b);
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
#include<bits/stdc++.h>
|
|
||||||
using namespace std;
|
|
||||||
int main() {
|
|
||||||
long long a, b;
|
|
||||||
cin >> a >> b;
|
|
||||||
cout << a + b << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
print(sum(map(int, input().strip().split())))
|
|
@ -1,15 +0,0 @@
|
|||||||
use std::io;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let mut input = String::new();
|
|
||||||
io::stdin().read_line(&mut input).unwrap();
|
|
||||||
|
|
||||||
let nums: Vec<i32> = input
|
|
||||||
.trim()
|
|
||||||
.split_whitespace()
|
|
||||||
.map(|num| num.parse().unwrap())
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let sum = nums[0] + nums[1];
|
|
||||||
println!("{}", sum);
|
|
||||||
}
|
|
@ -1,15 +1,20 @@
|
|||||||
FROM docker.io/library/debian:bookworm-slim
|
FROM docker.io/library/debian:bookworm-slim
|
||||||
WORKDIR /woj
|
WORKDIR /woj
|
||||||
|
|
||||||
# RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list.d/debian.sources
|
# Install dependencies & languages: c/cpp/python3/pypy3
|
||||||
|
RUN apt-get update && apt-get upgrade -y && apt-get install -y software-properties-common \
|
||||||
# Install dependencies & languages: c/cpp/python3/pypy3/go/rust/nodejs
|
|
||||||
RUN apt-get update && apt-get upgrade -y \
|
|
||||||
&& apt-get install -y \
|
&& apt-get install -y \
|
||||||
git parallel wget curl \
|
git parallel wget curl \
|
||||||
autoconf bison cmake flex gperf libnl-route-3-dev libprotobuf-dev libtool m4 make pkg-config protobuf-compiler \
|
autoconf bison cmake flex gperf libnl-route-3-dev libprotobuf-dev libtool m4 make pkg-config protobuf-compiler \
|
||||||
gcc g++ clang python3 pypy3 golang-go rustc nodejs \
|
gcc g++ clang \
|
||||||
|
python3 pypy3 \
|
||||||
&& apt-get clean && rm -rf /var/lib/apt/lists
|
&& apt-get clean && rm -rf /var/lib/apt/lists
|
||||||
|
# Install golang
|
||||||
|
RUN wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz && rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz && rm go1.22.1.linux-amd64.tar.gz
|
||||||
|
# Install Rust
|
||||||
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
|
# Setup PATH
|
||||||
|
ENV PATH=/usr/local/go/bin:/root/.cargo/bin:$PATH
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
RUN mkdir -p /woj/framework && mkdir -p /woj/problem
|
RUN mkdir -p /woj/framework && mkdir -p /woj/problem
|
||||||
|
Loading…
Reference in New Issue
Block a user