diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 21:06:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 21:06:40 +0000 |
commit | d827c6cf1631209f5042a9d1d8a7ecc24223c8a0 (patch) | |
tree | 91a431d301efd0e524bdfb0c46e97d591a9d7b03 /t/buildsystems/06-buildsystem-mkdir-rmdir.t | |
parent | Initial commit. (diff) | |
download | debhelper-317edf61ca7b4a9acdf8a38e4b634bad6c07ddf6.tar.xz debhelper-317edf61ca7b4a9acdf8a38e4b634bad6c07ddf6.zip |
Adding upstream version 13.11.4.upstream/13.11.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/buildsystems/06-buildsystem-mkdir-rmdir.t')
-rwxr-xr-x | t/buildsystems/06-buildsystem-mkdir-rmdir.t | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/t/buildsystems/06-buildsystem-mkdir-rmdir.t b/t/buildsystems/06-buildsystem-mkdir-rmdir.t new file mode 100755 index 0000000..c13b253 --- /dev/null +++ b/t/buildsystems/06-buildsystem-mkdir-rmdir.t @@ -0,0 +1,51 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Cwd; +use Test::More tests => 6; + +use File::Temp qw(tempdir); +use File::Basename qw(dirname); +use lib dirname(dirname(__FILE__)); +use File::Path qw(make_path); +use Test::DH; +use Debian::Debhelper::Dh_Lib qw(!dirname); +use Debian::Debhelper::Buildsystem; + +chdir(dirname($0)) or die("chdir: $!"); +my $TEMP_DIR = tempdir('tmp.XXXXXXX', CLEANUP => 1); +my $sourcedir = $TEMP_DIR; +my $builddir = "${TEMP_DIR}/build"; +my $BS_CLASS = 'Debian::Debhelper::Buildsystem'; + +# Tests + +do_rmdir_builddir($sourcedir, $builddir); +ok ( ! -e $builddir, "testing rmdir_builddir() 1: builddir parent '$builddir' deleted" ); +ok ( -d $sourcedir, "testing rmdir_builddir() 1: sourcedir '$sourcedir' remains" ); + +$builddir = "$sourcedir/bld"; +do_rmdir_builddir($sourcedir, "$builddir/dir"); +ok ( ! -e $builddir, "testing rmdir_builddir() 2: builddir parent '$builddir' deleted" ); +ok ( -d $sourcedir, "testing rmdir_builddir() 2: sourcedir '$sourcedir' remains" ); + +$builddir = "$sourcedir/bld"; + +make_path($builddir, "$builddir/dir"); +create_empty_file("$builddir/afile"); +create_empty_file("$builddir/dir/afile2"); +do_rmdir_builddir($sourcedir, "$builddir/dir"); +ok ( ! -e "$builddir/dir", "testing rmdir_builddir() 3: builddir '$builddir/dir' not empty, but deleted" ); +ok ( -d $builddir, "testing rmdir_builddir() 3: builddir parent '$builddir' not empty, remains" ); + + +### Test Buildsystem::rmdir_builddir() +sub do_rmdir_builddir { + my ($sourcedir, $builddir) = @_; + my $system; + $system = $BS_CLASS->new(builddir => $builddir, sourcedir => $sourcedir); + $system->mkdir_builddir(); + $system->rmdir_builddir(); +} + |