chiark / gitweb /
Testing: Provide test-wrap script
[cgi-auth-flexible.git] / test-wrap
diff --git a/test-wrap b/test-wrap
new file mode 100755 (executable)
index 0000000..b896e82
--- /dev/null
+++ b/test-wrap
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -e
+exec 2>>"$CAHTEST_HOME/test-data/log"
+export HTTP_COOKIE=$(cat "$CAHTEST_HOME/test-data/cookie")
+./test.cgi "$@" | perl -pe '
+    next if m/^$/..0;
+    next unless m/Set-Cookie: (\w+=[^; ]+)/;
+    my $cf = "$ENV{CAHTEST_HOME}/test-data/cookie";
+    open C, ">", "$cf.new" or die "$cf $!";
+    print C $1 or die $!;
+    close C or die $!;
+    rename "$cf.new", $cf or die "$cf $!";
+'