commit 13280533ede11fd6bd137cfbc610d2334976b02e
parent 17e9c959ca325b46bd4f9b7627105417773a7482
Author: Kyle Milz <kyle@0x30.net>
Date: Tue, 19 Sep 2017 01:14:55 -0600
bin: actually commit the changes to citrun_check
Diffstat:
M | bin/check.awk | | | 72 | +++++++++++++++++++++++++++++++----------------------------------------- |
1 file changed, 31 insertions(+), 41 deletions(-)
diff --git a/bin/check.awk b/bin/check.awk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2016 Kyle Milz <kyle@0x30.net>
+# Copyright (c) 2016, 2017 Kyle Milz <kyle@0x30.net>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -15,53 +15,44 @@
#
# Counts events in citrun.log files.
#
-set -eu
+$0~/>> citrun_inst/ { summary[0] += 1 }
+$0~/Found source file/ { summary[1] += 1 }
+$0~/Link detected/ { summary[2] += 1 }
+$0~/Rewritten source compile successfu/ { summary[3] += 1 }
+$0~/Rewritten source compile failed/ { summary[4] += 1 }
-# If positional arguments are zero length (== no directories given).
-if [ -z $@ ]; then
- # Then set $1 (and $@) to current directory.
- set -- "."
-fi
-
-# If stdout is a tty.
-if [ -t 1 ]; then
- echo Checking "$@"
-fi
-
-find $@ -name citrun.log -print0 | xargs -0 awk '
-$0~/Found source file/ { summary[0] += 1 }
-$0~/Link detected/ { summary[1] += 1 }
-$0~/Rewritten source compile successful/ { summary[2] += 1 }
-$0~/Rewritten source compile failed/ { summary[3] += 1 }
-
-$0~/Lines of source code/ { totals[0] += $2 }
-$0~/Milliseconds spent rewriting source/ { totals[1] += $2 }
-$0~/Function definitions/ { totals[2] += $2 }
-$0~/If statements/ { totals[3] += $2 }
-$0~/For loops/ { totals[4] += $2 }
-$0~/While loops/ { totals[5] += $2 }
-$0~/Do while loops/ { totals[6] += $2 }
-$0~/Switch statements/ { totals[7] += $2 }
-$0~/Return statement values/ { totals[8] += $2 }
-$0~/Call expressions/ { totals[9] += $2 }
-$0~/Total statements/ { totals[10] += $2 }
-$0~/Binary operators/ { totals[11] += $2 }
-$0~/Errors rewriting source/ { totals[12] += $2 }
+$0~/Lines of source code/ { totals[0] += $2 }
+$0~/Milliseconds spent rewriting sourc/ { totals[1] += $2 }
+$0~/Function definitions/ { totals[2] += $2 }
+$0~/If statements/ { totals[3] += $2 }
+$0~/For loops/ { totals[4] += $2 }
+$0~/While loops/ { totals[5] += $2 }
+$0~/Do while loops/ { totals[6] += $2 }
+$0~/Switch statements/ { totals[7] += $2 }
+$0~/Return statement values/ { totals[8] += $2 }
+$0~/Call expressions/ { totals[9] += $2 }
+$0~/Total statements/ { totals[10] += $2 }
+$0~/Binary operators/ { totals[11] += $2 }
+$0~/Errors rewriting source/ { totals[12] += $2 }
END {
- summary_desc[0] = "Source files used as input"
- summary_desc[1] = "Application link commands"
- summary_desc[2] = "Successful modified source compiles"
- summary_desc[3] = "Failed modified source compiles"
+ if (summary[0] == 0) {
+ print "No signs of rewrite activity. Are any of the arguments log files?"
+ exit 1
+ }
+
+ summary_desc[0] = "Rewrite tool runs"
+ summary_desc[1] = "Source files used as input"
+ summary_desc[2] = "Application link commands"
+ summary_desc[3] = "Successful modified source compiles"
+ summary_desc[4] = "Failed modified source compiles"
print "Summary:"
- for (i = 0; i < 4; i++) {
- if (i != 0 && summary[i] == 0) continue
+ for (i = 0; i < 5; i++) {
+ if (summary[i] == 0) continue
printf "%10i %s\n", summary[i], summary_desc[i]
}
- if (summary[0] == 0) exit 1
-
totals_desc[0] = "Lines of source code"
totals_desc[1] = "Milliseconds spent rewriting source"
totals_desc[2] = "Function definitions"
@@ -83,4 +74,3 @@ END {
printf "%10i %s\n", totals[i], totals_desc[i]
}
}
-'