]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Run autopkgtest tests using autodep8 and the pkg-perl team's infrastructure
authorSimon McVittie <smcv@debian.org>
Mon, 30 Nov 2015 17:33:00 +0000 (17:33 +0000)
committerSimon McVittie <smcv@debian.org>
Wed, 11 Jan 2017 22:36:42 +0000 (22:36 +0000)
(cherry picked from commit cdfb4ab1a3c60bf699b8d77618ec9bdf526cdb35)

14 files changed:
debian/control
debian/tests/pkg-perl/smoke-env [new file with mode: 0644]
debian/tests/pkg-perl/syntax-skip [new file with mode: 0644]
debian/tests/pkg-perl/use-name [new file with mode: 0644]
t/basewiki_brokenlinks.t
t/comments.t
t/conflicts.t
t/cvs.t
t/git.t
t/permalink.t
t/syntax.t
t/template_syntax.t
t/templates_documented.t
t/trail.t

index 05908cf23dba568394dd704c37806db6eff00a25..fef9b10b04143efca0a0701d81ca8a77d35874cc 100644 (file)
@@ -23,6 +23,7 @@ Uploaders: Josh Triplett <josh@freedesktop.org>
 Standards-Version: 3.9.3
 Homepage: http://ikiwiki.info/
 Vcs-Git: git://git.ikiwiki.info/
+Testsuite: autopkgtest-pkg-perl
 
 Package: ikiwiki
 Architecture: all
diff --git a/debian/tests/pkg-perl/smoke-env b/debian/tests/pkg-perl/smoke-env
new file mode 100644 (file)
index 0000000..7747381
--- /dev/null
@@ -0,0 +1 @@
+INSTALLED_TESTS=1
diff --git a/debian/tests/pkg-perl/syntax-skip b/debian/tests/pkg-perl/syntax-skip
new file mode 100644 (file)
index 0000000..404e431
--- /dev/null
@@ -0,0 +1,4 @@
+IkiWiki/Plugin/amazon_s3.pm
+IkiWiki/Plugin/cvs.pm
+IkiWiki/Plugin/monotone.pm
+IkiWiki/Plugin/po.pm
diff --git a/debian/tests/pkg-perl/use-name b/debian/tests/pkg-perl/use-name
new file mode 100644 (file)
index 0000000..3d60011
--- /dev/null
@@ -0,0 +1 @@
+IkiWiki
index 74ddc61c5a8b636a80b5ed24c293ce2c3582c4de..26e3859abedc37b39c70a2bcf40c505751f73455 100755 (executable)
@@ -1,21 +1,32 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More 'no_plan';
+use Test::More;
+
+my $installed = $ENV{INSTALLED_TESTS};
 
 ok(! system("rm -rf t/tmp; mkdir t/tmp"));
