commit b9da118dd6af8f0500705261f003cf0ca4fb7178
parent 6032d93243cf9e9e570f5d02a379e40eebf183a1
Author: kyle <kyle@0x30.net>
Date: Sun, 15 Jan 2017 13:23:32 -0700
t: fix procfile leaks
Diffstat:
7 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/t/e2e_intent.t b/t/e2e_intent.t
@@ -4,9 +4,11 @@
#
use strict;
use warnings;
+
use t::utils;
plan tests => 11;
+
my $e2e = Test::Cmd->new( prog => 'citrun_wrap', workdir => '' );
$e2e->write( 'fib.c', <<EOF );
@@ -69,6 +71,8 @@ is( $e2e->stderr, '', 'is citrun_wrap compile stderr silent' );
is( $? >> 8, 0, 'is citrun_wrap compile exit code 0' );
eq_or_diff( $log, $log_good, 'is citrun_wrap log file identical' );
+$ENV{CITRUN_PROCDIR} = $e2e->workdir;
+
$e2e->run( prog => $e2e->workdir . "/fib", chdir => $e2e->curdir );
is( $e2e->stderr, '', 'is fib stderr silent' );
is( $? >> 8, 1, 'is fib with no args exit 1' );
diff --git a/t/lib_badver.t b/t/lib_badver.t
@@ -33,6 +33,7 @@ my $err_good = 'libcitrun 0.0: incompatible version 0.255.
Try cleaning and rebuilding your project.
';
+$ENV{CITRUN_PROCDIR} = $compiler->workdir;
my $abs_prog_path = File::Spec->catfile( $compiler->workdir, "main" );
$compiler->run( prog => $abs_prog_path, chdir => $compiler->curdir );
is( $compiler->stdout, '', 'is incompatible node program stdout silent' );
diff --git a/t/wrap_cmake.t b/t/wrap_cmake.t
@@ -3,14 +3,13 @@
#
use strict;
use warnings;
+
use File::Which;
use t::utils;
-if (which 'cmake') {
- plan tests => 8;
-} else {
- plan skip_all => 'cmake not found';
-}
+plan skip_all => 'cmake not found' unless (which 'cmake');
+plan tests => 8;
+
my $wrap = Test::Cmd->new( prog => 'citrun_wrap', workdir => '' );
@@ -78,11 +77,13 @@ print $wrap->stdout;
is( $wrap->stderr, '', 'is citrun_wrap make stderr empty');
is( $? >> 8, 0, 'is citrun_wrap make exit code 0');
+$ENV{CITRUN_PROCDIR} = $wrap->workdir;
+
# Check the instrumented program runs.
$wrap->run( prog => $wrap->workdir . "/program", chdir => $wrap->curdir );
-is( $wrap->stdout, '', 'is program stdout empty');
-is( $wrap->stderr, '', 'is program stderr empty');
-is( $? >> 8, 0, 'is program exit code 0');
+is( $wrap->stdout, '', 'is instrumented program stdout empty');
+is( $wrap->stderr, '', 'is instrumented program stderr empty');
+is( $? >> 8, 0, 'is instrumented program exit code 0');
#ok "is runtime shared memory file created" test -f procdir/program_*
diff --git a/t/wrap_jam.t b/t/wrap_jam.t
@@ -3,12 +3,11 @@
#
use strict;
use warnings;
+
use File::Which;
use t::utils;
-unless (which 'jam') {
- plan skip_all => 'jam not found';
-}
+plan skip_all => 'jam not found' unless (which 'jam');
plan tests => 6;
@@ -63,6 +62,7 @@ $citrun_log = clean_citrun_log( $citrun_log );
eq_or_diff( $citrun_log, $log_good, 'is citrun_wrap log file identical', { context => 3 } );
+$ENV{CITRUN_PROCDIR} = $wrap->workdir;
$wrap->run( prog => $wrap->workdir . '/program', chdir => $wrap->curdir );
is( $wrap->stdout, '', 'is instrumented program stdout silent' );
is( $wrap->stderr, '', 'is instrumented program stderr silent' );
diff --git a/t/wrap_make.t b/t/wrap_make.t
@@ -3,12 +3,11 @@
#
use strict;
use warnings;
+
use File::Which;
use t::utils;
-unless (which 'make') {
- plan skip_all => 'make not found';
-}
+plan skip_all => 'make not found' unless (which 'make');
plan tests => 6;
@@ -56,6 +55,7 @@ $citrun_log = clean_citrun_log( $citrun_log );
eq_or_diff( $citrun_log, $log_good, 'is citrun_wrap log file identical', { context => 3 } );
+$ENV{CITRUN_PROCDIR} = $wrap->workdir;
$wrap->run( prog => $wrap->workdir . '/program', chdir => $wrap->curdir );
is( $wrap->stdout, '', 'is instrumented program stdout silent' );
is( $wrap->stderr, '', 'is instrumented program stderr silent' );
diff --git a/t/wrap_ninja.t b/t/wrap_ninja.t
@@ -3,12 +3,11 @@
#
use strict;
use warnings;
+
use File::Which;
use t::utils;
-unless (which 'ninja') {
- plan skip_all => 'ninja not found';
-}
+plan skip_all => 'ninja not found' unless (which 'ninja');
plan tests => 6;
@@ -62,6 +61,7 @@ $citrun_log = clean_citrun_log( $citrun_log );
eq_or_diff( $citrun_log, $log_good, 'is citrun_wrap log file identical', { context => 3 } );
+$ENV{CITRUN_PROCDIR} = $wrap->workdir;
$wrap->run( prog => $wrap->workdir . '/program', chdir => $wrap->curdir );
is( $wrap->stdout, '', 'is instrumented program stdout silent' );
is( $wrap->stderr, '', 'is instrumented program stderr silent' );
diff --git a/t/wrap_parallel.t b/t/wrap_parallel.t
@@ -4,8 +4,10 @@
#
use strict;
use warnings;
+
use File::Which;
use t::utils;
+
plan skip_all => 'make not found' unless (which 'make');
plan tests => 15;
@@ -53,6 +55,7 @@ my $check_out = $wrap->stdout;
$check_out =~ s/^.*Milliseconds spent rewriting.*\n//gm;
eq_or_diff( $check_out, $check_good, 'is citrun_check stdout identical', { context => 3 } );
+$ENV{CITRUN_PROCDIR} = $wrap->workdir;
for (1..4) {
$wrap->run( prog => $wrap->workdir . "/program$_", chdir => $wrap->curdir );
is( $wrap->stdout, '', "is instrumented program$_ stdout silent" );