Fix tests in hdf5 module: 95/8795/1
Vincent COUVERT [Fri, 24 Aug 2012 07:50:03 +0000 (09:50 +0200)]
 - Missing files in Linux binary versions
 - Fix error message (filename freed before being displayed).

Change-Id: I7419acfe535f02b27484292d6904fa881001fcf1

scilab/modules/hdf5/Makefile.am
scilab/modules/hdf5/Makefile.in
scilab/modules/hdf5/sci_gateway/cpp/sci_import_from_hdf5.cpp

index 25a1f1c..694a9ea 100644 (file)
@@ -92,32 +92,61 @@ libscihdf5_la_etc_DATA = etc/hdf5.quit etc/hdf5.start
 
 #### hdf5 : test file ####
 libscihdf5_la_testsampledatadir = $(mydatadir)/tests/sample_scilab_data
-libscihdf5_la_testsampledata_DATA = tests/sample_scilab_data/booleanmatrix.sod \
+libscihdf5_la_testsampledata_DATA = \
+tests/sample_scilab_data/booleanmatrix.sod \
+tests/sample_scilab_data/booleanmatrix_v1.sod \
 tests/sample_scilab_data/booleanscalar.sod \
+tests/sample_scilab_data/booleanscalar_v1.sod \
 tests/sample_scilab_data/booleansparse.sod \
+tests/sample_scilab_data/booleansparse_v1.sod \
+tests/sample_scilab_data/emptymatrix.sod \
 tests/sample_scilab_data/emptysparse.sod \
+tests/sample_scilab_data/emptysparse_v1.sod \
 tests/sample_scilab_data/hypermatrixcomplex.sod \
+tests/sample_scilab_data/hypermatrixcomplex_v1.sod \
 tests/sample_scilab_data/hypermatrix.sod \
+tests/sample_scilab_data/hypermatrix_v1.sod \
 tests/sample_scilab_data/int16.sod \
+tests/sample_scilab_data/int16_v1.sod \
 tests/sample_scilab_data/int32.sod \
+tests/sample_scilab_data/int32_v1.sod \
 tests/sample_scilab_data/int8.sod \
+tests/sample_scilab_data/int8_v1.sod \
 tests/sample_scilab_data/list.sod \
+tests/sample_scilab_data/list_v1.sod \
 tests/sample_scilab_data/listnested.sod \
+tests/sample_scilab_data/listnested_v1.sod \
 tests/sample_scilab_data/matricedoublecomplex.sod \
+tests/sample_scilab_data/matricedoublecomplex_v1.sod \
 tests/sample_scilab_data/matricedoublecomplexscalar.sod \
+tests/sample_scilab_data/matricedoublecomplexscalar_v1.sod \
 tests/sample_scilab_data/matricedouble.sod \
+tests/sample_scilab_data/matricedouble_v1.sod \
 tests/sample_scilab_data/matricedoublescalar.sod \
+tests/sample_scilab_data/matricedoublescalar_v1.sod \
 tests/sample_scilab_data/matricestring.sod \
+tests/sample_scilab_data/matricestring_v1.sod \
 tests/sample_scilab_data/matricestringscalar.sod \
+tests/sample_scilab_data/matricestringscalar_v1.sod \
 tests/sample_scilab_data/mlist.sod \
+tests/sample_scilab_data/mlist_v1.sod \
 tests/sample_scilab_data/polynomialscoef.sod \
+tests/sample_scilab_data/polynomialscoef_v1.sod \
 tests/sample_scilab_data/polynomials.sod \
+tests/sample_scilab_data/polynomials_v1.sod \
 tests/sample_scilab_data/sparsematrix.sod \
+tests/sample_scilab_data/sparsematrix_v1.sod \
 tests/sample_scilab_data/tlist.sod \
+tests/sample_scilab_data/tlist_v1.sod \
 tests/sample_scilab_data/uint16.sod \
+tests/sample_scilab_data/uint16_v1.sod \
 tests/sample_scilab_data/uint32.sod \
+tests/sample_scilab_data/uint32_v1.sod \
 tests/sample_scilab_data/uint8.sod \
+tests/sample_scilab_data/uint8_v1.sod \
 tests/sample_scilab_data/undefinedelement.sod \
-tests/sample_scilab_data/voidelement.sod
+tests/sample_scilab_data/undefinedelement_v1.sod \
+tests/sample_scilab_data/voidelement.sod \
+tests/sample_scilab_data/voidelement_v1.sod
 
 include $(top_srcdir)/Makefile.incl.am
index 528333e..8f8ec47 100644 (file)
@@ -509,33 +509,62 @@ libscihdf5_la_etc_DATA = etc/hdf5.quit etc/hdf5.start
 
 #### hdf5 : test file ####
 libscihdf5_la_testsampledatadir = $(mydatadir)/tests/sample_scilab_data
-libscihdf5_la_testsampledata_DATA = tests/sample_scilab_data/booleanmatrix.sod \
+libscihdf5_la_testsampledata_DATA = \
+tests/sample_scilab_data/booleanmatrix.sod \
+tests/sample_scilab_data/booleanmatrix_v1.sod \
 tests/sample_scilab_data/booleanscalar.sod \
+tests/sample_scilab_data/booleanscalar_v1.sod \
 tests/sample_scilab_data/booleansparse.sod \
