1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#!/bin/sh
# vim: set filetype=sh :
# file: test.ia_mktemp2
# copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2020)
# license: GNU General Public License, version 3
# description: test using function ia_mktemp with exit trap
# see also: example.ia_mktemp2
# The following tests are included:
# (1) Run ia_mktemp
. ./tstlib
UNIFY_tmpfile_name="sed -e \"s:/tmp/shellia.*:/tmp/shellia:\""
bug913718_unify UNIFY_tmpfile_name
shell=""
while [ $# -ne 0 ]; do
if [ "$1" = "-s" ]; then
shell="$2"
shift 2
else
echo "ERROR $0: unknown option <$1>" >&2
exit 1
fi
done
[ "$shell" ] && set -- "$@" -s "$shell"
set -- "$@" -u "$UNIFY_tmpfile_name"
cmd=$(dirname $0)/example.ia_mktemp2
bug913718_cmd
check "(1) Run ia_mktemp" "$@" "$cmd" \
"OK: 1. file exists in fun fun1
OK: 2. file exists in fun fun1
OK: 1. file exists in fun fun2
OK: 2. file exists in fun fun2
OK: 1. file deleted in fun fun2
OK: 2. file deleted in fun fun2
OK: 1. file exists in fun fun3
OK: 2. file exists in fun fun3
OK: 1. file deleted in fun fun3
OK: 2. file deleted in fun fun3
OK: 1. file exists in fun main
OK: 2. file exists in fun main
OK: 1. file deleted in fun main
OK: 2. file deleted in fun main"
|