Chris Hillery has proposed merging lp:~zorba-coders/zorba/ctest-j8 into 
lp:zorba.

Commit message:
Test fixes to ensure all tests can be run in parallel. In particular: create 
all .res file output directories at CMake time, not in the testdrivers. Also 
create unique test-gen files for RuntimeGenerator tests.

Requested reviews:
  Chris Hillery (ceejatec)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/ctest-j8/+merge/147855
-- 
https://code.launchpad.net/~zorba-coders/zorba/ctest-j8/+merge/147855
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'cmake_modules/GenZorbaRuntime.cmake'
--- cmake_modules/GenZorbaRuntime.cmake	2012-09-19 21:16:15 +0000
+++ cmake_modules/GenZorbaRuntime.cmake	2013-02-12 08:51:26 +0000
@@ -68,8 +68,7 @@
 # If we are testing the generation, overwrite gen_file with a dummy location.
 IF(test_only)
   STRING(REGEX REPLACE "[/\\]" "_" gen_file "${gen_relfilename}")
-  SET(gen_file "${binary_dir}/gen_test.tmp.${gen_file}")
-  MESSAGE("  dobbbling: ${gen_file}")
+  SET(gen_file "${binary_dir}/test/GenZorbaRuntime/${gen_relfile}")
 ENDIF(test_only)
 
 

=== modified file 'test/rbkt/CMakeLists.txt'
--- test/rbkt/CMakeLists.txt	2012-09-19 21:16:15 +0000
+++ test/rbkt/CMakeLists.txt	2013-02-12 08:51:26 +0000
@@ -15,11 +15,6 @@
 ADD_SUBDIRECTORY(Scripts)
 ADD_SUBDIRECTORY(ExpCompilerResults)
 
-# create the result directory for all tests
-IF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/QueryResults/)
-    FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/QueryResults/)
-ENDIF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/QueryResults/)
-
 # configure the testdriver
 CONFIGURE_FILE(testdriverconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/testdriverconfig.h)
 

=== modified file 'test/rbkt/Queries/CMakeLists.txt'
--- test/rbkt/Queries/CMakeLists.txt	2013-01-24 10:49:06 +0000
+++ test/rbkt/Queries/CMakeLists.txt	2013-02-12 08:51:26 +0000
@@ -18,6 +18,9 @@
 
 MESSAGE(STATUS "Adding tests for CTest")
 
+# Compute results directory for testdriver
+SET (_results_dir "${CMAKE_CURRENT_BINARY_DIR}/../QueryResults")
+
 FILE(GLOB_RECURSE TESTFILES FOLLOW_SYMLINKS
   RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.xq")
 IF(ZORBA_TEST_XQUERYX)
@@ -91,6 +94,10 @@
     # finally add the test
     ZORBA_ADD_TEST("${TEST_NAME}" testdriver ${CHAINED_TESTS_FILES})
 
+    # Create directory for output, if it doesn't exit
+    IF (NOT EXISTS "${_results_dir}/${CT}")
+      FILE (MAKE_DIRECTORY "${_results_dir}/${CT}")
+    ENDIF (NOT EXISTS "${_results_dir}/${CT}")
 
     # clear the list of testfiles, args and also the name of the test
     SET(CHAINED_TESTS_FILES)
@@ -197,6 +204,12 @@
 
     ZORBA_ADD_TEST("${TESTNAME}" testdriver ${TESTFILE})
 
+    # Create directory for output, if it doesn't exist
+    GET_FILENAME_COMPONENT(_bucket_path ${TESTFILE} PATH)
+    IF (NOT EXISTS "${_results_dir}/${_bucket_path}")
+      FILE (MAKE_DIRECTORY "${_results_dir}/${_bucket_path}")
+    ENDIF (NOT EXISTS "${_results_dir}/${_bucket_path}")
+
     MATH(EXPR TESTCOUNTER ${TESTCOUNTER}+1)
     MATH(EXPR TESTMOD "${TESTCOUNTER}/1000")
     IF (${TESTMOD})

=== modified file 'test/rbkt/testdriver.cpp'
--- test/rbkt/testdriver.cpp	2013-02-08 00:42:44 +0000
+++ test/rbkt/testdriver.cpp	2013-02-12 08:51:26 +0000
@@ -216,15 +216,7 @@
     zorba::file lResultFile (rbkt_bin_dir + "/QueryResults/" 
                              + lQueryWithoutSuffix + ".xml.res", path_flags);
 
-    zorba::file lErrorFile  (rbkt_bin_dir + "/" 
-                             + lQueryWithoutSuffix + ".err", path_flags);
-
     if ( lResultFile.exists () ) { lResultFile.remove (); }
-    if ( lErrorFile.exists () )  { lErrorFile.remove ();  }
-
-    zorba::file lBucket (lResultFile.branch_path());
-    if ( ! lBucket.exists () )
-      lBucket.deep_mkdir (); // create deep directories
 
     // Form the full pathname for the .spec file that may be associated
     // with this query. If the .spec file exists, read its contents to

=== modified file 'test/sax2/CMakeLists.txt'
--- test/sax2/CMakeLists.txt	2012-09-19 21:16:15 +0000
+++ test/sax2/CMakeLists.txt	2013-02-12 08:51:26 +0000
@@ -12,11 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# create the result directory for all tests
-IF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/QueryResults/)
-    FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/QueryResults/)
-ENDIF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/QueryResults/)
-
 # configure the testdriver
 CONFIGURE_FILE(sax2testdriverconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/sax2testdriverconfig.h)
 
