diff --git a/.github/workflows/doc-and-test.yml b/.github/workflows/doc-and-test.yml index 26524710..e065b69b 100644 --- a/.github/workflows/doc-and-test.yml +++ b/.github/workflows/doc-and-test.yml @@ -9,37 +9,58 @@ jobs: build-doc: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2022-04-11 + components: rust-src, llvm-tools-preview + target: riscv64gc-unknown-none-elf - name: Build doc - run: | - rustup target add riscv64gc-unknown-none-elf - rustup component add llvm-tools-preview - rustup component add rust-src - cd os - cargo doc --no-deps --verbose + run: cd os && cargo doc --no-deps --verbose - name: Deploy to Github Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./os/target/riscv64gc-unknown-none-elf/doc destination_dir: ${{ github.ref_name }} + run-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2022-04-11 + components: rust-src, llvm-tools-preview + target: riscv64gc-unknown-none-elf + - uses: actions-rs/install@v0.1 + with: + crate: cargo-binutils + version: latest + use-tool-cache: true + - name: Cache QEMU + uses: actions/cache@v3 + with: + path: qemu-7.0.0 + key: qemu-7.0.0-x86_64-riscv64 - name: Install QEMU run: | sudo apt-get update sudo apt-get install ninja-build -y - [ ! -d qemu-6.1.0 ] && wget https://download.qemu.org/qemu-6.1.0.tar.xz \ - && tar xJf qemu-6.1.0.tar.xz > /dev/null \ - && cd qemu-6.1.0 && ./configure --target-list=riscv64-softmmu && cd .. - cd qemu-6.1.0 && sudo make install -j + if [ ! -d qemu-7.0.0 ]; then + wget https://download.qemu.org/qemu-7.0.0.tar.xz + tar -xf qemu-7.0.0.tar.xz + cd qemu-7.0.0 + ./configure --target-list=riscv64-softmmu + make -j + else + cd qemu-7.0.0 + fi + sudo make install qemu-system-riscv64 --version - - name: Run usertests - run: | - cd os && make run TEST=1 - - - \ No newline at end of file + - name: Run usertests + run: cd os && make run TEST=1 + timeout-minutes: 10 diff --git a/.gitignore b/.gitignore index 80614cf9..f411b223 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,13 @@ -.idea/* -os/target/* -os/.idea/* +.*/* +!.github/* +!.vscode/settings.json + +**/target/ +**/Cargo.lock + os/src/link_app.S os/src/linker.ld os/last-* -os/Cargo.lock -os/last-* os/.gdb_history -user/target/* -user/.idea/* -user/Cargo.lock -easy-fs/Cargo.lock -easy-fs/target/* -easy-fs-fuse/Cargo.lock -easy-fs-fuse/target/* tools/ pushall.sh diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..11de1111 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + // Prevent "can't find crate for `test`" error on no_std + // Ref: https://github.com/rust-lang/vscode-rust/issues/729 + // For vscode-rust plugin users: + "rust.target": "riscv64gc-unknown-none-elf", + "rust.all_targets": false, + // For Rust Analyzer plugin users: + "rust-analyzer.cargo.target": "riscv64gc-unknown-none-elf", + "rust-analyzer.checkOnSave.allTargets": false +} diff --git a/user/src/bin/usertests.rs b/user/src/bin/usertests.rs index 32b28f6f..7d104d27 100644 --- a/user/src/bin/usertests.rs +++ b/user/src/bin/usertests.rs @@ -5,19 +5,46 @@ extern crate user_lib; static SUCC_TESTS: &[&str] = &[ + "matrix\0", "exit\0", "fantastic_text\0", + "filetest_simple\0", + "forktest_simple\0", "forktest\0", "forktest2\0", - "forktest_simple\0", + "forktree\0", "hello_world\0", - "matrix\0", + "huge_write\0", + "mpsc_sem\0", + "phil_din_mutex\0", + "pipe_large_test\0", + "pipetest\0", + "race_adder_atomic\0", + "race_adder_mutex_blocking\0", + "race_adder_mutex_spin\0", + "race_adder_arg\0", + "sleep_simple\0", "sleep\0", "sleep_simple\0", + "sync_sem\0", + "test_condvar\0", + "threads_arg\0", + "threads\0", "yield\0", + "run_pipe_test\0", +]; + +static FAIL_TESTS: &[&str] = &[ + "stack_overflow\0", + "race_adder_loop\0", + "priv_csr\0", + "priv_inst\0", + "store_fault\0", + "until_timeout\0", + "stack_overflow\0", + "race_adder\0", + "huge_write_mt\0", ]; - -static FAIL_TESTS: &[&str] = &["stack_overflow\0"]; use user_lib::{exec, fork, waitpid};