feat(runner): compile Go and check answers per test group

This commit is contained in:
shira committed 2026-10-11 08:59:29 +03:00
1 parent e95c681165
commit afee564bf4
61 files changed
+2592 -143

No files matched your search

+38 -3
View File
@@ -168,9 +168,10 @@ RunRequest:
$ref: '#/TestGroup'
RunLanguage:
type: string
description: Language and runtime of the source. `python3` runs the Python 3 interpreter of the runner image with isolated mode and no bytecode writes; a syntax check runs first and fails with compile_error.
description: Language and runtime of the source. `python3` runs the Python 3 interpreter of the runner image with isolated mode and no bytecode writes; a syntax check runs first and fails with compile_error. `go` compiles one `package main` file with the Go toolchain of the runner image against a prebuilt standard library (no modules, no cgo, no network) in a separate compile phase with its own limits; a compile or link error is compile_error and no test runs.
enum:
- python3
- go
RunLimits:
type: object
description: Limits applied to every test of the run.
@@ -234,21 +235,55 @@ TestVisibility:
- hidden
Checker:
type: object
description: How the standard output of a test is compared with `expected_output`. Future kinds, such as a float tolerance or a custom checker, add a `kind` value and their own optional parameters to this object.
description: How the standard output of a test is compared with `expected_output`. `numbers` requires `abs_tolerance`, `rel_tolerance`, or both; `custom` requires `program`. Other kinds take no parameter. New kinds add a `kind` value and their own optional parameters.
additionalProperties: false
required:
- kind
properties:
kind:
$ref: '#/CheckerKind'
abs_tolerance:
type: number
format: double
minimum: 0
maximum: 1000000000
description: Largest accepted absolute difference of two numeric tokens.
rel_tolerance:
type: number
format: double
minimum: 0
maximum: 1
description: Largest accepted difference of two numeric tokens relative to the expected value.
program:
$ref: '#/CheckerProgram'
CheckerProgram:
type: object
description: 'Checker program of the task family. It runs in the sandbox with the same isolation as the solution and fixed limits of its own (5 s CPU, 256 MiB). Its arguments are the paths of three read-only files: the test input, the expected output, and the actual output. Exit status 0 accepts, 1 rejects, and anything else, a signal, or a limit is a checker failure, which makes the run infrastructure_failure. Its own output is discarded and never returned.'
additionalProperties: false
required:
- language
- source
properties:
language:
$ref: '#/RunLanguage'
source:
type: string
minLength: 1
maxLength: 65536
CheckerKind:
type: string
description: '- exact: both texts are equal after replacing CRLF with LF, removing trailing spaces and tabs at the end of each line, and removing trailing empty lines.
- tokens: both texts split on ASCII whitespace give the same sequence of tokens.'
- tokens: both texts split on ASCII whitespace give the same sequence of tokens.
- numbers: like tokens, but two finite numeric tokens are equal when their difference is within abs_tolerance or within rel_tolerance times the expected value; other tokens must be equal.
- custom: the checker program of the task family decides in the sandbox.'
enum:
- exact
- tokens
- numbers
- custom
TestCase:
type: object
additionalProperties: false
+50 -3
View File
@@ -37,9 +37,14 @@ schemas:
description: >-
Language and runtime of the source. `python3` runs the Python 3
interpreter of the runner image with isolated mode and no bytecode
writes; a syntax check runs first and fails with compile_error.
writes; a syntax check runs first and fails with compile_error. `go`
compiles one `package main` file with the Go toolchain of the runner
image against a prebuilt standard library (no modules, no cgo, no
network) in a separate compile phase with its own limits; a compile
or link error is compile_error and no test runs.
enum:
- python3
- go
RunLimits:
type: object
description: Limits applied to every test of the run.
@@ -120,22 +125,64 @@ schemas:
type: object
description: >-
How the standard output of a test is compared with `expected_output`.
Future kinds, such as a float tolerance or a custom checker, add a
`kind` value and their own optional parameters to this object.
`numbers` requires `abs_tolerance`, `rel_tolerance`, or both; `custom`
requires `program`. Other kinds take no parameter. New kinds add a
`kind` value and their own optional parameters.
additionalProperties: false
required:
- kind
properties:
kind:
$ref: "#/schemas/CheckerKind"
abs_tolerance:
type: number
format: double
minimum: 0
maximum: 1000000000
description: Largest accepted absolute difference of two numeric tokens.
rel_tolerance:
type: number
format: double
minimum: 0
maximum: 1
description: >-
Largest accepted difference of two numeric tokens relative to the
expected value.
program:
$ref: "#/schemas/CheckerProgram"
CheckerProgram:
type: object
description: >-
Checker program of the task family. It runs in the sandbox with the
same isolation as the solution and fixed limits of its own (5 s CPU,
256 MiB). Its arguments are the paths of three read-only files: the
test input, the expected output, and the actual output. Exit status 0
accepts, 1 rejects, and anything else, a signal, or a limit is a
checker failure, which makes the run infrastructure_failure. Its own
output is discarded and never returned.
additionalProperties: false
required:
- language
- source
properties:
language:
$ref: "#/schemas/RunLanguage"
source:
type: string
minLength: 1
maxLength: 65536
CheckerKind:
type: string
description: |-
- exact: both texts are equal after replacing CRLF with LF, removing trailing spaces and tabs at the end of each line, and removing trailing empty lines.
- tokens: both texts split on ASCII whitespace give the same sequence of tokens.
- numbers: like tokens, but two finite numeric tokens are equal when their difference is within abs_tolerance or within rel_tolerance times the expected value; other tokens must be equal.
- custom: the checker program of the task family decides in the sandbox.
enum:
- exact
- tokens
- numbers
- custom
TestCase:
type: object
additionalProperties: false
+39 -4
View File
@@ -93,8 +93,10 @@ paths:
Requests above the configured body limit (8 MiB by default) answer 413
`payload_too_large`. Semantic rules that the schema cannot express answer
400 `validation_failed`: group IDs are unique in a run, test IDs are
unique in a group, and the number of tests multiplied by
`limits.time_limit_ms` does not exceed 300000.
unique in a group, the number of tests multiplied by
`limits.time_limit_ms` does not exceed 300000, a `numbers` checker has a
positive tolerance, a `custom` checker has a program, and no other kind
carries tolerances or a program.
tags:
- runs
requestBody:
@@ -518,9 +520,10 @@ components:
$ref: '#/components/schemas/RunResult'
RunLanguage:
type: string
description: Language and runtime of the source. `python3` runs the Python 3 interpreter of the runner image with isolated mode and no bytecode writes; a syntax check runs first and fails with compile_error.
description: Language and runtime of the source. `python3` runs the Python 3 interpreter of the runner image with isolated mode and no bytecode writes; a syntax check runs first and fails with compile_error. `go` compiles one `package main` file with the Go toolchain of the runner image against a prebuilt standard library (no modules, no cgo, no network) in a separate compile phase with its own limits; a compile or link error is compile_error and no test runs.
enum:
- python3
- go
RunLimits:
type: object
description: Limits applied to every test of the run.
@@ -553,18 +556,50 @@ components:
description: |-
- exact: both texts are equal after replacing CRLF with LF, removing trailing spaces and tabs at the end of each line, and removing trailing empty lines.
- tokens: both texts split on ASCII whitespace give the same sequence of tokens.
- numbers: like tokens, but two finite numeric tokens are equal when their difference is within abs_tolerance or within rel_tolerance times the expected value; other tokens must be equal.
- custom: the checker program of the task family decides in the sandbox.
enum:
- exact
- tokens
- numbers
- custom
CheckerProgram:
type: object
description: 'Checker program of the task family. It runs in the sandbox with the same isolation as the solution and fixed limits of its own (5 s CPU, 256 MiB). Its arguments are the paths of three read-only files: the test input, the expected output, and the actual output. Exit status 0 accepts, 1 rejects, and anything else, a signal, or a limit is a checker failure, which makes the run infrastructure_failure. Its own output is discarded and never returned.'
additionalProperties: false
required:
- language
- source
properties:
language:
$ref: '#/components/schemas/RunLanguage'
source:
type: string
minLength: 1
maxLength: 65536
Checker:
type: object
description: How the standard output of a test is compared with `expected_output`. Future kinds, such as a float tolerance or a custom checker, add a `kind` value and their own optional parameters to this object.
description: How the standard output of a test is compared with `expected_output`. `numbers` requires `abs_tolerance`, `rel_tolerance`, or both; `custom` requires `program`. Other kinds take no parameter. New kinds add a `kind` value and their own optional parameters.
additionalProperties: false
required:
- kind
properties:
kind:
$ref: '#/components/schemas/CheckerKind'
abs_tolerance:
type: number
format: double
minimum: 0
maximum: 1000000000
description: Largest accepted absolute difference of two numeric tokens.
rel_tolerance:
type: number
format: double
minimum: 0
maximum: 1
description: Largest accepted difference of two numeric tokens relative to the expected value.
program:
$ref: '#/components/schemas/CheckerProgram'
TestCase:
type: object
additionalProperties: false
+4 -2
View File
@@ -26,8 +26,10 @@ put:
Requests above the configured body limit (8 MiB by default) answer 413
`payload_too_large`. Semantic rules that the schema cannot express answer
400 `validation_failed`: group IDs are unique in a run, test IDs are
unique in a group, and the number of tests multiplied by
`limits.time_limit_ms` does not exceed 300000.
unique in a group, the number of tests multiplied by
`limits.time_limit_ms` does not exceed 300000, a `numbers` checker has a
positive tolerance, a `custom` checker has a program, and no other kind
carries tolerances or a program.
tags:
- runs
requestBody: