diff --git a/tools/test-avrdude b/tools/test-avrdude index 14d13b907..a400baf4d 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -149,8 +149,6 @@ fi arraylength=${#pgm_and_target[@]} type "$avrdude_bin" >/dev/null 2>&1 || { echo "$progname: cannot execute $avrdude_bin"; exit 1; } -echo -n "Testing $avrdude_bin" -$avrdude_bin -v 2>&1 | grep '[vV]ersion' | cut -f2- -d: | sed s/Version/version/ [[ -d $tmp && -w $tmp ]] || tmp=/tmp # Fall back to /tmp if tmp directory unusable status=$(mktemp "$tmp/$progname.status.XXXXXX") @@ -160,6 +158,17 @@ tmpfile=$(mktemp "$tmp/$progname.tmp.XXXXXX") resfile=$(mktemp "$tmp/$progname.res.XXXXXX") trap "rm -f $status $logfile $outfile $tmpfile $resfile" EXIT +echo -n "Testing '$avrdude_bin -v'..." +$avrdude_bin -v 2>&1 | grep '[vV]ersion' | cut -f2- -d: | sed s/Version/version/ > "$outfile" +if grep version "$outfile" > /dev/null 2>&1; then + echo -n " " + cat "$outfile" +else + echo " error" + $avrdude_bin -v + exit 1 +fi + devnull=$tmpfile # Cannot use /dev/null as file in Windows avrdude TIMEFORMAT=%R # time built-in only returns elapsed wall-clock time