File: tst_filter_misc.sh

package info (click to toggle)
netcdf-parallel 1%3A4.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 116,192 kB
  • sloc: ansic: 279,265; sh: 14,143; cpp: 5,971; yacc: 2,612; makefile: 2,075; lex: 1,218; javascript: 280; xml: 173; awk: 2
file content (114 lines) | stat: -rwxr-xr-x 2,344 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash 

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

if test "x$TESTNCZARR" = x1; then
. $srcdir/test_nczarr.sh
fi

set -e

isolate "testdir_filter_misc"
THISDIR=`pwd`
cd $ISOPATH

if test "x$TESTNCZARR" = x1; then
s3isolate
fi

if test "x$TESTNCZARR" = x1; then
    TFAVAIL=${execdir}/test_filter_avail
    TFVLEN=${execdir}/test_filter_vlen
else
    TFAVAIL=${execdir}/tst_filter_avail
    TFVLEN=${execdir}/tst_filter_vlen
fi

# Load the findplugins function
. ${builddir}/findplugin.sh
echo "findplugin.sh loaded"

# test for deflate filter
if avail 1 ; then HAVE_DEFLATE=1; else HAVE_DEFLATE=0; fi
if test "$HAVE_DEFLAGE" = 0 ; then
   echo ">>> Filter bzip2 not available; discontinuing test"
   exit 0;
fi

# Function to remove selected -s attributes from file;
# These attributes might be platform dependent
sclean() {
    cat $1 \
 	| sed -e '/:_IsNetcdf4/d' \
	| sed -e '/:_Endianness/d' \
	| sed -e '/_NCProperties/d' \
	| sed -e '/_SuperblockVersion/d' \
      	| sed -e '/_Format/d' \
        | sed -e '/global attributes:/d' \
	| cat > $2
}

# Function to extract _Filter attribute from a file
# These attributes might be platform dependent
getfilterattr() {
V="$1"
sed -e '/${V}.*:_Filter/p' -ed <$2 >$3
}

# Function to extract _Codecs attribute from a file
# These attributes might be platform dependent
getcodecsattr() {
V="$1"
sed -e '/${V}.*:_Codecs/p' -ed <$2 >$3
}

trimleft() {
sed -e 's/[ 	]*\([^ 	].*\)/\1/' <$1 >$2
}

setfilter() {
    FF="$1"
    FSRC="$2"
    FDST="$3"
    FIH5="$4"
    FICX="$5"
    FFH5="$6"
    FFCX="$7"
    if test "x$FFH5" = x ; then FFH5="$FIH5" ; fi
    if test "x$FFCX" = x ; then FFCX="$FICX" ; fi
    rm -f $FDST
    cat ${srcdir}/$FSRC \
	| sed -e "s/ref_any/${FF}/" \
	| sed -e "s/IH5/${FIH5}/" -e "s/FH5/${FFH5}/" \
	| sed -e "s/ICX/${FICX}/" -e "s/FCX/${FFCX}/" \
	| sed -e 's/"/\\"/g' -e 's/@/"/g' \
	| cat > $FDST
}

# Execute the specified tests

testavail() {
  zext=$1
  if ! filteravail bzip2; then return 0; fi
  ${TFAVAIL}
}

testvlen() {
  zext=$1
  ${TFVLEN}
}

testset() {
# Which test cases to exercise
    testavail $1
    testvlen $1
}

if test "x$TESTNCZARR" = x1 ; then
    testset file
    if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testset zip ; fi
    if test "x$FEATURE_S3TESTS" = xyes ; then testset s3 ; fi
else
    testset nc
fi