Repository: Unidata/netcdf-c
Pull request #2295 (2022-04-19 17:07:37)

2161 re-run tests
This is PR #2161, the normal 'rerun tests' control appears to be MIA, this is the path of least resistance to re-run the tests.


Patch:
diff --git a/configure.ac b/configure.ac
index 880ac4065..ce05fc5da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1976,7 +1976,6 @@ AC_CONFIG_FILES(ncdap_test/findtestserver.c:ncdap_test/findtestserver.c.in)
 AC_CONFIG_FILES(dap4_test/findtestserver4.c:ncdap_test/findtestserver.c.in)
 AC_CONFIG_FILES(dap4_test/pingurl4.c:ncdap_test/pingurl.c)
 AC_CONFIG_FILES([h5_test/run_par_tests.sh], [chmod ugo+x h5_test/run_par_tests.sh])
-AC_CONFIG_FILES([nc_test/run_pnetcdf_tests.sh], [chmod ugo+x nc_test/run_pnetcdf_tests.sh])
 AC_CONFIG_FILES([nc_test4/run_par_test.sh], [chmod ugo+x nc_test4/run_par_test.sh])
 AC_CONFIG_FILES([nc_perf/run_par_bm_test.sh], [chmod ugo+x nc_perf/run_par_bm_test.sh])
 AC_CONFIG_FILES([nc_perf/run_gfs_test.sh], [chmod ugo+x nc_perf/run_gfs_test.sh])
diff --git a/examples/C/Makefile.am b/examples/C/Makefile.am
index e9f087ada..5d5f7e2e7 100644
--- a/examples/C/Makefile.am
+++ b/examples/C/Makefile.am
@@ -33,13 +33,11 @@ check_PROGRAMS += simple_nc4_wr simple_nc4_rd simple_xy_nc4_wr	\
 simple_xy_nc4_rd
 TESTS += run_examples4.sh
 
-if BUILD_UTILITIES
 if ENABLE_FILTER_TESTING
 # filter_example.c should be same as nc_test4/test_filter.c
 check_PROGRAMS += filter_example
 TESTS += run_filter.sh
 endif
-endif
 
 endif #USE_HDF5
 
diff --git a/include/nc4internal.h b/include/nc4internal.h
index b78a69c07..9b76c135a 100644
--- a/include/nc4internal.h
+++ b/include/nc4internal.h
@@ -300,7 +300,8 @@ typedef struct NC_FILE_INFO
     nc_bool_t parallel;   /**< True if file is open for parallel access */
     nc_bool_t redef;      /**< True if redefining an existing file */
     nc_bool_t no_attr_create_order; /**< True if the creation order tracking of attributes is disabled (netcdf-4 only) */
-    int fill_mode;        /**< Fill mode for vars */
+    nc_bool_t no_dimscale_attach; /**< True if attaching dimscales to variables is disabled (netcdf-4 only) */
+    int fill_mode;        /**< Fill mode for vars - Unused internally currently */
     nc_bool_t no_write;   /**< true if nc_open has mode NC_NOWRITE. */
     NC_GRP_INFO_T *root_grp; /**< Pointer to root group. */
     short next_nc_grpid;  /**< Next available group ID. */
diff --git a/include/netcdf.h b/include/netcdf.h
index 77c2fbcc3..47e1394d7 100644
--- a/include/netcdf.h
+++ b/include/netcdf.h
@@ -164,6 +164,7 @@ Use this in mode flags for both nc_create() and nc_open(). */
 
 /* Upper 16 bits */
 #define NC_NOATTCREORD  0x20000 /**< Disable the netcdf-4 (hdf5) attribute creation order tracking */
+#define NC_NODIMSCALE_ATTACH 0x40000 /**< Disable the netcdf-4 (hdf5) attaching of dimscales to variables (#2128) */
 
 #define NC_MAX_MAGIC_NUMBER_LEN 8 /**< Max len of user-defined format magic number. */
 
