aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SBO-Lib/lib/SBO/Lib/Readme.pm2
-rwxr-xr-xt/07-fail.t27
2 files changed, 16 insertions, 13 deletions
diff --git a/SBO-Lib/lib/SBO/Lib/Readme.pm b/SBO-Lib/lib/SBO/Lib/Readme.pm
index a16bb49..c5fb95c 100644
--- a/SBO-Lib/lib/SBO/Lib/Readme.pm
+++ b/SBO-Lib/lib/SBO/Lib/Readme.pm
@@ -174,7 +174,7 @@ sub user_prompt {
my ($sbo, $location) = @_;
if (not defined $location) { usage_error("Unable to locate $sbo in the SlackBuilds.org tree."); }
my $readme = get_readme_contents($location);
- usage_error("Could not open README for $sbo.") unless defined $readme;
+ return "Could not open README for $sbo.", undef, _ERR_OPENFH if not defined $readme;
if (is_local($sbo)) { print "\nFound $sbo in local overrides.\n"; }
# check for user/group add commands, offer to run any found
my $user_group = get_user_group($readme);
diff --git a/t/07-fail.t b/t/07-fail.t
index b4b75eb..a7d2a45 100755
--- a/t/07-fail.t
+++ b/t/07-fail.t
@@ -128,14 +128,17 @@ sboinstall 'malformed-info', { input => "y\ny\nn", expected => qr!Failures:\n m
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 };
sboinstall 'malformed-info3', { exit => 2, expected => "A fatal script error has occurred:\nerror when parsing malformed-info3.info file. Line: FAIL\nExiting.\n" };
-# 14: Malformed slackbuild - no readme
-sboinstall 'malformed-readme', { expected => "Could not open README for malformed-readme.\n", exit => 1 };
+# 14-15: Malformed slackbuild - no readme
+sboinstall 'malformed-readme', { expected => "Unable to open README for malformed-readme.\n", exit => 6 };
+sboinstall qw/ -r malformed-readme /, { test => 0 };
+sboupgrade qw/ -f malformed-readme /, { expected => "Unable to open README for malformed-readme.\n", exit => 6 };
+sboremove 'malformed-readme', { input => "y\ny", test => 0 };
-# 15: Malformed slackbuild - no .SlackBuild
+# 16: 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 };
-# 16: Multilib fails - no multilib
+# 17: 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";
@@ -144,7 +147,7 @@ SKIP: {
sboremove 'nonexistentslackbuild', { input => "y\ny", test => 0 };
}
-# 17: Multilib fails - no convertpkg
+# 18: 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";
@@ -153,7 +156,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 };
}
-# 18: Multilib fails - convertpkg fail
+# 19: 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};
@@ -163,18 +166,18 @@ 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 };
}
-# 19: Slackbuild exits 0 but doesn't create a package
+# 20: 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 };
-# 20: Slackbuild fails, but we still want to continue with the queue
+# 21: 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 };
-# 21: Slackbuild fails during noninteractive run
+# 22: Slackbuild fails during noninteractive run
sboinstall qw/ -r failingslackbuild /, { expected => qr/Failures:\n failingslackbuild: failingslackbuild.SlackBuild return non-zero\n/, exit => 3 };
-# 22-24: Slackbuild with %README% req without a readme
-sboinstall qw/ -r noreadmebutreadmereq /;
+# 23-24: Slackbuild with %README% req without a readme
+sboinstall qw/ -r noreadmebutreadmereq /, { test => 0 };
sboremove qw/ noreadmebutreadmereq /, { input => "y\nn", expected => qr/Unable to open README for noreadmebutreadmereq[.]/s, exit => 0 };
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 };
@@ -203,7 +206,7 @@ SKIP: {
skip "No /etc/profile.d/32dev.sh", 1 unless -e "/etc/profile.d/32dev.sh";
skip "No /usr/sbin/convertpkg-compat32", 1 unless -e "/usr/sbin/convertpkg-compat32";
- sboinstall qw/ -p malformed-readme /, { exit => 1, expected => qr!Could not open README for malformed-readme[.]! };
+ sboinstall qw/ -p malformed-readme /, { expected => sub { m/\QUnable to open README for malformed-readme.\E\n/ and m/\Qmalformed-readme-compat32 requires malformed-readme.\E\n/ }, exit => 6 };
}
# 27: sboupgrade with -r and -z