Module: sip-router
Branch: master
Commit: 7ac811b4fda52b4294fe740d24cf71e321fc707a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7ac811b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Jun 1 12:36:05 2009 +0200
test: gcc version test scripts
Test if gcc version is correctly detected with a large collection
of gcc version strings. To be used each time the gcc version
detection is changed.
---
test/gcc_version.sh | 17 +++++++++++++++++
test/gcc_version_test.sh | 26 ++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/test/gcc_version.sh b/test/gcc_version.sh
new file mode 100755
index 0000000..078b852
--- /dev/null
+++ b/test/gcc_version.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#
+# wrapper arroung gcc, that intercepts --version and reports instead
+# $GCC_VERSION
+#
+
+if [ -n "$GCC_VERSION" ]; then
+ for o in $@; do
+ if [ "$o" = "--version" ] ; then
+ echo $GCC_VERSION
+ exit 0
+ fi
+ done
+fi
+
+gcc $@
diff --git a/test/gcc_version_test.sh b/test/gcc_version_test.sh
new file mode 100755
index 0000000..4a6912b
--- /dev/null
+++ b/test/gcc_version_test.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# test make cfg with all the gcc versions in gcc_versions.txt
+# should be run from the main sip-router directory
+# Depends on: test/gcc_version.sh and test/gcc_versions.txt
+
+if [ ! -e test/gcc_version.sh -o ! -r test/gcc_versions.txt -o ! -r Makefile ]
+then
+ echo "ERROR: wrong path, this test must be run from the main"\
+ " sip-router directory"
+ exit 1
+fi
+
+while read v ; do
+ GCC_VERSION=$v make CC=test/gcc_version.sh cfg-defs >/dev/null
+ if [ $? -ne 0 -o ! -r config.mak ]; then
+ echo "ERROR: make cfg failed for version \"$v\""
+ exit 1
+ fi
+ COMPILER=`egrep -o -- "-DCOMPILER='\"[^\"' ]+
[2-9]\.[0-9]{1,2}(\.[0-9]{1,2})?\"'" config.mak`
+ if [ $? -ne 0 -o -z "$COMPILER" ]; then
+ echo "ERROR: bad ver: \"$v\" => `egrep -o --
"-DCOMPILER='[^']*'" config.mak`"
+ exit 1
+ fi
+ echo "ok: \"$v\" => $COMPILER"
+done < test/gcc_versions.txt