* Modified page.tmpl to to set html lang= and dir= when
values have been specified for them, which the po plugin does.
+ [ Simon McVittie ]
+ * Run autopkgtest tests using autodep8 and the pkg-perl team's
+ infrastructure
+
-- Simon McVittie <smcv@debian.org> Mon, 15 Jun 2015 18:13:23 +0100
ikiwiki (3.20150614) unstable; urgency=medium
Standards-Version: 3.9.5
Homepage: http://ikiwiki.info/
Vcs-Git: git://git.ikiwiki.info/
+Testsuite: autopkgtest-pkg-perl
Package: ikiwiki
Architecture: all
--- /dev/null
+INSTALLED_TESTS=1
--- /dev/null
+IkiWiki/Plugin/amazon_s3.pm
+IkiWiki/Plugin/cvs.pm
+IkiWiki/Plugin/monotone.pm
+IkiWiki/Plugin/po.pm
#!/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) {
ok(! system("rm -rf t/tmp/out t/basewiki_brokenlinks/.ikiwiki"));
}
ok(! system("rm -rf t/tmp"));
+
+done_testing();
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More 'no_plan';
+use Test::More;
use IkiWiki;
ok(! system("rm -rf 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;
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
my $content = slurp("t/tmp/out/post/index.html");
ok(defined $content);
ok($content =~ m/I conquered.*I explored.*I landed/s);
+
+done_testing();
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 {
use Test::More; my $total_tests = 72;
use IkiWiki;
+my $installed = $ENV{INSTALLED_TESTS};
+
my $default_test_methods = '^test_*';
my @required_programs = qw(
cvs
$config{wrapper} = $config{cvs_wrapper};
require IkiWiki::Wrapper;
- {
- no warnings 'once';
+ if ($installed) {
$IkiWiki::program_to_wrap = 'ikiwiki.out';
- # XXX substitute its interpreter to Makefile's $(PERL)
- # XXX best solution: do this to all scripts during build
}
+ else {
+ $IkiWiki::program_to_wrap = `which ikiwiki`;
+ }
+ # XXX substitute its interpreter to Makefile's $(PERL)
+ # XXX best solution: do this to all scripts during build
IkiWiki::gen_wrapper();
my $cvs = "cvs -d $config{cvsrepo}";
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);
use IkiWiki;
+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 img t/tmp/in t/tmp/out --verbose);
+
my $magick = new Image::Magick;
my $SVGS_WORK = defined $magick->QueryFormat("svg");
);
ok(utime(333333333, 333333333, "t/tmp/in/imgconversions.mdwn"));
-ok(! system("make -s ikiwiki.out"));
-
-my $command = "perl -I. ./ikiwiki.out --set usedirs=0 --templatedir=templates --plugin img t/tmp/in t/tmp/out --verbose";
-
-ok(! system($command));
+ok(! system(@command));
sub size($) {
my $filename = shift;
if (1) { # for easier testing
writefile("imgconversions.mdwn", "t/tmp/in", "nothing to see here");
- ok(! system("$command --refresh"));
+ ok(! system(@command, "--refresh"));
ok(! -e "$outpath/10x-simple.png");
ok(! -e "$outpath/10x-simple-svg.png");
use Test::More;
use IkiWiki;
+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 inline
+ --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi
+ --rss --atom t/tmp/in t/tmp/out --verbose);
+
my $blob;
my $add_new_post = gettext("Add a new post titled:");
write_old_file("$page.mdwn", "this page is {$page}");
}
-ok(! system("make -s ikiwiki.out"));
-
-my $command = "perl -I. ./ikiwiki.out --set usedirs=0 --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/protagonists.html");
like($blob, qr{\Q$add_new_post\E}, 'rootpage=yes gives postform');
my $srcdir = "$tmp/in";
my $destdir = "$tmp/out";
-my @command = (qw(./ikiwiki.out --plugin meta --disable-plugin htmlscrubber));
-push @command, qw(-underlaydir=underlays/basewiki);
-push @command, qw(-set underlaydirbase=underlays);
-push @command, qw(--templatedir=templates);
+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(--plugin meta --disable-plugin htmlscrubber);
push @command, $srcdir, $destdir;
sub write_build_read_compare {
#!/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("rm -rf t/tmp"));
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();
"XML::Feed and/or HTML::Parser or File::MimeInfo not available"};
}
else {
- eval q{use Test::More tests => 136};
+ eval q{use Test::More tests => 137};
}
}
use Cwd;
use File::Basename;
+my $installed = $ENV{INSTALLED_TESTS};
+
+my @base_command;
+if ($installed) {
+ ok(1, "running installed");
+ @base_command = qw(ikiwiki);
+}
+else {
+ ok(! system("make -s ikiwiki.out"));
+ @base_command = qw(perl -I. ./ikiwiki.out
+ --underlaydir=underlays/basewiki
+ --set underlaydirbase=underlays
+ --templatedir=templates);
+}
+
my $tmp = 't/tmp';
my $statedir = 't/tinypodcast/.ikiwiki';
my $podcast_style = shift;
my $baseurl = 'http://example.com';
- my @command = (qw(./ikiwiki.out --plugin inline --rss --atom));
- push @command, qw(-underlaydir=underlays/basewiki);
- push @command, qw(-set underlaydirbase=underlays --templatedir=templates);
+ my @command = (@base_command, qw(--plugin inline --rss --atom));
push @command, "--url=$baseurl", qw(t/tinypodcast), "$tmp/out";
ok(! system("mkdir $tmp"),
}
sub single_page_html {
- my @command = (qw(./ikiwiki.out));
- push @command, qw(-underlaydir=underlays/basewiki);
- push @command, qw(-set underlaydirbase=underlays --templatedir=templates);
+ my @command = @base_command;
push @command, qw(t/tinypodcast), "$tmp/out";
ok(! system("mkdir $tmp"),
}
sub inlined_pages_html {
- my @command = (qw(./ikiwiki.out --plugin inline));
- push @command, qw(-underlaydir=underlays/basewiki);
- push @command, qw(-set underlaydirbase=underlays --templatedir=templates);
+ my @command = (@base_command, qw(--plugin inline));
push @command, qw(t/tinypodcast), "$tmp/out";
ok(! system("mkdir $tmp"),
# Black-box (ish) test for relative linking between CGI and static content
+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);
+}
+
sub parse_cgi_content {
my $content = shift;
my %bits;
wikiname: this is the name of my wiki
srcdir: t/tmp/in
destdir: t/tmp/out
-templatedir: templates
$urlline
cgiurl: $args{cgiurl}
$w3mmodeline
sub thoroughly_rebuild {
ok(unlink("t/tmp/ikiwiki.cgi") || $!{ENOENT});
- ok(! system("./ikiwiki.out --setup t/tmp/test.setup --rebuild --wrappers"));
+ ok(! system(@command, qw(--setup t/tmp/test.setup --rebuild --wrappers)));
}
sub check_cgi_mode_bits {
}
sub test_startup {
- ok(! system("make -s ikiwiki.out"));
ok(! system("rm -rf t/tmp"));
ok(! system("mkdir t/tmp"));
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
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);
#!/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: $!";
$file=~s/templates\///;
ok($page =~ /\Q$file\E/, "$file documented on doc/templates.mdwn");
}
+
+done_testing();
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More 'no_plan';
+use Test::More;
use IkiWiki;
sub check_trail {
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 {
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);
writefile("untrail.mdwn", "t/tmp/in", "no longer a trail");
-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");
check_no_trail("untrail/b.html");
ok(! system("rm -rf t/tmp"));
+
+done_testing();
use File::Find;
use Test::More;
+plan(skip_all => 'running installed') if $ENV{INSTALLED_TESTS};
+
plan(skip_all => "XML::Parser not available")
unless eval q{use XML::Parser (); 1;};