From 5ee2ca48acd53dd81e458b461e5155e6c8bdb477 Mon Sep 17 00:00:00 2001 From: Timo Date: Wed, 4 Dec 2024 15:57:13 +0100 Subject: [PATCH] update stm32 project, validate json output --- .github/test-projects/step-executor.sh | 31 +++- .github/test-projects/stm32/Cargo.lock | 170 ++++++++++++------ .github/test-projects/stm32/Cargo.toml | 7 +- .github/test-projects/stm32/build.sh | 4 +- .../test-projects/stm32/tests/example_test.rs | 36 +++- .idea/embedded-test.iml | 3 + 6 files changed, 189 insertions(+), 62 deletions(-) diff --git a/.github/test-projects/step-executor.sh b/.github/test-projects/step-executor.sh index 19b0a28..9709b58 100755 --- a/.github/test-projects/step-executor.sh +++ b/.github/test-projects/step-executor.sh @@ -1,7 +1,32 @@ -#!/bin/sh +#!/bin/bash set -e set -x -/home/probe-rs-runner/probe-rs run "$TARGET" $TARGET_CONFIG +touch stdout +touch stderr -exit 1 \ No newline at end of file +/home/probe-rs-runner/probe-rs run --disable-progressbars "$TARGET" $TARGET_CONFIG --format=json 2> stderr | jq -c 'del(.exec_time)' >stdout + + +diff stdout <(cat < () { @@ -13,10 +13,40 @@ mod test { #[test] fn test() { - rtt_target::rtt_init_log!(); log::error!("Hello, log!"); + assert_eq!(1 + 1, 2); + } + #[test] + fn it_fails1() { + assert!(false) + } + #[test] + fn it_fails2() -> Result<(), &'static str> { + Err("It failed because ...") + } + + #[test] + #[should_panic] + fn it_passes() { + assert!(false) + } + + // This test should panic, but doesn't => it fails + #[test] + #[should_panic] + fn it_fails3() {} + + #[test] + #[timeout(3)] + fn it_timeouts() { + loop {} // should run into the 3s timeout + } + + #[test] + async fn async_test() { + Timer::after(Duration::from_millis(100)).await; assert_eq!(1 + 1, 2); } } diff --git a/.idea/embedded-test.iml b/.idea/embedded-test.iml index 7520542..fa29e32 100644 --- a/.idea/embedded-test.iml +++ b/.idea/embedded-test.iml @@ -10,10 +10,13 @@ + + +