Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/share/mk When no gcc but clang can be found, fallback ...



details:   https://anonhg.NetBSD.org/src/rev/9934cf136579
branches:  trunk
changeset: 344081:9934cf136579
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sat Mar 12 08:55:54 2016 +0000

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

diffstat:

 tests/share/mk/t_lib.sh  |  8 +++++++-
 tests/share/mk/t_prog.sh |  8 ++++++++
 tests/share/mk/t_test.sh |  4 ++++
 3 files changed, 19 insertions(+), 1 deletions(-)

diffs (64 lines):

diff -r d4f530201d38 -r 9934cf136579 tests/share/mk/t_lib.sh
--- a/tests/share/mk/t_lib.sh   Sat Mar 12 08:51:13 2016 +0000
+++ b/tests/share/mk/t_lib.sh   Sat Mar 12 08:55:54 2016 +0000
@@ -31,6 +31,12 @@
        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 @@
        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
 }
diff -r d4f530201d38 -r 9934cf136579 tests/share/mk/t_prog.sh
--- a/tests/share/mk/t_prog.sh  Sat Mar 12 08:51:13 2016 +0000
+++ b/tests/share/mk/t_prog.sh  Sat Mar 12 08:55:54 2016 +0000
@@ -31,6 +31,10 @@
        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 @@
 
 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; }
diff -r d4f530201d38 -r 9934cf136579 tests/share/mk/t_test.sh
--- a/tests/share/mk/t_test.sh  Sat Mar 12 08:51:13 2016 +0000
+++ b/tests/share/mk/t_test.sh  Sat Mar 12 08:55:54 2016 +0000
@@ -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
 



Home | Main Index | Thread Index | Old Index