Skip to content

Commit

Permalink
Fix various files
Browse files Browse the repository at this point in the history
  • Loading branch information
MasloMaslane committed Aug 22, 2024
1 parent 41e5225 commit 72f7cc0
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 20 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ they lack some built-in mechanisms for verifying packages and finding mistakes
before uploading the package to the judge system.
As sinol-make was created specifically for the sio2 problem packages,
by default it downloads and uses sio2's deterministic mechanism of measuring
solutions' runtime, called `oiejq`.
solutions' runtime, called `sio2jail`.

### Installation

Expand All @@ -43,7 +43,7 @@ pip3 install sinol-make
so make sure this directory is in your `PATH`.
[Here's](https://gist.github.com/nex3/c395b2f8fd4b02068be37c961301caa7) how to add a directory to `PATH`.

As `oiejq` works only on Linux-based operating systems,
As `sio2jail` works only on Linux-based operating systems,
*we do not recommend* using operating systems such as Windows or macOS.
Nevertheless `sinol-make` supports those operating systems,
though there are additional installation steps required to use
Expand All @@ -67,8 +67,8 @@ activate-global-python-argcomplete
The available commands (see `sinol-make --help`) are:

- `sinol-make run` -- Runs selected solutions (by default all solutions) on selected tests (by default all tests) with a given number
of CPUs. Measures the solutions' time with oiejq, unless specified otherwise. After running the solutions, it
compares the solutions' scores with the ones saved in config.yml. If you're using oiejq, make sure you are not running on efficiency
of CPUs. Measures the solutions' time with sio2jail, unless specified otherwise. After running the solutions, it
compares the solutions' scores with the ones saved in config.yml. If you're using sio2jail, make sure you are not running on efficiency
cpu cores. You can check if you have them [like this](https://stackoverflow.com/a/71282744). To run on normal cpu cores, use
`taskset -c 8-15 sinol-make ...`, assuming that cpu cores 8-15 are not efficiency cores.
Run `sinol-make run --help` to see available flags.
Expand Down Expand Up @@ -113,15 +113,15 @@ There are also available short aliases for the commands:
the contest type with the `sinol_contest_type` key in config. Here is the table of available contest types and their
features:

| Feature | `default` | `oi` | `oij` | `icpc` |
|-----------------------------------------------------------------------------------------------------|-----------|-------|-------|--------|
| Max score | 100 | 100 | 100 | 1 |
| Default time tool | oiejq | oiejq | oiejq | time |
| Full score if took less than half of the time limit, <br/>otherwise linearly decreasing to 1. || ✔️ |||
| Full score if took less than the time limit | ✔️ || ✔️ | ✔️ |
| Scores must sum up to 100 || ✔️ | ✔️ ||
| Limits can be set for individual tests | ✔️ || ✔️ | ✔️ |
| Verifies if tests are named correctly<br/> (letters within groups increase, group numbers increase) || ✔️ | ✔️ | ✔️ |
| Feature | `default` | `oi` | `oij` | `icpc` |
|-----------------------------------------------------------------------------------------------------|-----------|----------|----------|--------|
| Max score | 100 | 100 | 100 | 1 |
| Default time tool | sio2jail | sio2jail | sio2jail | time |
| Full score if took less than half of the time limit, <br/>otherwise linearly decreasing to 1. || ✔️ | ||
| Full score if took less than the time limit | ✔️ | | ✔️ | ✔️ |
| Scores must sum up to 100 || ✔️ | ✔️ ||
| Limits can be set for individual tests | ✔️ | | ✔️ | ✔️ |
| Verifies if tests are named correctly<br/> (letters within groups increase, group numbers increase) || ✔️ | ✔️ | ✔️ |

### Reporting bugs and contributing code

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ testpaths =
tests
markers =
github_runner: Mark tests that require GitHub runner
oiejq: Mark tests that require working oiejq
sio2jail: Mark tests that require working sio2jail
4 changes: 3 additions & 1 deletion src/sinol_make/executors/sio2jail.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ def _execute(self, command: List[str], time_limit: int, hard_time_limit: int, me
result_file_path: str, executable: str, execution_dir: str, stdin: int, stdout: int,
stderr: Union[None, int], fds_to_close: Union[None, List[int]],
*args, **kwargs) -> Tuple[bool, bool, int, List[str]]:
env = os.environ.copy()
env['UNDER_SIO2JAIL'] = 1
with open(result_file_path, "w") as result_file:
process = subprocess.Popen(' '.join(command), *args, shell=True, stdin=stdin, stdout=stdout,
process = subprocess.Popen(' '.join(command), *args, shell=True, stdin=stdin, stdout=stdout, env=env,
stderr=result_file, preexec_fn=os.setpgrp, cwd=execution_dir, **kwargs)
if fds_to_close is not None:
for fd in fds_to_close:
Expand Down
2 changes: 1 addition & 1 deletion tests/packages/lim/prog/lim2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void s2j_wait(long long instructions) {
}

int wait(int secs) {
if (getenv("UNDER_OIEJQ") != NULL) {
if (getenv("UNDER_SIO2JAIL") != NULL) {
s2j_wait((long long)secs * 2'000'000'000);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/packages/ovl/prog/ovl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void s2j_wait(long long instructions) {
}

int wait(int secs) {
if (getenv("UNDER_OIEJQ") != NULL) {
if (getenv("UNDER_SIO2JAIL") != NULL) {
s2j_wait((long long)secs * 2'000'000'000);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/packages/vso/prog/vso4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void s2j_wait(long long instructions) {
}

int wait(int secs) {
if (getenv("UNDER_OIEJQ") != NULL) {
if (getenv("UNDER_SIO2JAIL") != NULL) {
s2j_wait((long long)secs * 2'000'000'000);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/packages/vso/prog/vso7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void s2j_wait(long long instructions) {
}

int wait(int secs) {
if (getenv("UNDER_OIEJQ") != NULL) {
if (getenv("UNDER_SIO2JAIL") != NULL) {
s2j_wait((long long)secs * 2'000'000'000);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sio2jail.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_perf_counters_set():
@pytest.mark.github_runner
def test_updating():
"""
Test updating oiejq
Test updating sio2jail
"""
if sys.platform != 'linux':
return
Expand Down

0 comments on commit 72f7cc0

Please sign in to comment.