-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 'master'
Develop See merge request in3/c/in3-core!335
- Loading branch information
Showing
7 changed files
with
72 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,41 @@ | ||
#!/bin/bash | ||
xtensa-softmmu/qemu-system-xtensa -nographic -semihosting -machine esp32 -drive file=flash_image.bin,if=mtd,format=raw -nographic -vga none -net none -global driver=timer.esp32.timg,property=wdt_disable,value=true -no-reboot 2> /dev/null > test_out.txt | ||
# search for the result of the test | ||
grep "IN3 TEST PASSED" ./test_out.txt | ||
out="$?" | ||
if [ "$out" -eq 1 ] ; then | ||
echo "TEST FAILED" | ||
exit 1 | ||
else | ||
echo "TEST SUCCESS!" | ||
exit 0 | ||
fi | ||
|
||
xtensa_run() { | ||
# kill xtensa processes | ||
pids=$(ps aux | grep "[q]emu-system-xtensa" |awk '{print $2}') | ||
for pi in $pids; do kill -9 $pi; done | ||
# run qemu with timeout | ||
timeout --foreground 100s xtensa-softmmu/qemu-system-xtensa -nographic -semihosting -machine esp32 -drive file=flash_image.bin,if=mtd,format=raw -nographic -vga none -net none -global driver=timer.esp32.timg,property=wdt_disable,value=true -no-reboot | tee test.txt | ||
# search for the result of the test | ||
if [ -f ./test.txt ]; then | ||
grep "IN3 TEST PASSED" ./test.txt | ||
out="$?" | ||
if [ "$out" -eq 0 ] ; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
else | ||
return 1 | ||
fi | ||
} | ||
|
||
retry() { | ||
local -r -i max_attempts="$1"; shift | ||
local -i attempt_num=0 | ||
echo $max_attempts | ||
until [ ${attempt_num} -ge ${max_attempts} ] | ||
do | ||
xtensa_run | ||
local res=$? | ||
if [ "$res" -eq 0 ] ; then | ||
echo "TEST SUCCESS" | ||
exit 0 | ||
else | ||
echo "TEST FAILED... RETRYING" | ||
fi | ||
sleep $(( attempt_num++ )) | ||
|
||
done | ||
} | ||
retry 3 |