summaryrefslogtreecommitdiffstats
path: root/tools/tools/build_option_survey/reduce.sh
blob: 375574987574347f3fe36552ab4fff1d3d20d0b8 (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
#!/bin/sh
# This file is in the public domain
# $FreeBSD$

set -e

OPLIST=`sh listallopts.sh`

ODIR=/usr/obj/`pwd`
RDIR=${ODIR}/_.result
export ODIR RDIR


compa ( ) (
	if [ ! -f $1/_.mtree ] ; then
		return
	fi
	if [ ! -f $2/_.mtree ] ; then
		return
	fi
	
	mtree -k uid,gid,mode,nlink,size,link,type,flags \
	    -f ${1}/_.mtree -f $2/_.mtree > $2/_.mtree.all.txt || true
	grep '^		' $2/_.mtree.all.txt > $4/$3.mtree.chg.txt || true
	grep '^[^	]' $2/_.mtree.all.txt > $4/$3.mtree.sub.txt || true
	grep '^	[^	]' $2/_.mtree.all.txt > $4/$3.mtree.add.txt || true
	a=`wc -l < $4/$3.mtree.add.txt`
	s=`wc -l < $4/$3.mtree.sub.txt`
	c=`wc -l < $4/$3.mtree.chg.txt`
	c=`expr $c / 2 || true`

	br=`awk 'NR == 2 {print $3}' $1/_.df`
	bt=`awk 'NR == 2 {print $3}' $2/_.df`
	echo $3 A $a S $s C $c B $bt D `expr $br - $bt`
)

for o in $OPLIST
do
	md=`echo "${o}=foo" | md5`
	m=${RDIR}/$md
	if [ ! -d $m ] ; then
		continue
	fi
	if [ ! -d $m/iw -a ! -d $m/bw -a ! -d $m/w ] ; then
		continue
	fi
	echo "=== reduce ${o}"

	echo
	echo -------------------------------------------------------------
	echo $md
	cat $m/src.conf
	echo -------------------------------------------------------------
	if [ ! -f $m/iw/done ] ; then
		echo "IW pending"
	elif [ ! -f $m/iw/_.success ] ; then
		echo "IW failed"
	fi
	if [ ! -f $m/bw/done ] ; then
		echo "BW pending"
	elif [ ! -f $m/bw/_.success ] ; then
		echo "BW failed"
	fi
	if [ ! -f $m/w/done ] ; then
		echo "W pending"
	elif [ ! -f $m/w/_.success ] ; then
		echo "W failed"
	fi
	(
	for x in iw bw w
	do
		compa ${RDIR}/Ref/ $m/$x r-$x $m
	done
	) > $m/stats
	cat $m/stats
done
echo "== reduce done"
OpenPOWER on IntegriCloud