From 25cde31d9e97fd5d45c58b9330f033694a86d181 Mon Sep 17 00:00:00 2001 From: evouga Date: Tue, 17 Sep 2024 01:37:20 -0500 Subject: [PATCH 1/3] Require POSIX shell and Python interpreter Clarify use of build and run scripts Harmonize working directory requirements --- spec/2023-07-draft.md | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/spec/2023-07-draft.md b/spec/2023-07-draft.md index 55c5b0c..5c21523 100644 --- a/spec/2023-07-draft.md +++ b/spec/2023-07-draft.md @@ -82,7 +82,9 @@ In the case that a program is a single file, it is treated as if a directory wit The name of the program, for the purpose of referring to it within the package, is the base name of the file or the name of the directory. There can't be two programs of the same kind with the same name. -#### Submissions +#### Languages and Compilation + +##### Submissions The language of a submission program is determined by the `language` key in `submissions.yaml` if present; otherwise, by comparing the file extensions of the submission file(s) to those specified in the [languages table](../appendix/languages.md). @@ -92,10 +94,7 @@ If a single language can't be determined, building fails. For languages where there could be several entry points, the entry point specified by the `entrypoint` key in `submissions.yaml` is used if present; otherwise, the default entry point in the [languages table](../appendix/languages.md) is used. -Each submission must be run with a working directory that contains (a copy of) the submitted files, any compiled binaries and compilation byproducts, as well as any [included files](#included-files), and nothing else. -In particular the working directory must not contain any of the [test data](#test-data) files. - -#### Other Programs +##### Other Programs Other programs (validators and visualizers) provided as a directory may include one of two POSIX-compliant shell scripts, `build` and `run`. If at least one of these two files is included: @@ -105,19 +104,25 @@ If at least one of these two files is included: 2. Then, the `run` file (which now exists, and is an executable binary or POSIX-compliant shell script) will be used as the validator or visualizer program. -Scripts may assume that a C and C++ compiler are available on the system search path, aliased to `cc` and `cpp` respectively. +Scripts may assume a POSIX-compliant shell and that a Python 3 interpreter, C compiler, and C++ compiler are available on the system search path, aliased to `python`, `cc`, and `cpp` respectively. Contest systems may provide additional libraries or tools. Problem packages with `build` or `run` scripts are strongly encouraged to include a `README` file in the program directory documenting any such additional dependencies. Programs that do not include a `build` or `run` script must have one of the following forms: -- a single Python 3 file. -- a directory containing multiple Python 3 source files, two of which are `__init__.py`, (defining a module), and `__main__.py` (which will be used as the program entry point). +- a single Python 3 file; +- a directory containing multiple Python 3 source files, two of which are `__init__.py` (defining a module) and `__main__.py` (which will be used as the program entry point); - a single C or C++ source file, or a directory containing one or more such files. The language of files is inferred from their extension as listed in the [languages table](../appendix/languages.md). -Each input validator must be run with a working directory that contains the files in the program directory of the input validator in question. +#### Working Directory + +Each program must be run in a working directory with the following contents and **nothing else**: + +- For input validators: the files in the program directory of the input validator in question. +- For submissions, ouput validators, output visualizers, and static validators: the submitted files, any compiled binaries of the submitted files and compilation byproducts, as well as any [included files](#included-files). -Each output validator, output visualizer, and static validator must be run with a working directory that contains the submitted files and any compiled binaries of the submission being validated. -(Note in particular that this working directory does **not** contain the files in the program directory of the output validator, output visualizer or static validator.) +Please note that in particular: +- the working directory for submissions **must not** contain any of the [test data](#test-data) files; +- except for input validators, the files in a program's directory are not included in the working directory. ## Problem Metadata From eceec92f65684002414ef3fb69c8a09fb8974cb4 Mon Sep 17 00:00:00 2001 From: evouga Date: Fri, 20 Sep 2024 20:00:40 -0500 Subject: [PATCH 2/3] Update spec/2023-07-draft.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Niemelä --- spec/2023-07-draft.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/2023-07-draft.md b/spec/2023-07-draft.md index 5c21523..2c85b9a 100644 --- a/spec/2023-07-draft.md +++ b/spec/2023-07-draft.md @@ -104,7 +104,9 @@ If at least one of these two files is included: 2. Then, the `run` file (which now exists, and is an executable binary or POSIX-compliant shell script) will be used as the validator or visualizer program. -Scripts may assume a POSIX-compliant shell and that a Python 3 interpreter, C compiler, and C++ compiler are available on the system search path, aliased to `python`, `cc`, and `cpp` respectively. Contest systems may provide additional libraries or tools. Problem packages with `build` or `run` scripts are strongly encouraged to include a `README` file in the program directory documenting any such additional dependencies. +Scripts may assume a POSIX-compliant shell and that a Python 3 interpreter, C compiler, and C++ compiler are available on the system search path, aliased to `python3`, `cc`, and `cpp` respectively. +Contest systems may provide additional libraries or tools. +Problem packages with `build` or `run` scripts are strongly encouraged to include a `README` file in the program directory documenting any such additional dependencies. Programs that do not include a `build` or `run` script must have one of the following forms: - a single Python 3 file; From 1a2b409ba96165d15b47882d3c61cea2ba6f6745 Mon Sep 17 00:00:00 2001 From: evouga Date: Fri, 20 Sep 2024 20:22:14 -0500 Subject: [PATCH 3/3] Incorporate .files --- spec/2023-07-draft.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/2023-07-draft.md b/spec/2023-07-draft.md index 72dd645..ffcdd12 100644 --- a/spec/2023-07-draft.md +++ b/spec/2023-07-draft.md @@ -118,10 +118,11 @@ The language of files is inferred from their extension as listed in the [languag Each program must be run in a working directory with the following contents and **nothing else**: - For input validators: the files in the program directory of the input validator in question. -- For submissions, ouput validators, output visualizers, and static validators: the submitted files, any compiled binaries of the submitted files and compilation byproducts, as well as any [included files](#included-files). +- For submissions: the submitted files, any compiled binaries of the submitted files, any [included files](#included-files), and the contents of the `.files` directory of the test case being tested (if this directory exists). +- For ouput validators, output visualizers, and static validators: the submitted files, any compiled binaries of the submitted files, as well as any included files. Please note that in particular: -- the working directory for submissions **must not** contain any of the [test data](#test-data) files; +- the working directory for submissions **must not** contain any of the [test data](#test-data) files, except for the contents of the test case `.files` directory; - except for input validators, the files in a program's directory are not included in the working directory. ## Problem Metadata