+6 July 2017: Wouter
+ - Fix tests to use .tdir (from Manu Bretelle) instead of .tpkg.
+
4 July 2017: Wouter
- Fix 1332: Bump verbosity of failed chown'ing of the control socket.
#!/usr/bin/env bash
. testdata/common.sh
-NEED_SPLINT='00-lint.tpkg'
-NEED_DOXYGEN='01-doc.tpkg'
-NEED_XXD='fwd_compress_c00c.tpkg fwd_zero.tpkg'
-NEED_NC='fwd_compress_c00c.tpkg fwd_zero.tpkg'
-NEED_CURL='06-ianaports.tpkg root_anchor.tpkg'
-NEED_WHOAMI='07-confroot.tpkg'
-NEED_IPV6='fwd_ancil.tpkg fwd_tcp_tc6.tpkg stub_udp6.tpkg edns_cache.tpkg'
-NEED_NOMINGW='tcp_sigpipe.tpkg 07-confroot.tpkg 08-host-lib.tpkg fwd_ancil.tpkg'
-NEED_DNSCRYPT_PROXY='dnscrypt_queries.tpkg dnscrypt_queries_chacha.tpkg'
+NEED_SPLINT='00-lint.tdir'
+NEED_DOXYGEN='01-doc.tdir'
+NEED_XXD='fwd_compress_c00c.tdir fwd_zero.tdir'
+NEED_NC='fwd_compress_c00c.tdir fwd_zero.tdir'
+NEED_CURL='06-ianaports.tdir root_anchor.tdir'
+NEED_WHOAMI='07-confroot.tdir'
+NEED_IPV6='fwd_ancil.tdir fwd_tcp_tc6.tdir stub_udp6.tdir edns_cache.tdir'
+NEED_NOMINGW='tcp_sigpipe.tdir 07-confroot.tdir 08-host-lib.tdir fwd_ancil.tdir'
+NEED_DNSCRYPT_PROXY='dnscrypt_queries.tdir dnscrypt_queries_chacha.tdir'
# test if dig and ldns-testns are available.
test_tool_avail "dig"
fi
cd testdata;
-sh ../testcode/mini_tpkg.sh clean
+sh ../testcode/mini_tdir.sh clean
rm -f .perfstats.txt
-for test in `ls *.tpkg`; do
+for test in `ls -d *.tdir`; do
SKIP=0
skip_if_in_list $test "$NEED_SPLINT" "splint"
skip_if_in_list $test "$NEED_DOXYGEN" "doxygen"
fi
if test $SKIP -eq 0; then
echo $test
- sh ../testcode/mini_tpkg.sh -a ../.. exe $test
+ sh ../testcode/mini_tdir.sh -a ../.. exe $test
else
echo "skip $test"
fi
done
-sh ../testcode/mini_tpkg.sh report
+sh ../testcode/mini_tdir.sh report
cat .perfstats.txt
return 0;
}
-/* timers in testbound for autotrust. statistics tested in tpkg. */
+/* timers in testbound for autotrust. statistics tested in tdir. */
struct comm_timer* comm_timer_create(struct comm_base* base,
void (*cb)(void*), void* cb_arg)
{
--- /dev/null
+# tdir that only exes the files.
+args="../.."
+if test "$1" = "-a"; then
+ args=$2
+ shift
+ shift
+fi
+
+if test "$1" = "clean"; then
+ echo "rm -f result.* .done* .tdir.var.master .tdir.var.test"
+ rm -f result.* .done* .tdir.var.master .tdir.var.test
+ exit 0
+fi
+if test "$1" = "fake"; then
+ echo "minitdir fake $2"
+ echo "fake" > .done-`basename $2 .tdir`
+ exit 0
+fi
+if test "$1" = "report" || test "$2" = "report"; then
+ echo "Minitdir Report"
+ for result in *.tdir; do
+ name=`basename $result .tdir`
+ if test -f ".done-$name"; then
+ if test "$1" != "-q"; then
+ echo "** PASSED ** : $name"
+ fi
+ else
+ if test -f "result.$name"; then
+ echo "!! FAILED !! : $name"
+ else
+ echo ">> SKIPPED<< : $name"
+ fi
+ fi
+ done
+ exit 0
+fi
+
+if test "$1" != 'exe'; then
+ # usage
+ echo "mini tdir. Reduced functionality for old shells."
+ echo " tdir exe <file>"
+ echo " tdir fake <file>"
+ echo " tdir clean"
+ echo " tdir [-q] report"
+ exit 1
+fi
+shift
+
+# do not execute if the disk is too full
+#DISKLIMIT=100000
+# This check is not portable (to Solaris 10).
+#avail=`df . | tail -1 | awk '{print $4}'`
+#if test "$avail" -lt "$DISKLIMIT"; then
+ #echo "minitdir: The disk is too full! Only $avail."
+ #exit 1
+#fi
+
+name=`basename $1 .tdir`
+dir=$name.$$
+result=result.$name
+done=.done-$name
+success="no"
+if test -x "`which bash`"; then
+ shell="bash"
+else
+ shell="sh"
+fi
+
+# check already done
+if test -f .done-$name; then
+ echo "minitdir .done-$name exists. skip test."
+ exit 0
+fi
+
+# Copy
+echo "minitdir copy $1 to $dir"
+mkdir $dir
+cp -a $name.tdir/* $dir/
+cd $dir
+
+# EXE
+echo "minitdir exe $name" > $result
+grep "Description:" $name.dsc >> $result 2>&1
+echo "DateRunStart: "`date "+%s" 2>/dev/null` >> $result
+if test -f $name.pre; then
+ echo "minitdir exe $name.pre"
+ echo "minitdir exe $name.pre" >> $result
+ $shell $name.pre $args >> $result
+ if test $? -ne 0; then
+ echo "Warning: $name.pre did not exit successfully"
+ fi
+fi
+if test -f $name.test; then
+ echo "minitdir exe $name.test"
+ echo "minitdir exe $name.test" >> $result
+ $shell $name.test $args >>$result 2>&1
+ if test $? -ne 0; then
+ echo "$name: FAILED" >> $result
+ echo "$name: FAILED"
+ success="no"
+ else
+ echo "$name: PASSED" >> $result
+ echo "$name: PASSED" > ../.done-$name
+ echo "$name: PASSED"
+ success="yes"
+ fi
+fi
+if test -f $name.post; then
+ echo "minitdir exe $name.post"
+ echo "minitdir exe $name.post" >> $result
+ $shell $name.post $args >> $result
+ if test $? -ne 0; then
+ echo "Warning: $name.post did not exit successfully"
+ fi
+fi
+echo "DateRunEnd: "`date "+%s" 2>/dev/null` >> $result
+
+mv $result ..
+cd ..
+rm -rf $dir
+# compat for windows where deletion may not succeed initially (files locked
+# by processes that still have to exit).
+if test $? -eq 1; then
+ echo "minitdir waiting for processes to terminate"
+ sleep 2 # some time to exit, and try again
+ rm -rf $dir
+fi
#!/usr/local/bin/bash
-# run tpkg tests from within a VM. Looks for loopback addr.
+# run tdir tests from within a VM. Looks for loopback addr.
# if run not from within a VM, runs the tests as usual.
-# with one argument: run that tpkg, otherwise, run all tpkgs.
+# with one argument: run that tdir, otherwise, run all tdirs.
get_lo0_ip4() {
if test -x /sbin/ifconfig
ALT_LOOPBACK=true
fi
cd testdata
-TPKG=../testcode/mini_tpkg.sh
-#RUNLIST=`(ls -1 *.tpkg|grep -v '^0[016]')`
-RUNLIST=`(ls -1 *.tpkg)`
+TPKG=../testcode/mini_tdir.sh
+#RUNLIST=`(ls -1 *.tdir|grep -v '^0[016]')`
+RUNLIST=`(ls -1 *.tdir)`
if test "$#" = "1"; then RUNLIST="$1"; fi
-# fix up tpkg that was edited on keyboard interrupt.
+# fix up tdir that was edited on keyboard interrupt.
cleanup() {
echo cleanup
if test -f "$t.bak"; then mv "$t.bak" "$t"; fi
continue
fi
# We have alternative 127.0.0.1 number
- if ( echo $t | grep '6\.tpkg$' ) # skip IPv6 tests
+ if ( echo $t | grep '6\.tdir$' ) # skip IPv6 tests
then
continue
- elif test "$t" = "edns_cache.tpkg" # This one is IPv6 too!
+ elif test "$t" = "edns_cache.tdir" # This one is IPv6 too!
then
continue
fi
- cp -p "$t" "$t.bak"
- tar xzf $t
- find "${t%.tpkg}.dir" -type f \
+ cp -ap "$t" "$t.bak"
+ find "${t}" -type f \
-exec grep -q -e '127\.0\.0\.1' -e '@localhost' {} \; -print | {
while read f
do
mv "$f._" "$f"
done
}
- find "${t%.tpkg}.dir" -type d -name "127.0.0.1" -print | {
+ find "${t}" -type d -name "127.0.0.1" -print | {
while read d
do
mv -v "$d" "${d%127.0.0.1}${LO0_IP4}"
done
}
- tar czf $t "${t%.tpkg}.dir"
- rm -fr "${t%.tpkg}.dir"
$TPKG exe $t
+ rm -fr "${t}"
mv "$t.bak" "$t"
done
# get out of testdata/
# 2011-02-18: ports check on BSD,Solaris. wait_nsd_up.
# 2011-02-11: first version.
#
-# include this file from a tpkg script with
+# include this file from a tdir script with
# . ../common.sh
#
# overview of functions available: