aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-07-24 00:02:33 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-07-24 00:02:33 +0200
commitc8fde30ea43c7ec54f76740c24926bf3904e7038 (patch)
treef505eb16bdf5c27bf58bb5f33b89b45a70486957 /t
parentc95832955e3349968c9973b2c14a45615186eb00 (diff)
downloadsbotools-c8fde30ea43c7ec54f76740c24926bf3904e7038.tar.xz
29-race-sboconfig.t: deleted because it is no longer relevant
Diffstat (limited to 't')
-rwxr-xr-xt/29-race-sboconfig.t71
1 files changed, 0 insertions, 71 deletions
diff --git a/t/29-race-sboconfig.t b/t/29-race-sboconfig.t
deleted file mode 100755
index d0f9d3d..0000000
--- a/t/29-race-sboconfig.t
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use Test::More;
-use Test::Exit;
-use FindBin '$RealBin';
-use lib "$RealBin/../SBO-Lib/lib";
-use Capture::Tiny qw/ capture_merged /;
-use File::Temp 'tempdir';
-use Cwd;
-
-plan tests => 6;
-
-sub load {
- my ($script, %opts) = @_;
-
- local @ARGV = exists $opts{argv} ? @{ $opts{argv} } : '-h';
- my ($ret, $exit, $out, $do_err);
- my $eval = eval {
- $out = capture_merged { $exit = exit_code {
- $ret = do "$RealBin/../$script";
- $do_err = $@;
- }; };
- 1;
- };
- my $err = $@;
-
- note explain { ret => $ret, exit => $exit, out => $out, eval => $eval, err => $err, do_err => $do_err } if $opts{explain};
-}
-
-# 1-4: sboconfig race test...
-{
- load('sboconfig');
-
- my $conffile = '/etc/sbotools/sbotools.conf';
- rename $conffile, "$conffile.bak";
- main::config_write('foo', 'bar');
- no warnings 'redefine';
- local *_race::cond = sub { unlink $conffile; };
-
- my $exit;
- my $out = capture_merged { $exit = exit_code { main::config_write('foo', 'bar'); }; };
-
- is ($out, "Unable to open /etc/sbotools/sbotools.conf.\n", "sboconfig's config_write() gave correct output");
- is ($exit, 6, "sboconfig's config_write exited with 6");
-
- local *_race::cond = sub { mkdir $conffile; };
-
- undef $exit;
- $out = capture_merged { $exit = exit_code { main::config_write('foo', 'bar'); }; };
-
- is ($out, "Unable to open /etc/sbotools/sbotools.conf.\n", "sboconfig's config_write() gave correct output");
- is ($exit, 6, "sboconfig's config_write exited with 6");
-
- rmdir $conffile;
- local *_race::cond = sub { 1; };
- main::config_write('foo', 'bar');
- my $cnt = 0;
- local *_race::cond = sub { do { unlink $conffile; mkdir $conffile } if $cnt++; };
-
- undef $exit;
- $out = capture_merged { $exit = exit_code { main::config_write('foo', 'baz'); }; };
-
- is ($out, "Unable to open /etc/sbotools/sbotools.conf.\n", "sboconfig's config_write() gave correct output");
- is ($exit, 6, "sboconfig's config_write exited with 6");
-
- unlink $conffile;
- rmdir $conffile;
- rename "$conffile.bak", $conffile;
-}