chiark / gitweb /
Testing: Reorganise files, variables, etc.
[cgi-auth-flexible.git] / tests / wrap
diff --git a/tests/wrap b/tests/wrap
new file mode 100755 (executable)
index 0000000..937820f
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+cd "$CAFTEST_CAF"
+exec 2>>tests/tmp/log
+export HTTP_COOKIE=$(cat "tests/tmp/cookie")
+export CAFTEST_URL=file:///cgi-bin/wrap
+tests/cgi "$@" | perl -pe '
+    next if m/^$/..0;
+    next unless m/Set-Cookie: (\w+=[^; ]+)/;
+    my $cf = "tests/tmp/cookie";
+    open C, ">", "$cf.new" or die "$cf $!";
+    print C $1 or die $!;
+    close C or die $!;
+    rename "$cf.new", $cf or die "$cf $!";
+'