Module Name:    src
Committed By:   joerg
Date:           Sat Mar 12 08:55:54 UTC 2016

Modified Files:
        src/tests/share/mk: t_lib.sh t_prog.sh t_test.sh

Log Message:
When no gcc but clang can be found, fallback to the latter instead of
failing the tests.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/share/mk/t_lib.sh \
    src/tests/share/mk/t_test.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/share/mk/t_prog.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/share/mk/t_lib.sh
diff -u src/tests/share/mk/t_lib.sh:1.1 src/tests/share/mk/t_lib.sh:1.2
--- src/tests/share/mk/t_lib.sh:1.1	Sun Aug 26 23:03:21 2012
+++ src/tests/share/mk/t_lib.sh	Sat Mar 12 08:55:54 2016
@@ -31,6 +31,12 @@ defaults__build_and_install_body() {
 	create_c_module module1 first
 	create_c_module module2 second
 
+	CC=gcc
+	if [ ! -e /usr/bin/gcc -a -e /usr/bin/clang ]; then
+		export HAVE_LLVM=yes
+		CC=clang
+	fi
+
 	cat >Makefile <<EOF
 LIB = two-modules
 SRCS = module1.c module2.c
@@ -44,7 +50,7 @@ EOF
 	atf_check -o ignore make install
 
 	create_main_using_modules main.c module1.h:first module2.h:second
-	atf_check -o ignore gcc -I. -Lroot/usr/lib -o main main.c -ltwo-modules
+	atf_check -o ignore ${CC} -I. -Lroot/usr/lib -o main main.c -ltwo-modules
 
 	atf_check -o inline:'module1\nmodule2\n' ./main
 }
Index: src/tests/share/mk/t_test.sh
diff -u src/tests/share/mk/t_test.sh:1.1 src/tests/share/mk/t_test.sh:1.2
--- src/tests/share/mk/t_test.sh:1.1	Sun Aug 26 23:03:21 2012
+++ src/tests/share/mk/t_test.sh	Sat Mar 12 08:55:54 2016
@@ -34,6 +34,10 @@
 # The second argument is the name of the test program, without an extension.
 # The corresponding source file must exist in the current directory.
 one_test() {
+
+	if [ ! -e /usr/bin/gcc -a -e /usr/bin/clang ]; then
+		export HAVE_LLVM=yes
+	fi
 	local lang="${1}"; shift
 	local name="${1}"; shift
 

Index: src/tests/share/mk/t_prog.sh
diff -u src/tests/share/mk/t_prog.sh:1.2 src/tests/share/mk/t_prog.sh:1.3
--- src/tests/share/mk/t_prog.sh:1.2	Tue Aug 28 15:22:18 2012
+++ src/tests/share/mk/t_prog.sh	Sat Mar 12 08:55:54 2016
@@ -31,6 +31,10 @@ defaults__build_and_install_head() {
 	atf_set "require.progs" "/usr/bin/mandoc"
 }
 defaults__build_and_install_body() {
+	if [ ! -e /usr/bin/gcc -a -e /usr/bin/clang ]; then
+		export HAVE_LLVM=yes
+	fi
+
 	cat >hello.c <<EOF
 #include <stdio.h>
 int main(void) { printf("Hello, test!\n"); return 0; }
@@ -61,6 +65,10 @@ EOF
 
 atf_test_case without_man__build_and_install
 without_man__build_and_install_body() {
+	if [ ! -e /usr/bin/gcc -a -e /usr/bin/clang ]; then
+		export HAVE_LLVM=yes
+	fi
+
 	cat >hello.c <<EOF
 #include <stdio.h>
 int main(void) { printf("Hello, test!\n"); return 0; }

Reply via email to