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 99c55c7
Show file tree
Hide file tree
Showing 9 changed files with 244 additions and 69 deletions.
49 changes: 44 additions & 5 deletions .github/test-projects/step-executor.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,46 @@
#!/bin/sh
set -e
set -x
#!/bin/bash

/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

# only fetch log rtt logs from stderr, ignore backtraces for now, remove function addresses
cat stderr | sed -nE 's/^[0-9]{1,2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}: (TRACE|DEBUG|INFO|WARN|ERROR)/\1/p' | sed 's/ function: 0x[0-9a-fA-F]\{1,\},//g'> rtt_logs

echo "------------------------------------------------" >&2
echo "Stdout" >&2
echo "------------------------------------------------" >&2
cat stdout >&2
echo "------------------------------------------------" >&2
echo "Stderr" >&2
echo "------------------------------------------------" >&2
cat stderr >&2
echo "------------------------------------------------" >&2
echo "Rtt logs" >&2
echo "------------------------------------------------" >&2
cat rtt_logs >&2
echo "------------------------------------------------" >&2

res=0

# Output markers around diff to render it nicely in markdown
echo "Test Results diff:"
echo "\`\`\`diff"
if ! diff expected_test_results.txt stdout; then
res=1
fi


echo "\`\`\`"

echo "Rtt logs diff:"
echo "\`\`\`diff"
if ! diff expected_rtt_logs.txt rtt_logs; then
res=1
fi
echo "\`\`\`"

rm -f stdout stderr rtt_logs

exit $res
171 changes: 120 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", "log"] }

[[test]]
name = "example_test"
Expand Down
Loading

0 comments on commit 99c55c7

Please sign in to comment.