citrun

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

commit 5ab2be663cb9524ce78fccbce4edc055f58fa24b
parent 7e3862b8d4e563cc97f4994613ee9a75014cbaa2
Author: Kyle Milz <kyle@0x30.net>
Date:   Wed, 10 Aug 2016 00:51:02 -0600

t: improve hello world

Diffstat:
Mt/hello_world.t | 45+++++++++++++++++++++++++++++++++------------
1 file changed, 33 insertions(+), 12 deletions(-)

diff --git a/t/hello_world.t b/t/hello_world.t @@ -1,12 +1,10 @@ -use strict; -use Test::More tests => 2; -use Test::Project; -use Test::Viewer; +#!/bin/sh +echo 1..2 -my $project = Test::Project->new(); -my $viewer = Test::Viewer->new(); +. test/utils.sh +setup -$project->add_src(<<EOF); +cat <<EOF > hello.c #include <stdio.h> int @@ -17,9 +15,32 @@ main(void) } EOF -$project->compile(); -$project->run(); +cat <<EOF > check.good +Checking ..done -my ($ret, $err) = $project->wait(); -is( $ret, 0, "instrumented program check return code" ); -is( $err, "hello, world!", "instrumented program check error message" ); +Summary: + 1 Log files found + 1 Source files input + 1 Calls to the instrumentation tool + 1 Forked compilers + 1 Instrument successes + 1 Application link commands + +Totals: + 9 Lines of source code + 32 Lines of instrumentation header + 1 Functions called 'main' + 5 Function definitions + 1 If statements + 4 Return statement values + 2 Call expressions + 191 Total statements +EOF + +cc -o hello hello.c +citrun-check > check.out + +export CITRUN_SOCKET= +[ "`./hello`" = "hello, world!" ] && echo ok program prints + +diff -u check.good check.out && echo ok citrun-check diff