commit f73109e28c220274e9f76ac6d3cb2cce30a8d5b5
parent e460a63c520bfa2c812a48ac158e38a229238cfa
Author: Kyle Milz <kyle@0x30.net>
Date: Fri, 5 Aug 2016 14:23:32 -0600
t/rt_dynmaic: check data 60 times in a loop
Diffstat:
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/t/rt_dynamic.t b/t/rt_dynamic.t
@@ -1,7 +1,8 @@
use strict;
-use Test::More tests => 51;
+use Test::More tests => 111;
use Test::Project;
use Test::Viewer;
+use Time::HiRes qw( usleep );
my $project = Test::Project->new();
my $viewer = Test::Viewer->new();
@@ -56,20 +57,15 @@ $project->compile();
$project->run(45);
$viewer->accept();
-
-# Check static data.
-my @known_good = [
- # filename lines inst sites
+$viewer->cmp_static_data([
[ "source_0.c", 20, 9 ],
[ "source_1.c", 11, 7 ],
[ "source_2.c", 9, 6 ],
-];
-$viewer->cmp_static_data(@known_good);
+]);
-# Request and check execution data.
+# Check initial execution counts
+#
my $data = $viewer->get_dynamic_data();
-
-# The nodes can be in any order.
my ($s0, $s1, $s2) = sort keys %$data;
my @lines = @{ $data->{$s0} };
@@ -92,6 +88,11 @@ is( $lines[8], 0, "src 1 line 8 check" );
my @lines = @{ $data->{$s2} };
is( $lines[$_], 0, "src 2 line $_ check" ) for (0..8);
+for (1..60) {
+ usleep(10 * 1000);
+ $viewer->cmp_dynamic_data();
+}
+
$project->kill();
my ($ret, $err) = $project->wait();
is( $ret, 0, "instrumented program check return code" );