+tests/sample_scilab_data/booleansparse_v1.sod \
+tests/sample_scilab_data/emptymatrix.sod \
 tests/sample_scilab_data/emptysparse.sod \
+tests/sample_scilab_data/emptysparse_v1.sod \
 tests/sample_scilab_data/hypermatrixcomplex.sod \
+tests/sample_scilab_data/hypermatrixcomplex_v1.sod \
 tests/sample_scilab_data/hypermatrix.sod \
+tests/sample_scilab_data/hypermatrix_v1.sod \
 tests/sample_scilab_data/int16.sod \
+tests/sample_scilab_data/int16_v1.sod \
 tests/sample_scilab_data/int32.sod \
+tests/sample_scilab_data/int32_v1.sod \
 tests/sample_scilab_data/int8.sod \
+tests/sample_scilab_data/int8_v1.sod \
 tests/sample_scilab_data/list.sod \
+tests/sample_scilab_data/list_v1.sod \
 tests/sample_scilab_data/listnested.sod \
+tests/sample_scilab_data/listnested_v1.sod \
 tests/sample_scilab_data/matricedoublecomplex.sod \
+tests/sample_scilab_data/matricedoublecomplex_v1.sod \
 tests/sample_scilab_data/matricedoublecomplexscalar.sod \
+tests/sample_scilab_data/matricedoublecomplexscalar_v1.sod \
 tests/sample_scilab_data/matricedouble.sod \
+tests/sample_scilab_data/matricedouble_v1.sod \
 tests/sample_scilab_data/matricedoublescalar.sod \
+tests/sample_scilab_data/matricedoublescalar_v1.sod \
 tests/sample_scilab_data/matricestring.sod \
+tests/sample_scilab_data/matricestring_v1.sod \
 tests/sample_scilab_data/matricestringscalar.sod \
+tests/sample_scilab_data/matricestringscalar_v1.sod \
 tests/sample_scilab_data/mlist.sod \
+tests/sample_scilab_data/mlist_v1.sod \
 tests/sample_scilab_data/polynomialscoef.sod \
+tests/sample_scilab_data/polynomialscoef_v1.sod \
 tests/sample_scilab_data/polynomials.sod \
+tests/sample_scilab_data/polynomials_v1.sod \
 tests/sample_scilab_data/sparsematrix.sod \
+tests/sample_scilab_data/sparsematrix_v1.sod \
 tests/sample_scilab_data/tlist.sod \
+tests/sample_scilab_data/tlist_v1.sod \
 tests/sample_scilab_data/uint16.sod \
+tests/sample_scilab_data/uint16_v1.sod \
 tests/sample_scilab_data/uint32.sod \
+tests/sample_scilab_data/uint32_v1.sod \
 tests/sample_scilab_data/uint8.sod \
+tests/sample_scilab_data/uint8_v1.sod \
 tests/sample_scilab_data/undefinedelement.sod \
-tests/sample_scilab_data/voidelement.sod
+tests/sample_scilab_data/undefinedelement_v1.sod \
+tests/sample_scilab_data/voidelement.sod \
+tests/sample_scilab_data/voidelement_v1.sod
 
 
 # Where all the Scilab stuff is installed (macros, help, ...)
index 7bd9659..caa821e 100644 (file)
@@ -75,9 +75,9 @@ int sci_import_from_hdf5(char *fname, unsigned long fname_len)
     int iFile = openHDF5File(pstExpandedFilename);
     if (iFile < 0)
     {
+        Scierror(999, _("%s: Unable to open file: %s\n"), fname, pstFilename);
         FREE(pstExpandedFilename);
         FREE(pstFilename);
-        Scierror(999, _("%s: Unable to open file: %s\n"), fname, pstFilename);
         return 1;
     }
 
@@ -86,16 +86,18 @@ int sci_import_from_hdf5(char *fname, unsigned long fname_len)
 
     //manage version information
     int iVersion = getSODFormatAttribute(iFile);
-    if(iVersion != SOD_FILE_VERSION)
+    if (iVersion != SOD_FILE_VERSION)
     {
         if (iVersion > SOD_FILE_VERSION)
-        {//can't read file with version newer that me !
+        {
+            //can't read file with version newer that me !
             Scierror(999, _("%s: Wrong SOD file format version. Max Expected: %d Found: %d\n"), fname, SOD_FILE_VERSION, iVersion);
             return 1;
         }
         else
-        {//call older import functions and exit or ... EXIT !
-            if(iVersion == 1 || iVersion == -1)
+        {
+            //call older import functions and exit or ... EXIT !
+            if (iVersion == 1 || iVersion == -1)
             {
                 //sciprint("old sci_import_from_hdf5_v1\n");
                 return sci_import_from_hdf5_v1(fname, fname_len);
@@ -342,8 +344,9 @@ static bool import_double(int _iDatasetId, int _iItemPos, int *_piAddress, char
             return false;
         }
     }
-    else if(iDims > 2)
-    {//hypermatrix
+    else if (iDims > 2)
+    {
+        //hypermatrix
         return false;
     }
     else
@@ -807,7 +810,7 @@ static bool import_poly(int _iDatasetId, int _iItemPos, int *_piAddress, char *_
     FREE(pdblReal);
 
 
-    if(iComplex)
+    if (iComplex)
     {
         for (int i = 0; i < iSize; i++)
         {