citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 295836ec7e84f13f1d4e21895f311f0c1bd76caf
parent d22a319dfd47a4c2a22df571ca31155fa852ebfb
Author: Kyle Milz <kyle@0x30.net>
Date:   Fri,  6 Jan 2017 19:09:11 -0700

t/lib_transunit: add instrumented program output validation

Diffstat:
Mt/lib_transunit.t | 4+++-
Mt/utils.pm | 5+++--
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/t/lib_transunit.t b/t/lib_transunit.t @@ -4,11 +4,13 @@ use strict; use warnings; use t::utils; -plan tests => 8; +plan tests => 11; my $dir = setup_projdir(); $dir->run( prog => $dir->workdir . '/program', args => '1', chdir => $dir->curdir ); +is( $dir->stdout, '1', 'is instrumented program stdout correct' ); +is( $dir->stderr, '', 'is instrumented program stderr silent' ); is( $? >> 8, 0, "is instrumented program exit code 0" ); my $shm_file_path = get_one_shmfile( $ENV{CITRUN_PROCDIR} ); diff --git a/t/utils.pm b/t/utils.pm @@ -72,7 +72,7 @@ EOF void print_output(long long n) { - fprintf(stderr, "%lli", n); + printf("%lli", n); return; } EOF @@ -133,11 +133,12 @@ sub new { $self->{cwd} ) = unpack("Z4I8Z1024Z1024", xread($fh, $aligned_size)); + my $node_fixed_size = citrun_node_size(); my @translation_units; + while (tell $fh < $self->stat_procfile()) { my %tu; - my $node_fixed_size = citrun_node_size(); ( $tu{size}, $tu{comp_file_name},