[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {testsuite-work} tests: improve `ccnoco*.test', better cross-compi
From: |
Stefano Lattarini |
Subject: |
[FYI] {testsuite-work} tests: improve `ccnoco*.test', better cross-compiling support |
Date: |
Sun, 29 May 2011 16:30:56 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
* tests/ccnoco3.test (Mycomp): Use the `$CC' chosen by `tests/defs'
instead of forcing `gcc' unconditionally. This ensures better
coverage in case of cross-compiling, when GCC can be named e.g.,
`i586-mingw32msvc-gcc', instead of simply `gcc'.
* tests/ccnoco.test: Likewise. Remove redundant checks. Modernize
the created `configure.in'. Run tests both in-tree and in VPATH.
Export `CC' to the overridden value only once.
* tests/ccnoco2.test: Slightly stricter grepping of automake
stderr. Add trailing `:' command.
---
ChangeLog | 13 ++++++++++
tests/ccnoco.test | 63 ++++++++++++++++++++++-----------------------------
tests/ccnoco2.test | 6 +++-
tests/ccnoco3.test | 10 +++++---
4 files changed, 50 insertions(+), 42 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 91f4f99..80b3c50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2011-05-27 Stefano Lattarini <address@hidden>
+ tests: improve `ccnoco*.test', better cross-compiling support
+ * tests/ccnoco3.test (Mycomp): Use the `$CC' chosen by `tests/defs'
+ instead of forcing `gcc' unconditionally. This ensures better
+ coverage in case of cross-compiling, when GCC can be named e.g.,
+ `i586-mingw32msvc-gcc', instead of simply `gcc'.
+ * tests/ccnoco.test: Likewise. Remove redundant checks. Modernize
+ the created `configure.in'. Run tests both in-tree and in VPATH.
+ Export `CC' to the overridden value only once.
+ * tests/ccnoco2.test: Slightly stricter grepping of automake
+ stderr. Add trailing `:' command.
+
+2011-05-27 Stefano Lattarini <address@hidden>
+
testsuite: each test case depends on `defs-static'
* tests/Makefile.am ($(TEST_LOGS)): Depends on `defs-static' too.
Simplify comments.
diff --git a/tests/ccnoco.test b/tests/ccnoco.test
index fb22ba7..bcd18fc 100755
--- a/tests/ccnoco.test
+++ b/tests/ccnoco.test
@@ -20,22 +20,12 @@
required=gcc
. ./defs || Exit 1
-cat > configure.1 << 'END'
-AC_INIT(a.c)
-AM_INIT_AUTOMAKE(nonesuch, 0.23)
+cat >> configure.in << 'END'
AC_PROG_CC
AM_PROG_CC_C_O
-AC_OUTPUT(Makefile)
-END
-
-# This one makes sure that $CC can be used after AM_PROG_CC_C_O.
-cat > configure.3 << 'END'
-AC_INIT(a.c)
-AM_INIT_AUTOMAKE(nonesuch, 0.23)
-AC_PROG_CC
-AM_PROG_CC_C_O
-$CC -v > Hi 2>&1 || exit 1
-AC_OUTPUT(Makefile)
+# Make sure that $CC can be used after AM_PROG_CC_C_O.
+$CC -v || exit 1
+AC_OUTPUT
END
cat > Makefile.am << 'END'
@@ -54,16 +44,17 @@ int main ()
}
END
-cat > Mycomp << 'END'
+cat > Mycomp << END
#!/bin/sh
-case " "$* in
+case " \$* " in
*\ -c*\ -o* | *\ -o*\ -c*)
exit 1
;;
esac
-exec gcc "$@"
+# Use '$CC', not 'gcc', to honour the compiler chosen by 'tests/defs'.
+exec $CC "\$@"
END
chmod +x Mycomp
@@ -72,25 +63,25 @@ chmod +x Mycomp
CFLAGS=
export CFLAGS
-for conf in configure.1 configure.3; do
- cp $conf configure.in
-
- $ACLOCAL
- $AUTOCONF
- $AUTOMAKE --copy --add-missing
-
- rm -rf build
- mkdir build
- cd build
-
- # Make sure the compiler doesn't understand `-c -o'
- CC=`pwd`/../Mycomp
- export CC
-
- ../configure
- $MAKE
-
- cd ..
+# Make sure the compiler doesn't understand `-c -o'
+CC=`pwd`/Mycomp
+export CC
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --copy --add-missing
+
+for vpath in : false; do
+ if $vpath; then
+ srcdir=..
+ mkdir build
+ cd build
+ else
+ srcdir=.
+ fi
+ $srcdir/configure
+ $MAKE
+ cd $srcdir
done
:
diff --git a/tests/ccnoco2.test b/tests/ccnoco2.test
index a724448..4c6b22b 100755
--- a/tests/ccnoco2.test
+++ b/tests/ccnoco2.test
@@ -35,7 +35,7 @@ touch a.c
$ACLOCAL
$AUTOCONF
AUTOMAKE_fails --copy --add-missing
-grep 'Makefile.am:2:.*per-target.*AM_PROG_CC_C_O' stderr
+grep '^Makefile\.am:2:.*per-target.*AM_PROG_CC_C_O' stderr
cat >Makefile.am <<EOF
@@ -50,4 +50,6 @@ $AUTOMAKE --copy --add-missing
echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
AUTOMAKE_fails --copy --add-missing
-grep 'Makefile.am:2:.*subdir.*AM_PROG_CC_C_O' stderr
+grep '^Makefile\.am:2:.*subdir.*AM_PROG_CC_C_O' stderr
+
+:
diff --git a/tests/ccnoco3.test b/tests/ccnoco3.test
index 92ccf79..2a32f6b 100755
--- a/tests/ccnoco3.test
+++ b/tests/ccnoco3.test
@@ -23,6 +23,7 @@ required=gcc
cat >> configure.in << 'END'
AC_PROG_CC
AM_PROG_CC_C_O
+$CC --version; $CC -v; # For debugging.
AC_OUTPUT
END
@@ -43,16 +44,17 @@ int main ()
}
END
-cat > Mycomp << 'END'
+cat > Mycomp << END
#!/bin/sh
-case " "$* in
+case " \$* " in
*\ -c*\ -o* | *\ -o*\ -c*)
exit 1
;;
esac
-exec gcc "$@"
+# Use '$CC', not 'gcc', to honour the compiler chosen by 'tests/defs'.
+exec $CC "\$@"
END
chmod +x Mycomp
@@ -77,4 +79,4 @@ $MAKE 2>stderr || { cat stderr >&2; Exit 1; }
cat stderr >&2
grep 'mv.*the same file' stderr && Exit 1
-Exit 0
+:
--
1.7.2.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [FYI] {testsuite-work} tests: improve `ccnoco*.test', better cross-compiling support,
Stefano Lattarini <=