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