diff --git a/libhdf5/hdf5create.c b/libhdf5/hdf5create.c
index 2c2af85fb..4d0fd7374 100644
--- a/libhdf5/hdf5create.c
+++ b/libhdf5/hdf5create.c
@@ -208,6 +208,11 @@ nc4_create_file(const char *path, int cmode, size_t initialsz,
         BAIL(NC_EHDFERR);
 #endif
 
+    if (cmode & NC_NODIMSCALE_ATTACH) {
+      /* See https://github.com/Unidata/netcdf-c/issues/2128 */
+      nc4_info->no_dimscale_attach = NC_TRUE;
+    }
+
     if(nc4_info->mem.inmemory) {
         retval = NC4_create_image_file(nc4_info,initialsz);
         if(retval)
@@ -337,7 +342,7 @@ nc4_H5Fcreate(const char *filename0, unsigned flags, hid_t fcpl_id, hid_t fapl_i
 
 #ifdef HDF5_UTF8_PATHS
     NCpath2utf8(filename0,&filename);
-#else    
+#else
     filename = strdup(filename0);
 #endif
     /* Canonicalize it since we are not opening the file ourselves */
diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c
index acb2448fc..66f2c3927 100644
--- a/libhdf5/nc4hdf.c
+++ b/libhdf5/nc4hdf.c
@@ -1957,9 +1957,11 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order)
         }
     } /* end while */
 
-    /* Attach dimscales to vars in this group. */
-    if ((retval = attach_dimscales(grp)))
-        return retval;
+    /* Attach dimscales to vars in this group. Unless directed not to. */
+    if (!grp->nc4_info->no_dimscale_attach) {
+        if ((retval = attach_dimscales(grp)))
+            return retval;
+    }
 
     /* If there are any child groups, write their metadata. */
     for (i = 0; i < ncindexsize(grp->children); i++)


