diff options
author | J Pipkin <j@dawnrazor.net> | 2013-01-12 04:14:03 -0600 |
---|---|---|
committer | J Pipkin <j@dawnrazor.net> | 2013-01-12 04:14:03 -0600 |
commit | be2bb2b27d61a39bff6efd890c3d519c39db321e (patch) | |
tree | 387f0c14a12526c6eb1668b3d588ded1a0472212 /t | |
parent | b2a26f795d32e398bfc3dbfc13882419bd3ba929 (diff) | |
download | sbotools2-be2bb2b27d61a39bff6efd890c3d519c39db321e.tar.xz |
implement failure-dependent exit statuses, ask to proceed if a failure is encountered during the process
Diffstat (limited to 't')
-rwxr-xr-x | t/prep.pl | 31 | ||||
-rwxr-xr-x | t/test.t | 22 |
2 files changed, 23 insertions, 30 deletions
@@ -69,15 +69,15 @@ while (my $line = <$file_h>) { } seek $file_h, 0, 0; -my @not_exported; -FIRST: for my $sub (@subs) { - my $found = 'FALSE'; - my $has = 'FALSE'; +my @not_exported; +FIRST: for my $sub (@subs) { + my $found = 'FALSE'; + my $has = 'FALSE'; SECOND: while (my $line = <$file_h>) { - if ($found eq 'FALSE') { + if ($found eq 'FALSE') { $found = 'TRUE', next SECOND if $line =~ /\@EXPORT/; - } else { - last SECOND if $line =~ /^\);$/; + } else { + last SECOND if $line =~ /^\);$/; $has = 'TRUE', last SECOND if $line =~ /$sub/; } } @@ -91,7 +91,20 @@ FIRST: for my $line (@file) { if ($line =~ /\@EXPORT/) { $line = "our \@EXPORT = qw(". join ' ', @not_exported; } - $line = "#$line" if $line =~ /root privileges/; + $line =~ s/^/#/ if $line =~ /^read_config;$/; } - +my $found = 0; +FIRST: for my $line (@file) { + unless ($found) { + if ($line =~ /^unless\s+\(\$<\s+==/) { + $found++; + $line =~ s/^/#/; + } + } else { + $line =~ s/^/#/; + if ($line =~ /^#}$/) { + last FIRST; + } + } +} @@ -14,6 +14,7 @@ chomp(my $pwd = `pwd`); my $sbo_home = "$pwd/sbo"; $conf_file = "$pwd/sbotools.conf"; +$SBO::Lib::conf_file = $conf_file; read_config; $config{SBO_HOME} = $sbo_home; $SBO::Lib::distfiles = "$sbo_home/distfiles"; @@ -47,9 +48,6 @@ is(chk_slackbuilds_txt, undef, 'chk_slackbuilds_txt returns false with no SLACKBUILDS.TXT'); move("$sbo_home/SLACKBUILDS.TXT.moved", "$sbo_home/SLACKBUILDS.TXT"); -#ok (rsync_sbo_tree == 1, 'rsync_sbo_tree is good'); -#ok (update_tree == 1, 'update_tree is good'); - # slackbuilds_or_fetch test is(slackbuilds_or_fetch, 1, 'slackbuilds_or_fetch is good'); @@ -312,13 +310,6 @@ for my $item (@$listing) { # remove_stuff test - can only really test for invalid input is(remove_stuff('/omg/wtf/bbq'), 1, 'remove_stuff good for invalid input'); -# config_write test -chmod 0444, $conf_file; -is(config_write ('OMG', 'WTF'), undef, - 'config_write returned undef correctly'); -chmod -chmod 0644, $conf_file; - # perform_search tests my $findings = perform_search('desktop'); for my $found (@$findings) { @@ -385,17 +376,6 @@ $readme = do {local $/; <$fh>}; close $fh; ok(! (get_opts $readme), 'get_opts good where README does not define opts'); -# clean_reqs tests - -# $SBO::Lib::compat32 = 0; -# $reqs = get_requires "zdoom", "$sbo_home/games/zdoom"; -# $reqs = clean_reqs $reqs; -# ok (! $$reqs[0], 'clean_reqs good for already installed reqs'); -# $reqs = get_requires 'gmpc', "$sbo_home/audio/gmpc"; -# $reqs = clean_reqs $reqs; -# is ($$reqs[0], 'gob2', 'clean_reqs good for un/installed reqs.'); -# is ($$reqs[1], 'libmpd', 'clean_reqs good for un/installed reqs.'); - # queue tests # test multiple sbo's |