diff --git a/README.md b/README.md index 1ba5eff..f22b950 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # judger-rs -![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/OJ-lab/judger/rust-check.yml) -![Discord](https://img.shields.io/discord/916955582181822486) +![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/OJ-lab/judger/rust-check.yml?logo=github&label=Core%20Tests) +![Discord](https://img.shields.io/discord/916955582181822486?label=Discord&color=blue&logo=discord&logoColor=white) Judger is supposed to be a simple **sandbox service** which works for online-judge systems. @@ -20,19 +20,8 @@ We'll consider other platform, but in a lower priority. If you are not familiar with system stuff. Developing judger-rs in local computer can be dangerous. -Github codespace is the currently the most perfered approach. -When first setup the cloud machine, run `ENV_SETUP.bash` to get essentials, -also install the recommended plugins provided in VSCode. - -## Run by admin - -`judge-core` build a sandbox environment by `seccomp`, so it's neccessary to run tests or examples by admin. -You need to install **Rust** in root user. - -``` sh -su -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -``` +Github codespace is the currently the most perfered approach, +it will setup all the needed environment for you. ## Contribute @@ -41,4 +30,3 @@ We have a guide in judger's [WIKI](https://github.com/OJ-lab/judger/wiki/Contrib ## Deeper Docs - [judge-core README](judge-core/README.md) -- [judge-cli README](judge-cli/README.md) diff --git a/judge-core/Cargo.toml b/judge-core/Cargo.toml index dd4c1d2..10df489 100644 --- a/judge-core/Cargo.toml +++ b/judge-core/Cargo.toml @@ -19,4 +19,6 @@ serde_json = "1" serde_yaml = "0.9" [dev-dependencies] +# Need to lock the version of env_logger to 0.10.0 +# 0.11.0 will break the test currently env_logger = "0.11.0" diff --git a/judge-core/README.md b/judge-core/README.md index 6edfb7a..8e6ed8d 100644 --- a/judge-core/README.md +++ b/judge-core/README.md @@ -19,7 +19,7 @@ supposing the judge directory structure is following [ICPC Problem Package forma Currently we are using a very normal approach by just running the following command: ``` shell -strace ./tmp/icpc/program +strace $program_path ``` It will be better if we have a strace runned executor. diff --git a/judge-core/src/run/executor.rs b/judge-core/src/run/executor.rs index fc266ef..d9cc1a6 100644 --- a/judge-core/src/run/executor.rs +++ b/judge-core/src/run/executor.rs @@ -11,6 +11,8 @@ pub struct Executor { pub additional_args: Vec, } +// Do not do logging or some other additional things which may use system calls +// these will blocked by seccomp filter unexpectedly impl Executor { pub fn new(language: Language, path: PathBuf) -> Result { if !path.exists() { @@ -36,7 +38,6 @@ impl Executor { .iter() .map(|s| CString::new(s.as_bytes())) .collect::, _>>()?; - log::debug!("execve: {:?} {:?}", command, c_args); Ok(execve( &CString::new(command)?, c_args.as_slice(), diff --git a/judger/README.md b/judger/README.md index 3bc02a7..f88f6ed 100644 --- a/judger/README.md +++ b/judger/README.md @@ -16,17 +16,6 @@ cargo run --bin judger-cli -- [COMMAND] cargo run --bin judger-cli -- batch-judge --help ``` -For an example usage of the lastest batch judge feature: - -``` shell -cargo run --bin judger-cli -- batch-judge \ - -s test-collection/src/programs/read_and_write.cpp \ - -p test-collection/packages/icpc/hello_world \ - -l cpp \ - -t icpc \ - -r tmp/icpc -``` - ## Server ### How to run diff --git a/scripts/env_setup.bash b/scripts/env_setup.bash index 6a15a86..04cff14 100755 --- a/scripts/env_setup.bash +++ b/scripts/env_setup.bash @@ -20,7 +20,7 @@ if ! [ -x "$(command -v rustup)" ]; then echo 'rustup not found. Installing rustup...' curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > scripts/thirdparty/rustup.sh chmod +x scripts/thirdparty/rustup.sh - sudo scripts/thirdparty/rustup.sh -y + scripts/thirdparty/rustup.sh -y fi echo 'Ensuring rclone is installed...'