Browse code

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.

Andrei Pelinescu-Onciul authored on 01/06/2009 10:36:05
Showing 2 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,17 @@
0
+#!/bin/sh
1
+
2
+#
3
+# wrapper arroung gcc, that intercepts --version and reports instead
4
+# $GCC_VERSION
5
+#
6
+
7
+if [ -n "$GCC_VERSION" ]; then
8
+	for o in $@; do
9
+		if [ "$o" = "--version" ] ; then
10
+			echo $GCC_VERSION
11
+			exit 0
12
+		fi
13
+	done
14
+fi
15
+
16
+gcc $@
0 17
new file mode 100755
... ...
@@ -0,0 +1,26 @@
0
+#!/bin/sh
1
+
2
+# test make cfg with all the gcc versions in gcc_versions.txt
3
+# should be run from the main sip-router directory
4
+# Depends on: test/gcc_version.sh and test/gcc_versions.txt
5
+
6
+if [ ! -e test/gcc_version.sh -o ! -r test/gcc_versions.txt -o ! -r Makefile ]
7
+then
8
+	echo "ERROR: wrong path, this test must be run from the main"\
9
+		" sip-router directory"
10
+	exit 1
11
+fi
12
+
13
+while read v ; do
14
+	GCC_VERSION=$v make CC=test/gcc_version.sh cfg-defs >/dev/null
15
+	if [ $? -ne 0 -o ! -r config.mak ]; then
16
+		echo "ERROR: make cfg failed for version \"$v\""
17
+		exit 1
18
+	fi
19
+	COMPILER=`egrep -o -- "-DCOMPILER='\"[^\"' ]+ [2-9]\.[0-9]{1,2}(\.[0-9]{1,2})?\"'" config.mak`
20
+	if [ $? -ne 0 -o -z "$COMPILER" ]; then
21
+		echo "ERROR: bad ver: \"$v\" => `egrep -o -- "-DCOMPILER='[^']*'" config.mak`"
22
+		exit 1
23
+	fi
24
+	echo "ok: \"$v\" => $COMPILER"
25
+done < test/gcc_versions.txt