mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-03 08:01:25 +08:00
9f848c9e53
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
56 lines
1.0 KiB
Bash
Executable File
56 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
. ../test_common.sh
|
|
|
|
# This shell script tests BOM support in ncgen
|
|
|
|
set -e
|
|
|
|
# add hack for sunos
|
|
export srcdir;
|
|
|
|
echo ""
|
|
|
|
rm -f tst_bom.cdl tmp_bom.cdl tst_bom8.* tst_bom16.*
|
|
|
|
cat <<EOF >>tst_bom.cdl
|
|
netcdf tst_bom {
|
|
variables:
|
|
float f;
|
|
data:
|
|
|
|
f = 1;
|
|
}
|
|
EOF
|
|
|
|
echo "*** Generate a cdl file with leading UTF-8 BOM."
|
|
${execdir}/bom 8 >tst_bom8.cdl
|
|
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_bom.cdl
|
|
diff -w tst_bom.cdl tmp_bom.cdl
|
|
|
|
# Do it again but with Big-Endian 16; should fail
|
|
|
|
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
|
|
cat tst_bom.cdl >> tst_bom16.cdl
|
|
|
|
echo "*** Verify UTF-16 file fails"
|
|
if ${NCGEN} -k nc3 -o tst_bom16.nc tst_bom16.cdl ; then
|
|
echo 'BOM Big Endian 16 succeeded, but should not'
|
|
exit 1
|
|
else
|
|
echo '***XFAIL : BOM Big Endian 16'
|
|
fi
|
|
|
|
# Cleanup
|
|
rm -f tst_bom.cdl tmp_bom.cdl tst_bom8.* tst_bom16.*
|
|
|
|
exit 0
|