[PATCH] D20993: Add support for collating profiles for use with code coverage

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 00:23:55 PDT 2016


silvas added a subscriber: silvas.
silvas added a comment.

Nit about the shell script.


================
Comment at: utils/prepare-code-coverage-artifact.sh:1
@@ +1,2 @@
+#!/bin/sh
+
----------------
I mentioned this in one of the reviews of some stuff that Chris Bieneman was adding to clang for PGO (http://reviews.llvm.org/D15462), but these kinds of utility scripts are generally much more readable, robust, and portable when written in Python.

For example, the standard library operations all will throw exceptions nicely in cases of errors (which will stop the program dead, give you a complete stacktrace that is e.g. easy to read in a bot log, etc.). Also you can easily say `assert <cond>, "reason"` for quick sanity checks / "error handling" (again, you get a full stack trace if it fails, so for this kind of script more elaborate error handling isn't really needed).

It's really hard to get that kind of robustness from a shell script. (also it avoids general shell script problems like what happens when paths contain spaces, which lead to tremendous head scratching)

Also, writing it in Python makes it pretty portable for free and is generally more readable.


http://reviews.llvm.org/D20993





More information about the llvm-commits mailing list