| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #! /bin/sh | | 1 | #! /bin/sh |
2 | # $NetBSD: test-variants.sh,v 1.2 2020/08/31 17:25:29 rillig Exp $ | | 2 | # $NetBSD: test-variants.sh,v 1.3 2020/08/31 18:57:41 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" |
| @@ -62,66 +62,77 @@ testcase USE_FILEMON="dev" | | | @@ -62,66 +62,77 @@ testcase USE_FILEMON="dev" |
62 | | | 62 | |
63 | testcase USE_FILEMON="ktrace" | | 63 | testcase USE_FILEMON="ktrace" |
64 | | | 64 | |
65 | testcase USE_META="no" | | 65 | testcase USE_META="no" |
66 | | | 66 | |
67 | testcase USER_CPPFLAGS="-DCLEANUP" | | 67 | testcase USER_CPPFLAGS="-DCLEANUP" |
68 | | | 68 | |
69 | testcase USER_CPPFLAGS="-DDEBUG_HASH_LOOKUP" | | 69 | testcase USER_CPPFLAGS="-DDEBUG_HASH_LOOKUP" |
70 | | | 70 | |
71 | testcase USER_CPPFLAGS="-DDEBUG_META_MODE" | | 71 | testcase USER_CPPFLAGS="-DDEBUG_META_MODE" |
72 | | | 72 | |
73 | testcase USER_CPPFLAGS="-DDEBUG_REALPATH_CACHE" | | 73 | testcase USER_CPPFLAGS="-DDEBUG_REALPATH_CACHE" |
74 | | | 74 | |
75 | testcase USER_CPPFLAGS="-DDEBUG_SRC" | | 75 | # Produces lots of debugging output. |
| | | 76 | # |
| | | 77 | #testcase USER_CPPFLAGS="-DDEBUG_SRC" |
76 | | | 78 | |
77 | #testcase USER_CPPFLAGS="-UGMAKEEXPORT" | | 79 | #testcase USER_CPPFLAGS="-UGMAKEEXPORT" |
78 | | | 80 | |
79 | # NetBSD 8.0 x86_64 | | 81 | # NetBSD 8.0 x86_64 |
80 | # In file included from arch.c:135:0: | | 82 | # In file included from arch.c:135:0: |
81 | # /usr/include/sys/param.h:357:0: error: "MAXPATHLEN" redefined [-Werror] | | 83 | # /usr/include/sys/param.h:357:0: error: "MAXPATHLEN" redefined [-Werror] |
82 | # #define MAXPATHLEN PATH_MAX | | 84 | # #define MAXPATHLEN PATH_MAX |
83 | #testcase USER_CPPFLAGS="-DMAXPATHLEN=20" | | 85 | #testcase USER_CPPFLAGS="-DMAXPATHLEN=20" |
84 | | | 86 | |
| | | 87 | # In this variant, the unit tests that use the :C modifier obviously fail. |
| | | 88 | # |
85 | testcase USER_CPPFLAGS="-DNO_REGEX" | | 89 | testcase USER_CPPFLAGS="-DNO_REGEX" |
86 | | | 90 | |
87 | # NetBSD 8.0 x86_64 says: | | 91 | # NetBSD 8.0 x86_64 says: |
88 | # In file included from /usr/include/sys/param.h:115:0, | | 92 | # In file included from /usr/include/sys/param.h:115:0, |
89 | # from arch.c:135: | | 93 | # from arch.c:135: |
90 | # /usr/include/sys/syslimits.h:60:0: error: "PATH_MAX" redefined [-Werror] | | 94 | # /usr/include/sys/syslimits.h:60:0: error: "PATH_MAX" redefined [-Werror] |
91 | # #define PATH_MAX 1024 /* max bytes in pathname */ | | 95 | # #define PATH_MAX 1024 /* max bytes in pathname */ |
92 | #testcase USER_CPPFLAGS="-DPATH_MAX=20" | | 96 | #testcase USER_CPPFLAGS="-DPATH_MAX=20" |
93 | | | 97 | |
94 | # config.h:124:0: error: "POSIX" redefined [-Werror] | | 98 | # config.h:124:0: error: "POSIX" redefined [-Werror] |
95 | #testcase USER_CPPFLAGS="-DPOSIX" | | 99 | #testcase USER_CPPFLAGS="-DPOSIX" |
96 | | | 100 | |
97 | # config.h:115:0: error: "RECHECK" redefined [-Werror] | | 101 | # config.h:115:0: error: "RECHECK" redefined [-Werror] |
98 | #testcase USER_CPPFLAGS="-DRECHECK" | | 102 | #testcase USER_CPPFLAGS="-DRECHECK" |
99 | | | 103 | |
100 | # This higher optimization level may trigger additional "may be used | | 104 | # This higher optimization level may trigger additional "may be used |
101 | # uninitialized" errors. Could be combined with other compilers as well. | | 105 | # uninitialized" errors. Could be combined with other compilers as well. |
102 | # | | 106 | # |
103 | testcase USER_CFLAGS="-O3" | | 107 | testcase USER_CFLAGS="-O3" |
104 | | | 108 | |
105 | testcase USER_CFLAGS="-O0 -ggdb" | | 109 | testcase USER_CFLAGS="-O0 -ggdb" |
106 | | | 110 | |
| | | 111 | # The make source code is _intended_ to be compatible with C90. |
| | | 112 | # It uses some C99 features though. |
| | | 113 | # To really port it to C90, it would have to be in a C90 environment |
| | | 114 | # in which the system headers don't aggressively depend on C99. |
| | | 115 | # |
| | | 116 | # NetBSD 8.0 x86_64: |
107 | # /usr/include/sys/cdefs.h:618:22: error: ISO C90 does not support 'long long' [-Werror=long-long] | | 117 | # /usr/include/sys/cdefs.h:618:22: error: ISO C90 does not support 'long long' [-Werror=long-long] |
108 | # /usr/include/sys/endian.h:205:1: error: use of C99 long long integer constant [-Werror=long-long] | | 118 | # /usr/include/sys/endian.h:205:1: error: use of C99 long long integer constant [-Werror=long-long] |
109 | # /usr/include/pthread_types.h:128:3: error: ISO C90 doesn't support unnamed structs/unions [-Werror=pedantic] | | 119 | # /usr/include/pthread_types.h:128:3: error: ISO C90 doesn't support unnamed structs/unions [-Werror=pedantic] |
110 | # var.c:3027:2: error: initializer element is not computable at load time [-Werror=pedantic] | | 120 | # var.c:3027:2: error: initializer element is not computable at load time [-Werror=pedantic] |
111 | # var.c:2532:5: error: ISO C does not support '__PRETTY_FUNCTION__' predefined identifier [-Werror=pedantic] | | 121 | # var.c:2532:5: error: ISO C does not support '__PRETTY_FUNCTION__' predefined identifier [-Werror=pedantic] |
112 | # var.c:1574:15: error: ISO C90 does not support the 'z' gnu_printf length modifier [-Werror=format=] | | 122 | # var.c:1574:15: error: ISO C90 does not support the 'z' gnu_printf length modifier [-Werror=format=] |
113 | # var.c:137:33: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] | | 123 | # var.c:137:33: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] |
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=] | | 124 | # 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=] |
| | | 125 | # |
115 | #testcase USER_CFLAGS="-std=c90 -ansi -pedantic" USER_CPPFLAGS="-Dinline=" | | 126 | #testcase USER_CFLAGS="-std=c90 -ansi -pedantic" USER_CPPFLAGS="-Dinline=" |
116 | | | 127 | |
117 | # Ensure that every inline function is declared as MAKE_ATTR_UNUSED. | | 128 | # Ensure that every inline function is declared as MAKE_ATTR_UNUSED. |
118 | testcase USER_CPPFLAGS="-Dinline=" | | 129 | testcase USER_CPPFLAGS="-Dinline=" |
119 | | | 130 | |
120 | testcase USER_CFLAGS="-std=c90" USER_CPPFLAGS="-Dinline=" | | 131 | testcase USER_CFLAGS="-std=c90" USER_CPPFLAGS="-Dinline=" |
121 | | | 132 | |
122 | #testcase USER_CFLAGS="-std=c90 -pedantic" USER_CPPFLAGS="-Dinline=" | | 133 | #testcase USER_CFLAGS="-std=c90 -pedantic" USER_CPPFLAGS="-Dinline=" |
123 | | | 134 | |
124 | testcase USER_CFLAGS="-ansi" USER_CPPFLAGS="-Dinline=" | | 135 | testcase USER_CFLAGS="-ansi" USER_CPPFLAGS="-Dinline=" |
125 | | | 136 | |
126 | # config.h does not allow overriding these features | | 137 | # config.h does not allow overriding these features |
127 | #testcase USER_CPPFLAGS="-UUSE_IOVEC" | | 138 | #testcase USER_CPPFLAGS="-UUSE_IOVEC" |
| @@ -134,14 +145,29 @@ testcase USER_CPPFLAGS="-DNDEBUG" | | | @@ -134,14 +145,29 @@ testcase USER_CPPFLAGS="-DNDEBUG" |
134 | # Running the code coverage using gcov takes a long time. Most of this | | 145 | # 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 | | 146 | # 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 | | 147 | # file to unbuffered, which means that every single byte needs its own |
137 | # system call to be read. | | 148 | # system call to be read. |
138 | # | | 149 | # |
139 | # Combining USE_COVERAGE with USE_GCC10 or HAVE_LLVM does not work since | | 150 | # Combining USE_COVERAGE with USE_GCC10 or HAVE_LLVM does not work since |
140 | # these fail to link with the coverage library. | | 151 | # these fail to link with the coverage library. |
141 | # | | 152 | # |
142 | # Turning the optimization off is required because of: | | 153 | # Turning the optimization off is required because of: |
143 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96622 | | 154 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96622 |
144 | # | | 155 | # |
145 | #testcase USE_COVERAGE="yes" USER_CFLAGS="-O0 -ggdb" | | 156 | #testcase USE_COVERAGE="yes" USER_CFLAGS="-O0 -ggdb" |
146 | | | 157 | |
| | | 158 | testcase USE_FORT="yes" |
| | | 159 | |
| | | 160 | # This test is the result of reading through the GCC "Warning Options" |
| | | 161 | # documentation, noting down everything that sounded interesting. |
| | | 162 | # |
| | | 163 | testcase USE_GCC10=yes GCC10BASE=$HOME/pkg/gcc10 USER_CFLAGS="\ |
| | | 164 | -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces \ |
| | | 165 | -Wextra -Wnonnull -Wnonnull-compare -Wnull-dereference -Wimplicit \ |
| | | 166 | -Wimplicit-fallthrough=4 -Wignored-qualifiers -Wunused \ |
| | | 167 | -Wunused-but-set-variable -Wunused-parameter -Wduplicated-branches \ |
| | | 168 | -Wduplicated-cond -Wunused-macros -Wcast-function-type -Wconversion \ |
| | | 169 | -Wenum-compare -Wmissing-field-initializers -Wredundant-decls \ |
| | | 170 | -Wno-error=conversion -Wno-error=sign-conversion -Wno-error=unused-macros \ |
| | | 171 | -Wno-error=unused-parameter -Wno-error=duplicated-branches" |
| | | 172 | |
147 | test "$failed" = "no" | | 173 | test "$failed" = "no" |