Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix race condition in ncdump (and other) tests. #2552

Merged
merged 16 commits into from
Nov 9, 2022
Merged
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1062,14 +1062,15 @@ ENDIF()
IF(ENABLE_DAP)
SET(USE_DAP ON CACHE BOOL "")
SET(ENABLE_DAP2 ON CACHE BOOL "")
SET(ENABLE_DAP4 OFF CACHE BOOL "")

IF(ENABLE_HDF5)
SET(ENABLE_DAP4 ON CACHE BOOL "")
IF(NOT ENABLE_HDF5)
SET(ENABLE_DAP4 OFF CACHE BOOL "")
ENDIF(ENABLE_HDF5)

ELSE()
SET(ENABLE_DAP2 OFF)
SET(ENABLE_DAP4 OFF)
SET(ENABLE_DAP2 OFF CACHE BOOL "")
SET(ENABLE_DAP4 OFF CACHE BOOL "")
ENDIF()

# Option to support byte-range reading of remote datasets
Expand Down
3 changes: 2 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This file contains a high-level description of this package's evolution. Release

## 4.9.1 - T.B.D.

### 4.9.1 - Release Candidate 1 - October 20, 2022
### 4.9.1 - Release Candidate 2 - TBD

#### Known Issues

Expand All @@ -16,6 +16,7 @@ This file contains a high-level description of this package's evolution. Release

#### Changes

