]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - t/relativity.t
Extract check_cgi_mode_bits(). No change intended.
[git.ikiwiki.info.git] / t / relativity.t
index c3c4fcf1ec612d1bb198e477e81422d894803aa1..5922ec9fa5bd9de4184c0189556daa026eb53b27 100755 (executable)
@@ -87,6 +87,18 @@ EOF
        );
 }
 
+sub thoroughly_rebuild {
+       ok(unlink("t/tmp/ikiwiki.cgi") || $!{ENOENT});
+       ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
+}
+
+sub check_cgi_mode_bits {
+       my (undef, undef, $mode, undef, undef,
+               undef, undef, undef, undef, undef,
+               undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
+       is($mode & 07777, 0754);
+}
+
 #######################################################################
 # site 1: a perfectly ordinary ikiwiki
 
@@ -95,15 +107,8 @@ write_setup_file(
        url     => "http://example.com/wiki/",
        cgiurl  => "http://example.com/cgi-bin/ikiwiki.cgi",
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi") || $!{ENOENT});
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-my (undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");
@@ -180,15 +185,8 @@ write_setup_file(
        url     => "http://example.com/wiki/",
        cgiurl  => "http://example.com/cgi-bin/ikiwiki.cgi",
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi") || $!{ENOENT});
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-(undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");
@@ -268,15 +266,8 @@ write_setup_file(
        url     => "http://static.example.com/",
        cgiurl  => "http://cgi.example.com/ikiwiki.cgi",
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi"));
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-(undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");
@@ -343,15 +334,8 @@ write_setup_file(
        url     => "http://static.example.com/",
        cgiurl  => "http://cgi.example.com/ikiwiki.cgi",
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi"));
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-(undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");
@@ -422,15 +406,8 @@ write_setup_file(
        url     => "https://example.com/wiki/",
        cgiurl  => "https://example.com/cgi-bin/ikiwiki.cgi",
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi"));
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-(undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");
@@ -517,15 +494,8 @@ write_setup_file(
        url     => "http://example.com/wiki/",
        cgiurl  => "https://example.com/cgi-bin/ikiwiki.cgi",
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi"));
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-(undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");
@@ -609,15 +579,8 @@ write_setup_file(
        url     => "http://example.com/wiki/",
        cgiurl  => "https://example.com/cgi-bin/ikiwiki.cgi",
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi"));
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-(undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");
@@ -708,15 +671,8 @@ write_setup_file(
        cgiurl  => "ikiwiki.cgi",
        w3mmode => 1,
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi"));
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-(undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");
@@ -747,15 +703,8 @@ write_setup_file(
        cgiurl  => "ikiwiki.cgi",
        w3mmode => 1,
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi"));
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-(undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");
@@ -789,15 +738,8 @@ write_setup_file(
        cgiurl  => "https://example.com/cgi-bin/ikiwiki.cgi",
        reverse_proxy => 1,
 );
-
-ok(unlink("t/tmp/ikiwiki.cgi"));
-ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
-
-# CGI wrapper should be exactly the requested mode
-(undef, undef, $mode, undef, undef,
-       undef, undef, undef, undef, undef,
-       undef, undef, undef) = stat("t/tmp/ikiwiki.cgi");
-is($mode & 07777, 0754);
+thoroughly_rebuild();
+check_cgi_mode_bits();
 
 ok(-e "t/tmp/out/a/b/c/index.html");
 $content = readfile("t/tmp/out/a/b/c/index.html");