2 # run tdir tests from within a VM. Looks for loopback addr.
3 # if run not from within a VM, runs the tests as usual.
4 # with one argument: run that tdir, otherwise, run all tdirs.
7 if test -x /sbin/ifconfig
9 LO0_IP4=`/sbin/ifconfig lo0 | grep '[^0-9]127\.' | sed -e 's/^[^1]*\(127\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[^0-9]*.*$/\1/g'`
10 if ( echo $LO0_IP4 | grep '^127\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' > /dev/null )
19 if test "x$LO0_IP4" = "x127.0.0.1"
26 TPKG=../testcode/mini_tdir.sh
27 #RUNLIST=`(ls -1d *.tdir|grep -v '^0[016]')`
28 RUNLIST=`(ls -1d *.tdir)`
29 if test "$#" = "1"; then
31 if echo "$RUNLIST" | grep '/$' >/dev/null; then
32 RUNLIST=`echo "$RUNLIST" | sed -e 's?/$??'`
36 # fix up tdir that was edited on keyboard interrupt.
39 if test -f "$t.bak"; then rm -fr "${t}"; mv "$t.bak" "$t"; fi
43 # stop tests from notifying systemd, if that is compiled in.
44 export -n NOTIFY_SOCKET
53 # We have alternative 127.0.0.1 number
54 if ( echo $t | grep '6\.tdir$' ) # skip IPv6 tests
57 elif test "$t" = "edns_cache.tdir" # This one is IPv6 too!
63 -exec grep -q -e '127\.0\.0\.1' -e '@localhost' {} \; -print | {
66 sed "s/127\.0\.0\.1/${LO0_IP4}/g" "$f" > "$f._"
68 sed "s/@localhost/@${LO0_IP4}/g" "$f" > "$f._"
72 find "${t}" -type d -name "127.0.0.1" -print | {
75 mv -v "$d" "${d%127.0.0.1}${LO0_IP4}"
82 # get out of testdata/