netcdf-c/ncdump/run_back_comp_tests.sh
Dennis Heimbigner 9f848c9e53 Fix race condition in ncdump (and other) tests.
re: Issue https://github.com/Unidata/netcdf-c/issues/2551

Ryan May identified the use of a common scratch file (tmp.cdl)
across multiple test shell scripts in ncdump directory
and the nczarr_test directory.
This sometimes causes errors because of race conditions
between those scripts.

I renamed those common files to avoid the race condition.  I
also did some further checking and found some additional,
similar conflicts and fixed those. Also did some minor cleanup
of unused files.

Tests fixed:
ncdump: run_back_comp_tests.sh tst_bom.sh tst_nccopy4.sh tst_nccopy5.sh
nczarr_test: git df master -- run_nccopyz.sh run_nczarr_fill.sh run_scalar.sh
2022-11-08 20:12:38 -07:00

38 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
# This shell script runs the backward compatibility tests.
set -e
echo ""
echo "*** Testing that this version can read data produced by old versions of netCDF."
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_back_comp.cdl
#tail -n +2 < tst_nc_test_netcdf4_4_0.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_back_comp.cdl
# tail -n +2 <tst_nc_test_netcdf4.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_back_comp.cdl
# tail -n +2 <tst_nc_test_netcdf4.cdl > tmp_4_0.cdl
# diff -b -w tmp_back_comp.cdl tmp_4_0.cdl
echo "*** All backward compatibility tests passed!"
exit 0