diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-12-31 17:09:55 +0100 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-12-31 22:52:46 +0100 |
commit | bf3417815e57d71e307b7b1d65ebfdaa46162f92 (patch) | |
tree | 28ce8e425201090f8b5151f0a7ff22d4f0b7b2a4 /t/fail.t | |
parent | b50e3a707b9c040af8a6b574436e765323ebf50e (diff) | |
download | sbotools2-bf3417815e57d71e307b7b1d65ebfdaa46162f92.tar.xz |
Add tests for malformed slackbuilds. See #23
Diffstat (limited to 't/fail.t')
-rwxr-xr-x | t/fail.t | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -11,7 +11,7 @@ use lib "$RealBin/../SBO-Lib/lib"; use Test::Execute; if ($ENV{TEST_INSTALL}) { - plan tests => 9; + plan tests => 13; } else { plan skip_all => 'Only run these tests if TEST_INSTALL=1'; } @@ -31,6 +31,10 @@ sub cleanup { unlink "$RealBin/LO-fail/nonexistentslackbuild2/perf.dummy"; unlink "$RealBin/LO-fail/nonexistentslackbuild3/perf.dummy"; 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-readme/perf.dummy"; + unlink "$RealBin/LO-fail/malformed-slackbuild/perf.dummy"; system(qw!rm -rf /tmp/SBo/failingslackbuild-1.0!); system(qw!rm -rf /tmp/SBo/failingslackbuild2-1.0!); system(qw!rm -rf /tmp/SBo/failingdownload-1.0!); @@ -41,6 +45,10 @@ sub cleanup { system(qw!rm -rf /tmp/SBo/nonexistentslackbuild2-1.0!); system(qw!rm -rf /tmp/SBo/nonexistentslackbuild3-1.0!); 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-readme-1.0!); + system(qw!rm -rf /tmp/SBo/malformed-slackbuild-1.0!); system(qw!rm -rf /tmp/package-failingslackbuild!); system(qw!rm -rf /tmp/package-failingslackbuild2!); system(qw!rm -rf /tmp/package-failingdownload!); @@ -51,6 +59,10 @@ sub cleanup { system(qw!rm -rf /tmp/package-nonexistentslackbuild2!); system(qw!rm -rf /tmp/package-nonexistentslackbuild3!); 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-readme!); + system(qw!rm -rf /tmp/package-malformed-slackbuild!); }; } @@ -116,6 +128,19 @@ SKIP: { script (qw/ sboinstall failingmd5sum2 /, { input => "y\ny\ny\nn", expected => qr!Failures:\n!, exit => 4 }); } +# 10: Malformed slackbuild - no .info +script (qw/ 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 +script (qw/ 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 }); + +# 12: Malformed slackbuild - no readme +script (qw/ 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 +script (qw/ sboinstall malformed-slackbuild /, + { input => "y\ny", expected => qr!\QFailures:\n malformed-slackbuild: Unable to backup $RealBin/LO-fail/malformed-slackbuild/malformed-slackbuild.SlackBuild to $RealBin/LO-fail/malformed-slackbuild/malformed-slackbuild.SlackBuild.orig\E!, exit => 6 }); + # Cleanup END { set_lo('delete'); |