aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-05-08 13:56:04 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-05-08 13:56:04 +0200
commita9c729dacf81b877ce2bec4b7ba108d306d78bd9 (patch)
tree7d0babb93d45cfac930eb22e8e04b2f347c51e80 /t
parentabebe65b09f21b98e246e2bdf51491bc5fc1edf6 (diff)
downloadsbotools2-a9c729dacf81b877ce2bec4b7ba108d306d78bd9.tar.xz
21-pkg-dir.t: add tests for making pkg dir
Diffstat (limited to 't')
-rwxr-xr-xt/21-pkg-dir.t24
1 files changed, 23 insertions, 1 deletions
diff --git a/t/21-pkg-dir.t b/t/21-pkg-dir.t
index 1a1f36e..db44118 100755
--- a/t/21-pkg-dir.t
+++ b/t/21-pkg-dir.t
@@ -11,7 +11,7 @@ use Test::Sbotools qw/ set_pkg_dir make_slackbuilds_txt set_lo sboconfig sboinst
use File::Temp 'tempdir';
if ($ENV{TEST_INSTALL}) {
- plan tests => 7;
+ plan tests => 10;
} else {
plan skip_all => 'Only run these tests if TEST_INSTALL=1';
}
@@ -56,6 +56,28 @@ sboinstall 'nonexistentslackbuild4', { input => "y\ny\ny", expected => sub { /\Q
ok (-f "$pkgdir/nonexistentslackbuild4-1.1-noarch-1_SBo.tgz", 'nonexistentslackbuild4-1.1-noarch-1_SBo.tgz is in PKG_DIR');
ok (-f "$pkgdir/nonexistentslackbuild5-1.1-noarch-1_SBo.tgz", 'nonexistentslackbuild5-1.1-noarch-1_SBo.tgz is in PKG_DIR');
+capture_merged {
+ system(qw/ rm -rf /, $pkgdir);
+ system(qw! /sbin/removepkg nonexistentslackbuild !);
+};
+
+# 8-9: make sure PKG_DIR gets recreated
+sboinstall 'nonexistentslackbuild', { input => "y\ny", expected => qr!\Qnonexistentslackbuild-1.1-noarch-1_SBo.tgz stored in $pkgdir! };
+ok (-f "$pkgdir/nonexistentslackbuild-1.1-noarch-1_SBo.tgz", 'nonexistentslackbuild-1.1-noarch-1_SBo.tgz is in PKG_DIR');
+
+capture_merged {
+ system(qw/ rm -rf /, $pkgdir );
+ system(qw! /sbin/removepkg nonexistentslackbuild !);
+ system('touch', $pkgdir);
+};
+
+# 10: creating PKG_DIR should fail properly
+sboinstall 'nonexistentslackbuild', { input => "y\ny", expected => sub { /\QUnable to create $pkgdir/ and /\Qnonexistentslackbuild-1.1-noarch-1_SBo.tgz left in / } };
+
+capture_merged {
+ system('rm', $pkgdir);
+};
+
# Cleanup
END {
cleanup();