about summary refs log tree commit diff stats
path: root/test_layers
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-07-27 16:01:55 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-27 17:47:59 -0700
commit6e1eeeebfb453fa7c871869c19375ce60fbd7413 (patch)
tree539c4a3fdf1756ae79770d5c4aaf6366f1d1525e /test_layers
parent8846a7f85cc04b77b2fe8a67b6d317723437b00c (diff)
downloadmu-6e1eeeebfb453fa7c871869c19375ce60fbd7413.tar.gz
5485 - promote SubX to top-level
Diffstat (limited to 'test_layers')
-rwxr-xr-xtest_layers101
1 files changed, 23 insertions, 78 deletions
diff --git a/test_layers b/test_layers
index 47cb01b0..2a7c693d 100755
--- a/test_layers
+++ b/test_layers
@@ -1,88 +1,33 @@
 #!/bin/bash
-# Repeatedly stop building until successive layers, and run all tests built,
-# while checking for undefined behavior using both UBSan and Valgrind.
+# Repeatedly stop building until successive layers, and run all tests built.
 #
-# Requires Linux.
-#
-# Usage:
-#   Test all layers:
-#     test_layers
-#   Test non-app layers after x:
-#     test_layers x
-#   Test layers after x and until y (inclusive):
-#     test_layers x y
-#   Test all layers for a specific app:
-#     test_layers app
-set -e
+# Assumes .subx files all come after .cc files.
 
-test "$BUILD" || export BUILD=build3
-
-if [[ $1 == one-off ]]
-then
-  ./$BUILD
-  ./mu_bin test || exit 1
-  exit 0
-fi
+set -e
 
-# Core layers atop Valgrind
-for f in [0-9]*
+cd `dirname $0`
+# add C++ files one at a time
+for f in [0-9]*cc
 do
-  if [[ $f < $1 ]]; then continue; fi
-  if [[ $2 && $f > $2 ]]; then exit 0; fi
   echo "=== $f"
-  ./clean top-level  # preserve subsidiary tools like tangle and cleave
-  ./$BUILD --until $f || exit 1
-  # valgrind requires Linux
-  valgrind --leak-check=yes --num-callers=40 -q --error-exitcode=1 ./mu_bin test || exit 1
-  # run on Mac OS without valgrind, and with a hacky fix for the coarser clock
-#?   ./mu_bin test || exit 1
-#?   sleep 1
+  ./build_and_test_until $f
 done
 
-# Layers for Mu apps without Valgrind
+# build everything one last time
 ./clean
-./$BUILD
+CFLAGS=$CFLAGS ./build  # build optimized by default since we'll be running it repeatedly below
 
-if [[ ! $1 || $1 == chessboard ]]
-then
-  echo "=== chessboard"
-  ./mu_bin test chessboard.mu || exit 1
-fi
-
-# slices of edit/ for Travis CI
-if [[ ! $1 || $1 == edit ]]
-then
-  echo "=== edit: until 001"
-  ./mu_bin test edit/001* || exit 1
-  echo "=== edit: until 002"
-  ./mu_bin test edit/00[1-2]* || exit 1
-  echo "=== edit: until 003"
-  ./mu_bin test edit/00[1-3]* || exit 1
-fi
-if [[ ! $1 || $1 == edit2 ]]
-then
-  echo "=== edit: until 004"
-  ./mu_bin test edit/00[1-4]* || exit 1
-  echo "=== edit: until 005"
-  ./mu_bin test edit/00[1-5]* || exit 1
-  echo "=== edit: until 006"
-  ./mu_bin test edit/00[1-6]* || exit 1
-fi
-if [[ ! $1 || $1 == edit3 ]]
-then
-  echo "=== edit: until 007"
-  ./mu_bin test edit/00[1-7]* || exit 1
-  echo "=== edit: until 008"
-  ./mu_bin test edit/00[1-8]* || exit 1
-  echo "=== edit: until 009"
-  ./mu_bin test edit/00* || exit 1
-fi
-if [[ ! $1 || $1 == edit4 ]]
-then
-  echo "=== edit: until 010"
-  ./mu_bin test edit/00* edit/010* || exit 1
-  echo "=== edit: until 011"
-  ./mu_bin test edit/00* edit/01[01]* || exit 1
-  echo "=== edit: until 012"
-  ./mu_bin test edit/00* edit/01[0-2]* || exit 1
-fi
+# add SubX files one at a time
+for f in [0-9]*.subx
+do
+  [ $f == *'memory_layout.subx' ]  &&  continue  # the very first .subx layer has no code
+  echo "=== $f"
+  ./subx translate $(enumerate/enumerate --until $f |grep '\.subx$') -o a.elf
+  ./subx run a.elf
+  echo
+  test `uname` = 'Linux'  &&  {
+    chmod +x a.elf
+    ./a.elf
+    echo
+  } || true
+done