dpkg-buildtree: New program
[dpkg.git] / scripts / t / Dpkg_BuildTree.t
blobbaef2aa5e6e9287a274701d7703c022d5afe82a3
1 #!/usr/bin/perl
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 use strict;
17 use warnings;
19 use Test::More tests => 11;
20 use Test::Dpkg qw(:paths);
22 use Cwd qw(realpath);
23 use File::Path qw(make_path rmtree);
24 use File::Spec::Functions qw(abs2rel);
26 use Dpkg::File;
28 use_ok('Dpkg::BuildTree');
30 my $tmpdir = test_get_temp_path();
32 make_path("$tmpdir/debian/tmp");
34 my @srcfiles = qw(
35 changelog
36 control
37 copyright
38 shlibs.local
41 my @genfiles = qw(
42 files
43 files.new
44 substvars
45 substvars.new
46 tmp/build-object
47 tmp/generated
50 foreach my $file (@srcfiles, @genfiles) {
51 file_touch("$tmpdir/debian/$file");
54 my $bt = Dpkg::BuildTree->new(dir => $tmpdir);
56 $bt->clean();
58 foreach my $srcfile (@srcfiles) {
59 ok(-e "$tmpdir/debian/$srcfile", "source file $tmpdir/$srcfile exists");
62 foreach my $genfile (@genfiles) {
63 ok(! -e "$tmpdir/debian/$genfile", "generated file $tmpdir/$genfile does not exist");