Test patch:
diff --git a/nc_test/Makefile.am b/nc_test/Makefile.am
index 68eaff87d..8ed1ec41f 100644
--- a/nc_test/Makefile.am
+++ b/nc_test/Makefile.am
@@ -22,26 +22,24 @@ AM_CPPFLAGS += -I$(top_builddir)/liblib -I$(top_builddir)/include -I$(top_srcdir
 
 TEST_EXTENSIONS = .sh
 
+check_PROGRAMS =
+
 # These are the tests which are always run.
-TESTPROGRAMS = tst_names tst_nofill2 tst_nofill3 tst_meta		\
-tst_inq_type tst_utf8_validate tst_utf8_phrases tst_global_fillval	\
+TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names	\
+tst_nofill tst_nofill2 tst_nofill3 tst_atts3 tst_meta tst_inq_type	\
+tst_utf8_validate tst_utf8_phrases tst_global_fillval			\
 tst_max_var_dims tst_formats tst_def_var_fill tst_err_enddef		\
 tst_default_format
 
-# These are always built, but for parallel builds are run from a test
-# script, because they are parallel-enabled tests.
-check_PROGRAMS = t_nc tst_atts3 tst_nofill nc_test tst_small
-
-# These tests are only run if pnetcdf is enabled.
 if USE_PNETCDF
-check_PROGRAMS += tst_parallel2 tst_pnetcdf tst_addvar	\
-tst_formatx_pnetcdf tst_default_format_pnetcdf
+check_PROGRAMS += tst_parallel2 tst_pnetcdf tst_addvar
+TESTPROGRAMS += tst_formatx_pnetcdf tst_default_format_pnetcdf
 endif
 
 if TEST_PARALLEL4
 if USE_PNETCDF
 if ENABLE_CDF5
-check_PROGRAMS += tst_cdf5format
+TESTPROGRAMS += tst_cdf5format
 endif
 endif
 endif
@@ -96,23 +94,21 @@ run_mmap.log: run_diskless.log
 endif
 endif
 
-# If pnetcdf is enabled, these tests are run by a test
-# script. Otherwise, the are run by automake in the usual way.
 if USE_PNETCDF
-TESTS += run_pnetcdf_tests.sh
-else
-TESTS += t_nc tst_atts3 tst_nofill nc_test tst_small
+TESTS += run_pnetcdf_test.sh
 endif
 
 # The .c files that are generated with m4 are already distributed, but
 # we also include the original m4 files, plus test scripts data.
-EXTRA_DIST = test_get.m4 test_put.m4 run_diskless.sh run_diskless2.sh	\
-run_diskless5.sh run_mmap.sh run_pnetcdf_test.sh test_read.m4		\
-test_write.m4 ref_tst_diskless2.cdl tst_diskless5.cdl			\
-ref_tst_diskless3_create.cdl ref_tst_diskless3_open.cdl			\
-run_inmemory.sh run_mmap.sh f03tst_open_mem.nc test_byterange.sh	\
-ref_tst_http_nc3.cdl ref_tst_http_nc4a.cdl ref_tst_http_nc4b.cdl	\
-ref_tst_http_nc4c.cdl CMakeLists.txt run_pnetcdf_tests.sh.in
+EXTRA_DIST = test_get.m4 test_put.m4 run_diskless.sh run_diskless2.sh   \
+run_diskless5.sh run_mmap.sh run_pnetcdf_test.sh test_read.m4           \
+test_write.m4 ref_tst_diskless2.cdl tst_diskless5.cdl                   \
+ref_tst_diskless3_create.cdl ref_tst_diskless3_open.cdl                 \
+run_inmemory.sh run_mmap.sh                                             \
+f03tst_open_mem.nc                                                      \
+test_byterange.sh ref_tst_http_nc3.cdl                                  \
+ref_tst_http_nc4a.cdl ref_tst_http_nc4b.cdl ref_tst_http_nc4c.cdl       \
+CMakeLists.txt
 
 # These files are created by the tests.
 CLEANFILES = nc_test_*.nc tst_*.nc t_nc.nc large_files.nc		\
diff --git a/nc_test/run_pnetcdf_test.sh b/nc_test/run_pnetcdf_test.sh
new file mode 100755
index 000000000..4b3961698
--- /dev/null
+++ b/nc_test/run_pnetcdf_test.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# This script runs some PnetCDF I/O tests
+
+set -e
+echo
+echo "Testing file created with PnetCDF is modifiable with netCDF..."
+./tst_pnetcdf
+
+echo "Testing file created with PnetCDF works when adding variables..."
+./tst_addvar tst_pnetcdf.nc
+
+# We assume a min of at least 2 processors is available
+mpiexec -n 2 ./tst_parallel2
diff --git a/nc_test/run_pnetcdf_tests.sh.in b/nc_test/run_pnetcdf_tests.sh.in
deleted file mode 100755
index b76a6cf0d..000000000
--- a/nc_test/run_pnetcdf_tests.sh.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-# This script runs some PnetCDF I/O tests
-
-set -e
-echo
-echo "Testing file created with PnetCDF is modifiable with netCDF..."
-./tst_pnetcdf
-
-echo "Testing file created with PnetCDF works when adding variables..."
-./tst_addvar tst_pnetcdf.nc
-
-# We assume a min of at least 2 processors is available
-@MPIEXEC@ -n 2 ./tst_parallel2
-
-# These tests work in either serial or parallel builds.
-@MPIEXEC@ -n 1 ./t_nc
-@MPIEXEC@ -n 1 ./tst_atts3
-@MPIEXEC@ -n 1 ./tst_nofill
-@MPIEXEC@ -n 1 ./nc_test
-@MPIEXEC@ -n 1 ./tst_default_format_pnetcdf
-@MPIEXEC@ -n 1 ./tst_small
-@MPIEXEC@ -n 1 ./tst_formatx_pnetcdf
-@MPIEXEC@ -n 1 ./tst_cdf5format
-
-
diff --git a/nc_test/tst_nofill.c b/nc_test/tst_nofill.c
index b6cb12d6f..770821bd3 100644
--- a/nc_test/tst_nofill.c
+++ b/nc_test/tst_nofill.c
@@ -486,9 +486,8 @@ main(int argc, char **argv)
        if (nc_close(ncid2)) ERR;
        SUMMARIZE_ERR;
    }
-
+   FINAL_RESULTS;
 #ifdef USE_PNETCDF
    MPI_Finalize();
 #endif
-   FINAL_RESULTS;
 }
diff --git a/nc_test/tst_pnetcdf.c b/nc_test/tst_pnetcdf.c
index 2ae175c70..de79f1989 100644
--- a/nc_test/tst_pnetcdf.c
+++ b/nc_test/tst_pnetcdf.c
@@ -44,8 +44,7 @@ int main(int argc, char* argv[])
     size_t start[2], count[2];
     MPI_Comm comm=MPI_COMM_SELF;
     MPI_Info info=MPI_INFO_NULL;
-    char file_name[NC_MAX_NAME + 1];
-    
+
     printf("\n*** Testing bug fix with changing PnetCDF variable offsets...");
 
     MPI_Init(&argc,&argv);
@@ -64,9 +63,7 @@ int main(int argc, char* argv[])
 #endif
 
     cmode = NC_CLOBBER;
-    sprintf(file_name, "%s/%s", TEMP_LARGE, FILENAME);
-    st = nc_create_par(file_name, cmode, comm, info, &ncid);
-
+    st = nc_create_par(FILENAME, cmode, comm, info, &ncid);
 #ifdef USE_PNETCDF
     CHK_ERR(st)
 #else
