commit e52e2b57a61f2073cc168acad58f13ad9565b366
parent 5b9e5cfff68eabe36b48e701a87652a196308f9b
Author: Kyle Milz <kyle@0x30.net>
Date: Sat, 20 Aug 2016 00:59:58 -0600
src: make citrun-dump loop
Diffstat:
2 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/src/dump_main.cc b/src/dump_main.cc
@@ -16,6 +16,18 @@ usage()
exit(1);
}
+static void
+count_execs(RuntimeProcess &rt)
+{
+ uint64_t total = 0;
+
+ for (auto &t : rt.m_tus)
+ for (int i = 0; i < t.num_lines; ++i)
+ total += t.exec_diffs[i];
+
+ std::cout << total << std::endl;
+}
+
int
main(int argc, char *argv[])
{
@@ -56,11 +68,8 @@ main(int argc, char *argv[])
}
if (tflag) {
- uint64_t total = 0;
- for (auto &t : rt.m_tus)
- for (int i = 0; i < t.num_lines; ++i)
- total += t.exec_diffs[i];
- std::cout << total << std::endl;
+ for (int i = 0; i < 60; i++)
+ count_execs(rt);
return 0;
}
@@ -77,15 +86,15 @@ main(int argc, char *argv[])
}
- std::cout << "Version: "
+ std::cout << "Version: "
<< unsigned(rt.m_major) << "."
<< unsigned(rt.m_minor) << "\n"
- << "Program name: " << rt.m_progname << "\n"
+ << "Program name: " << rt.m_progname << "\n"
<< "Working directory: " << rt.m_cwd << "\n"
<< "Translation units: " << rt.m_tus.size() << "\n"
- << "Process ID: " << rt.m_pid << "\n"
+ << "Process ID: " << rt.m_pid << "\n"
<< "Parent process ID: " << rt.m_ppid << "\n"
- << "Process group ID: " << rt.m_pgrp << "\n";
+ << "Process group ID: " << rt.m_pgrp << "\n";
return 0;
}
diff --git a/test/utils.sh b/test/utils.sh
@@ -17,22 +17,12 @@ echo "ok 1 - tmp dir created"
#
function test_total_execs
{
- test_num=${1}
+ $TEST_TOOLS/citrun-dump -t > execs.out
- let n=0
- let lst=0
- let cur=0
- let bad=0
- while [ $n -lt 60 ]; do
- cur=`$TEST_TOOLS/citrun-dump -t`
- [ $cur -le $lst ] && let bad++
- let lst=cur
- let n++
- done
- [ $bad -eq 0 ] && echo ok $test_num - program count increased 60 times
+ sort -n execs.out > execs.sorted
+ test_diff ${1} "executions strictly increasing" execs.sorted execs.out
}
-
#
# Differences two instrumented files. Knocks the header off of the "*.citrun"
# file.