Skip to content

Commit

Permalink
update stm32 project, validate json output
Browse files Browse the repository at this point in the history
  • Loading branch information
t-moe committed Dec 4, 2024
1 parent 430e5e5 commit 5ee2ca4
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 62 deletions.
31 changes: 28 additions & 3 deletions .github/test-projects/step-executor.sh
Original file line number Diff line number Diff line change
@@ -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
/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 <<EOF
{"type":"suite","event":"started","test_count":8}
{"type":"test","event":"started","name":"test::test"}
{"type":"test","name":"test::test","event":"ok"}
{"type":"test","event":"started","name":"test::it_fails1"}
{"type":"test","name":"test::it_fails1","event":"failed","stdout":"Error: \"Test should Pass but it did Panic\"\n"}
{"type":"test","event":"started","name":"test::it_fails2"}
{"type":"test","name":"test::it_fails2","event":"failed","stdout":"Error: \"Test should Pass but it did Panic\"\n"}
{"type":"test","event":"started","name":"test::it_passes"}
{"type":"test","name":"test::it_passes","event":"ok"}
{"type":"test","event":"started","name":"test::it_fails3"}
{"type":"test","name":"test::it_fails3","event":"failed","stdout":"Error: \"Test should Panic but it did Pass\"\n"}
{"type":"test","event":"started","name":"test::it_timeouts"}
{"type":"test","name":"test::it_timeouts","event":"failed","stdout":"Error: \"Test timed out after 3s\"\n"}
{"type":"test","event":"started","name":"test::async_test"}
{"type":"test","name":"test::async_test","event":"ok"}
{"type":"suite","event":"failed","passed":3,"failed":4,"ignored":0,"measured":0,"filtered_out":0}
EOF
)

rm -f stdout
rm -f stderr
170 changes: 119 additions & 51 deletions .github/test-projects/stm32/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions .github/test-projects/stm32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ cortex-m = { version = "0.7.7", features = ["inline-asm", "critical-section-sing
cortex-m-rt = "0.7.3"
panic-probe = "0.3"
rtt-target = { version = "0.6.1", features = ["log"] }

embassy-stm32 = { git = "https://github.com/embassy-rs/embassy", rev = "ed3da1721a4f704d3f2a8a1cf84d9fc051c71945", features = ["time-driver-any", "memory-x", "unstable-pac", "exti"] }
embassy-executor = { version = "0.6.3", features = ["arch-cortex-m", "executor-thread", "integrated-timers"] }
embassy-stm32 = { version = "0.1.0", features = ["time-driver-any", "memory-x", "unstable-pac", "exti"] }
embassy-time = "0.3.2"
log = "0.4.22"

[dev-dependencies]
embedded-test = { version = "0.5.0" }
embedded-test = { path = "../../..", features = ["embassy"] }

[[test]]
name = "example_test"
Expand Down
4 changes: 2 additions & 2 deletions .github/test-projects/stm32/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ set -x
set -e

# to show a possible error in the output
cargo test --target "$2" --features embassy-stm32/"$1" --release --test example_test --no-run
cargo test --locked --target "$2" --features embassy-stm32/"$1" --release --test example_test --no-run

# Copy artifact to output directory
exec=$(cargo test --target "$2" --features embassy-stm32/"$1" --release --test example_test --no-run --message-format=json | jq -r 'select(.executable and .target.kind==["test"])|.executable')
exec=$(cargo test --locked --target "$2" --features embassy-stm32/"$1" --release --test example_test --no-run --message-format=json | jq -r 'select(.executable and .target.kind==["test"])|.executable')
mkdir -p output
cp "$exec" output/"$1"
Loading

0 comments on commit 5ee2ca4

Please sign in to comment.