diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-05-02 13:52:04 +0000 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-05-02 13:52:09 +0000 |
commit | e8a510edbc57a2ab2ada5b6d35e8d153116a3350 (patch) | |
tree | 152f6b03a0e6fb53f1076709ae5330ce56ed56a0 /t/02-travis.t | |
parent | 2890e10823a93af5d8c0fa68f8c40029c405556d (diff) | |
download | sbotools2-e8a510edbc57a2ab2ada5b6d35e8d153116a3350.tar.xz |
02-travis.t: rewrite to use Test::Sbotools
Diffstat (limited to 't/02-travis.t')
-rwxr-xr-x | t/02-travis.t | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/t/02-travis.t b/t/02-travis.t index 31f2f62..86cfba4 100755 --- a/t/02-travis.t +++ b/t/02-travis.t @@ -8,7 +8,7 @@ use Capture::Tiny qw/ capture_merged /; use FindBin '$RealBin'; use lib $RealBin; use lib "$RealBin/../SBO-Lib/lib"; -use Test::Execute; +use Test::Sbotools qw/ sboconfig sbosnap sbofind sboinstall sboremove sbocheck sboupgrade /; if (defined $ENV{TRAVIS} and $ENV{TRAVIS} eq 'true') { plan tests => 26; @@ -17,38 +17,36 @@ if (defined $ENV{TRAVIS} and $ENV{TRAVIS} eq 'true') { } $ENV{TEST_ONLINE} //= 0; -$path = "$RealBin/../"; - # 1-3: Test SLACKWARE_VERSION -script (qw/ sboconfig -V 14.1 /, { expected => "Setting SLACKWARE_VERSION to 14.1...\n" }); +sboconfig qw/ -V 14.1 /, { expected => "Setting SLACKWARE_VERSION to 14.1...\n" }; SKIP: { skip 'Not doing online tests without TEST_ONLINE=1', 2 if $ENV{TEST_ONLINE} ne '1'; - script (qw/ sbosnap fetch /, { expected => qr/\APulling SlackBuilds tree\.\.\.\n/ }); - script (qw/ sbofind sbotools /, { expected => "SBo: sbotools\nPath: /usr/sbo/repo/system/sbotools\n\n" }); + sbosnap 'fetch', { expected => qr/\APulling SlackBuilds tree\.\.\.\n/ }; + sbofind 'sbotools', { expected => "SBo: sbotools\nPath: /usr/sbo/repo/system/sbotools\n\n" }; } # 4-10: Test alternative REPO is (system(qw!rm -rf /usr/sbo!), 0, 'Removing /usr/sbo works'); ok (! -e "/usr/sbo/repo/SLACKBUILDS.TXT", "SLACKBUILDS.TXT doesn't exist"); -script (qw! sboconfig -r https://github.com/Ponce/slackbuilds.git !, { expected => "Setting REPO to https://github.com/Ponce/slackbuilds.git...\n", name => 'Alternative REPO' }); +sboconfig qw! -r https://github.com/Ponce/slackbuilds.git !, { expected => "Setting REPO to https://github.com/Ponce/slackbuilds.git...\n", name => 'Alternative REPO' }; SKIP: { skip 'Not doing online tests without TEST_ONLINE=1', 4 if $ENV{TEST_ONLINE} ne '1'; - script (qw/ sbosnap fetch /, { expected => qr!Pulling SlackBuilds tree.*Cloning into '/usr/sbo/repo'!s }); + sbosnap 'fetch', { expected => qr!Pulling SlackBuilds tree.*Cloning into '/usr/sbo/repo'!s }; ok (-e "/usr/sbo/repo/SLACKBUILDS.TXT", "SLACKBUILDS.TXT exists (REPO)"); ok (! -e "/usr/sbo/repo/SLACKBUILDS.TXT.gz", "SLACKBUILDS.TXT.gz doesn't exist (REPO)"); - script (qw/ sbofind sbotools /, { expected => "SBo: sbotools\nPath: /usr/sbo/repo/system/sbotools\n\n" }); + sbofind 'sbotools', { expected => "SBo: sbotools\nPath: /usr/sbo/repo/system/sbotools\n\n" }; } # 11-17: Test local overrides -script (qw/ sboconfig -o /, "$RealBin/LO", { expected => "Setting LOCAL_OVERRIDES to $RealBin/LO...\n", name => 'LOCAL_OVERRIDES' }); +sboconfig '-o', "$RealBin/LO", { expected => "Setting LOCAL_OVERRIDES to $RealBin/LO...\n", name => 'LOCAL_OVERRIDES' }; my $skip = 0; SKIP: { if ($ENV{TEST_ONLINE} ne '1') { $skip = !(system(qw! mkdir -p /usr/sbo/repo !) == 0 and system(qw! touch /usr/sbo/repo/SLACKBUILDS.TXT !) == 0) } skip "Online testing disabled (TEST_ONLINE!=1) and could not create dummy SLACKBUILDS.TXT", 9 if $skip; - script (qw/ sbofind nonexistentslackbuild /, { expected => <<"LOCAL" }); + sbofind 'nonexistentslackbuild', { expected => <<"LOCAL" }; Local: nonexistentslackbuild6 Path: /home/travis/build/pink-mist/sbotools/t/LO/nonexistentslackbuild6 @@ -65,15 +63,15 @@ Local: nonexistentslackbuild Path: $RealBin/LO/nonexistentslackbuild LOCAL - script (qw/ sboinstall -r nonexistentslackbuild /, - { expected => qr/nonexistentslackbuild added to install queue[.].*perf[.]dummy' saved.*Cleaning for nonexistentslackbuild-1[.]0/s }); - script (qw/ sboremove --nointeractive nonexistentslackbuild /, { expected => qr/Removing 1 package\(s\).*nonexistentslackbuild.*All operations have completed/s }); + sboinstall qw/ -r nonexistentslackbuild /, + { expected => qr/nonexistentslackbuild added to install queue[.].*perf[.]dummy' saved.*Cleaning for nonexistentslackbuild-1[.]0/s }; + sboremove qw/ --nointeractive nonexistentslackbuild /, { expected => qr/Removing 1 package\(s\).*nonexistentslackbuild.*All operations have completed/s }; is (system(qw!/sbin/installpkg nonexistentslackbuild-0.9-noarch-1_SBo.tgz!), 0, 'Old version fake installed'); - script (qw/ sbocheck /, { expected => qr/Updating SlackBuilds tree.*Checking for updated SlackBuilds.*nonexistentslackbuild 0[.]9.*needs updating/s }); - script (qw/ sboupgrade -r nonexistentslackbuild /, { expected => qr/nonexistentslackbuild added to upgrade queue.*Upgrade queue: nonexistentslackbuild/s }); + sbocheck { expected => qr/Updating SlackBuilds tree.*Checking for updated SlackBuilds.*nonexistentslackbuild 0[.]9.*needs updating/s }; + sboupgrade qw/ -r nonexistentslackbuild /, { expected => qr/nonexistentslackbuild added to upgrade queue.*Upgrade queue: nonexistentslackbuild/s }; # 18: Test missing dep - script (qw/ sboinstall nonexistentslackbuild2 /, { input => 'y', exit => 1, expected => "Unable to locate nonexistentslackbuild3 in the SlackBuilds.org tree.\n" }); + sboinstall 'nonexistentslackbuild2', { input => 'y', exit => 1, expected => "Unable to locate nonexistentslackbuild3 in the SlackBuilds.org tree.\n" }; } # 19-23: Test sboupgrade --all @@ -90,26 +88,26 @@ SKIP: { 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'); - script (qw/ sboupgrade -r --all /, { expected => qr/Checking for updated SlackBuilds.*nonexistentslackbuild added to upgrade queue.*Cleaning for nonexistentslackbuild/s }); + sboupgrade qw/ -r --all /, { expected => qr/Checking for updated SlackBuilds.*nonexistentslackbuild added to upgrade queue.*Cleaning for nonexistentslackbuild/s }; ok (-e "/var/log/packages/nonexistentslackbuild-1.0-noarch-1_SBo", 'updated package is installed'); ok (! -e "/var/log/packages/nonexistentslackbuild-0.9-noarch-1_SBo", 'old package is removed'); } if (not glob("/var/log/packages/nonexistentslackbuild-*")) { - script (qw/ sboinstall -r nonexistentslackbuild /, { test => 0 }); + sboinstall qw/ -r nonexistentslackbuild /, { test => 0 }; } if (not glob("/var/log/packages/nonexistentslackbuild4-*")) { - script (qw/ sboinstall nonexistentslackbuild4 /, { input => "y\ny\ny", test => 0 }); + sboinstall 'nonexistentslackbuild4', { input => "y\ny\ny", test => 0 }; } # 24-25: Test sboupgrade -f -script (qw/ sboupgrade -f nonexistentslackbuild /, { input => "y\ny", expected => qr/Proceed with nonexistentslackbuild\?.*Upgrade queue: nonexistentslackbuild\n/s }); -script (qw/ sboupgrade -f nonexistentslackbuild4 /, { input => "y\ny", expected => qr/Proceed with nonexistentslackbuild4\?.*Upgrade queue: nonexistentslackbuild4\n/s }); +sboupgrade qw/ -f nonexistentslackbuild /, { input => "y\ny", expected => qr/Proceed with nonexistentslackbuild\?.*Upgrade queue: nonexistentslackbuild\n/s }; +sboupgrade qw/ -f nonexistentslackbuild4 /, { input => "y\ny", expected => qr/Proceed with nonexistentslackbuild4\?.*Upgrade queue: nonexistentslackbuild4\n/s }; # 26: Test sboupgrade -f -z -script (qw/ sboupgrade -f -z nonexistentslackbuild4 /, { +sboupgrade qw/ -f -z nonexistentslackbuild4 /, { input => "y\ny\ny", expected => qr/nonexistentslackbuild5 added to upgrade queue.*nonexistentslackbuild4 added to upgrade queue.*Upgrade queue: nonexistentslackbuild5 nonexistentslackbuild4\n/s -}); +}; # Cleanup capture_merged { |