#!/bin/bash
# Repeatedly stop building until successive layers, and run all tests built,
# while checking for undefined behavior using both UBSan and Valgrind.
#
# 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
test "$BUILD" || export BUILD=build3
if [[ $1 == one-off ]]
then
./$BUILD
./mu_bin test || exit 1
exit 0
fi
# Core layers atop Valgrind
for f in [