diff options
Diffstat (limited to 't/09-multilib.t')
-rwxr-xr-x | t/09-multilib.t | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/t/09-multilib.t b/t/09-multilib.t new file mode 100755 index 0000000..ac55cd6 --- /dev/null +++ b/t/09-multilib.t @@ -0,0 +1,67 @@ +#!/usr/bin/env perl + +use 5.16.0; +use strict; +use warnings FATAL => 'all'; +use Test::More; +use Capture::Tiny qw/ capture_merged /; +use FindBin '$RealBin'; +use lib $RealBin; +use lib "$RealBin/../SBO-Lib/lib"; +use Test::Execute; + +$ENV{TEST_MULTILIB} //= 0; +if ($ENV{TEST_INSTALL} and ($ENV{TEST_MULTILIB} == 2)) { + plan tests => 1; +} else { + plan skip_all => 'Only run these tests if TEST_INSTALL=1 and TEST_MULTILIB=2'; +} +$ENV{TEST_ONLINE} //= 0; + +$path = "$RealBin/../"; + +sub cleanup { + capture_merged { + unlink "$RealBin/LO-multilib/multilibsbo/perf.dummy"; + system(qw!rm -rf /tmp/SBo/multilibsbo-1.0!); + system(qw!rm -rf /tmp/package-multilibsbo!); + }; +} + +sub make_slackbuilds_txt { + state $made = 0; + my $fname = "/usr/sbo/repo/SLACKBUILDS.TXT"; + if ($_[0]) { + if ($made) { return system(qw!rm -rf!, $fname); } + } else { + if (not -e $fname) { $made = 1; system('mkdir', '-p', '/usr/sbo/repo'); system('touch', $fname); } + } +} + +sub set_lo { + state $set = 0; + state $lo; + if ($_[0]) { + if ($set) { script (qw/ sboconfig -o /, $lo, { test => 0 }); } + } else { + ($lo) = script (qw/ sboconfig -l /, { expected => qr/LOCAL_OVERRIDES=(.*)/, test => 0 }); + $lo //= 'FALSE'; + note "Saving original value of LOCAL_OVERRIDES: $lo"; + $set = 1; + script (qw/ sboconfig -o /, "$RealBin/LO-multilib", { test => 0 }); + } +} + +cleanup(); +make_slackbuilds_txt(); +set_lo(); + +# 1: Failing slackbuild script +script (qw/ sboinstall multilibsbo /, { input => "y\ny", expected => qr// }); + +# Cleanup +END { + set_lo('delete'); + make_slackbuilds_txt('delete'); + cleanup(); +} |