File: tst_iter.sh

package info (click to toggle)
netcdf 1%3A4.4.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 96,828 kB
  • ctags: 15,369
  • sloc: ansic: 163,650; sh: 9,294; yacc: 2,457; makefile: 1,208; lex: 1,161; xml: 173; f90: 7; fortran: 6; awk: 2
file content (57 lines) | stat: -rwxr-xr-x 1,068 bytes parent folder | download
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
56
57
#!/bin/sh
if test "x$SETX" = x1 ; then echo "file=$0"; set -x ; fi
# This shell script runs an ncdump bug test for netcdf
# Test if the nciter code is working [NCF-154]

set -e
echo ""
echo "*** Running ncdump nc_iter test."

if test "x$CC" = "x" ; then CC="gcc"; fi

CLEANUP="iter.*"

rm -f $CLEANUP

# echo "create iter.cdl"
cat > iter.cdl <<EOF
netcdf iter {
dimensions:
x = 5 ;
y = 256 ;
z = 256;
variables:
int var(x,y,z) ;
data:
var =
EOF
cat >./iter.c <<EOF
#include <stdlib.h>
#include <stdio.h>
#define N (5*256*256)
int main() {
  int i;
  for(i=0;i<N-1;i++) {printf("%d,\n",i);}
  printf("%d;\n}\n",N);
  return 0;
}
EOF

$CC ./iter.c -o iter.exe
./iter.exe >>iter.cdl

# echo "*** create iter.nc "
../ncgen/ncgen -k nc3 -o iter.nc ./iter.cdl
echo "*** dumping iter.nc to iter.dmp"
./ncdump iter.nc > iter.dmp
echo "*** reformat iter.dmp"
mv iter.dmp iter.tmp
sed -e 's/\([0-9][,]\) /\1@/g' <iter.tmp |tr '@' '\n' |sed -e '/^$/d' >./iter.dmp

echo "*** comparing iter.dmp with iter.cdl..."
diff -b -w ./iter.dmp ./iter.cdl

# cleanup
rm -f $CLEANUP

exit 0