@@ -31,6 +26,9 @@
 
 ZORBA_GENERATE_EXE(sax2testdriver "${SAX2_TESTDRIVER_SRCS}" "" "" "")
 
+# Compute results directory for testdriver
+SET (_results_dir "${CMAKE_CURRENT_BINARY_DIR}/QueryResults")
+
 # collect all queries (suffix .xq) in all subdirectories of the Queries dir
 FILE(GLOB_RECURSE TESTFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/Queries/ *.xq)
 
@@ -45,6 +43,13 @@
 
  SET (TESTNAME "test/sax2/${TESTNAME}")
  ZORBA_ADD_TEST(${TESTNAME} sax2testdriver ${TESTFILE})
+
+ # Create directory for output, if it doesn't exist
+ GET_FILENAME_COMPONENT(_bucket_path ${TESTFILE} PATH)
+ IF (NOT EXISTS "${_results_dir}/${_bucket_path}")
+   FILE (MAKE_DIRECTORY "${_results_dir}/${_bucket_path}")
+ ENDIF (NOT EXISTS "${_results_dir}/${_bucket_path}")
+
  ZORBA_SET_TEST_PROPERTY (${TESTNAME} TIMEOUT "10")
 
  MATH(EXPR TESTCOUNTER ${TESTCOUNTER}+1)

=== modified file 'test/sax2/sax2testdriver.cpp'
--- test/sax2/sax2testdriver.cpp	2012-09-19 21:16:15 +0000
+++ test/sax2/sax2testdriver.cpp	2013-02-12 08:51:26 +0000
@@ -303,11 +303,6 @@
   if ( lResultFile.exists () ) { lResultFile.remove (); }
   if ( lErrorFile.exists () )  { lErrorFile.remove ();  }
 
-  // create the result directory
-  zorba::file lBucket = lResultFile.branch_path();
-  if ( ! lBucket.exists () )
-    lBucket.deep_mkdir ();
-
   // we must either have a reference file or an expected error code
   if ( (! lRefFile.exists ()) || lRefFile.is_directory ())
   {

=== modified file 'test/update/CMakeLists.txt'
--- test/update/CMakeLists.txt	2012-09-19 21:16:15 +0000
+++ test/update/CMakeLists.txt	2013-02-12 08:51:26 +0000
@@ -12,11 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# create the result directory for all tests
-IF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/QueryResults/)
-    FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/QueryResults/)
-ENDIF (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/QueryResults/)
-
 # configure the testdriver
 CONFIGURE_FILE(testdriverconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/testdriverconfig.h)
 
@@ -40,6 +35,9 @@
 MESSAGE(STATUS "Adding update tests for CTest")
 SET(TESTCOUNTER 0)
 
+# Compute results directory for updtestdriver
+SET (_results_dir "${CMAKE_CURRENT_BINARY_DIR}/QueryResults")
+
 FOREACH(TESTFILE ${TESTFILES})
 
  STRING(LENGTH ${TESTFILE} TESTFILELENGTH)
@@ -56,10 +54,16 @@
 
    ZORBA_ADD_TEST("${TESTNAME}" updtestdriver ${TESTFILE})
 
+   # Create directory for output, if it doesn't exist
+   GET_FILENAME_COMPONENT(_bucket_path ${TESTFILE} PATH)
+   IF (NOT EXISTS "${_results_dir}/${_bucket_path}")
+     FILE (MAKE_DIRECTORY "${_results_dir}/${_bucket_path}")
+   ENDIF (NOT EXISTS "${_results_dir}/${_bucket_path}")
+
    MATH(EXPR TESTCOUNTER ${TESTCOUNTER}+1)
-   MATH(EXPR TESTMOD "${TESTCOUNTER}/100")
+   MATH(EXPR TESTMOD "${TESTCOUNTER}/500")
    IF (${TESTMOD})
-     MESSAGE(STATUS "Adding another 100 update tests")
+     MESSAGE(STATUS "Adding another 500 update tests")
      SET(TESTCOUNTER 0)
    ENDIF (${TESTMOD})
 

=== modified file 'test/update/updtestdriver.cpp'
--- test/update/updtestdriver.cpp	2013-02-08 00:42:44 +0000
+++ test/update/updtestdriver.cpp	2013-02-12 08:51:26 +0000
@@ -252,8 +252,6 @@
   
   std::string lResultFileString = binDir+"/QueryResults/"+lSpecNoSuffix+".res";
   zorba::file lResultFile(lResultFileString, flags);
-  if (!lResultFile.exists())
-    zorba::file(lResultFile.branch_path()).deep_mkdir();
 
   std::string lRefFileString = srcDir+"/ExpectedTestResults/"+lSpecNoSuffix+".xml.res";
   zorba::file lRefFile(lRefFileString, flags);
@@ -267,8 +265,6 @@
 
   std::auto_ptr<zorba::TestSchemaURIMapper> smapper;
 
-  std::vector<zorba::XQuery_t> lQueries;
-
   ulong numQueries = (ulong)lSpec.theStates.size();
 
   //

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to