about summary refs log tree commit diff stats
path: root/test_layers
blob: 45cc6b3cd6f87f1575da22c6823edbf62e8599f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/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

BUILD_UNTIL="./build_until"
MAKE="make"
VALGRIND="valgrind --leak-check=yes --num-callers=40 -q --error-exitcode=1"

for f in [0-9]*
do
  if [[ $f < $1 ]]; then continue; fi
  if [[ $2 && $f > $2 ]]; then exit 0; fi
  echo "=== $f"
  $BUILD_UNTIL $f || exit 1
done

CXX=clang++ CFLAGS="-O3 -fsanitize=undefined -Wno-tautological-constant-out-of-range-compare" $MAKE

if [[ ! $1 || $1 == chessboard ]]
then
  echo "=== chessboard"
  $VALGRIND ./mu_bin test chessboard.mu || exit 1
fi

if [[ ! $1 ]]
then
  for f in edit/[0-9]*
  do
    echo "=== edit: until $f"
    $VALGRIND ./mu_bin test `echo edit/[0-9]* |perl -pwe "s,$f.*,$f,"` || exit 1
  done
fi

if [[ $1 && $1 == edit ]]
then
  for f in edit/00[1-3]*
  do
    echo "=== edit: until $f"
    $VALGRIND ./mu_bin test `echo edit/[0-9]* |perl -pwe "s,$f.*,$f,"` || exit 1
  done
fi

if [[ $1 && $1 == edit2 ]]
then
  for f in edit/00[4-6]*
  do
    echo "=== edit: until $f"
    $VALGRIND ./mu_bin test `echo edit/[0-9]* |perl -pwe "s,$f.*,$f,"` || exit 1
  done
fi

if [[ $1 && $1 == edit3 ]]
then
  for f in edit/00[7-9]*
  do
    echo "=== edit: until $f"
    $VALGRIND ./mu_bin test `echo edit/[0-9]* |perl -pwe "s,$f.*,$f,"` || exit 1
  done
fi

if [[ $1 && $1 == edit4 ]]
then
  for f in edit/01*
  do
    echo "=== edit: until $f"
    $VALGRIND ./mu_bin test `echo edit/[0-9]* |perl -pwe "s,$f.*,$f,"` || exit 1
  done
fi