summaryrefslogtreecommitdiff
path: root/tools/diffPickled
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-02-15 20:00:36 +0000
committerPaul Phillips <paulp@improving.org>2010-02-15 20:00:36 +0000
commit821229741d41ab5a0087ddf289ee01b92e9c0685 (patch)
tree1306ddc619017d903c2bceb35ba37ba27cc27dbf /tools/diffPickled
parent369d3ca26f05ab848807c109e464f90f2e668c81 (diff)
downloadscala-821229741d41ab5a0087ddf289ee01b92e9c0685.tar.gz
scala-821229741d41ab5a0087ddf289ee01b92e9c0685.tar.bz2
scala-821229741d41ab5a0087ddf289ee01b92e9c0685.zip
Some new tools for the tools directory.
amounts to a yak shaving expedition to enable this, which now works: tools/diffPickled scala.Either and since stability is presently broken you will see the following. (When it's not broken you will see nothing.) 541,544c541,544 < 538,4090: EXTref 3: 539(Left) 2 < 539,4095: TYPEname 4: Left < 540,4101: EXTref 3: 541(Right) 2 < 541,4106: TYPEname 5: Right --- > 538,4090: EXTref 3: 539(Right) 2 > 539,4095: TYPEname 5: Right > 540,4102: EXTref 3: 541(Left) 2 > 541,4107: TYPEname 4: Left
Diffstat (limited to 'tools/diffPickled')
-rwxr-xr-xtools/diffPickled51
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/diffPickled b/tools/diffPickled
new file mode 100755
index 0000000000..b4a345dc7d
--- /dev/null
+++ b/tools/diffPickled
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# Shows the difference in pickler output between two variations on a class.
+#
+# If quick and strap are built normally you can run
+#
+# diffPickled foo.bar.Baz
+#
+# to see any differences between them in that class.
+
+USAGE="Usage: $0 classpath1 classpath2 class"
+TOOLSDIR=`dirname $0`
+BUILDDIR="${TOOLSDIR}/../build"
+QUICKDIR="${BUILDDIR}/quick"
+STRAPDIR="${BUILDDIR}/strap"
+
+CP1=""
+CP2=""
+CLASS=""
+
+if [ $# == 1 ] ; then
+ if [ -e ${QUICKDIR} ] && [ -e ${STRAPDIR} ] ; then
+ CP1=`${TOOLSDIR}/quickcp`
+ CP2=`${TOOLSDIR}/strapcp`
+ CLASS=$1
+ else
+ echo $USAGE
+ echo "(If only one argument is given, $QUICKDIR and $STRAPDIR must exist.)"
+ exit 1
+ fi
+elif [ $# == 3 ] ; then
+ CP1=$1
+ CP2=$2
+ CLASS=$3
+else
+ echo $USAGE
+ exit 1
+fi
+
+TMPDIR="/tmp/scala_pickle_diff${RANDOM}"
+
+if mkdir -m 0700 "$TMPDIR" 2>/dev/null ; then
+ ${TOOLSDIR}/showPickled -cp $CP1 $CLASS > "${TMPDIR}/out1.txt"
+ ${TOOLSDIR}/showPickled -cp $CP2 $CLASS > "${TMPDIR}/out2.txt"
+ diff "${TMPDIR}/out1.txt" "${TMPDIR}/out2.txt"
+ rm -rf ${TMPDIR}
+else
+ echo "Failed to create temporary directory ${TMPDIR}."
+ exit 1
+fi
+