Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions configs/client-config-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Address: # Enter address to run client.

MasterConnection:
Address: # Address on which the testing system is started.

StorageConnection:
Address: # Address on which the testing system is started.

DB:
Dsn: # Use your postgres dsn to connect to database.

ResourcesPath: # Path of folder "clients/resources" in testing system repository

Admin: true # Use this parameter to set up admin frontend client, it will be available at path /admin
TestingSystemAPI:
DefaultLoadFilesHead: 100 # Number of first bytes to load for each file that is served.

3 changes: 3 additions & 0 deletions configs/compiler/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Languages:
cpp:
Template: "cpp.sh.tmpl"
3 changes: 3 additions & 0 deletions configs/compiler/scripts/cpp.sh.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

g++ "{{.source}}" -std=c++20 -O2 -o "{{.binary}}"
47 changes: 47 additions & 0 deletions configs/config-invoker-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Port: # enter the port to run the invoker
# Host: "enter the host string value" # By default, Host equals to localhost

Logger:
# LogPath: "path to save logs" # By default, logs are written to stdout and stderr
# LogLevel: 0. # By default LogLevel is 0.
# Possible log levels are: 0 (Trace), 1 (Debug), 2 (Info), 3 (Warn), 4 (Error)

Invoker:
# AutodetectPublicAddress is used to automatically detect public address of invoker.
# This address will be used for master to communicate with invoker.
# With this parameter, the configuration file can be the same for all invokers that are started in some cloud service.
AutodetectPublicAddress: true
# Threads defines the number of simultaneous processes allowed to run at the same time.
# It is strongly recommended to keep this config equal to 1
Threads: 1
# Sandboxes defines the number of simultaneous test runs that are processed at the same time.
# The best value for this parameter is Threads * 2
Sandboxes: 2
# QueueSize defines the number of test runs that are added to invoker and their resources are loading.
# The best value for this parameter is 1, but for slow networks it can be grater
QueueSize: 1
# SandboxType defines the type of sandbox used for process isolation. Possible values are "isolate" and "simple"
# It is strongly recommended to use "isolate" for safe process execution
SandboxType: "isolate"
# CacheSize defines the size of the cached files (in bytes). It is recommended to have it al least 10^9 or more.
CacheSize: 1000000000
# SaveOutputHead defines the number of bytes that should be saved for each resource, produced by solution.
# If this parameter is absent, the full content of each resource will be saved.
SaveOutputHead: 100
# SandboxHomePath is the path to directory for some sandbox specific files. This directory should be empty.
SandboxHomePath: "some path to empty directory"
# SandboxHomePath is the path to directory for cached files. This directory should be empty.
# The cache is reset at each invoker restart.
CachePath: "some cache path to empty directory"
# CompilerConfigsFolder is the path to directory, containing compiler configs (just like the folder configs/compiler)
CompilerConfigsFolder: "path to compiler configs"
# MasterPingInterval: 1s # The interval at which invoker pings master. By default, equal to 1s

DB:
Dsn: # Use your postgres dsn on master server to connect to database.

MasterConnection:
Address: # Public address of master server

StorageConnection:
Address: # Public address of master server
24 changes: 24 additions & 0 deletions configs/config-master-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Port: # enter the port to run the testing system
# Host: "enter the host string value" # By default, Host equals to localhost

Logger:
# LogPath: "path to save logs" # By default, logs are written to stdout and stderr
# LogLevel: 0. # By default LogLevel is 0.
# Possible log levels are: 0 (Trace), 1 (Debug), 2 (Info), 3 (Warn), 4 (Error)

Master:
# InvokersPingInterval defines the interval at which invokers should be pinged.
InvokersPingInterval: 1s

Storage:
# StoragePath defines the path to store all resources.
StoragePath: "some path to folder containing all the resources"

DB:
Dsn: "postgresql://localhost:5432/ts" # Use your postgres dsn to connect to database.

