Skip to content

Commit

Permalink
Merge pull request #1903 from stefanrueger/test8-e
Browse files Browse the repository at this point in the history
Add -e exe option to test8
  • Loading branch information
stefanrueger authored Aug 23, 2024
2 parents 2cd9e5b + b389e8b commit 720d21f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tools/test8
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ adopts=()
mem=ALL
init=-1
rand=-1
avrdude_bin=avrdude

Usage() {
cat <<END
Expand All @@ -17,6 +18,7 @@ Function: test AVRDUDE for v 8.0 release with -c programmer -p part;
Options:
-i <n> use avrdude -c dryrun -xinit=<n> to initialise part and exit
-r <n> use avrdude -c dryrun -xrandom=<n> to initialise part and exit
-e <exe> path of the avrdude executable
-a <opt> pass avrdude option <opt> through to avrdude test commands
-m <mlist> use memory list <mlist> instead of ALL
Expand All @@ -30,14 +32,16 @@ Examples:
END
}

while getopts ":i:r:a:m:" opt; do
while getopts ":i:r:a:e:m:" opt; do
case ${opt} in
i) init=0; [[ ! -z "$OPTARG" ]] && init="$OPTARG"
;;
r) rand=0; [[ ! -z "$OPTARG" ]] && rand="$OPTARG"
;;
a) if [[ ! -z "$OPTARG" ]]; then adopts+=("$OPTARG"); fi
;;
e) avrdude_bin="$OPTARG"
;;
m) if [[ ! -z "$OPTARG" ]]; then mem="$OPTARG"; fi
;;
--) shift;
Expand Down Expand Up @@ -71,17 +75,17 @@ f="bak-$1-$2.hex:I"

if [[ $init -gt -1 || $rand -gt -1 ]]; then
how="init=$init"; [ $rand -gt -1 ] && how="random=$rand"
avrdude -qqc dryrun -p $2 -U $mem:r:$f -x $how
avrdude "${adopts[@]}" -c $1 -p $2 -U $mem:w:$f
$avrdude_bin -qqc dryrun -p $2 -U $mem:r:$f -x $how
$avrdude_bin "${adopts[@]}" -c $1 -p $2 -U $mem:w:$f
echo $progname: $2 initialised
exit 0
fi

######
# Actual test

if ! avrdude "${adopts[@]}" -c $1 -p $2 -D -U$mem:r:$f -T "fact reset" -U$mem:w:$f -U$mem:v:$f; then
if ! $avrdude_bin "${adopts[@]}" -c $1 -p $2 -D -U$mem:r:$f -T "fact reset" -U$mem:w:$f -U$mem:v:$f; then
echo -------------------------------
echo Re-running to create error logs
avrdude "${adopts[@]}" -vvv -c $1 -p $2 -D -U$mem:r:$f -T "fact reset" -U$mem:w:$f -U$mem:v:$f -llog-$1-$2.txt
$avrdude_bin "${adopts[@]}" -vvv -c $1 -p $2 -D -U$mem:r:$f -T "fact reset" -U$mem:w:$f -U$mem:v:$f -llog-$1-$2.txt
fi

0 comments on commit 720d21f

Please sign in to comment.