chiark / gitweb /
Testing: Provide test-wrap script
[cgi-auth-flexible.git] / test-wrap
1 #!/bin/sh
2 set -e
3 exec 2>>"$CAHTEST_HOME/test-data/log"
4 export HTTP_COOKIE=$(cat "$CAHTEST_HOME/test-data/cookie")
5 ./test.cgi "$@" | perl -pe '
6     next if m/^$/..0;
7     next unless m/Set-Cookie: (\w+=[^; ]+)/;
8     my $cf = "$ENV{CAHTEST_HOME}/test-data/cookie";
9     open C, ">", "$cf.new" or die "$cf $!";
10     print C $1 or die $!;
11     close C or die $!;
12     rename "$cf.new", $cf or die "$cf $!";
13 '