commit 1de837ea4a6cc5cfee6dcc44845cfa8a05b738e2
parent cb823e4219e196d16c7a6121103f94c974d7015a
Author: Kyle Milz <kyle@0x30.net>
Date: Sun, 7 Aug 2016 20:51:58 -0600
t: convert inst_while to shell
Diffstat:
M | t/inst_while.t | | | 68 | ++++++++++++++++++++++++++++++++++++++++++++++++++------------------ |
1 file changed, 50 insertions(+), 18 deletions(-)
diff --git a/t/inst_while.t b/t/inst_while.t
@@ -1,28 +1,60 @@
-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
-$project->add_src(<<EOF);
+cat <<EOF > while.c
int
-main(void)
+main(int argc, char *argv[])
{
- int i;
+ while (argc < 17)
+ argc++;
- i = 0;
- while (i < 17) {
- i++;
- }
+ while ((argc && argv));
+ return 0;
+}
+EOF
+
+cat <<EOF > while.c.inst_good
+int
+main(int argc, char *argv[])
+{citrun_start();++_citrun_lines[1];++_citrun_lines[2];++_citrun_lines[3];
+ while ((++_citrun_lines[4], argc < 17))
+ argc++;
- return i;
+ while ((++_citrun_lines[7], (argc && argv)));
+ return (++_citrun_lines[8], 0);
}
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 = 1
+Added clangtool argument ''.
+Instrumentation of '' finished:
+ 10 Lines of source code
+ 30 Lines of instrumentation header
+ 1 Functions called ''
+ 1 Function declarations
+ 0 If statements
+ 0 For statements
+ 2 While statements
+ 0 Switch statements
+ 1 Return statement values
+ 0 Call expressions
+ 18 Total statements in source
+Writing modified source to ''.
+Modified source written successfully.
+Instrumentation successful.
+EOF
+
+citrun-inst -c while.c
+
+diff -u while.c.inst_good while.c.citrun && echo "ok 2 - instrumented source diff"
-my ($ret) = $project->wait();
-is($ret, 17, "instrumented program check");
+process_citrun_log
+diff -u citrun.log.good citrun.log.proc && echo "ok 3 - citrun.log diff"