MasterConnection:
Address: "http://localhost:<port>" # Use the port that is defined in Port parameter for testing system.

StorageConnection:
Address: "http://localhost:<port>" # Use the port that is defined in Port parameter for testing system.
51 changes: 51 additions & 0 deletions configs/config-single-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Port: # enter the port to run the testing system
# Host: "enter the host string value" # By default, Host equals to localhost

Logger:
# LogPath: "path to save logs" # By default, logs are written to stdout and stderr
# LogLevel: 0. # By default LogLevel is 0.
# Possible log levels are: 0 (Trace), 1 (Debug), 2 (Info), 3 (Warn), 4 (Error)

Invoker:
# Threads defines the number of simultaneous processes allowed to run at the same time.
# It is strongly recommended to keep this config equal to 1
Threads: 1
# Sandboxes defines the number of simultaneous test runs that are processed at the same time.
# The best value for this parameter is Threads * 2
Sandboxes: 2
# QueueSize defines the number of test runs that are added to invoker and their resources are loading.
# The best value for this parameter is 1, but for slow networks it can be grater
QueueSize: 1
# SandboxType defines the type of sandbox used for process isolation. Possible values are "isolate" and "simple"
# It is strongly recommended to use "isolate" for safe process execution
SandboxType: "isolate"
# CacheSize defines the size of the cached files (in bytes). It is recommended to have it al least 10^9 or more.
CacheSize: 1000000000
# SaveOutputHead defines the number of bytes that should be saved for each resource, produced by solution.
# If this parameter is absent, the full content of each resource will be saved.
SaveOutputHead: 100
# SandboxHomePath is the path to directory for some sandbox specific files. This directory should be empty.
SandboxHomePath: "some path to empty directory"
# SandboxHomePath is the path to directory for cached files. This directory should be empty.
# The cache is reset at each invoker restart.
CachePath: "some cache path to empty directory"
# CompilerConfigsFolder is the path to directory, containing compiler configs (just like the folder configs/compiler)
CompilerConfigsFolder: "path to compiler configs"
# MasterPingInterval: 1s # The interval at which invoker pings master. By default, equal to 1s

Master:
# InvokersPingInterval defines the interval at which invokers should be pinged.
InvokersPingInterval: 1s

Storage:
# StoragePath defines the path to store all resources.
StoragePath: "some path to folder containing all the resources"

DB:
Dsn: "postgresql://localhost:5432/ts" # Use your postgres dsn to connect to database.

MasterConnection:
Address: "http://localhost:<port>" # Use the port that is defined in Port parameter for testing system.

StorageConnection:
Address: "http://localhost:<port>" # Use the port that is defined in Port parameter for testing system.
52 changes: 52 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Testing system

This is a fast testing system for programming tasks.

## Installation

The testing system can be used at any linux repository.

You will need go 1.24 to build the testing system.
You will need postgres for database.
You will also need [isolate](https://github.com/ioi/isolate) for code isolation.

To install testing system, download the repository. Then run command:

```shell
go build ./
```

To run the testing system, use command:

```shell
./testing_system <config.yaml file path>
```

There are two ways to configure testing system:

- Single process run. For this configuration, use the file `configs/config-single-example.yaml` as a base for config. You can read the comments in config to configure testing system correctly.
- Multiple server run.
For this configuration, there should be master server where the master component of testing system is set up,
and there can be multiple invoker servers for invokers.
For config files, use `config/config-master-example.yaml` for master server config
and `config/config-invoker-example.yaml` for invoker server config.

### Client configuration

For client build, use command:

```shell
go build ./clients
```

To run the client, run compiled binary with config as a first argument.
The config can be produced from `configs/client-config-example.yaml`.

### Polygon import

To import problems from polygon, you can use `tools/polygon_importer`.
It should be run with the following command:
```shell
polygon_importer <testing system config path> <polygon ID of problem> <polygon API key> <polygon API secret>
```