]> git.draconx.ca Git - liblbx.git/blobdiff - tests/util/test-init.sh
tests: Migrate remaining regress.zsh tests to TAP.
[liblbx.git] / tests / util / test-init.sh
index e8a53dae9fa02f93c05743e8099e6da7de0debde..52625c0d199f86f66f14957a42cb4ffdbfc68e3a 100644 (file)
@@ -105,6 +105,32 @@ dx_create_testdir()
        cd "$dx_testdir"
 }
 
+dx_pam_header()
+{
+       awk 'BEGIN { ret=1 }
+               NR==1 { if (!/^P7$/) exit 1 }
+               /^P7$/,/^ENDHDR$/ { ret=0; if ($2) print $1"="$2 }
+               /^ENDHDR$/ { print $1"="NR+1; exit }
+               END { exit ret }' ${1+"$@"}
+}
+
+dx_check_pam_md5_() {
+       dx_pam_header "$1" > "$1.sh" || return
+       . "./$1.sh" || return
+
+       tail -n +"$ENDHDR" "$1" > "$1.px" || return
+       echo "$2  $1.px" > "$1.md5" || return
+       $MD5SUM -c "$1.md5"
+}
+
+dx_check_pam_md5() {
+       if $HAVE_MD5SUM; then
+               command_ok_ "$1" dx_check_pam_md5_ "$1" "$2"
+       else
+               skip_ "$1"
+       fi
+}
+
 # Variables to run the LBX tools.  Default to the build tree, but can also be
 # set explicitly to test installed tools.
 : "${LBXTOOL=$builddir/lbxtool$EXEEXT}"