-ok(! system("make -s ikiwiki.out"));
-ok(! system("make underlay_install DESTDIR=`pwd`/t/tmp/install PREFIX=/usr >/dev/null"));
+
+my @command;
+if ($installed) {
+       @command = qw(env LC_ALL=C ikiwiki);
+}
+else {
+       ok(! system("make -s ikiwiki.out"));
+       ok(! system("make underlay_install DESTDIR=`pwd`/t/tmp/install PREFIX=/usr >/dev/null"));
+       @command = qw(env LC_ALL=C perl -I. ./ikiwiki.out
+               --underlaydir=t/tmp/install/usr/share/ikiwiki/basewiki
+               --set underlaydirbase=t/tmp/install/usr/share/ikiwiki
+               --templatedir=templates);
+}
 
 foreach my $plugin ("", "listdirectives") {
-       ok(! system("LC_ALL=C perl -I. ./ikiwiki.out -rebuild -plugin brokenlinks ".
+       ok(! system(@command, qw(--rebuild --plugin brokenlinks),
                        # always enabled because pages link to it conditionally,
                        # which brokenlinks cannot handle properly
-                       "-plugin smiley ".
-                       ($plugin ? "-plugin $plugin " : "").
-                       "-underlaydir=t/tmp/install/usr/share/ikiwiki/basewiki ".
-                       "-set underlaydirbase=t/tmp/install/usr/share/ikiwiki ".
-                       "-templatedir=templates t/basewiki_brokenlinks t/tmp/out"));
+                       qw(--plugin smiley),
+                       ($plugin ? ("--plugin", $plugin) : ()),
+                       qw(t/basewiki_brokenlinks t/tmp/out)));
        my $result=`grep 'no broken links' t/tmp/out/index.html`;
        ok(length($result));
        if (! length $result) {
@@ -27,3 +38,5 @@ foreach my $plugin ("", "listdirectives") {
        ok(! system("rm -rf t/tmp/out t/basewiki_brokenlinks/.ikiwiki"));
 }
 ok(! system("rm -rf t/tmp"));
+
+done_testing();
index da2148b6b8f8cc5a3a92db07420397971ae1fe84..a5add970192c953b77c9968ebd0a51cbb4f46755 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More 'no_plan';
+use Test::More;
 use IkiWiki;
 
 ok(! system("rm -rf t/tmp"));
@@ -9,6 +9,20 @@ ok(mkdir "t/tmp");
 ok(! system("cp -R t/tinyblog t/tmp/in"));
 ok(mkdir "t/tmp/in/post" or -d "t/tmp/in/post");
 
+my $installed = $ENV{INSTALLED_TESTS};
+
+my @command;
+if ($installed) {
+       @command = qw(ikiwiki);
+}
+else {
+       ok(! system("make -s ikiwiki.out"));
+       @command = qw(perl -I. ./ikiwiki.out
+               --underlaydir=underlays/basewiki
+               --set underlaydirbase=underlays
+               --templatedir=templates);
+}
+
 my $comment;
 
 $comment = <<EOF;
@@ -39,8 +53,7 @@ ok(utime(222222222, 222222222, "t/tmp/in/post/comment_2._comment"));
 ok(utime(333333333, 333333333, "t/tmp/in/post/comment_1._comment"));
 
 # Build the wiki
-ok(! system("make -s ikiwiki.out"));
-ok(! system("perl -I. ./ikiwiki.out -verbose -plugin comments -url=http://example.com -cgiurl=http://example.com/ikiwiki.cgi -rss -atom -underlaydir=underlays/basewiki -set underlaydirbase=underlays -set comments_pagespec='*' -templatedir=templates t/tmp/in t/tmp/out"));
+ok(! system(@command, qw(--verbose --plugin comments --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi --rss --atom --set comments_pagespec=* t/tmp/in t/tmp/out)));
 
 # Check that the comments are in the right order
 
@@ -55,3 +68,5 @@ sub slurp {
 my $content = slurp("t/tmp/out/post/index.html");
 ok(defined $content);
 ok($content =~ m/I conquered.*I explored.*I landed/s);
+
+done_testing();
index d7e04d3ae39a66b1bdcd711aa0aa0ee12f0584ec..07c392cd3a70ae59992f422124814cd21fdd5b32 100755 (executable)
@@ -4,15 +4,30 @@ use warnings;
 use strict;
 use Test::More tests => 106;
 
+my $installed = $ENV{INSTALLED_TESTS};
+
+my @command;
+if ($installed) {
+       ok(1, "running installed");
+       @command = qw(ikiwiki);
+}
+else {
+       ok(! system("make -s ikiwiki.out"));
+       @command = qw(perl -I. ./ikiwiki.out
+               --underlaydir=underlays/basewiki
+               --set underlaydirbase=underlays
+               --templatedir=templates);
+}
+
 # setup
 my $srcdir="t/tmp/src";
 my $destdir="t/tmp/dest";
-ok(! system("make -s ikiwiki.out"));
 
 # runs ikiwiki to build test site
 sub runiki {
        my $testdesc=shift;
-       ok((! system("perl -I. ./ikiwiki.out -plugin txt -plugin rawhtml -underlaydir=underlays/basewiki -set underlaydirbase=underlays -templatedir=templates $srcdir $destdir @_")),
+       ok((! system(@command, qw(--plugin txt --plugin rawhtml),
+                               $srcdir, $destdir, @_)),
                $testdesc);
 }
 sub refreshiki {
diff --git a/t/cvs.t b/t/cvs.t
index 9afd5a7e9061767f8cc0f1f5ad08d97dcc335c98..f903d79b195b0314b4a314dcf7a7b8261b235e75 100755 (executable)
--- a/t/cvs.t
+++ b/t/cvs.t
@@ -4,6 +4,8 @@ use strict;
 use Test::More; my $total_tests = 42;
 use IkiWiki;
 
+my $installed = $ENV{INSTALLED_TESTS};
+
 my $default_test_methods = '^test_*';
 my @required_programs = qw(
        cvs
diff --git a/t/git.t b/t/git.t
index 6d847dfb04d56808dab435a125bc6cbadcfd3af0..8e4e8eb655d6a7bd9c8d9bab8d825797f8319f83 100755 (executable)
--- a/t/git.t
+++ b/t/git.t
@@ -26,8 +26,16 @@ $config{srcdir} = "$dir/src";
 IkiWiki::loadplugins();
 IkiWiki::checkconfig();
 
+my $makerepo;
+if ($ENV{INSTALLED_TESTS}) {
+       $makerepo = "ikiwiki-makerepo";
+}
+else {
+       $makerepo = "./ikiwiki-makerepo";
+}
+
 ok (mkdir($config{srcdir}));
-is (system("./ikiwiki-makerepo git $config{srcdir} $dir/repo"), 0);
+is (system("$makerepo git $config{srcdir} $dir/repo"), 0);
 
 my @changes;
 @changes = IkiWiki::rcs_recentchanges(3);
index 81d4d18206e860f672f7689222ef45c526dcc0a5..f776dd260da60d23b29b09e7e890dadd1f4d2fb1 100755 (executable)
@@ -1,13 +1,30 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More 'no_plan';
+use Test::More;
+
+my $installed = $ENV{INSTALLED_TESTS};
+
+my @command;
+if ($installed) {
+       @command = qw(ikiwiki);
+}
+else {
+       ok(! system("make -s ikiwiki.out"));
+       @command = qw(perl -I. ./ikiwiki.out
+               --underlaydir=underlays/basewiki
+               --set underlaydirbase=underlays
+               --templatedir=templates);
+}
 
 ok(! system("mkdir t/tmp"));
-ok(! system("make -s ikiwiki.out"));
-ok(! system("perl -I. ./ikiwiki.out -plugin inline -url=http://example.com -cgiurl=http://example.com/ikiwiki.cgi -rss -atom -underlaydir=underlays/basewiki -set underlaydirbase=underlays -templatedir=templates t/tinyblog t/tmp/out"));
+ok(! system(@command, qw(--plugin inline --url=http://example.com
+               --cgiurl=http://example.com/ikiwiki.cgi --rss --atom
+               t/tinyblog t/tmp/out)));
 # This guid should never, ever change, for any reason whatsoever!
 my $guid="http://example.com/post/";
 ok(length `egrep '<guid.*>$guid</guid>' t/tmp/out/index.rss`);
 ok(length `egrep '<id>$guid</id>' t/tmp/out/index.atom`);
 ok(! system("rm -rf t/tmp t/tinyblog/.ikiwiki"));
+
+done_testing();
index b7c6efd58345de974628f6e55dab4424336c9c09..1d496be2dec2e5231b053533adfd0d2a2bb761cd 100755 (executable)
@@ -3,6 +3,8 @@ use warnings;
 use strict;
 use Test::More;
 
+plan(skip_all => 'running installed') if $ENV{INSTALLED_TESTS};
+
 my @progs="ikiwiki.in";
 my @libs="IkiWiki.pm";
 # monotone, external, amazon_s3, po, and cvs
index 1e156eed897890f1e856eb25606ba8057f169975..661f450c0b1169efbc826be0ffc72d22dd8eca4a 100755 (executable)
@@ -3,6 +3,8 @@ use warnings;
 use strict;
 use Test::More;
 
+plan(skip_all => 'running installed') if $ENV{INSTALLED_TESTS};
+
 my @templates=glob("templates/*.tmpl"), glob("doc/templates/*.mdwn");
 plan(tests => 2*@templates);
 
index 826c51d3667ab1ae93c636c330e010d379630fec..4991e4521eaeee71b86b991c1e54643c9290da4a 100755 (executable)
@@ -1,7 +1,9 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More 'no_plan';
+use Test::More;
+
+plan(skip_all => 'running installed') if $ENV{INSTALLED_TESTS};
 
 $/=undef;
 open(IN, "doc/templates.mdwn") || die "doc/templates.mdwn: $!";
@@ -12,3 +14,5 @@ foreach my $file (glob("templates/*.tmpl")) {
        $file=~s/templates\///;
        ok($page =~ /\Q$file\E/, "$file documented on doc/templates.mdwn");
 }
+
+done_testing();
index 2e4b9278d1a324875684324b114b324431c55df7..53c5efb0b585657406460562ee4c7afb7b1f2144 100755 (executable)
--- a/t/trail.t
+++ b/t/trail.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More 'no_plan';
+use Test::More;
 use IkiWiki;
 
 sub check_trail {
@@ -27,6 +27,24 @@ my $blob;
 ok(! system("rm -rf t/tmp"));
 ok(! system("mkdir t/tmp"));
 
+my $installed = $ENV{INSTALLED_TESTS};
+
+my @command;
+if ($installed) {
+       @command = qw(ikiwiki);
+}
+else {
+       ok(! system("make -s ikiwiki.out"));
+       @command = qw(perl -I. ./ikiwiki.out
+               --underlaydir=underlays/basewiki
+               --set underlaydirbase=underlays
+               --templatedir=templates);
+}
+
+push @command, qw(--set usedirs=0 --plugin trail --plugin inline
+       --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi
+       --rss --atom t/tmp/in t/tmp/out --verbose);
+
 # Write files with a date in the past, so that when we refresh,
 # the update is detected.
 sub write_old_file {
@@ -117,13 +135,8 @@ write_old_file("wind_in_the_willows.mdwn", <<EOF
 EOF
 );
 
-ok(! system("make -s ikiwiki.out"));
-
-my $command = "perl -I. ./ikiwiki.out -set usedirs=0 -plugin trail -plugin inline -url=http://example.com -cgiurl=http://example.com/ikiwiki.cgi -rss -atom -underlaydir=underlays/basewiki -set underlaydirbase=underlays -templatedir=templates t/tmp/in t/tmp/out -verbose";
-
-ok(! system($command));
-
-ok(! system("$command -refresh"));
+ok(! system(@command));
+ok(! system(@command, "--refresh"));
 
 $blob = readfile("t/tmp/out/meme.html");
 ok($blob =~ /<a href="(\.\/)?badger.html">badger<\/a>/m);
@@ -192,7 +205,7 @@ writefile("sorting.mdwn", "t/tmp/in",
        readfile("t/tmp/in/sorting.mdwn") .
        '[[!trailoptions sort="title" reverse="yes"]]'); 
 
-ok(! system("$command -refresh"));
+ok(! system(@command, "--refresh"));
 
 check_trail("add/a.html", "n=add/b p=");
 check_trail("add/b.html", "n=add/c p=add/a");
@@ -219,3 +232,5 @@ check_trail("sorting/ancient.html", "n=sorting/z/a p=sorting/a/b");
 check_trail("sorting/z/a.html", "n= p=sorting/ancient");
 
 ok(! system("rm -rf t/tmp"));
+
+done_testing();