citrun

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

commit 97919caf639a68fafced2e687c5a131af1a9623c
parent 8870045c0242d98a1554b944424f223e48e4405e
Author: Kyle Milz <kyle@getaddrinfo.net>
Date:   Sat,  9 Apr 2016 10:46:19 -0600

t: add runtime reconnect test

Diffstat:
At/runtime_reconnect.t | 39+++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+), 0 deletions(-)

diff --git a/t/runtime_reconnect.t b/t/runtime_reconnect.t @@ -0,0 +1,39 @@ +use strict; +use SCV::Project; +use SCV::Viewer; +use Test::More tests => 5; + +my $project = SCV::Project->new(); + +$project->add_src(<<EOF); +int +main(void) +{ + while (1); + return 0; +} +EOF + +$project->compile(); +$project->run(); + +# Give the runtime a chance to reconnect +sleep(1); + +my $viewer = SCV::Viewer->new(); +$viewer->accept(); + +# Request and check metadata first +my $runtime_metadata = $viewer->get_metadata(); + +my $tus = $runtime_metadata->{tus}; +is ( scalar(@$tus), 1, "translation unit count" ); +my $tu = $tus->[0]; + +like( $tu->{filename}, qr/.*source_0.c/, "filename check" ); +is( $tu->{lines}, 7, "line count check" ); + +$project->kill(); +my ($ret, $err) = $project->wait(); +is( $ret, 0, "instrumented program check return code" ); +is( $err, undef, "instrumented program check stderr" );