about summary refs log tree commit diff stats
path: root/mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-07-22 23:36:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-07-22 23:36:19 -0700
commit60e11efcb042cb9cfb3fc50d8d7e36d74020b6ae (patch)
tree939aba1c2493874df2af1fbf09a663803b048e32 /mu
parentd8f7ec8ec9251e4f4aef179e83d291c7518e984e (diff)
downloadmu-60e11efcb042cb9cfb3fc50d8d7e36d74020b6ae.tar.gz
3137
Complicated logic to not run core tests. I only want to disable core
tests if:

  a) I'm changing CFLAGS on the commandline (usually to disable
  optimizations, causing tests to run slower in a debug cycle)
  b) I'm not printing a help message (either with just 'mu' or
  'mu --help')
  c) I'm loading other files besides just the core.

Under these circumstances I only want to run tests in the files
explicitly loaded at the commandline.

This is all pretty hairy, in spite of my attempts to document it in
four different places. I might end up taking it all out the first time I
need to run core tests under all these conditions.
Diffstat (limited to 'mu')
-rwxr-xr-xmu15
1 files changed, 15 insertions, 0 deletions
diff --git a/mu b/mu
index 3b1bb6c4..0a8dd082 100755
--- a/mu
+++ b/mu
@@ -5,4 +5,19 @@
 # show make output only if something needs doing
 make -q || make >&2 || exit 1
 
+# If I'm setting flags at the commandline I'm often disabling optimizations.
+# In that case don't run all tests if I load any app files.
+if [[ $CFLAGS && $# -gt 0 && $1 != '--help' ]]  # latter two conditions are to continue printing the help message
+then
+  ./mu_bin --test-only-app "$@"
+  exit 1
+fi
+
 ./mu_bin "$@"
+
+# Scenarios considered:
+#   mu
+#   mu --help
+#   mu test
+#   mu test file1.mu
+#   CFLAGS=-g mu test file1.mu  # run only tests in file1.mu