diff --git a/resource/runner/framework/template/default/c.Makefile b/resource/runner/framework/template/default/c.Makefile index 25be642..f5b407c 100644 --- a/resource/runner/framework/template/default/c.Makefile +++ b/resource/runner/framework/template/default/c.Makefile @@ -4,4 +4,4 @@ compile: @$(CC) $(CFLAGS) -o $(PREFIX)/user/$(USER_PROG).out $(PREFIX)/user/$(USER_PROG).$(LANG) judge: - $($(CMP)) $(PREFIX)/data/input/$(TEST_NUM).input $(PREFIX)/user/$(TEST_NUM).out.usr $(PREFIX)/data/output/$(TEST_NUM).output $(PREFIX)/user/$(TEST_NUM).judge -appes + $($(CMP)) $(PREFIX)/problem/data/input/$(TEST_NUM).input $(PREFIX)/user/$(TEST_NUM).out.usr $(PREFIX)/problem/data/output/$(TEST_NUM).output $(PREFIX)/user/$(TEST_NUM).judge -appes diff --git a/resource/runner/framework/template/default/cpp.Makefile b/resource/runner/framework/template/default/cpp.Makefile index ea648d2..5f51cda 100644 --- a/resource/runner/framework/template/default/cpp.Makefile +++ b/resource/runner/framework/template/default/cpp.Makefile @@ -4,4 +4,4 @@ compile: @$(CXX) $(CFLAGS) -o $(PREFIX)/user/$(USER_PROG).out $(PREFIX)/user/$(USER_PROG).$(LANG) judge: - $($(CMP)) $(PREFIX)/data/input/$(TEST_NUM).input $(PREFIX)/user/$(TEST_NUM).out.usr $(PREFIX)/data/output/$(TEST_NUM).output $(PREFIX)/user/$(TEST_NUM).judge -appes + $($(CMP)) $(PREFIX)/problem/data/input/$(TEST_NUM).input $(PREFIX)/user/$(TEST_NUM).out.usr $(PREFIX)/problem/data/output/$(TEST_NUM).output $(PREFIX)/user/$(TEST_NUM).judge -appes diff --git a/resource/runner/framework/template/default/go.Makefile b/resource/runner/framework/template/default/go.Makefile index 1a10bff..4eb0b9e 100644 --- a/resource/runner/framework/template/default/go.Makefile +++ b/resource/runner/framework/template/default/go.Makefile @@ -4,4 +4,4 @@ compile: @$(GO) build $(GO_BUILD_FLAGS) -o $(PREFIX)/user/$(USER_PROG).out $(PREFIX)/user/$(USER_PROG).$(LANG) judge: - $($(CMP)) $(PREFIX)/data/input/$(TEST_NUM).input $(PREFIX)/user/$(TEST_NUM).out.usr $(PREFIX)/data/output/$(TEST_NUM).output $(PREFIX)/user/$(TEST_NUM).judge -appes + $($(CMP)) $(PREFIX)/problem/data/input/$(TEST_NUM).input $(PREFIX)/user/$(TEST_NUM).out.usr $(PREFIX)/problem/data/output/$(TEST_NUM).output $(PREFIX)/user/$(TEST_NUM).judge -appes diff --git a/resource/runner/problem/example/judge/XYZ.Makefile b/resource/runner/problem/example/judge/XYZ.Makefile index 6fcde11..665e359 100644 --- a/resource/runner/problem/example/judge/XYZ.Makefile +++ b/resource/runner/problem/example/judge/XYZ.Makefile @@ -6,9 +6,8 @@ include ${TEMPLATE}/c.mk ${TEMPLATE}/Judger.mk # 详细信息见 XYZ.Makefile # 2. compile: 用于编译用户提交的程序 # 目录映射情况: -# /woj/problem -# ├── judge 映射到题目目录的 ./judge <-- Readonly -# └── user 映射到题目目录的 ./user <-- 用户提交的程序在这里,命名:$(USER_PROG).$(LANG) +# /woj/problem/judge 映射到题目目录的 ./judge <-- Readonly +# /woj/user 映射到题目目录的 ./user <-- 用户提交的程序在这里,命名:$(USER_PROG).$(LANG) # 环境变量: # USER_PROG=... <-- 一段随机字符串 # LANG=... <-- 用户提交的程序的语言,如 c, cpp @@ -18,15 +17,15 @@ include ${TEMPLATE}/c.mk ${TEMPLATE}/Judger.mk # 3. run: 运行用户程序 # 只有 ./data/input/*.input 和 ./user/$(USER_PROG).out 可见 # 用户输出存放于 ./user/?.out.usr -# 使用 woj-sandbox 运行,等效于 $(PREFIX)/user/$(USER_PROG).out < $(PREFIX)/data/input/$(TEST_NUM).input > $(PREFIX)/user/$(TEST_NUM).out.usr +# 使用 woj-sandbox 运行,等效于 $(PREFIX)/user/$(USER_PROG).out < $(PREFIX)/problem/data/input/$(TEST_NUM).input > $(PREFIX)/user/$(TEST_NUM).out.usr # 4. judge: 用于判定输出结果 环境变量 TEST_NUM 表示当前测试点编号,每个测试点都会执行一次 # 目录映射情况: # /woj/problem # ├── data 映射到题目目录的 ./data <-- Readonly -# ├── judge 映射到题目目录的 ./judge <-- Readonly -# └── user -# ├── $(TEST_NUM).out.usr <-- 用户程序在 $(TEST_NUM) 上的输出 -# └── $(TEST_NUM).judge <-- 评测结果写在这里,格式要求为 testlib 的 XML 格式 +# └── judge 映射到题目目录的 ./judge <-- Readonly +# /woj/user +# ├── $(TEST_NUM).out.usr <-- 用户程序在 $(TEST_NUM) 上的输出 +# └── $(TEST_NUM).judge <-- 评测结果写在这里,格式要求为 testlib 的 XML 格式 # 环境变量: # TEST_NUM=... <-- 当前测试点编号 # CMP=... <-- 在 config.json 中配置的比较器,如 NCMP @@ -35,11 +34,11 @@ include ${TEMPLATE}/c.mk ${TEMPLATE}/Judger.mk # 目前版本硬编码限制:时间 60s,内存 256mb compile: - $(CC) $(CFLAGS) -o $(PREFIX)/user/$(USER_PROG).out $(PREFIX)/user/$(USER_PROG).$(LANG) $(PREFIX)/judge/gadget.c + $(CC) $(CFLAGS) -o $(PREFIX)/user/$(USER_PROG).out $(PREFIX)/user/$(USER_PROG).$(LANG) $(PREFIX)/problem/judge/gadget.c judge: # !! Rename on *.out.usr or *.judge is not allowed !! # 自定义评测方式 sed '/gadgets/d' $(PREFIX)/user/$(TEST_NUM).out.usr >$(PREFIX)/user/$(TEST_NUM).out.usr1 # 评测结果要求符合 testlib 的格式 -> $(TEST_NUM).judge - $(NCMP) $(PREFIX)/data/input/$(TEST_NUM).input $(PREFIX)/user/$(TEST_NUM).out.usr1 $(PREFIX)/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 diff --git a/resource/runner/problem/example/judge/prebuild.Makefile b/resource/runner/problem/example/judge/prebuild.Makefile index b10e235..aa3fbc5 100644 --- a/resource/runner/problem/example/judge/prebuild.Makefile +++ b/resource/runner/problem/example/judge/prebuild.Makefile @@ -8,20 +8,20 @@ include ${TEMPLATE}/c.mk ${TEMPLATE}/Judger.mk # ├── data 映射到题目目录的 ./data # └── judge 映射到题目目录的 ./judge # 环境变量: -# PREFIX=/woj/problem +# PREFIX=/woj # 其余通用环境变量,详见 ubuntu-full.Dockerfile # 执行限制: # 目前版本硬编码限制:时间 300s,内存 1g prebuild: # 生成测试数据生成工具 - clang++ -I$(TESTLIB) -Ofast -o $(PREFIX)/judge/gen.out $(PREFIX)/judge/gen.cpp + clang++ -I$(TESTLIB) -Ofast -o $(PREFIX)/problem/judge/gen.out $(PREFIX)/problem/judge/gen.cpp # 生成 2,4 号测试数据 - @if [ ! -f $(PREFIX)/data/input/2.input ]; then \ - $(PREFIX)/judge/gen.out > $(PREFIX)/data/input/2.input; \ - python3 -c "print(sum(map(int, input().split())))" < $(PREFIX)/data/input/2.input > $(PREFIX)/data/output/2.output; \ + @if [ ! -f $(PREFIX)/problem/data/input/2.input ]; then \ + $(PREFIX)/problem/judge/gen.out > $(PREFIX)/problem/data/input/2.input; \ + python3 -c "print(sum(map(int, input().split())))" < $(PREFIX)/problem/data/input/2.input > $(PREFIX)/problem/data/output/2.output; \ fi - @if [ ! -f $(PREFIX)/data/input/4.input ]; then \ - $(PREFIX)/judge/gen.out > $(PREFIX)/data/input/4.input; \ - python3 -c "print(sum(map(int, input().split())))" < $(PREFIX)/data/input/4.input > $(PREFIX)/data/output/4.output; \ + @if [ ! -f $(PREFIX)/problem/data/input/4.input ]; then \ + $(PREFIX)/problem/judge/gen.out > $(PREFIX)/problem/data/input/4.input; \ + python3 -c "print(sum(map(int, input().split())))" < $(PREFIX)/problem/data/input/4.input > $(PREFIX)/problem/data/output/4.output; \ fi diff --git a/resource/runner/scripts/ubuntu-full.Dockerfile b/resource/runner/scripts/ubuntu-full.Dockerfile index ad7f3cd..980c278 100644 --- a/resource/runner/scripts/ubuntu-full.Dockerfile +++ b/resource/runner/scripts/ubuntu-full.Dockerfile @@ -18,5 +18,5 @@ ENV WOJ_LAUNCHER=/woj/framework/scripts/woj_launcher ENV WOJ_SANDBOX=/woj/framework/scripts/libwoj_sandbox.so ENV TEMPLATE=/woj/framework/template ENV TESTLIB=/woj/framework/template/testlib -ENV PREFIX=/woj/problem +ENV PREFIX=/woj