File: dotest

package info (click to toggle)
ion 3.2.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,768 kB
  • ctags: 11,049
  • sloc: ansic: 141,798; sh: 22,848; makefile: 7,818; python: 1,638; sql: 311; perl: 197; awk: 178; xml: 50; java: 19
file content (105 lines) | stat: -rwxr-xr-x 3,050 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# 
# this test checks the linking cleanliness of the executables
#
# it's a bit icky, because it's not obvious what files are executables
# so we install them all in a throw-away directory, then check the matching files in $IONDIR
#

#set -x

if ! which ldd > /dev/null; then
	echo "This system doesn't have 'ldd'; Skipping"
	exit 2;
fi

# vercmp ripped from
# http://rubinium.org/blog/archives/2010/04/05/shell-script-version-compare-vercmp/
function vercmp()
{
	RETVAL=`expr '(' "$1" : '\([^.]*\)' ')' '-' '(' "$2" : '\([^.]*\)' ')' '|' \
		'(' "$1" : '[^.]*[.]\([^.]*\)' ')' '-' '(' "$2" : '[^.]*[.]\([^.]*\)' ')' '|' \
		'(' "$1" : '[^.]*[.][^.]*[.]\([^.]*\)' ')' '-' '(' "$2" : '[^.]*[.][^.]*[.]\([^.]*\)' ')' '|' \
		'(' "$1" : '[^.]*[.][^.]*[.][^.]*[.]\([^.]*\)' ')' '-' '(' "$2" : '[^.]*[.][^.]*[.][^.]*[.]\([^.]*\)' ')'`
}
# Check the version of libtool because it was noticed that ubuntu 8.10's
# libtool v2.2.4 automatically generates -lpthread in some libraries even
# if they don't use it.
# This check is fragile in that it assumes "libtool --version" returns:
# ltmain.sh (GNU libtool) 2.2.6
# as the first line returned.

# Initialize myversion in case libtool --version doesn't work.
# default behavior is to assume libtool is working fine and report errors.
MYVERSION='999'
MYVERSION=`libtool --version | head -n1 | cut -d' ' -f4 | tr -dc [:digit:].`
MINVERSION='2.2.5'
OLDLIBTOOL=0
vercmp $MYVERSION $MINVERSION
if [ $RETVAL -le 0 ] ; then
	echo "Libtool is older than $MINVERSION."
	OLDLIBTOOL=1
fi

RETVAL=0

CURDIR=$PWD

(cd "$IONDIR" && "$CURDIR/make-link-graph.sh" -o "$CURDIR/ionliblinks.dot")
(cd "$IONDIR" && "$CURDIR/make-link-graph.sh" -x -o "$CURDIR/ionexelinks.dot")

bail () {
	exit $RETVAL
}

#Check library links first.
if grep -q 'color=red' ionliblinks.dot; then
	echo "Missing link between libraries:"
	grep 'color=red' ionliblinks.dot | cut -d ' ' -f 1 | sort -u
	echo
	RETVAL=1
fi
if grep -q 'color=purple' ionliblinks.dot; then
	echo "Unused link between libraries:"
	grep 'color=purple' ionliblinks.dot | cut -d ' ' -f 1 | sort -u
	if [ $OLDLIBTOOL -eq 1 ] ; then
		echo "Libtool is too old and inserts spurious -pthreads; ignoring error."
		RETVAL=0
	else
		RETVAL=1
	fi
	echo
fi

if [ "$RETVAL" != "0" ]; then
	echo "Errors found in libraries."
       	echo "Run 'dot -Tpng -o ionliblinks.png ionliblinks.dot' for details"
	bail
fi

#If no errors, also check executables
if grep -q 'color=red' ionliblinks.dot; then
	echo "Missing link between libraries:"
	grep 'color=red' ionliblinks.dot | cut -d ' ' -f 1 | sort -u
	echo
	RETVAL=1
fi
if grep -q 'color=purple' ionliblinks.dot; then
	echo "Unused link between libraries:"
	grep 'color=purple' ionliblinks.dot | cut -d ' ' -f 1 | sort -u
	if [ $OLDLIBTOOL -eq 1 ] ; then
		echo "Libtool is too old and inserts spurious -pthreads; ignoring error."
		RETVAL=0
	else
		RETVAL=1
	fi
	echo
fi

if [ "$RETVAL" != "0" ]; then
	echo "Errors found in executables."
       	echo "Run 'dot -Tpng -o ionexelinks.png ionexelinks.dot' for details"
fi

bail