Skip to content

Commit

Permalink
Add option test-avrdude -t <dir> for tmp directory
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanrueger committed Jan 30, 2024
1 parent 8f46c53 commit 86af6b6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/test-avrdude
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ avrdude_bin=avrdude # Executable
list_only=0 # Normal run
declare -a pgm_and_target=() # Array with test option strings, eg, "-c dryrun -p m328p"
skip_eeprom=0 # Do not skip EEPROM tests for bootloaders by default
tmp=/dev/shm # Temporary RAM directory
verbose=0 # Do not show AVRDUDE errors and warnings by default

Usage() {
Expand All @@ -26,14 +27,15 @@ Options:
-l list test commands but do not execute them
-p <programmer/part specs> can be used multiple times, overrides default tests
-s skip EEPROM tests for bootloaders
-t <dir> temporary directory
-v verbose: show AVRDUDE error and warning messages
-? or -h show this help text
Example:
\$ $progname -d 0 -p "-c dryrun -p t13" -p "-c dryrun -p m4809"
END
}

while getopts ":\?hc:d:e:lp:sv" opt; do
while getopts ":\?hc:d:e:lp:st:v" opt; do
case ${opt} in
c) avrdude_conf="$OPTARG"
;;
Expand All @@ -47,6 +49,8 @@ while getopts ":\?hc:d:e:lp:sv" opt; do
;;
s) skip_eeprom=1
;;
t) tmp="$OPTARG"
;;
v) verbose=1
;;
--) shift;
Expand Down Expand Up @@ -93,8 +97,7 @@ arraylength=${#pgm_and_target[@]}
echo -n "Testing $avrdude_bin"
$avrdude_bin -v 2>&1 | grep Version | cut -f2- -d: | sed s/Version/version/

tmp=/dev/shm # Temporary RAM directory
[[ -d $tmp && -w $tmp ]] || tmp=/tmp # Fall back to /tmp if /dev/shm unusable
[[ -d $tmp && -w $tmp ]] || tmp=/tmp # Fall back to /tmp if tmp directory unusable
status=$(mktemp "$tmp/$progname.status.XXXXXX")
logfile=$(mktemp "$tmp/$progname.log.XXXXXX")
outfile=$(mktemp "$tmp/$progname.out.XXXXXX")
Expand Down

0 comments on commit 86af6b6

Please sign in to comment.