citrun

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

commit aac303269624f32c100cb6af73c90f553ceb5813
parent e90ab4175d6c0f46b227f449168fa19634ff317f
Author: Kyle Milz <kyle@0x30.net>
Date:   Thu,  4 Aug 2016 23:59:13 -0600

Test: move pid and version checking into it's own test

Diffstat:
MTest/Viewer.pm | 12------------
Mt/rt_counters_increase.t | 2+-
Dt/rt_metadata.t | 31-------------------------------
Mt/rt_reconnect.t | 2+-
Mt/rt_sanity.t | 6+++---
At/rt_static.t | 41+++++++++++++++++++++++++++++++++++++++++
6 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/Test/Viewer.pm b/Test/Viewer.pm @@ -39,18 +39,6 @@ sub accept { $self->{progname} = read_string($client); $self->{cwd} = read_string($client); - # Always sanity check these. - is( $self->{maj}, 0, "major version" ); - is( $self->{min}, 0, "minor version" ); - is( scalar @{ $self->{pids} }, 3, "number of pids" ); - cmp_ok( $self->{pids}->[0], ">", 1, "pid check lower" ); - cmp_ok( $self->{pids}->[0], "<", 100000, "pid check upper" ); - cmp_ok( $self->{pids}->[1], ">", 1, "ppid check lower" ); - cmp_ok( $self->{pids}->[1], "<", 100000, "ppid check upper" ); - cmp_ok( $self->{pids}->[2], ">", 1, "pgrp check lower" ); - cmp_ok( $self->{pids}->[2], "<", 100000, "pgrp check upper" ); - - # Read the static translation unit information. my @tus; for (1..$self->{num_tus}) { my $file_name = read_string($client); diff --git a/t/rt_counters_increase.t b/t/rt_counters_increase.t @@ -1,5 +1,5 @@ use strict; -use Test::More tests => 20; +use Test::More tests => 13; use Test::Project; use Test::Viewer; diff --git a/t/rt_metadata.t b/t/rt_metadata.t @@ -1,31 +0,0 @@ -use strict; -use Test::More tests => 14; -use Test::Project; -use Test::Viewer; - -my $project = Test::Project->new(); -my $viewer = Test::Viewer->new(); - -$project->add_src(<<EOF); -int -main(void) -{ - /* Just do something so we can probe the runtime reliably */ - while (1); - return 0; -} -EOF - -$project->compile(); -$project->run(); - -$viewer->accept(); -is( $viewer->{num_tus}, 1, "translation unit count" ); - -my @known_good = [ [ "source_0.c", 8, 2 ] ]; -$viewer->cmp_static_data(@known_good); - -$project->kill(); -my ($ret, $err) = $project->wait(); -is( $ret, 0, "instrumented program check return code" ); -is( $err, undef, "instrumented program check stderr" ); diff --git a/t/rt_reconnect.t b/t/rt_reconnect.t @@ -1,5 +1,5 @@ use strict; -use Test::More tests => 14; +use Test::More tests => 7; use Test::Project; use Test::Viewer; diff --git a/t/rt_sanity.t b/t/rt_sanity.t @@ -1,6 +1,6 @@ use strict; use Cwd; -use Test::More tests => 63; +use Test::More tests => 56; use Test::Project; use Test::Viewer; @@ -57,8 +57,8 @@ $project->compile(); $project->run(45); $viewer->accept(); -is( $viewer->{major}, 0, "protocol major" ); -is( $viewer->{minor}, 0, "protocol minor" ); +is( $viewer->{maj}, 0, "protocol major" ); +is( $viewer->{min}, 0, "protocol minor" ); is( $viewer->{num_tus}, 3, "translation unit count" ); is( $viewer->{progname}, "program", "program name" ); is( $viewer->{cwd}, getcwd, "current working dir" ); diff --git a/t/rt_static.t b/t/rt_static.t @@ -0,0 +1,41 @@ +use strict; +use Test::More tests => 16; +use Test::Project; +use Test::Viewer; + +my $project = Test::Project->new(); +my $viewer = Test::Viewer->new(); + +$project->add_src(<<EOF); +int +main(void) +{ + /* Just do something so we can probe the runtime reliably */ + while (1); + return 0; +} +EOF + +$project->compile(); +$project->run(); + +$viewer->accept(); + +is( $viewer->{maj}, 0, "major version" ); +is( $viewer->{min}, 0, "minor version" ); +is( scalar @{ $viewer->{pids} }, 3, "number of pids" ); +cmp_ok( $viewer->{pids}->[0], ">", 1, "pid check lower" ); +cmp_ok( $viewer->{pids}->[0], "<", 100000, "pid check upper" ); +cmp_ok( $viewer->{pids}->[1], ">", 1, "ppid check lower" ); +cmp_ok( $viewer->{pids}->[1], "<", 100000, "ppid check upper" ); +cmp_ok( $viewer->{pids}->[2], ">", 1, "pgrp check lower" ); +cmp_ok( $viewer->{pids}->[2], "<", 100000, "pgrp check upper" ); +is( $viewer->{num_tus}, 1, "translation unit count" ); + +my @known_good = [ [ "source_0.c", 8, 2 ] ]; +$viewer->cmp_static_data(@known_good); + +$project->kill(); +my ($ret, $err) = $project->wait(); +is( $ret, 0, "instrumented program check return code" ); +is( $err, undef, "instrumented program check stderr" );