[ooo-build-commit] .: 2 commits - bin/run-tests.sh bin/setup.in configure.in download.in download_tests_dependencies.sh Makefile.shared test/ooxml

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Tue Jul 6 05:09:18 PDT 2010


 Makefile.shared                |    5 +++
 bin/run-tests.sh               |   35 ++++++++++++++++++++++++++
 bin/setup.in                   |    1 
 configure.in                   |   11 ++++++++
 download.in                    |   11 +++++++-
 download_tests_dependencies.sh |   20 +++++++++++++++
 test/ooxml/.gitignore          |    1 
 test/ooxml/download.sh         |   21 +++++++++++++++
 test/ooxml/run.sh              |   54 +++++++++++++++++++++++++++++++++++++++++
 9 files changed, 158 insertions(+), 1 deletion(-)

New commits:
commit c9349ed90ddcb3481b4931937a636f5d6214151a
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Tue Jul 6 14:06:28 2010 +0200

    Added OOXML automated tests
    
    * test/ooxml/.gitignore:
        Ignore the test logs
    
    * test/ooxml/download.sh:
        Get officeotron and the test data
    
    * test/ooxml/run.sh:
        Actually run the tests

diff --git a/test/ooxml/.gitignore b/test/ooxml/.gitignore
new file mode 100644
index 0000000..6bfe6b1
--- /dev/null
+++ b/test/ooxml/.gitignore
@@ -0,0 +1 @@
+log
diff --git a/test/ooxml/download.sh b/test/ooxml/download.sh
new file mode 100755
index 0000000..a51809e
--- /dev/null
+++ b/test/ooxml/download.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+SRCDIR=$1
+
+# The test data
+cd $SRCDIR/clone
+if test -d test-files ;then 
+    cd test-files
+    git fetch -t origin
+else
+    # TODO Replace by the ooo-build/contrib URL once the repo is created 
+    git clone git://anongit.freedesktop.org/~cbosdo/test-files
+fi
+
+# OfficeOTron
+# TODO Replace by the SVN copy once the patch is integrated upstream
+OFFICEOTRON=officeotron-0.5.5-Beta.jar
+if test ! -a $SRCDIR/$OFFICEOTRON ; then
+    cd $SRCDIR
+    wget "http://people.freedesktop.org/~cbosdo/$OFFICEOTRON" -O $OFFICEOTRON
+fi
diff --git a/test/ooxml/run.sh b/test/ooxml/run.sh
new file mode 100755
index 0000000..311713a
--- /dev/null
+++ b/test/ooxml/run.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+ooinstall=$1
+TOOLSDIR=$2
+
+set -x
+
+. $TOOLSDIR/bin/setup >/dev/null 2>&1
+
+LOGS=`dirname $0`/log
+
+
+function validate()
+{
+    FILE_LOG=$LOGS/`basename $1`.log
+
+    mkdir -p `dirname $FILE_LOG`
+
+    SUMMARY_LOG=$LOGS/validations.log
+    if test ! -a $SUMMARY_LOG; then
+        touch $SUMMARY_LOG
+    fi
+    java -jar $SRCDIR/officeotron-0.5.5-Beta.jar $1 >$FILE_LOG 2>&1
+
+    # Need to save a log for each file and a summary log
+    STATUS="FAILED"
+    RESULT=0
+    LINES_COUNT='cat $FILE_LOG | wc -l'
+    if test "$LINES_COUNT" == "0"; then
+        STATUS="PASSED"
+        RESULT=1
+        rm $FILE_LOG
+    fi
+
+    echo -e "$1:\t$STATUS" >>$SUMMARY_LOG
+    return $RESULT
+}
+
+# Generate the test files
+TEST_FILES_DIR=$SRCDIR/clone/test-files
+cd $TEST_FILES_DIR && make
+cd $OLDPWD
+
+# Validate the test files
+RESULT=0
+for f in `ls $TEST_FILES_DIR/ooxml-strict/tmp`; do
+    validate $TEST_FILES_DIR/ooxml-strict/tmp/$f
+    if test $? != 0; then
+        RESULT=1
+    fi
+done
+
+
+exit $RESULT
commit 69c313c5c15bdaab05e060a8a27abaa019b6f984
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Tue Jul 6 14:04:08 2010 +0200

    Adding some testing automation tools
    
    * Makefile.shared:
        Added make test rule
    
    * bin/run-tests.sh:
        Script used to run the tests from the makefile
    
    * bin/setup.in:
    * configure.in:
        Added --with-tests option to configure
    
    * download.in:
        Changed to download the test dependencies
    
    * download_tests_dependencies.sh:
        Download delegate calling all the download.sh scripts in the test/*
    folder

diff --git a/Makefile.shared b/Makefile.shared
index e80ac3f..84ebd2b 100644
--- a/Makefile.shared
+++ b/Makefile.shared
@@ -147,6 +147,10 @@ gitignore : $(OOBUILDDIR)/.gitignore
 $(OOBUILDDIR)/.gitignore : $(OOBUILDDIR)/unpack
 	cd $(OOBUILDDIR); $(TOOLSDIR)/bin/create-gitignores.sh
 
+test: $(BUILDDIR)/install/program/ooenv
+	bin/run-tests.sh $(BUILDDIR)/install
+
+
 help:
 	@echo "-----------------------------------------------------------------------------------"
 	@echo " MAIN TARGETS"
@@ -161,6 +165,7 @@ help:
 	@echo "-----------------------------------------------------------------------------------"
 	@echo ""
 	@echo "    * dev-install:     installs with links to the build tree"
+	@echo "    * test:            runs the tests"
 	@echo "    * id:              generates the GNU ID database"
 	@echo "    * tags:            generates the tags file"
 	@echo "    * docs:            generates (partial) doxygen src docs"
diff --git a/bin/run-tests.sh b/bin/run-tests.sh
new file mode 100755
index 0000000..4a23241
--- /dev/null
+++ b/bin/run-tests.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# runs all the test scripts in the test folder.
+# Args: <install dir>
+#
+# The main idea:
+#   - The script will loop over the test folder subdirectories
+#   - If there is a run.sh script inside, then execute it with the 
+#     oo install folder as arg.
+# 
+# This way each script is autonomous and has place to store the logs 
+# beside the run.sh script
+
+# Get the oo installation to improve
+ooinstall=$1
+
+# Load the whole ooo-build config
+. `dirname $0`/setup >/dev/null 2>&1
+
+TESTDIR=$TOOLSDIR/test/
+
+for t in `ls -1 $TESTDIR`
+do
+    # Is there a run.sh executable script inside?
+    if test -x $TESTDIR/$t/run.sh ; then
+        sh $TESTDIR/$t/run.sh "$ooinstall" "$TOOLSDIR"
+        if test $? ; then
+            echo -e "$t\t:\tPASSED"
+        else
+            echo -e "$t\t:\tFAILED" 
+        fi
+    else
+        echo -e "$t\t:\tSKIPPED"
+    fi
+done
diff --git a/bin/setup.in b/bin/setup.in
index e595dfe..4715143 100755
--- a/bin/setup.in
+++ b/bin/setup.in
@@ -52,6 +52,7 @@ SPLIT_APP_MODULES='@SPLIT_APP_MODULES@'
 SPLIT_OPT_FEATURES='@SPLIT_OPT_FEATURES@'
 RUN_POST_INSTALL_SCRIPTS='@RUN_POST_INSTALL_SCRIPTS@'
 DEFUZZ_PATCHES='@DEFUZZ_PATCHES@'
+TESTS='@TESTS@'
 TOOLSDIR='@TOOLSDIR@'
 ENABLE_ODK='@ENABLE_ODK@'
 USE_PREBUILD_UNOWINREG_DLL='@USE_PREBUILD_UNOWINREG_DLL@'
diff --git a/configure.in b/configure.in
index 9b303de..0046ac3 100644
--- a/configure.in
+++ b/configure.in
@@ -245,6 +245,11 @@ AC_ARG_WITH(max-jobs,
 			  the same time. Defaults to 1.],
 ,)
 
+AC_ARG_ENABLE(tests,
+[
+  --enable-tests          Enables the execution of the tests.],
+,)
+
 AC_ARG_ENABLE(gtk,
 [
   --disable-gtk           Disables gtk+ native widgets.],
@@ -918,6 +923,12 @@ if test "z$enable_post_install_scripts" = "zno"; then
 fi
 AC_SUBST(RUN_POST_INSTALL_SCRIPTS)
 
+TESTS="NO"
+if test "z$enable_tests" = "zyes"; then
+    TESTS="YES"
+fi
+AC_SUBST(TESTS)
+
 DEFUZZ_PATCHES="NO"
 if test "z$enable_defuzz_patches" = "zyes"; then
    DEFUZZ_PATCHES="YES"
diff --git a/download.in b/download.in
index 8c66ba5..f07a1fd 100755
--- a/download.in
+++ b/download.in
@@ -58,6 +58,10 @@ sub download_external_sources() {
 	system("./download_external_sources.sh")
 }
 
+sub download_tests_dependencies() {
+    system('./download_tests_dependencies.sh @SRCDIR@')
+}
+
 %SRC_URLS = (
     'http:\/\/.*'                        => '',
     'binutils-.*'			 => '@MIRROR@/support',
@@ -184,7 +188,7 @@ sub download_external_sources() {
     'MagyarLinLibertine.*\.zip' => 'http://numbertext.org/linux/',
 
 # Multi-dimensional data structure
-    'cf8a6967f7de535ae257fa411c98eb88-mdds_0.3.0.tar.bz2' => 'http://hg.services.openoffice.org/binaries/'
+    'cf8a6967f7de535ae257fa411c98eb88-mdds_0.3.0.tar.bz2' => 'http://hg.services.openoffice.org/binaries/',
 );
 
 
@@ -583,6 +587,11 @@ if ($download_all ||
     source_file_ooo( "sdk" );
 }
 
+# Test Dependencies
+if ('@TESTS@' eq 'YES') {
+    download_tests_dependencies();
+}
+
 download_files (\@files, \%SRC_URLS, '@SRCDIR@');
 
 download_external_sources();
diff --git a/download_tests_dependencies.sh b/download_tests_dependencies.sh
new file mode 100755
index 0000000..0e2adbf
--- /dev/null
+++ b/download_tests_dependencies.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Loop over the test folders and run the download.sh script if any
+
+echo "Downloading test dependencies"
+
+TESTDIR=./test/
+
+for t in `ls -1 $TESTDIR`
+do
+    # Is there a run.sh executable script inside?
+    if test -x $TESTDIR/$t/download.sh ; then
+        echo "Downloading dependencies for test $t"
+        sh $TESTDIR/$t/download.sh "$1"
+        if test $? != 0 ; then
+            echo "Failed to download dependencies for test $t!"
+            exit $?
+        fi
+    fi
+done


More information about the ooo-build-commit mailing list