+ );
+}
+
+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);
+}
+
+sub check_generated_content {
+ my $cgiurl_regex = shift;
+ ok(-e "t/tmp/out/a/b/c/index.html");
+ my $content = readfile("t/tmp/out/a/b/c/index.html");
+ # no <base> on static HTML
+ unlike($content, qr{<base\W});
+ like($content, $cgiurl_regex);
+ # cross-links between static pages are relative
+ like($content, qr{<li>A: <a href="../../">a</a></li>});
+ like($content, qr{<li>B: <a href="../">b</a></li>});
+ like($content, qr{<li>E: <a href="../../d/e/">e</a></li>});
+}