citrun

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

commit a6075ad7d2570fc1d7744768c37486c8243a68ab
parent d7713eb9fcb1945b61abda9654dcd490eeb62750
Author: Kyle Milz <kyle@0x30.net>
Date:   Thu,  4 Aug 2016 18:44:36 -0600

src/check: add error function

Diffstat:
Msrc/check.in | 20++++++++++++--------
Msrc/inst_main.cc | 6++----
2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/check.in b/src/check.in @@ -1,18 +1,20 @@ -#!/bin/sh +#!/bin/sh -e dir=`pwd` [ "${1}" != "" ] && dir="${1}" -if [ ! -d $dir ]; then - echo "$dir: no such directory" - exit 0 -fi +function err { + echo "${1}" + exit 1 +} + +[ -d $dir ] || err "$dir: no such directory" GREP[1]="citrun-inst" GREP[2]="Forked " -GREP[3]="Instrumentation successful." -GREP[4]="Good news bud" -GREP[5]="Bad news bud" +GREP[3]="Instrumentation successful" +GREP[4]="And the native compile failed" +GREP[5]="But the native compile succeeded" GREP[6]="Link detected" DESC[0]="Log files found" @@ -39,6 +41,8 @@ for d in `find $dir -name citrun.log`; do done echo +[ ${COUNT[0]} -eq 0 ] && err "No results." + for i in 0 1 2 3 4 5 6; do [ ${COUNT[$i]} -eq 0 ] && continue printf "%8i %s\n" ${COUNT[$i]} "${DESC[$i]}" diff --git a/src/inst_main.cc b/src/inst_main.cc @@ -301,17 +301,15 @@ CitrunInst::instrument() int CitrunInst::try_unmodified_compile() { - m_log << m_pfx << "Attempting compilation of unmodified source.\n"; - restore_original_src(); int ret = fork_compiler(); if (ret == 0) { - m_log << m_pfx << "Bad news bud native compile succeeded.\n"; + m_log << m_pfx << "But the native compile succeeded!\n"; return 1; } - m_log << m_pfx << "Good news bud the native compiler also failed.\n"; + m_log << m_pfx << "And the native compile failed.\n"; return ret; }