commit 51913a505c2ac6fc73db2c100d6fbb61275c48a8
parent 97ebd2c9406001c6ab3b09835548b801fceb6525
Author: Kyle Milz <kyle@0x30.net>
Date: Sat, 20 Aug 2016 14:45:29 -0600
src: reduce some logging
Diffstat:
3 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/src/inst_main.cc b/src/inst_main.cc
@@ -70,7 +70,7 @@ clean_PATH(InstrumentLogger &llog)
}
void
-print_toolinfo(InstrumentLogger &llog, const char *argv0)
+print_toolinfo(InstrumentLogger &llog)
{
struct utsname utsname;
@@ -78,15 +78,13 @@ print_toolinfo(InstrumentLogger &llog, const char *argv0)
<< unsigned(citrun_major) << "."
<< unsigned(citrun_minor) << " ";
if (uname(&utsname) == -1)
- llog << "(Unknown OS)\n";
+ llog << "(Unknown OS) ";
else {
llog << "(" << utsname.sysname << "-"
<< utsname.release << " "
- << utsname.machine << ")\n";
+ << utsname.machine << ") ";
}
-
- llog << "Tool called as '" << argv0 << "'.\n";
- llog << "Resource directory is '" << CITRUN_SHARE << "'\n";
+ llog << "'" << CITRUN_SHARE << "'\n";
}
int
@@ -104,18 +102,22 @@ main(int argc, char *argv[])
is_citruninst = true;
InstrumentLogger llog(is_citruninst);
- print_toolinfo(llog, argv[0]);
+ print_toolinfo(llog);
+ llog << "Tool called as '" << argv[0] << "'";
if (std::strcmp(base_name, argv[0]) != 0) {
- llog << "Changing '" << argv[0] << "' to '" << base_name << "'.\n";
+ llog << ", changing to '" << base_name << "'";
argv[0] = base_name;
}
-
- setprogname("citrun-inst");
-
- if (is_citruninst == false && clean_PATH(llog) != 0)
- // We were not called as citrun-inst and PATH cleaning failed.
- return 1;
+ llog << ".\n";
+
+ if (!is_citruninst) {
+ // There's extra work to do if we're not running as citrun-inst.
+ setprogname("citrun-inst");
+ if (clean_PATH(llog) != 0)
+ // PATH cleaning failed, exiting is advisable.
+ return 1;
+ }
InstrumentFrontend main(argc, argv, &llog, is_citruninst);
main.process_cmdline();
diff --git a/t/inst_log.sh b/t/inst_log.sh
@@ -45,9 +45,8 @@ sed -e "s,^.*: ,," \
&& echo "ok 5 - processed citrun.log"
cat <<EOF > citrun.log.good
-citrun-inst 0.0 ()
+citrun-inst 0.0 () ''
Tool called as ''.
-Resource directory is ''
PATH=''
Found source file ''.
Command line is ''.
@@ -66,9 +65,8 @@ Forked ''.
'' exited 0.
Rewritten source compile successful.
Restored ''.
-citrun-inst 0.0 ()
+citrun-inst 0.0 () ''
Tool called as ''.
-Resource directory is ''
PATH=''
Command line is ''.
Link detected, adding '' to command line.
diff --git a/t/inst_path.sh b/t/inst_path.sh
@@ -35,15 +35,11 @@ $TEST_TOOLS/cc -c nomatter.c 2> /dev/null
[ $? -eq 1 ] && echo ok 3
$cat <<EOF > citrun.log.good
-citrun-inst 0.0 ()
+citrun-inst 0.0 () ''
Tool called as ''.
-Resource directory is ''
-Changing ''.
PATH is not set.
-citrun-inst 0.0 ()
+citrun-inst 0.0 () ''
Tool called as ''.
-Resource directory is ''
-Changing ''.
PATH=''
'' not in PATH.
EOF