summaryrefslogtreecommitdiffstats
path: root/package/gnuconfig/testsuite/config-guess.sh
blob: 3f51030806ce097a9035a0e863808f7ab0ddd496 (plain)
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
#!/bin/sh
#
# Copyright 2004, 2005 Free Software Foundation, Inc.
# Contributed by Ben Elliston <bje@gnu.org>.
#
# This test reads 5-tuples from config-guess.data: the components of
# the simulated uname(1) output and the expected GNU system triplet.

verbose=false
export PATH=`pwd`:$PATH
IFS="	" # tab

function run_config_guess ()
{
    rc=0
    while read machine release system version triplet ; do
	sed \
	    -e "s,@MACHINE@,$machine," \
	    -e "s,@RELEASE@,$release," \
	    -e "s,@SYSTEM@,$system," \
	    -e "s,@VERSION@,$version," < uname.in > uname
	chmod +x uname
	output=`sh ../config.guess 2>/dev/null`
	if test $? != 0 ; then
	    echo "FAIL: unable to guess $machine:$release:$system:$version"
	    rc=1
	    continue
	fi
	if test $output != $triplet ; then
	    echo "FAIL: $output (expected $triplet)"
	    rc=1
	    continue
	fi
	$verbose && echo "PASS: $triplet"
    done
    return $rc
}

sed 's/		*/	/g' < config-guess.data | run_config_guess
rc=$?
if test $rc -eq 0 ; then
  $verbose || echo "PASS: config.guess checks"
else
  test $rc -eq 1 && echo "Unexpected failures."
fi

exit $rc