commit 9cdc1440b6e16e81dbcb60fde352a0817a8ff393
parent 946c33e268ce7d7da7f8647ca5ad028252372659
Author: Kyle Milz <kyle@0x30.net>
Date: Sun, 7 Aug 2016 20:39:40 -0600
t: move inst_for to shell from Perl
Diffstat:
M | t/inst_for.t | | | 72 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------- |
1 file changed, 55 insertions(+), 17 deletions(-)
diff --git a/t/inst_for.t b/t/inst_for.t
@@ -1,27 +1,65 @@
-use strict;
-use Test::More tests => 1;
-use Test::Project;
-use Test::Viewer;
+#!/bin/sh -e
+echo 1..3
-my $project = Test::Project->new();
-my $viewer = Test::Viewer->new();
+. test/utils.sh
+setup
+
+echo "ok 1 - tmp dir created"
+
+cat <<EOF > for.c
+#include <stdlib.h>
-$project->add_src(<<EOF);
int
-main(void)
+main(int argc, char *argv[])
{
- int i;
+ for (;;);
+
+ for (argc = 0; argc < 10; argc++)
+ argv++;
+}
+EOF
- for (i = 0; i < 19; i++) {
- i++;
- }
+cat <<EOF > for.c.inst_good
+#include <stdlib.h>
- return i;
+int
+main(int argc, char *argv[])
+{citrun_start();++_citrun_lines[3];++_citrun_lines[4];++_citrun_lines[5];
+ for (;;);
+
+ for (argc = 0; (++_citrun_lines[8], argc < 10); argc++)
+ argv++;
}
EOF
-$project->compile();
-$project->run();
+cat <<EOF > citrun.log.good
+
+citrun-inst v0.0 () called as ''.
+Command line is ''.
+Found source file ''.
+Object arg = 0, compile arg = 0
+Link detected, adding '' to command line.
+Added clangtool argument ''.
+Instrumentation of '' finished:
+ 11 Lines of source code
+ 30 Lines of instrumentation header
+ 1 Functions called ''
+ 4 Function declarations
+ 0 If statements
+ 1 For statements
+ 0 While statements
+ 0 Switch statements
+ 1 Return statement values
+ 0 Call expressions
+ 155 Total statements in source
+Writing modified source to ''.
+Modified source written successfully.
+Instrumentation successful.
+EOF
+
+citrun-inst for.c
+
+diff -u for.c.inst_good for.c.citrun && echo "ok 2 - instrumented source diff"
-my ($ret) = $project->wait();
-is($ret, 20, "instrumented program check");
+process_citrun_log
+diff -u citrun.log.good citrun.log.proc && echo "ok 3 - citrun.log diff"