aboutsummaryrefslogtreecommitdiff
path: root/validate.sh
blob: 909eed48b321ccb6138556331d2d76d02801b0fd (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
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
#!/bin/bash
# 
#   Copyright (C) 2013, 2014 Linaro, Inc
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
# 

# load the configure file produced by configure
if test -e "${PWD}/host.conf"; then
    . "${PWD}/host.conf"
else
    echo "Error: this script needs to be run from a configured Abe tree!" 1>&2
fi

if test $# -lt 4; then
    echo "ERROR: No revisions to build!"
    echo "validate.sh --target triplet 1111 2222 [3333...]"
    exit
fi

# For each revision we build the toolchain for this config triplet
if test `echo $* | grep -c target` -eq 0; then
    echo "ERROR: No target to build!"
    echo "validate.sh --target triplet 1111 2222 [3333...]"
    exit
fi
shift
target=$1
shift

# load commonly used functions
abe="`which $0`"
topdir="${abe_path}"
abe="`basename $0`"

. "${topdir}/lib/diff.sh" || exit 1

# Get the list of revisions to build and compare
declare -a revisions=($*)

# Get the path for the other scripts.
fullpath="`which $0`"
abe="`dirname ${fullpath}`/abe.sh"
tcwgweb="`dirname ${fullpath}`/tcwgweb.sh"

# We'll move all the results to subdirectories under here
resultsdir="${local_builds}/test-results"
mkdir -p ${resultsdir}

# Build all the specified revisions.
i=0
while test $i -lt ${#revisions[@]}; do
    stamps="`ls -C1 ${local_builds}/${build}/${target}/*-stage2-build.stamp`"
    if test "`echo ${stamps} | grep -c ${revisions[$i]}`" -eq 0; then
     	${abe} --target ${target} --check gcc=gcc.git@${revisions[$i]} --build all
    fi
    sums="`find ${local_builds}/${build}/${target} -name \*.sum`"
    if test x"${sums}" != x; then
	mkdir -p ${resultsdir}/abe${revisions[$i]}/${build}-${target}
	cp ${sums} ${resultsdir}/abe${revisions[$i]}/${build}-${target}
	    # We don't need these files leftover from the DejaGnu testsuite
            # itself.
	xz -f ${resultsdir}/abe${revisions[$i]}/${build}-${target}/*.sum
	rm ${resultsdir}/abe${revisions[$i]}/${build}-${target}/{x,xXx,testrun}.sum
    fi
    i=`expr $i + 1`
done

# Compare the test results. If we only have 2, just do those. If there
# is a series, do them all in the order they were specified on the
# command line.
if test ${#revisions[@]} -eq 2; then
    difftwodirs ${resultsdir}/abe${revisions[0]} ${resultsdir}/abe${revisions[1]}
else
    j=0
    while test $j -lt ${#revisions[@]}; do
	first=abe${revisions[$j]}/${build}-${target}
	j=`expr $j + 1`
	second=abe${revisions[$j]}/${build}-${target}
	if test x"${second}" = x; then
	    break
	else
	    difftwodirs ${resultsdir}/${first} ${resultsdir}/${second}
	fi
    done
fi