Skip to content

Commit

Permalink
Perf documentation & cloud dev settings (#140)
Browse files Browse the repository at this point in the history
* Delete some outdated content

* Fix setup script

* Fix cargo test failed caused by env logger

* Fix env_logger failure

* Perf shields

* Adjust some outdated content
  • Loading branch information
slhmy authored Jan 27, 2024
1 parent aaf5ae7 commit 5d2045f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 30 deletions.
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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

Expand All @@ -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)
2 changes: 2 additions & 0 deletions judge-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion judge-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 2 additions & 1 deletion judge-core/src/run/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ pub struct Executor {
pub additional_args: Vec<String>,
}

// 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<Self, JudgeCoreError> {
if !path.exists() {
Expand All @@ -36,7 +38,6 @@ impl Executor {
.iter()
.map(|s| CString::new(s.as_bytes()))
.collect::<Result<Vec<_>, _>>()?;
log::debug!("execve: {:?} {:?}", command, c_args);
Ok(execve(
&CString::new(command)?,
c_args.as_slice(),
Expand Down
11 changes: 0 additions & 11 deletions judger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/env_setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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...'
Expand Down

0 comments on commit 5d2045f

Please sign in to comment.