| @@ -1,107 +1,115 @@ | | | @@ -1,107 +1,115 @@ |
1 | #! /bin/sh | | 1 | #! /bin/sh |
2 | # $NetBSD: test-variants.sh,v 1.1 2020/08/31 16:51:17 rillig Exp $ | | 2 | # $NetBSD: test-variants.sh,v 1.2 2020/08/31 17:25:29 rillig Exp $ |
3 | # | | 3 | # |
4 | # Build several variants of make and run the tests on them. | | 4 | # Build several variants of make and run the tests on them. |
5 | # | | 5 | # |
6 | # The output of this test suite must be inspected manuelly to see the | | 6 | # The output of this test suite must be inspected manuelly to see the |
7 | # interesting details. The main purpose is to list the available build | | 7 | # interesting details. The main purpose is to list the available build |
8 | # options. | | 8 | # options. |
9 | | | 9 | |
10 | set -eu | | 10 | set -eu |
11 | | | 11 | |
12 | failed="no" | | 12 | failed="no" |
13 | | | 13 | |
14 | fail() { | | 14 | fail() { |
15 | echo "failed" | | 15 | echo "failed" |
16 | failed="yes" | | 16 | failed="yes" |
17 | } | | 17 | } |
18 | | | 18 | |
19 | testcase() { | | 19 | testcase() { |
20 | echo "===> Running $*" | | 20 | echo "===> Running $*" |
21 | | | 21 | |
22 | case "$*" in **O3*|*NDEB*) ;; *) return ;; esac | | | |
23 | | | | |
24 | env -i PATH="$PATH" USETOOLS="no" "$@" \ | | 22 | env -i PATH="$PATH" USETOOLS="no" "$@" \ |
25 | sh -ce "make -s cleandir" \ | | 23 | sh -ce "make -s cleandir" \ |
26 | && env -i PATH="$PATH" USETOOLS="no" "$@" \ | | 24 | && env -i PATH="$PATH" USETOOLS="no" "$@" \ |
27 | sh -ce "make -ks all" \ | | 25 | sh -ce "make -ks all" \ |
28 | && size *.o make \ | | 26 | && size *.o make \ |
29 | && env -i PATH="$PATH" USETOOLS="no" MALLOC_OPTIONS="JA" "$@" \ | | 27 | && env -i PATH="$PATH" USETOOLS="no" MALLOC_OPTIONS="JA" "$@" \ |
30 | sh -ce "make -s test" \ | | 28 | sh -ce "make -s test" \ |
31 | || fail | | 29 | || fail |
32 | } | | 30 | } |
33 | | | 31 | |
34 | | | 32 | |
35 | testcase # just the plain default options | | 33 | testcase # just the plain default options |
36 | | | 34 | |
| | | 35 | # See whether the Boolean type is only used as a single-bit type. |
| | | 36 | # By default it is aliased to int, and int is already used for any other |
| | | 37 | # purpose. |
| | | 38 | # |
37 | testcase USER_CPPFLAGS="-DUSE_DOUBLE_BOOLEAN" | | 39 | testcase USER_CPPFLAGS="-DUSE_DOUBLE_BOOLEAN" |
38 | | | 40 | |
| | | 41 | # Ensure that variables of type Boolean are not assigned integers. |
| | | 42 | # The only valid values are TRUE and FALSE. |
| | | 43 | # |
39 | testcase USER_CPPFLAGS="-DUSE_UCHAR_BOOLEAN" | | 44 | testcase USER_CPPFLAGS="-DUSE_UCHAR_BOOLEAN" |
40 | | | 45 | |
| | | 46 | # Try a different compiler, with slightly different warnings and error |
| | | 47 | # messages. One feature that is missing from GCC is a little stricter |
| | | 48 | # checks for enums. |
| | | 49 | # |
41 | testcase HAVE_LLVM="yes" | | 50 | testcase HAVE_LLVM="yes" |
42 | | | 51 | |
43 | testcase USE_GCC8="yes" | | 52 | testcase USE_GCC8="yes" |
44 | | | 53 | |
45 | testcase USE_GCC9="yes" | | 54 | testcase USE_GCC9="yes" |
46 | | | 55 | |
47 | testcase USE_GCC10="yes" GCC10BASE="$HOME/pkg/gcc10" | | 56 | testcase USE_GCC10="yes" GCC10BASE="$HOME/pkg/gcc10" |
48 | | | 57 | |
49 | testcase USE_COVERAGE="yes" | | | |
50 | | | | |
51 | # for selecting emalloc | | 58 | # for selecting emalloc |
52 | testcase TOOLDIR="" | | 59 | testcase TOOLDIR="" |
53 | | | 60 | |
54 | testcase USE_FILEMON="dev" | | 61 | testcase USE_FILEMON="dev" |
55 | | | 62 | |
56 | testcase USE_FILEMON="ktrace" | | 63 | testcase USE_FILEMON="ktrace" |
57 | | | 64 | |
58 | testcase USE_META="no" | | 65 | testcase USE_META="no" |
59 | | | 66 | |
60 | testcase USER_CPPFLAGS="-DCLEANUP" | | 67 | testcase USER_CPPFLAGS="-DCLEANUP" |
61 | | | 68 | |
62 | testcase USER_CPPFLAGS="-DDEBUG_HASH_LOOKUP" | | 69 | testcase USER_CPPFLAGS="-DDEBUG_HASH_LOOKUP" |
63 | | | 70 | |
64 | testcase USER_CPPFLAGS="-DDEBUG_META_MODE" | | 71 | testcase USER_CPPFLAGS="-DDEBUG_META_MODE" |
65 | | | 72 | |
66 | testcase USER_CPPFLAGS="-DDEBUG_REALPATH_CACHE" | | 73 | testcase USER_CPPFLAGS="-DDEBUG_REALPATH_CACHE" |
67 | | | 74 | |
68 | testcase USER_CPPFLAGS="-DDEBUG_SRC" | | 75 | testcase USER_CPPFLAGS="-DDEBUG_SRC" |
69 | | | 76 | |
70 | testcase USER_CPPFLAGS="-UGMAKEEXPORT" | | 77 | #testcase USER_CPPFLAGS="-UGMAKEEXPORT" |
71 | | | 78 | |
72 | # NetBSD 8.0 x86_64 | | 79 | # NetBSD 8.0 x86_64 |
73 | # In file included from arch.c:135:0: | | 80 | # In file included from arch.c:135:0: |
74 | # /usr/include/sys/param.h:357:0: error: "MAXPATHLEN" redefined [-Werror] | | 81 | # /usr/include/sys/param.h:357:0: error: "MAXPATHLEN" redefined [-Werror] |
75 | # #define MAXPATHLEN PATH_MAX | | 82 | # #define MAXPATHLEN PATH_MAX |
76 | #testcase USER_CPPFLAGS="-DMAXPATHLEN=20" | | 83 | #testcase USER_CPPFLAGS="-DMAXPATHLEN=20" |
77 | | | 84 | |
78 | testcase USER_CPPFLAGS="-DNO_REGEX" | | 85 | testcase USER_CPPFLAGS="-DNO_REGEX" |
79 | | | 86 | |
80 | # NetBSD 8.0 x86_64 says: | | 87 | # NetBSD 8.0 x86_64 says: |
81 | # In file included from /usr/include/sys/param.h:115:0, | | 88 | # In file included from /usr/include/sys/param.h:115:0, |
82 | # from arch.c:135: | | 89 | # from arch.c:135: |
83 | # /usr/include/sys/syslimits.h:60:0: error: "PATH_MAX" redefined [-Werror] | | 90 | # /usr/include/sys/syslimits.h:60:0: error: "PATH_MAX" redefined [-Werror] |
84 | # #define PATH_MAX 1024 /* max bytes in pathname */ | | 91 | # #define PATH_MAX 1024 /* max bytes in pathname */ |
85 | #testcase USER_CPPFLAGS="-DPATH_MAX=20" | | 92 | #testcase USER_CPPFLAGS="-DPATH_MAX=20" |
86 | | | 93 | |
87 | # config.h:124:0: error: "POSIX" redefined [-Werror] | | 94 | # config.h:124:0: error: "POSIX" redefined [-Werror] |
88 | #testcase USER_CPPFLAGS="-DPOSIX" | | 95 | #testcase USER_CPPFLAGS="-DPOSIX" |
89 | | | 96 | |
90 | # config.h:115:0: error: "RECHECK" redefined [-Werror] | | 97 | # config.h:115:0: error: "RECHECK" redefined [-Werror] |
91 | #testcase USER_CPPFLAGS="-DRECHECK" | | 98 | #testcase USER_CPPFLAGS="-DRECHECK" |
92 | | | 99 | |
93 | # May trigger additional "may be used uninitialized" errors. | | 100 | # This higher optimization level may trigger additional "may be used |
94 | # Could be combined with other compilers as well. | | 101 | # uninitialized" errors. Could be combined with other compilers as well. |
| | | 102 | # |
95 | testcase USER_CFLAGS="-O3" | | 103 | testcase USER_CFLAGS="-O3" |
96 | | | 104 | |
97 | testcase USER_CFLAGS="-O0 -ggdb" | | 105 | testcase USER_CFLAGS="-O0 -ggdb" |
98 | | | 106 | |
99 | # /usr/include/sys/cdefs.h:618:22: error: ISO C90 does not support 'long long' [-Werror=long-long] | | 107 | # /usr/include/sys/cdefs.h:618:22: error: ISO C90 does not support 'long long' [-Werror=long-long] |
100 | # /usr/include/sys/endian.h:205:1: error: use of C99 long long integer constant [-Werror=long-long] | | 108 | # /usr/include/sys/endian.h:205:1: error: use of C99 long long integer constant [-Werror=long-long] |
101 | # /usr/include/pthread_types.h:128:3: error: ISO C90 doesn't support unnamed structs/unions [-Werror=pedantic] | | 109 | # /usr/include/pthread_types.h:128:3: error: ISO C90 doesn't support unnamed structs/unions [-Werror=pedantic] |
102 | # var.c:3027:2: error: initializer element is not computable at load time [-Werror=pedantic] | | 110 | # var.c:3027:2: error: initializer element is not computable at load time [-Werror=pedantic] |
103 | # var.c:2532:5: error: ISO C does not support '__PRETTY_FUNCTION__' predefined identifier [-Werror=pedantic] | | 111 | # var.c:2532:5: error: ISO C does not support '__PRETTY_FUNCTION__' predefined identifier [-Werror=pedantic] |
104 | # var.c:1574:15: error: ISO C90 does not support the 'z' gnu_printf length modifier [-Werror=format=] | | 112 | # var.c:1574:15: error: ISO C90 does not support the 'z' gnu_printf length modifier [-Werror=format=] |
105 | # var.c:137:33: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] | | 113 | # var.c:137:33: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] |
106 | # parse.c:2473:22: error: format '%p' expects argument of type 'void *', but argument 7 has type 'char * (*)(void *, size_t *) {aka char * (*)(void *, long unsigned int *)}' [-Werror=format=] | | 114 | # parse.c:2473:22: error: format '%p' expects argument of type 'void *', but argument 7 has type 'char * (*)(void *, size_t *) {aka char * (*)(void *, long unsigned int *)}' [-Werror=format=] |
107 | #testcase USER_CFLAGS="-std=c90 -ansi -pedantic" USER_CPPFLAGS="-Dinline=" | | 115 | #testcase USER_CFLAGS="-std=c90 -ansi -pedantic" USER_CPPFLAGS="-Dinline=" |
| @@ -110,16 +118,30 @@ testcase USER_CFLAGS="-O0 -ggdb" | | | @@ -110,16 +118,30 @@ testcase USER_CFLAGS="-O0 -ggdb" |
110 | testcase USER_CPPFLAGS="-Dinline=" | | 118 | testcase USER_CPPFLAGS="-Dinline=" |
111 | | | 119 | |
112 | testcase USER_CFLAGS="-std=c90" USER_CPPFLAGS="-Dinline=" | | 120 | testcase USER_CFLAGS="-std=c90" USER_CPPFLAGS="-Dinline=" |
113 | | | 121 | |
114 | #testcase USER_CFLAGS="-std=c90 -pedantic" USER_CPPFLAGS="-Dinline=" | | 122 | #testcase USER_CFLAGS="-std=c90 -pedantic" USER_CPPFLAGS="-Dinline=" |
115 | | | 123 | |
116 | testcase USER_CFLAGS="-ansi" USER_CPPFLAGS="-Dinline=" | | 124 | testcase USER_CFLAGS="-ansi" USER_CPPFLAGS="-Dinline=" |
117 | | | 125 | |
118 | # config.h does not allow overriding these features | | 126 | # config.h does not allow overriding these features |
119 | #testcase USER_CPPFLAGS="-UUSE_IOVEC" | | 127 | #testcase USER_CPPFLAGS="-UUSE_IOVEC" |
120 | | | 128 | |
121 | # Ensure that there are only side-effect-free conditions in the assert | | 129 | # Ensure that there are only side-effect-free conditions in the assert |
122 | # macro, or at least none that affect the outcome of the tests. | | 130 | # macro, or at least none that affect the outcome of the tests. |
| | | 131 | # |
123 | testcase USER_CPPFLAGS="-DNDEBUG" | | 132 | testcase USER_CPPFLAGS="-DNDEBUG" |
124 | | | 133 | |
| | | 134 | # Running the code coverage using gcov takes a long time. Most of this |
| | | 135 | # time is spent in gcov_read_unsigned because gcov_open sets the .gcda |
| | | 136 | # file to unbuffered, which means that every single byte needs its own |
| | | 137 | # system call to be read. |
| | | 138 | # |
| | | 139 | # Combining USE_COVERAGE with USE_GCC10 or HAVE_LLVM does not work since |
| | | 140 | # these fail to link with the coverage library. |
| | | 141 | # |
| | | 142 | # Turning the optimization off is required because of: |
| | | 143 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96622 |
| | | 144 | # |
| | | 145 | #testcase USE_COVERAGE="yes" USER_CFLAGS="-O0 -ggdb" |
| | | 146 | |
125 | test "$failed" = "no" | | 147 | test "$failed" = "no" |