mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 05:45:19 +01:00
ci: QEMU esp32c3: Output into unique tmp dir
This commit is contained in:
parent
2e6227e275
commit
13da3410df
1 changed files with 12 additions and 4 deletions
|
|
@ -8,9 +8,13 @@ outputfilenamecargo=$1
|
||||||
outputfilename="$outputfilenamecargo".bin
|
outputfilename="$outputfilenamecargo".bin
|
||||||
|
|
||||||
logfile=qemu.log
|
logfile=qemu.log
|
||||||
|
qemuoutputfile=qemuoutput.log
|
||||||
|
|
||||||
qemuexec=qemu-system-riscv32
|
qemuexec=qemu-system-riscv32
|
||||||
|
|
||||||
|
# Create a temporary directory for all output files
|
||||||
|
tempdir=$(mktemp -d) || exit 1
|
||||||
|
|
||||||
# Building ESP32-C3 image
|
# Building ESP32-C3 image
|
||||||
espflash save-image --chip esp32c3 --merge "$outputfilenamecargo" "$outputfilename" 1>&2
|
espflash save-image --chip esp32c3 --merge "$outputfilenamecargo" "$outputfilename" 1>&2
|
||||||
|
|
||||||
|
|
@ -18,7 +22,7 @@ espflash save-image --chip esp32c3 --merge "$outputfilenamecargo" "$outputfilena
|
||||||
esptool.py image_info --version 2 "$outputfilename" 1>&2
|
esptool.py image_info --version 2 "$outputfilename" 1>&2
|
||||||
|
|
||||||
# Run in QEMU
|
# Run in QEMU
|
||||||
$qemuexec -nographic -monitor tcp:127.0.0.1:55555,server,nowait -icount 3 -machine esp32c3 -drive file="$outputfilename",if=mtd,format=raw -serial file:"$logfile" > qemuoutput.log 2>&1 &
|
$qemuexec -nographic -monitor tcp:127.0.0.1:55555,server,nowait -icount 3 -machine esp32c3 -drive file="$outputfilename",if=mtd,format=raw -serial file:"$tempdir/$logfile" >"$tempdir"/$qemuoutputfile 2>&1 &
|
||||||
|
|
||||||
qemupid=$!
|
qemupid=$!
|
||||||
|
|
||||||
|
|
@ -26,13 +30,17 @@ qemupid=$!
|
||||||
sleep 3s
|
sleep 3s
|
||||||
|
|
||||||
# Kill QEMU nicely by sending 'q' (quit) over tcp
|
# Kill QEMU nicely by sending 'q' (quit) over tcp
|
||||||
echo q | nc -N 127.0.0.1 55555 >> qemuoutput.log 2>&1
|
echo q | nc -N 127.0.0.1 55555 >>"$tempdir"/$qemuoutputfile 2>&1
|
||||||
# Output that will be compared must be printed to stdout
|
# Output that will be compared must be printed to stdout
|
||||||
|
|
||||||
# Make boot phase silent, for debugging change, run with e.g. $ `env DEBUGGING=true` cargo xtask....
|
# Make boot phase silent, for debugging change, run with e.g. $ `env DEBUGGING=true` cargo xtask....
|
||||||
if [ -n "${DEBUGGING}" ]; then
|
if [ -n "${DEBUGGING}" ]; then
|
||||||
# Debugging: strip leading "I (xyz)" where xyz is an incrementing number, and esp_image specifics
|
# Debugging: strip leading "I (xyz)" where xyz is an incrementing number, and esp_image specifics
|
||||||
sed -e 's/esp_image: .*$/esp_image: REDACTED/' -e 's/I\s\([0-9]*\)(.*)/\1/' < $logfile
|
sed -e 's/esp_image: .*$/esp_image: REDACTED/' -e 's/I\s\([0-9]*\)(.*)/\1/' <"$tempdir"/$logfile
|
||||||
else
|
else
|
||||||
tail -n +12 "$logfile" | sed -e '/I\s\([0-9]*\)(.*)/d'
|
tail -n +12 "$tempdir/$logfile" | sed -e '/I\s\([0-9]*\)(.*)/d'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mv "$tempdir/$logfile" "$(basename "$outputfilename")"-$logfile
|
||||||
|
mv "$tempdir/$qemuoutputfile" "$(basename "$outputfilename")"-$qemuoutputfile
|
||||||
|
rm -r "$tempdir"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue