File: test_scope.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 (56 lines) | stat: -rwxr-xr-x 1,632 bytes parent folder | download | duplicates (4)
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
#!/bin/bash

if test "x$srcdir" = x ; then srcdir=`pwd`; fi 
. ../test_common.sh

set -e

# Test scoping rules for types and dimensions

# Type test cases
# group_only - type defined in same group as var/attr
# ancestor_only - type defined in some ancestor group of var/attr
# ancestor_subgroup - type defined in both ancestor group and subgroup
# preorder - type defined in some preceding, non ancestor group

# Dimension test cases
# group_only - dim defined in same group as var
# ancestor_only - dim defined in some ancestor group of var
# ancestor_subgroup - dim defined in both ancestor group and subgroup

TSTS="scope_group_only scope_ancestor_only scope_ancestor_subgroup scope_preorder"

setup() {
    ${NCGEN} -4 -lb ${srcdir}/$1.cdl
}

testcycle() {
${NCCOPY} ${execdir}/$1.nc ${execdir}/$1_copy.nc
${NCDUMP} -h -n $1 ${execdir}/$1_copy.nc > copy_$1.cdl
diff -wB ${srcdir}/$1.cdl ${execdir}/copy_$1.cdl
}

typescope() {
ls -l ${execdir}/printfqn* ${execdir}/$1.nc ${execdir}/$1_copy.nc
REFT=`${execdir}/printfqn -f ${execdir}/$1.nc -v test_variable -t`
COPYT=`${execdir}/printfqn -f ${execdir}/$1_copy.nc -v test_variable -t`
if test "x$REFT" != "x$COPYT" ; then
  echo "***Fail: ref=${REFT} copy=${COPYT}"
  exit 1
fi
}

dimscope() {
REFT=`${execdir}/printfqn -f ${execdir}/$1.nc -v test_variable -d`
COPYT=`${execdir}/printfqn -f ${execdir}/$1_copy.nc -v test_variable -d`
if test "x$REFT" != "x$COPYT" ; then
  echo "***Fail: ref=${REFT} copy=${COPYT}"
fi
}

for t in $TSTS ; do setup $t; done
for t in $TSTS ; do testcycle $t; done
for t in $TSTS ; do typescope $t; done
for t in $TSTS ; do dimscope $t; done

exit 0