From 0ebb43672526cfc2d3e9d04593c953468c1ffb93 Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Tue, 15 Dec 2015 10:47:15 +0100 Subject: Add -v switch to prove and skip tests if they can't work --- .travis.yml | 2 +- t/travis.t | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a1a34b..63c294c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ sudo: required install: - sudo bash t/travis-deps/install.sh - cpanm Text::Diff Capture::Tiny Test::Output -script: bash -c 'PROVE=`which prove`; sudo $PROVE t/*.t' +script: bash -c 'PROVE=`which prove`; sudo $PROVE -v t/*.t' diff --git a/t/travis.t b/t/travis.t index d740dee..7c23d98 100755 --- a/t/travis.t +++ b/t/travis.t @@ -55,10 +55,10 @@ SKIP: { # 11-16: Test local overrides is (run(cmd => [qw/ sboconfig -o /, "$RealBin/LO"]), "Setting LOCAL_OVERRIDES to $RealBin/LO...\n", 'setting LOCAL_OVERRIDES works'); +my $skip = 0; SKIP: { - my $skip = 0; if ($ENV{TEST_ONLINE} ne '1') { $skip = system(qw! touch /usr/sbo/repo/SLACKBUILDS.txt !) == 0 } - skip "Online testing disabled (TEST_ONLINE!=1) and could not create dummy SLACKBUILDS.txt", 13 if $skip; + skip "Online testing disabled (TEST_ONLINE!=1) and could not create dummy SLACKBUILDS.txt", 9 if $skip; is (run(cmd => [qw/ sbofind nonexistentslackbuild /]), <<"LOCAL", "sbofind finds local overrides"); Local: nonexistentslackbuild2 @@ -80,9 +80,21 @@ LOCAL my ($output, $ret) = capture_merged { system(qw/bash -c/, "$^X -I$lib $path/sboinstall nonexistentslackbuild2 <> 8; }; is ($ret, 1, "sboinstall nonexistentslackbuild2 has correct exit code"); is ($output, "Unable to locate nonexistentslackbuild3 in the SlackBuilds.org tree.\n", 'sboinstall nonexistentslackbuild2 has correct output'); +} # 19-23: Test sboupgrade --all +SKIP: { + my @files = glob("/var/log/packages/nonexistentslackbuild-*"); + skip 'nonexistentslackbuild not installed', 1 if @files == 0; + is (system(qw!/sbin/removepkg nonexistentslackbuild!), 0, 'removepkging nonexistentslackbuild works'); +} +SKIP: { + skip "Online testing disabled (TEST_ONLINE!=1) and could not create dummy SLACKBUILDS.txt", 4 if $skip; + + my @files = glob("/var/log/packages/nonexistentslackbuild-*"); + skip 'Cannot test if nonexistentslackbuild is already installed', 4 if @files; + is (system(qw!/sbin/installpkg nonexistentslackbuild-0.9-noarch-1_SBo.tgz!), 0, 'installpkg old version works'); like (run(cmd => [qw/ sboupgrade --all /]), qr/Checking for updated SlackBuilds.*nonexistentslackbuild added to upgrade queue.*Cleaning for nonexistentslackbuild/s, 'sboupgrade --all works'); -- cgit v1.2.3