diff options
-rwxr-xr-x | t/07-fail.t | 28 | ||||
-rw-r--r-- | t/LO-fail/malformed-info2/README | 1 | ||||
-rw-r--r-- | t/LO-fail/malformed-info2/malformed-info2.SlackBuild | 15 | ||||
-rw-r--r-- | t/LO-fail/malformed-info2/malformed-info2.info | 5 |
4 files changed, 37 insertions, 12 deletions
diff --git a/t/07-fail.t b/t/07-fail.t index 8e301a1..acc56a4 100755 --- a/t/07-fail.t +++ b/t/07-fail.t @@ -11,7 +11,7 @@ use Test::Sbotools qw/ make_slackbuilds_txt set_lo set_repo sboinstall sboremove use File::Temp 'tempdir'; if ($ENV{TEST_INSTALL}) { - plan tests => 23; + plan tests => 24; } else { plan skip_all => 'Only run these tests if TEST_INSTALL=1'; } @@ -33,6 +33,7 @@ sub cleanup { unlink "$RealBin/LO-fail/nonexistentslackbuild4/perf.dummy"; unlink "$RealBin/LO-fail/malformed-noinfo/perf.dummy"; unlink "$RealBin/LO-fail/malformed-info/perf.dummy"; + unlink "$RealBin/LO-fail/malformed-info2/perf.dummy"; unlink "$RealBin/LO-fail/malformed-readme/perf.dummy"; unlink "$RealBin/LO-fail/malformed-slackbuild/perf.dummy"; unlink "$RealBin/LO-fail/multilibfail/perf.dummy"; @@ -50,6 +51,7 @@ sub cleanup { system(qw!rm -rf /tmp/SBo/nonexistentslackbuild4-1.0!); system(qw!rm -rf /tmp/SBo/malformed-noinfo-1.0!); system(qw!rm -rf /tmp/SBo/malformed-info-1.0!); + system(qw!rm -rf /tmp/SBo/malformed-info2-1.0!); system(qw!rm -rf /tmp/SBo/malformed-readme-1.0!); system(qw!rm -rf /tmp/SBo/malformed-slackbuild-1.0!); system(qw!rm -rf /tmp/SBo/multilibfail-1.0!); @@ -67,6 +69,7 @@ sub cleanup { system(qw!rm -rf /tmp/package-nonexistentslackbuild4!); system(qw!rm -rf /tmp/package-malformed-noinfo!); system(qw!rm -rf /tmp/package-malformed-info!); + system(qw!rm -rf /tmp/package-malformed-info2!); system(qw!rm -rf /tmp/package-malformed-readme!); system(qw!rm -rf /tmp/package-malformed-slackbuild!); system(qw!rm -rf /tmp/package-multilibfail!); @@ -116,17 +119,18 @@ SKIP: { # 10: Malformed slackbuild - no .info sboinstall 'malformed-noinfo', { expected => "A fatal script error has occurred:\nopen_fh, $RealBin/LO-fail/malformed-noinfo/malformed-noinfo.info is not a file\nExiting.\n", exit => 2 }; -# 11: Malformed slackbuild - malformed .info +# 11-12: Malformed slackbuild - malformed .info sboinstall 'malformed-info', { input => "y\ny\nn", expected => qr!Failures:\n malformed-info: Unable to get download info from $RealBin/LO-fail/malformed-info/malformed-info[.]info\n!, exit => 7 }; +sboinstall 'malformed-info2', { input => "y\ny\nn", expected => qr!Failures:\n malformed-info2: Unable to get download info from $RealBin/LO-fail/malformed-info2/malformed-info2[.]info\n!, exit => 7 }; -# 12: Malformed slackbuild - no readme +# 13: Malformed slackbuild - no readme sboinstall 'malformed-readme', { expected => "A fatal script error has occurred:\nopen_fh, $RealBin/LO-fail/malformed-readme/README is not a file\nExiting.\n", exit => 2 }; -# 13: Malformed slackbuild - no .SlackBuild +# 14: Malformed slackbuild - no .SlackBuild sboinstall 'malformed-slackbuild', { input => "y\ny", expected => qr!Failures:\n malformed-slackbuild: Unable to backup \Q$RealBin/LO-fail/malformed-slackbuild/malformed-slackbuild.SlackBuild to $RealBin/LO-fail/malformed-slackbuild/malformed-slackbuild.SlackBuild.orig\E!, exit => 6 }; -# 14: Multilib fails - no multilib +# 15: Multilib fails - no multilib SKIP: { skip "No multilib test only valid when TEST_MULTILIB=0", 1 unless $ENV{TEST_MULTILIB} == 0; skip "/etc/profile.d/32dev.sh exists", 1 if -e "/etc/profile.d/32dev.sh"; @@ -135,7 +139,7 @@ SKIP: { sboremove 'nonexistentslackbuild', { input => "y\ny", test => 0 }; } -# 15: Multilib fails - no convertpkg +# 16: Multilib fails - no convertpkg SKIP: { skip "No convertpkg test only valid when TEST_MULTILIB=1", 1 unless $ENV{TEST_MULTILIB} == 1; skip "/etc/profile.d/32dev.sh doesn't exist", 1 unless -e "/etc/profile.d/32dev.sh"; @@ -144,7 +148,7 @@ SKIP: { sboinstall qw/ -p nonexistentslackbuild /, { input => "y\ny\ny", expected => qr!Failures:\n nonexistentslackbuild-compat32: compat32 requires /usr/sbin/convertpkg-compat32[.]\n!, exit => 11 }; } -# 16: Multilib fails - convertpkg fail +# 17: Multilib fails - convertpkg fail SKIP: { skip "Multilib convertpkg fail test only valid if TEST_MULTILIB=2", 1 unless $ENV{TEST_MULTILIB} == 2; skip "This test is designed to be run in the Travis CI environment", 1 unless $ENV{TRAVIS}; @@ -154,22 +158,22 @@ SKIP: { sboinstall qw/ -p multilibfail /, { input => "y\ny\ny", expected => qr/Failures:\n multilibfail-compat32: convertpkg-compt32 returned non-zero exit status\n/, exit => 10 }; } -# 17: Slackbuild exits 0 but doesn't create a package +# 18: Slackbuild exits 0 but doesn't create a package sboinstall 'failingslackbuild3', { input => "y\ny", expected => qr/Failures:\n failingslackbuild3: failingslackbuild3.SlackBuild didn't create a package\n\z/, exit => 3 }; -# 18: Slackbuild fails, but we still want to continue with the queue +# 19: Slackbuild fails, but we still want to continue with the queue sboinstall 'nonexistentslackbuild2', { input => "y\ny\ny\ny", expected => qr/Failures:\n failingslackbuild: failingslackbuild.SlackBuild return non-zero\n/, exit => 0 }; sboremove 'nonexistentslackbuild2', { input => "y\ny", test => 0 }; -# 19: Slackbuild fails during noninteractive run +# 20: Slackbuild fails during noninteractive run sboinstall qw/ -r failingslackbuild /, { expected => qr/Failures:\n failingslackbuild: failingslackbuild.SlackBuild return non-zero\n/, exit => 3 }; -# 20-22: Slackbuild with %README% req without a readme +# 21-23: Slackbuild with %README% req without a readme sboinstall qw/ -r noreadmebutreadmereq /; sboremove qw/ noreadmebutreadmereq /, { input => 'y', expected => qr/fatal script error.*open_fh/s, exit => 2 }; sboremove qw/ noreadmebutreadmereq /, { input => "n\ny\ny", expected => qr/Display README.*Remove noreadme.*Added to remove queue.*Removing 1 pack.*noreadme.*All operations/s, exit => 0 }; -# 23: compat32 should fail for a perl sbo +# 24: compat32 should fail for a perl sbo SKIP: { skip "This test is designed to be run in the Travis CI environment", 1 unless $ENV{TRAVIS}; diff --git a/t/LO-fail/malformed-info2/README b/t/LO-fail/malformed-info2/README new file mode 100644 index 0000000..6d388bb --- /dev/null +++ b/t/LO-fail/malformed-info2/README @@ -0,0 +1 @@ +This doesn't exist! diff --git a/t/LO-fail/malformed-info2/malformed-info2.SlackBuild b/t/LO-fail/malformed-info2/malformed-info2.SlackBuild new file mode 100644 index 0000000..24c66a9 --- /dev/null +++ b/t/LO-fail/malformed-info2/malformed-info2.SlackBuild @@ -0,0 +1,15 @@ +#!/bin/bash +PRGNAM="malformed-info2" +VERSION=${VERSION:-1.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +TMP=${TMP:-/tmp/SBo} +OUTPUT=${OUTPUT:-/tmp} + +mkdir -p $TMP/$PRGNAM-$VERSION +cp README $TMP/$PRGNAM-$VERSION +mkdir -p $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION +cp README $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION +cd $OUTPUT/package-$PRGNAM + +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.tgz diff --git a/t/LO-fail/malformed-info2/malformed-info2.info b/t/LO-fail/malformed-info2/malformed-info2.info new file mode 100644 index 0000000..48d4ccb --- /dev/null +++ b/t/LO-fail/malformed-info2/malformed-info2.info @@ -0,0 +1,5 @@ +PRGNAM="malformed-info2" +VERSION="1.0" +DOWNLOAD="http://pink-mist.github.io/sbotools/testing/perf.dummy" +MAINTAINER="Andreas Guldstrand" +EMAIL="doesnt@matter.org" |