build: Add support for compiler analyzer flags
[dpkg.git] / scripts / t / Dpkg_Source_Package.t
blob509e422e2313261fd61f794e4b8ab896a03a84e9
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;
20 use Test::Dpkg qw(:paths :needs);
22 use File::Compare;
24 use Dpkg::ErrorHandling;
25 use Dpkg::OpenPGP::ErrorCodes;
27 test_needs_openpgp_backend();
29 plan tests => 6;
31 use_ok('Dpkg::Source::Package');
33 report_options(quiet_warnings => 1);
35 my $datadir = test_get_data_path();
36 my $tmpdir = test_get_temp_path();
37 my $ascfile;
39 my $p = Dpkg::Source::Package->new();
41 $ascfile = "$tmpdir/package_1.0.orig.tar.enoent";
42 is($p->armor_original_tarball_signature("$datadir/nonexistent", $ascfile),
43 undef, 'no conversion of inexistent file');
45 $ascfile = "$tmpdir/package_1.0.orig.tar.sig2asc";
46 is($p->armor_original_tarball_signature("$datadir/package_1.0.orig.tar.sig", $ascfile),
47 OPENPGP_OK, 'conversion from binary sig to armored asc');
49 ok(compare($ascfile, "$datadir/package_1.0.orig.tar.asc") == 0,
50 'binary signature converted to OpenPGP ASCII Armor');
52 # Grab the output messages.
53 eval {
54 $ascfile = "$tmpdir/package_1.0.orig.tar.asc2asc";
55 is($p->armor_original_tarball_signature("$datadir/package_1.0.orig.tar.asc", $ascfile),
56 OPENPGP_OK, 'copy instead of converting already armored input');
59 ok(compare($ascfile, "$datadir/package_1.0.orig.tar.asc") == 0,
60 'OpenPGP ASCII Armor copied to destination');
62 # TODO: Add actual test cases.