diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2020-04-09 15:01:22 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2020-04-28 20:58:59 +0200 |
commit | 7e61200dc4867f5b25d44c0d4d62ebb6525be1fa (patch) | |
tree | 3b8f171b04f68474956f7a1f78559e16f34ad15f /t | |
parent | ef70ebb63a9ca9fb1215d0a0d5f46dbbfa82f6fd (diff) | |
download | urpmi-7e61200dc4867f5b25d44c0d4d62ebb6525be1fa.tar urpmi-7e61200dc4867f5b25d44c0d4d62ebb6525be1fa.tar.gz urpmi-7e61200dc4867f5b25d44c0d4d62ebb6525be1fa.tar.bz2 urpmi-7e61200dc4867f5b25d44c0d4d62ebb6525be1fa.tar.xz urpmi-7e61200dc4867f5b25d44c0d4d62ebb6525be1fa.zip |
describe more tests to help pinpoint regressions
Diffstat (limited to 't')
-rw-r--r-- | t/cfg.t | 10 | ||||
-rw-r--r-- | t/helper.pm | 10 | ||||
-rw-r--r-- | t/superuser--addmedia.t | 2 | ||||
-rw-r--r-- | t/superuser--buggy-rpms.t | 2 | ||||
-rw-r--r-- | t/superuser--exclude.t | 4 | ||||
-rw-r--r-- | t/superuser--http.t | 8 | ||||
-rw-r--r-- | t/superuser--mirrorlist.t | 4 | ||||
-rw-r--r-- | t/superuser--rpmnew.t | 6 | ||||
-rw-r--r-- | t/superuser--specify-media.t | 4 |
9 files changed, 25 insertions, 25 deletions
@@ -38,11 +38,11 @@ close $f; my $config = urpm::cfg::load_config($file); ok( ref $config, 'config loaded' ); -is($config->{global}{downloader}, 'wget'); -ok(my ($update_2) = grep { $_->{name} eq 'update_2' } @{$config->{media}}); -is($update_2->{url}, 'ftp://foo/bar/'); -ok(my ($update_1) = grep { $_->{name} eq 'update 1' } @{$config->{media}}); -is($update_1->{url}, 'http://foo/bar/' . urpm::cfg::get_release()); +is($config->{global}{downloader}, 'wget', 'config is wget'); +ok(my ($update_2) = (grep { $_->{name} eq 'update_2' } @{$config->{media}}), 'update_2 medium exists'); +is($update_2->{url}, 'ftp://foo/bar/', 'url is ftp'); +ok(my ($update_1) = (grep { $_->{name} eq 'update 1' } @{$config->{media}}), 'update_1 medium exists'); +is($update_1->{url}, 'http://foo/bar/' . urpm::cfg::get_release(), 'url is http'); my $config_verbatim = urpm::cfg::load_config_raw($file, 1); ok( ref $config_verbatim, 'config loaded' ); diff --git a/t/helper.pm b/t/helper.pm index 21bc4c6e..d9a5b7e7 100644 --- a/t/helper.pm +++ b/t/helper.pm @@ -25,7 +25,7 @@ sub need_root_and_prepare() { -d 'media' or die "02create_pkgs.t not done\n"; system('rm -rf root'); - isnt(-d 'root', "test root dir can not be removed $!"); + isnt(-d 'root', "test root dir can not be removed $!", "creating chroot"); system('mkdir -p root/etc/rpm'); system('echo "%_pkgverify_level none" >root/etc/rpm/macros'); $using_root = 1; @@ -117,7 +117,7 @@ sub urpmi_cfg() { sub set_urpmi_cfg_global_options { my ($options) = @_; require_ok('urpm::cfg'); - ok(my $config = urpm::cfg::load_config(urpmi_cfg())); + ok(my $config = urpm::cfg::load_config(urpmi_cfg()), "loading urpmi config"); $config->{global} = $options; ok(urpm::cfg::dump_config(urpmi_cfg(), $config), 'set_urpmi_cfg_global_options'); } @@ -143,16 +143,16 @@ sub system_should_fail { sub check_installed_fullnames { my (@names) = @_; - is(`rpm -qa --qf '%{NVR}\\n' --root $::pwd/root | sort`, join('', map { "$_\n" } sort(@names))); + is(`rpm -qa --qf '%{NVR}\\n' --root $::pwd/root | sort`, join('', map { "$_\n" } sort(@names)), 'pkgs are installed (fullnames)'); } sub check_installed_names { my (@names) = @_; - is(`rpm -qa --qf '%{name}\\n' --root $::pwd/root | sort`, join('', map { "$_\n" } sort(@names))); + is(`rpm -qa --qf '%{name}\\n' --root $::pwd/root | sort`, join('', map { "$_\n" } sort(@names)), 'pkgs are installed (fullnames)'); } sub check_nothing_installed() { - is(`rpm -qa --root $::pwd/root`, ''); + is(`rpm -qa --root $::pwd/root`, '', 'nothing is installed'); } sub check_installed_and_remove { diff --git a/t/superuser--addmedia.t b/t/superuser--addmedia.t index ffe2ff14..51bd4cb5 100644 --- a/t/superuser--addmedia.t +++ b/t/superuser--addmedia.t @@ -132,7 +132,7 @@ sub try_distrib_removable_ { sub check_conf { my (@want) = @_; my $config = urpm::cfg::load_config("root/etc/urpmi/urpmi.cfg"); - is(int(@{$config->{media}}), int(@want)); + is(int(@{$config->{media}}), int(@want), 'have wanted number'); foreach my $i (0 .. $#want) { my ($medium, $want) = ($config->{media}[$i], $want[$i]); foreach my $field (@fields) { diff --git a/t/superuser--buggy-rpms.t b/t/superuser--buggy-rpms.t index 256f45f8..6f4d1ba0 100644 --- a/t/superuser--buggy-rpms.t +++ b/t/superuser--buggy-rpms.t @@ -21,5 +21,5 @@ foreach (@pkgs) { is($?, 2 << 8, "urpmi $_"); my $verif = URPM::verify_signature($_); - ok($verif =~ /NOT OK/); + ok($verif =~ /NOT OK/, 'signature is OK'); } diff --git a/t/superuser--exclude.t b/t/superuser--exclude.t index a59a2c32..a2ab10b2 100644 --- a/t/superuser--exclude.t +++ b/t/superuser--exclude.t @@ -42,7 +42,7 @@ sub set_install_langs_macro { mkdir "$::pwd/root/etc/rpm"; my $macros_file = "$::pwd/root/etc/rpm/macros"; system("echo \%_install_langs $langs > $macros_file"); - ok(-e $macros_file); + ok(-e $macros_file, "macros file exists"); } sub test_rpm_cmdline { @@ -58,7 +58,7 @@ sub test_urpmi_cmdline { my ($option, $want) = @_; urpmi("$option $name"); - check("urpmi $option", $want); + check("urpmi $option", $want), "have $want"; urpme($name); check('rpm -e', []); } diff --git a/t/superuser--http.t b/t/superuser--http.t index ba74e54c..84a1924a 100644 --- a/t/superuser--http.t +++ b/t/superuser--http.t @@ -44,12 +44,12 @@ sub test_exotic_medium_name { # test urpmf/urpmq using info.xml.lzma as user mkdir 'root/tmp'; chmod 0777, 'root/tmp'; - is(run_urpm_cmd_as_user('urpmf --sourcerpm .'), "various:various-1-1.src.rpm\n"); - is(run_urpm_cmd_as_user('urpmq --sourcerpm various'), "various: various-1-1.src.rpm\n"); + is(run_urpm_cmd_as_user('urpmf --sourcerpm .'), "various:various-1-1.src.rpm\n", 'urpmf --sourcerpm works as user'); + is(run_urpm_cmd_as_user('urpmq --sourcerpm various'), "various: various-1-1.src.rpm\n", 'urpmq --sourcerpm works as user'); # test urpmf/urpmq using info.xml.lzma as root - is(run_urpm_cmd('urpmf --sourcerpm .'), "various:various-1-1.src.rpm\n"); - is(run_urpm_cmd('urpmq --sourcerpm various'), "various: various-1-1.src.rpm\n"); + is(run_urpm_cmd('urpmf --sourcerpm .'), "various:various-1-1.src.rpm\n", 'urpmf --sourcerpm works as root'); + is(run_urpm_cmd('urpmq --sourcerpm various'), "various: various-1-1.src.rpm\n", 'urpmq --sourcerpm works as root'); urpmi($name); check_installed_fullnames("$name-1-1"); diff --git a/t/superuser--mirrorlist.t b/t/superuser--mirrorlist.t index 2ebbfd7f..26cbc3fd 100644 --- a/t/superuser--mirrorlist.t +++ b/t/superuser--mirrorlist.t @@ -21,9 +21,9 @@ need_root_and_prepare(); need_downloader(); urpmi_addmedia('--mirrorlist \$MIRRORLIST core media/core/release'); -is(run_urpm_cmd('urpmq sed'), "sed\n"); +is(run_urpm_cmd('urpmq sed'), "sed\n", "is sed available"); urpmi_removemedia('core'); urpmi_addmedia('--distrib --mirrorlist \$MIRRORLIST'); -is(run_urpm_cmd('urpmq sed'), "sed\n"); +is(run_urpm_cmd('urpmq sed'), "sed\n", "is sed available"); urpmi_removemedia('-a'); diff --git a/t/superuser--rpmnew.t b/t/superuser--rpmnew.t index cb6e3e31..18012cd6 100644 --- a/t/superuser--rpmnew.t +++ b/t/superuser--rpmnew.t @@ -60,9 +60,9 @@ sub test3 { check_one_content('<removed>', 'config.rpmorig', 'foo'); check_one_content('<removed>', 'config-noreplace.rpmsave', 'foo'); check_one_content('<removed>', 'config-noreplace.rpmnew', 'changed'); - ok(unlink "$::pwd/root/etc/config.rpmorig"); - ok(unlink "$::pwd/root/etc/config-noreplace.rpmsave"); - ok(unlink "$::pwd/root/etc/config-noreplace.rpmnew"); + ok(unlink("$::pwd/root/etc/config.rpmorig"), 'unlink .rpmorig'); + ok(unlink("$::pwd/root/etc/config-noreplace.rpmsave"), 'unlink .rpmsave'); + ok(unlink("$::pwd/root/etc/config-noreplace.rpmnew"), 'unlink .rpmnew'); check_no_etc_files(); } diff --git a/t/superuser--specify-media.t b/t/superuser--specify-media.t index 8381582b..32a143df 100644 --- a/t/superuser--specify-media.t +++ b/t/superuser--specify-media.t @@ -37,7 +37,7 @@ sub test_urpmq { my @l = run_urpm_cmd("urpmq $para --sources $name"); foreach my $dir (@wanted) { my $found = shift @l; - is(dirname($found), $dir); + is(dirname($found), $dir, "directory $dir found"); } } @@ -49,7 +49,7 @@ sub test_urpmi { $s =~ s/^SECURITY: NOT checking package.*//m; ok($s =~ m!^installing $name\S* from $wanted$!m, "$wanted in <<'$s'>>"); - isnt($s =~ m!\Q$bad/!, "$bad not in $s"); + isnt($s =~ m!\Q$bad/!, "$bad not in $s", "$bad not in output"); urpme($name); } |