* [Bug Fix] Fix some race conditions due to use of a common file in multiple shell scripts . See [Github #2552](https://github.com/Unidata/netcdf-c/pull/2552).
* [Enhancement][Documentation] Add Plugins Quick Start Guide. See [GitHub #2524](https://github.com/Unidata/netcdf-c/pull/2524) for more information.
* [Enhancement] Add new entries in `netcdf_meta.h`, `NC_HAS_BLOSC` and `NC_HAS_BZ2`. See [Github #2511](https://github.com/Unidata/netcdf-c/issues/2511) and [Github #2512](https://github.com/Unidata/netcdf-c/issues/2512) for more information.
* [Enhancement] Add new options to `nc-config`: `--has-multifilters`, `--has-stdfilters`, `--has-quantize`, `--plugindir`. See [Github #2509](https://github.com/Unidata/netcdf-c/pull/2509) for more information.
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ fi
AM_CONDITIONAL(ENABLE_QUANTIZE, [test x$enable_quantize = xyes])

# --enable-dap => enable-dap4
enable_dap4=$enable_dap
enable_dap4=no
AC_MSG_CHECKING([whether dap use of remotetest server should be enabled])
AC_ARG_ENABLE([dap-remote-tests],
[AS_HELP_STRING([--disable-dap-remote-tests],
Expand Down
2 changes: 1 addition & 1 deletion nc_test4/tst_filter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fi

if test "x$NCP" = x1 ; then
echo "*** Testing dynamic filters using nccopy"
rm -f ./tmp_unfiltered.nc ./tmp_filtered.nc ./tmp.nc ./tmp_filtered.dump ./tmp_filter.txt
rm -f ./tmp_unfiltered.nc ./tmp_filtered.nc ./tmp_filtered.dump ./tmp_filter.txt
# Create our input test files
${NCGEN} -4 -lb -o tmp_unfiltered.nc ${srcdir}/ref_unfiltered.cdl
${NCGEN} -4 -lb -o tmp_unfilteredvv.nc ${srcdir}/ref_unfilteredvv.cdl
Expand Down
12 changes: 6 additions & 6 deletions ncdump/run_back_comp_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ echo "*** Testing that this version can read data produced by old versions of ne
echo "*** checking ref_nc_test_netcdf4_4_0.nc..."
${NCDUMP} -n ref_nc_test_netcdf4_4_0 $srcdir/ref_nc_test_netcdf4_4_0.nc > tst_nc_test_netcdf4_4_0.cdl
# Why drop the first two lines?
#tail -n +2 < $srcdir/ref_nc_test_netcdf4.cdl > tmp.cdl
#tail -n +2 < $srcdir/ref_nc_test_netcdf4.cdl > tmp_back_comp.cdl
#tail -n +2 < tst_nc_test_netcdf4_4_0.cdl > tmp_4_0.cdl
#diff -b -w tmp.cdl tmp_4_0.cdl
#diff -b -w tmp_back_comp.cdl tmp_4_0.cdl
diff -b -w $srcdir/ref_nc_test_netcdf4.cdl tst_nc_test_netcdf4_4_0.cdl

# echo "*** Testing that old versions can read data produced by this version of netCDF."
# echo "*** checking version 4.0..."
# ${NCGEN} -b -o tst_nc_test_netcdf4 -k nc7 $srcdir/ref_nc_test_netcdf4.cdl
# /machine/local_4.0/bin/ncdump tst_nc_test_netcdf4.nc > tst_nc_test_netcdf4.cdl
# tail -n +2 <$srcdir/ref_nc_test_netcdf4.cdl > tmp.cdl
# tail -n +2 <$srcdir/ref_nc_test_netcdf4.cdl > tmp_back_comp.cdl
# tail -n +2 <tst_nc_test_netcdf4.cdl > tmp_4_0.cdl
# diff -b -w tmp.cdl tmp_4_0.cdl
# diff -b -w tmp_back_comp.cdl tmp_4_0.cdl

# echo "*** checking version 4.1.1..."
# ${NCGEN} -b -o tst_nc_test_netcdf4 -k nc7 $srcdir/ref_nc_test_netcdf4.cdl
# /machine/local_4.1.1/bin/ncdump tst_nc_test_netcdf4.nc > tst_nc_test_netcdf4.cdl
# tail -n +2 <$srcdir/ref_nc_test_netcdf4.cdl > tmp.cdl
# tail -n +2 <$srcdir/ref_nc_test_netcdf4.cdl > tmp_back_comp.cdl
# tail -n +2 <tst_nc_test_netcdf4.cdl > tmp_4_0.cdl
# diff -b -w tmp.cdl tmp_4_0.cdl
# diff -b -w tmp_back_comp.cdl tmp_4_0.cdl

echo "*** All backward compatibility tests passed!"
exit 0
10 changes: 5 additions & 5 deletions ncdump/tst_bom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export srcdir;

echo ""

rm -f tst_bom.cdl tmp.cdl tst_bom8.* tst_bom16.*
rm -f tst_bom.cdl tmp_bom.cdl tst_bom8.* tst_bom16.*

cat <<EOF >>tst_bom.cdl
netcdf tst_bom {
Expand All @@ -30,12 +30,12 @@ cat tst_bom.cdl >> tst_bom8.cdl

echo "*** Verify .nc file"
${NCGEN} -k nc3 -o tst_bom8.nc tst_bom8.cdl
${NCDUMP} -n tst_bom tst_bom8.nc > tmp.cdl
diff -w tst_bom.cdl tmp.cdl
${NCDUMP} -n tst_bom tst_bom8.nc > tmp_bom.cdl
diff -w tst_bom.cdl tmp_bom.cdl

# Do it again but with Big-Endian 16; should fail

rm -f tmp.cdl tst_bom8.* tst_bom16.*
rm -f tmp_bom.cdl tst_bom8.* tst_bom16.*

echo "*** Generate a cdl file with leading UTF-16 BOM."
${execdir}/bom 16 >tst_bom16.cdl
Expand All @@ -50,6 +50,6 @@ echo '***XFAIL : BOM Big Endian 16'
fi

# Cleanup
rm -f tst_bom.cdl tmp.cdl tst_bom8.* tst_bom16.*
rm -f tst_bom.cdl tmp_bom.cdl tst_bom8.* tst_bom16.*

exit 0
48 changes: 24 additions & 24 deletions ncdump/tst_nccopy4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,56 +56,56 @@ if test `wc -c < tst_deflated.nc` -ge `wc -c < tst_inflated4.nc`; then
exit 1
fi
echo "*** Test nccopy -d1 -s can compress a classic model netCDF-4 file even more ..."
${NCCOPY} -d1 -s tst_inflated.nc tmp.nc
if test `wc -c < tmp.nc` -ge `wc -c < tst_inflated.nc`; then
${NCCOPY} -d1 -s tst_inflated.nc tmp_ncc4.nc
if test `wc -c < tmp_ncc4.nc` -ge `wc -c < tst_inflated.nc`; then
exit 1
fi
echo "*** Test nccopy -d1 -s can compress a netCDF-4 file even more ..."
${NCCOPY} -d1 -s tst_inflated4.nc tmp.nc
if test `wc -c < tmp.nc` -ge `wc -c < tst_inflated4.nc`; then
${NCCOPY} -d1 -s tst_inflated4.nc tmp_ncc4.nc
if test `wc -c < tmp_ncc4.nc` -ge `wc -c < tst_inflated4.nc`; then
exit 1
fi
echo "*** Test nccopy -d0 turns off compression, shuffling of compressed, shuffled file ..."
${NCCOPY} -d0 tst_inflated4.nc tmp.nc
${NCDUMP} -sh tmp.nc > tmp.cdl
if fgrep '_DeflateLevel' < tmp.cdl ; then
${NCCOPY} -d0 tst_inflated4.nc tmp_ncc4.nc
${NCDUMP} -sh tmp_ncc4.nc > tmp_ncc4.cdl
if fgrep '_DeflateLevel' < tmp_ncc4.cdl ; then
exit 1
fi
if fgrep '_Shuffle' < tmp.cdl ; then
if fgrep '_Shuffle' < tmp_ncc4.cdl ; then
exit 1
fi
rm tst_deflated.nc tst_inflated.nc tst_inflated4.nc tmp.nc tmp.cdl
rm tst_deflated.nc tst_inflated.nc tst_inflated4.nc tmp_ncc4.nc tmp_ncc4.cdl

echo "*** Testing nccopy -d1 -s on ncdump/*.nc files"
for i in $TESTFILES0 ; do
echo "*** Test nccopy -d1 -s $i.nc copy_of_$i.nc ..."
${NCCOPY} -d1 -s $i.nc copy_of_$i.nc
${NCDUMP} -n copy_of_$i $i.nc > tmp.cdl
${NCDUMP} -n copy_of_$i $i.nc > tmp_ncc4.cdl
${NCDUMP} copy_of_$i.nc > copy_of_$i.cdl
# echo "*** compare " with copy_of_$i.cdl
diff copy_of_$i.cdl tmp.cdl
rm copy_of_$i.nc copy_of_$i.cdl tmp.cdl
diff copy_of_$i.cdl tmp_ncc4.cdl
rm copy_of_$i.nc copy_of_$i.cdl tmp_ncc4.cdl
done
./tst_chunking
echo "*** Test that nccopy -c can chunk and unchunk files"
${NCCOPY} -M0 tst_chunking.nc tmp.nc
${NCDUMP} tmp.nc > tmp.cdl
${NCCOPY} -M0 tst_chunking.nc tmp_ncc4.nc
${NCDUMP} tmp_ncc4.nc > tmp_ncc4.cdl
${NCCOPY} -c dim0/,dim1/1,dim2/,dim3/1,dim4/,dim5/1,dim6/ tst_chunking.nc tmp-chunked.nc
${NCDUMP} -n tmp tmp-chunked.nc > tmp-chunked.cdl
diff tmp.cdl tmp-chunked.cdl
${NCDUMP} -n tmp_ncc4 tmp-chunked.nc > tmp-chunked.cdl
diff tmp_ncc4.cdl tmp-chunked.cdl
${NCCOPY} -c dim0/,dim1/,dim2/,dim3/,dim4/,dim5/,dim6/ tmp-chunked.nc tmp-unchunked.nc
${NCDUMP} -n tmp tmp-unchunked.nc > tmp-unchunked.cdl
diff tmp.cdl tmp-unchunked.cdl
${NCDUMP} -n tmp_ncc4 tmp-unchunked.nc > tmp-unchunked.cdl
diff tmp_ncc4.cdl tmp-unchunked.cdl
${NCCOPY} -c // tmp-chunked.nc tmp-unchunked2.nc
${NCDUMP} -n tmp tmp-unchunked.nc > tmp-unchunked2.cdl
diff tmp.cdl tmp-unchunked2.cdl
${NCDUMP} -n tmp_ncc4 tmp-unchunked.nc > tmp-unchunked2.cdl
diff tmp_ncc4.cdl tmp-unchunked2.cdl
echo "*** Test that nccopy -c works as intended for record dimension default (1)"
${NCGEN} -b -o tst_bug321.nc $srcdir/tst_bug321.cdl
${NCCOPY} -k nc7 -c"lat/2,lon/2" tst_bug321.nc tmp.nc
${NCDUMP} -n tst_bug321 tmp.nc > tmp.cdl
diff -b $srcdir/tst_bug321.cdl tmp.cdl
${NCCOPY} -k nc7 -c"lat/2,lon/2" tst_bug321.nc tmp_ncc4.nc
${NCDUMP} -n tst_bug321 tmp_ncc4.nc > tmp_ncc4.cdl
diff -b $srcdir/tst_bug321.cdl tmp_ncc4.cdl

rm tst_chunking.nc tmp.nc tmp.cdl tmp-chunked.nc tmp-chunked.cdl tmp-unchunked.nc tmp-unchunked.cdl
rm tst_chunking.nc tmp_ncc4.nc tmp_ncc4.cdl tmp-chunked.nc tmp-chunked.cdl tmp-unchunked.nc tmp-unchunked.cdl

echo "*** Test that nccopy -c dim/n works as intended "
${NCGEN} -4 -b -o tst_perdimspecs.nc $srcdir/ref_tst_perdimspecs.cdl
Expand Down
2 changes: 1 addition & 1 deletion ncdump/tst_nccopy5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ cleanup() {
# remove all created files
reset() {
cleanup
rm -fr tst_nc5.nc tst_nc5.cdl tmp.cdl
rm -fr tst_nc5.nc tst_nc5.cdl tmp_ncc5.cdl
rm -f tst_nc5_omit.nc tst_nc5_omit.cdl
}

Expand Down
6 changes: 3 additions & 3 deletions nczarr_test/run_nccopyz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ fileargs tmp
./tst_zchunks3 -e ${zext}
echo "*** Test that nccopy -c can chunk files"
${NCCOPY} -M0 tmp_chunks3.nc "$fileurl"
${NCDUMP} -n tmp -sh "$fileurl" > tmp.cdl
verifychunking tmp.cdl "ivar:_ChunkSizes=7,4,2,3,5,6,9;" "fvar:_ChunkSizes=9,6,5,3,2,4,7;"
${NCDUMP} -n tmp -sh "$fileurl" > tmp_nccz.cdl
verifychunking tmp_nccz.cdl "ivar:_ChunkSizes=7,4,2,3,5,6,9;" "fvar:_ChunkSizes=9,6,5,3,2,4,7;"

fileargs tmp_chunked
./tst_zchunks3 -e ${zext}
${NCCOPY} -M0 -c dim0/,dim1/1,dim2/,dim3/1,dim4/,dim5/1,dim6/ tmp_chunks3.nc "$fileurl"
${NCDUMP} -sh -n tmp "$fileurl" > tmp_chunked.cdl
verifychunking tmp_chunked.cdl "ivar:_ChunkSizes=7,1,2,1,5,1,9;" "fvar:_ChunkSizes=9,1,5,1,2,1,7;"
chunkclean tmp.cdl tmpx.cdl
chunkclean tmp_nccz.cdl tmpx.cdl
chunkclean tmp_chunked.cdl tmp_chunkedx.cdl
diff tmpx.cdl tmp_chunkedx.cdl

Expand Down
18 changes: 9 additions & 9 deletions nczarr_test/run_nczarr_fill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ echo "*** Test: Github issue #2059"
fileargs tmp_groups_regular "mode=zarr,$zext"
deletemap $zext $file
${NCCOPY} ${srcdir}/ref_groups.h5 "$fileurl"
rm -f tmp.cdl
rm -f tmp_nczfill.cdl
${ZMD} -h "$fileurl"
${NCDUMP} -s -n tmp_groups_regular "$fileurl" > tmp.cdl
sclean tmp.cdl tmp_groups_regular_$zext.cdl
${NCDUMP} -s -n tmp_groups_regular "$fileurl" > tmp_nczfill.cdl
sclean tmp_nczfill.cdl tmp_groups_regular_$zext.cdl
diff -wb ${srcdir}/ref_groups_regular.cdl tmp_groups_regular_$zext.cdl
}

Expand All @@ -27,10 +27,10 @@ zext=$1
echo "*** Test: Github issue #2062"
rm -fr ref_byte.zarr
unzip ${srcdir}/ref_byte.zarr.zip
rm -fr tmp.cdl
rm -fr tmp_nczfill.cdl
${ZMD} -h "file://ref_byte.zarr#mode=zarr,$zext"
${NCDUMP} -s "file://ref_byte.zarr#mode=zarr,$zext" > tmp.cdl
sclean tmp.cdl tmp_byte_$zext.cdl
${NCDUMP} -s "file://ref_byte.zarr#mode=zarr,$zext" > tmp_nczfill.cdl
sclean tmp_nczfill.cdl tmp_byte_$zext.cdl
diff -wb ${srcdir}/ref_byte.cdl tmp_byte_$zext.cdl
rm -fr ref_byte.zarr
}
Expand All @@ -40,10 +40,10 @@ zext=$1
echo "*** Test: Github issue #2063"
rm -fr ref_byte_fill_value_null.zarr
unzip ${srcdir}/ref_byte_fill_value_null.zarr.zip
rm -fr tmp.cdl
rm -fr tmp_nczfill.cdl
${ZMD} -h "file://ref_byte_fill_value_null.zarr#mode=zarr,$zext"
${NCDUMP} -s "file://ref_byte_fill_value_null.zarr#mode=zarr,$zext" > tmp.cdl
sclean tmp.cdl tmp_byte_fill_value_null_$zext.cdl
${NCDUMP} -s "file://ref_byte_fill_value_null.zarr#mode=zarr,$zext" > tmp_nczfill.cdl
sclean tmp_nczfill.cdl tmp_byte_fill_value_null_$zext.cdl
diff -wb ${srcdir}/ref_byte_fill_value_null.cdl tmp_byte_fill_value_null_$zext.cdl
rm -fr ref_byte_fill_value_null.zarr
}
Expand Down
1 change: 1 addition & 0 deletions nczarr_test/run_scalar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi

# This shell script tests support for the NC_STRING type

set -x
set -e

zarrscalar() {
Expand Down