summaryrefslogtreecommitdiffstats
path: root/eclipse.plugin/diff-build-results.sh
blob: e5ae6d0fbedb8cd2583dcc25699695a3dfe4d8b8 (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
#!/bin/bash
# Regression test when changing the build script.
# Compare new.zip and old.zip, assuming they contain build results
# aj-build/dist/ide/eclipse for two different versions of the build script
# (and comparing only the contents of the .jar files).
# [There must be a better way: diff support that recurses into .jar/.zip files]

[ -n "$DEBUG" ] && set -vx 

jar="${JAVA_HOME}/bin/jar"

errExit() {
  echo "ERROR $1: $2"
  exit "$1"
}

# make this empty to avoid unzipping new.zip and old.zip
dozip="yes"
if [ -z "${dozip}" ] ; then
	cd temp
else
	rm -rf temp
	mkdir temp
	cd temp
	for d in new old; do
		[ -f ../$d.zip ] || errExit 2 "make $d.zip";
		mkdir $d
		cd $d
		$jar -xf ../../$d.zip
		cd eclipse
		ls *.jar | sort > ../../$d-names.txt
		cd ../..
	done
fi

  diff *-names.txt > /dev/null || errExit 3 "expected same products"
  for j in `cat new-names.txt`; do
     mkdir $j-dir;
     cd $j-dir
     for d in new old; do 
	     mkdir $d
	     cd $d
	     $jar xf ../../$d/eclipse/$j
	     dirpath=`pwd | sed 's|/cygdrive/c|c:|'`
	     for z in `find . -type f -name \*.jar -o -name \*.zip`; do
	        mkdir ${z}-dir
	        pushd ${z}-dir
	        $jar -xf $dirpath/${z}
	        popd
	     done
	     cd ..
     done
	 diff -qr new old > diffs.txt
     cd ..
  done
  cat */diffs.txt
  wc -l */diffs.txt