X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/7d82570fe09a8f588565873a0da5aaaf95a2d361..dc872e42c8649f5b3fd59861e5c56c89d9fc1cbb:/t/relativity.t?ds=inline diff --git a/t/relativity.t b/t/relativity.t index c3c4fcf1e..5922ec9fa 100755 --- a/t/relativity.t +++ b/t/relativity.t @@ -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");