@@ -112,7 +109,7 @@ int main(int argc, char* argv[])
     if (info != MPI_INFO_NULL) MPI_Info_free(&info);
 
     /* re-open the file with netCDF (parallel) and enter define mode */
-    st = nc_open_par(file_name, NC_WRITE, comm, info, &ncid); CHK_ERR(st)
+    st = nc_open_par(FILENAME, NC_WRITE, comm, info, &ncid); CHK_ERR(st)
 
     st = nc_redef(ncid); CHK_ERR(st)
 
diff --git a/ncdump/testpathcvt.sh b/ncdump/testpathcvt.sh
index 7954095e7..d1e5e36a5 100755
--- a/ncdump/testpathcvt.sh
+++ b/ncdump/testpathcvt.sh
@@ -5,9 +5,6 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
 
 set -e
 
-# Disable automatic path conversions in MINGW shell:
-export MSYS2_ARG_CONV_EXCL='*'
-
 # We need to find the drive letter, if any
 DL=`${NCPATHCVT} -c -e / | sed -e 's|/cygdrive/\([a-zA-Z]\)/.*|\1|'`
 if test "x$DL" != x ; then
@@ -16,7 +13,6 @@ if test "x$DL" != x ; then
   DL="-d $DLL"
 fi
 
-
 testcase1() {
 T="$1"
 P="$2"
diff --git a/nctest/Makefile.am b/nctest/Makefile.am
index 47b9281c4..9532399a2 100644
--- a/nctest/Makefile.am
+++ b/nctest/Makefile.am
@@ -30,17 +30,14 @@ nctest_classic.cdl ref_nctest_classic.cdl
 # reference file.
 TESTPROGRAMS = nctest tst_rename
 check_PROGRAMS = $(TESTPROGRAMS)
-
-# This test requires that the utilites also be built.
-if BUILD_UTILITIES
 TESTS = $(TESTPROGRAMS) compare_test_files.sh
-# compare_test_files depends on nctest executing first.
-compare_test_files.log: nctest.log
-endif
 
 # Note which tests depend on other tests. Necessary for make -j check.
 TEST_EXTENSIONS = .sh
 
+# compare_test_files depends on nctest executing first.
+compare_test_files.log: nctest.log
+
 # These are the source files for the nctest program.
 nctest_SOURCES = add.c add.h atttests.c cdftests.c dimtests.c driver.c	\
 emalloc.c emalloc.h error.c error.h misctest.c rec.c slabs.c testcdf.h	\
diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am
index c7c15565d..a7ca56d36 100644
--- a/nczarr_test/Makefile.am
+++ b/nczarr_test/Makefile.am
@@ -37,13 +37,13 @@ tst_fillonlyz_SOURCES = tst_fillonlyz.c ${tstcommonsrc}
 
 check_PROGRAMS += tst_zchunks tst_zchunks2 tst_zchunks3 tst_fillonlyz test_quantize 
 
+TESTS += run_ut_map.sh
+TESTS += run_ut_mapapi.sh
+TESTS += run_ut_misc.sh
 TESTS += run_ut_chunk.sh
 
 if BUILD_UTILITIES
 
-TESTS += run_ut_map.sh
-TESTS += run_ut_mapapi.sh
-TESTS += run_ut_misc.sh
 TESTS += run_ncgen4.sh
 
 if USE_HDF5
diff --git a/test_common.in b/test_common.in
index f7c04b3bc..109b12998 100644
--- a/test_common.in
+++ b/test_common.in
@@ -88,11 +88,14 @@ if test "x$SETX" = x1 ; then set -x ; fi
 # On MINGW, bash and other POSIX utilities use a mounted root directory,
 # but executables compiled for Windows do not recognise the mount point.
 # Here we ensure that Windows paths are used in tests of Windows executables.
-
-system=`uname`
-if test "x${system##MINGW*}" = x; then
-  alias pwd='pwd -W'
-
+if test "x${FP_ISMSYS}" = xyes || test "x${FP_ISCYGWIN}" = xyes ; then
+  if test "x${MSYS2_PREFIX}" = x ; then
+    MSYS2_PREFIX=`cygpath -w '/'`
+    export MSYS2_PREFIX
+  fi
+fi
+if test "x${FP_ISMINGW}" = xyes ; then
+    alias pwd='pwd -W'
 fi
 
 # We assume that TOPSRCDIR and TOPBUILDDIR are defined