commit a9c729dacf81b877ce2bec4b7ba108d306d78bd9
parent abebe65b09f21b98e246e2bdf51491bc5fc1edf6
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date: Sun, 8 May 2016 13:56:04 +0200
21-pkg-dir.t: add tests for making pkg dir
Diffstat:
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git 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();