File: tst_bom.sh

package info (click to toggle)
netcdf-parallel 1%3A4.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 113,164 kB
  • sloc: ansic: 267,893; sh: 12,869; cpp: 5,822; yacc: 2,613; makefile: 1,813; lex: 1,216; xml: 173; awk: 2
file content (55 lines) | stat: -rwxr-xr-x 1,054 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/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.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.cdl
diff -w tst_bom.cdl tmp.cdl

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

rm -f tmp.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.cdl tst_bom8.* tst_bom16.*

exit 0