Skip to content

Commit

Permalink
Merge pull request kata-containers#10388 from GabyCT/topic/testimtemp
Browse files Browse the repository at this point in the history
tools/osbuilder/tests: Add trap statement in test images script
  • Loading branch information
GabyCT authored Oct 9, 2024
2 parents 80196c0 + e08749c commit 2035d63
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/osbuilder/tests/test_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ show_stats()
local sizes

local tmpfile=$(mktemp)
trap 'rm -f $tmpfile' EXIT

# images
for name in "${!built_images[@]}"
Expand Down Expand Up @@ -140,8 +141,6 @@ show_stats()
"Name"

sort -k1,1n -k3,3n "$tmpfile"

rm -f "${tmpfile}"
}


Expand Down Expand Up @@ -326,13 +325,13 @@ get_distros_config()
fi

tmpfile=$(mktemp /tmp/osbuilder-$d-config.XXX)
trap 'rm -f $tmpfile' EXIT
${rootfs_builder} -t $d > $tmpfile
# Get value of all keys in distroCfg
for k in ${!distroCfg[@]}; do
distroCfg[$k]="$(awk -v cfgKey=$k 'BEGIN{FS=":\t+"}{if ($1 == cfgKey) print $2}' $tmpfile)"
debug "distroCfg[$k]=${distroCfg[$k]}"
done
rm -f $tmpfile

machinePattern="\<${MACHINE_TYPE}\>"
if [[ "${distroCfg[ARCH_EXCLUDE_LIST]}" =~ $machinePattern ]]; then
Expand Down

0 comments on commit 2035d63

Please sign in to comment.