Skip to content

Commit bd57a3b

Browse files
committed
update stm32 project, validate json output
1 parent 430e5e5 commit bd57a3b

File tree

9 files changed

+214
-70
lines changed

9 files changed

+214
-70
lines changed
Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
1-
#!/bin/sh
2-
set -e
1+
#!/bin/bash
32
set -x
43

5-
/home/probe-rs-runner/probe-rs run "$TARGET" $TARGET_CONFIG
4+
touch stdout
5+
touch stderr
66

7-
exit 1
7+
/home/probe-rs-runner/probe-rs run --disable-progressbars "$TARGET" $TARGET_CONFIG --format=json 2> stderr | jq -c 'del(.exec_time)' >stdout
8+
9+
res=0
10+
11+
# Output markers around diff to render it nicely in markdown
12+
echo "Test Results diff:"
13+
echo "\`\`\`diff"
14+
if ! diff stdout expected_test_results.txt; then
15+
res=1
16+
fi
17+
18+
echo "\`\`\`"
19+
20+
echo "Stderr diff:"
21+
echo "\`\`\`diff"
22+
#if !diff stderr expected_stderr.txt; then
23+
# res=1
24+
#fi
25+
cat stderr
26+
echo "\`\`\`"
27+
28+
rm -f stdout
29+
rm -f stderr
30+
31+
exit $res

.github/test-projects/stm32/Cargo.lock

Lines changed: 120 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/test-projects/stm32/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ cortex-m = { version = "0.7.7", features = ["inline-asm", "critical-section-sing
1010
cortex-m-rt = "0.7.3"
1111
panic-probe = "0.3"
1212
rtt-target = { version = "0.6.1", features = ["log"] }
13-
14-
embassy-stm32 = { git = "https://github.com/embassy-rs/embassy", rev = "ed3da1721a4f704d3f2a8a1cf84d9fc051c71945", features = ["time-driver-any", "memory-x", "unstable-pac", "exti"] }
13+
embassy-executor = { version = "0.6.3", features = ["arch-cortex-m", "executor-thread", "integrated-timers"] }
14+
embassy-stm32 = { version = "0.1.0", features = ["time-driver-any", "memory-x", "unstable-pac", "exti"] }
15+
embassy-time = "0.3.2"
1516
log = "0.4.22"
1617

1718
[dev-dependencies]
18-
embedded-test = { version = "0.5.0" }
19+
embedded-test = { path = "../../..", features = ["embassy", "log"] }
1920

2021
[[test]]
2122
name = "example_test"

.github/test-projects/stm32/build.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ set -x
99
set -e
1010

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

1414
# Copy artifact to output directory
15-
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')
15+
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')
1616
mkdir -p output
17-
cp "$exec" output/"$1"
17+
cp "$exec" output/"$1"
18+
cp expected_test_results.txt output/

0 commit comments

Comments
 (0)