#case #test-cases #unit-testing #bare-metal #test

bare-test

A test framework for bare metal

13 unstable releases (3 breaking)

0.3.1 Jan 20, 2025
0.3.0 Jan 20, 2025
0.2.0 Dec 10, 2024
0.1.4 Dec 2, 2024
0.0.3 Oct 31, 2024

#290 in Testing

Download history 481/week @ 2024-10-30 77/week @ 2024-11-06 467/week @ 2024-11-13 31/week @ 2024-11-20 136/week @ 2024-11-27 165/week @ 2024-12-04 73/week @ 2024-12-11 3/week @ 2024-12-18 13/week @ 2025-01-08 197/week @ 2025-01-15 21/week @ 2025-01-22

231 downloads per month
Used in 2 crates

MPL-2.0 license

8KB
117 lines

Bare Test

A test framework for testing the bare metal.

Usage

  1. Install ostool.

    cargo install ostool
    
  2. setup .cargo/config.toml

    [target.'cfg(all(target_os = "none"))']
    runner = "ostool cargo-test"
    [build]
    target = "aarch64-unknown-none"
    
  3. setup cargo.toml.

    [dev-dependencies]
    bare-test = "0.2"
    
    [build-dependencies]
    bare-test-macros = "0.2"
    
    [[test]]
    name = "test"
    harness = false
    
  4. setup build.rs.

    fn main() {
        bare_test_macros::build_test_setup!();
    }
    
  5. new tests dir and add test.rs.

    #![no_std]
    #![no_main]
    #![feature(used_with_arg)]
    
    #[bare_test::tests]
    mod tests {
    
        #[test]
        fn it_works() {
            assert_eq!(2 + 2, 4)
        }
    
        #[test]
        fn test2() {
            assert_eq!(2 + 2, 4)
        }
    }
    
  6. run cargo test --test test -- --show-output.

  7. for uboot board test:

cargo test --test tests --  --show-output --uboot

Dependencies

~2.5–3.5MB
~72K SLoC