diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-01-04 15:42:04 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-01-04 15:42:04 -0500 |
commit | c6e8003fb8854d2bccf744cae52ecc1400afcf29 (patch) | |
tree | 0798867cc8da3e5f169fad4b08ae2ca0b3ac08c9 | |
parent | b34c0f705bdec52dba4f83e7d4a02afa5b3b9a9c (diff) |
Run diff on the before and after documents, and compare the diff outputs.
-rw-r--r-- | configure.ac | 6 | ||||
-rwxr-xr-x | run-test.sh.in | 40 | ||||
-rw-r--r-- | setenv.sh.in | 1 |
3 files changed, 43 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 2459047..b6e3a28 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,12 @@ if test -z "PYTHON"; then fi AC_SUBST(PYTHON) +AC_PATH_PROG(DIFF, diff) +if test -z "DIFF"; then + AC_MSG_ERROR([diff not found in your path.]) +fi +AC_SUBST(DIFF) + ROOTDIR=`pwd` AC_SUBST(ROOTDIR) diff --git a/run-test.sh.in b/run-test.sh.in index a2125b5..e7ae067 100755 --- a/run-test.sh.in +++ b/run-test.sh.in @@ -9,15 +9,47 @@ dump_files() continue fi dumppath=$(echo "$filepath" | sed -e 's/\.xls$/\.log/g') - @PYTHON@ "$XLS_DUMP_PATH" "$filepath" > "$dumppath" + @PYTHON@ "$XLS_DUMP_PATH" --dump-mode=canonical-xml "$filepath" > "$dumppath" done } -export LD_LIBRARY_PATH=@OOO_INSTALL_PATH@/program:@OOO_INSTALL_PATH@/ure/lib source @ROOTDIR@/setenv.sh + +# First, import and export each xls document. +echo "First, import and export echo xls document." +export LD_LIBRARY_PATH=@OOO_INSTALL_PATH@/program:@OOO_INSTALL_PATH@/ure/lib mkdir "$CTRL_XLS_OUT_DIR" 2>/dev/null || /bin/true cd @OOO_INSTALL_PATH@/ure/lib @EXECDIR@/run-soffice || exit 1 -dump_files "$CTRL_XLS_IN_DIR" -dump_files "$CTRL_XLS_OUT_DIR" +# Dump the contents of before and after documents. +echo "Dump the contents of the original and exported documents." +dump_files "$CTRL_XLS_IN_DIR" || exit 1 +dump_files "$CTRL_XLS_OUT_DIR" || exit 1 + +echo "Now, compare the dumps to see if anything differs before and after." +# Now, compare the dumps to see if anything differs. +mkdir "$LOG_DIFF_DIR" 2>/dev/null || /bin/true +everdifferent="no" +for file in $(ls "$CTRL_XLS_IN_DIR"); do + fileext=$(echo "$file" | sed -e 's/.*\.//g') + if test $fileext != "log"; then + continue + fi + inpath="$CTRL_XLS_IN_DIR/$file" + outpath="$CTRL_XLS_OUT_DIR/$file" + diffoutpath="$LOG_DIFF_DIR/$file" + filesdiffer="no" + /usr/bin/diff -u "$inpath" "$outpath" > "$diffoutpath" || filesdiffer="yes" + if test "$filesdiffer" == "yes"; then + xlsfile=$(echo "$file" | sed -e 's/\.log$/\.xls/g') + echo "$xlsfile differs." + everdifferent="yes" + else + rm "$diffoutpath" + fi +done + +if test "$everdifferent" == "yes"; then + echo "Content of one or more files differ. Check the full diff output(s) in $LOG_DIFF_DIR for more details." +fi diff --git a/setenv.sh.in b/setenv.sh.in index 9e794c0..5c5ba74 100644 --- a/setenv.sh.in +++ b/setenv.sh.in @@ -1,4 +1,5 @@ CTRL_XLS_IN_DIR=@ROOTDIR@/control-import CTRL_XLS_OUT_DIR=@ROOTDIR@/control-export +LOG_DIFF_DIR=@ROOTDIR@/log-diff XLS_DUMP_PATH=@XLS_DUMP_PATH@ export CTRL_XLS_IN_DIR CTRL_XLS_OUT_DIR XLS_DUMP_PATH |