File: testpathcvt.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 (67 lines) | stat: -rwxr-xr-x 1,674 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
#!/bin/bash

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

set -e

# Disable automatic path conversions in MINGW shell:
export MSYS2_ARG_CONV_EXCL='*'

# We need to find the drive letter, if any
DL=`${NCPATHCVT} -c -x / | sed -e 's|/cygdrive/\([a-zA-Z]\)/.*|\1|'`
if test "x$DL" != x ; then
  # Lower case drive letter
  DLL=`echon -e "$DL" | tr '[:upper:]' '[:lower:]'`
  DL="-D $DLL"
fi

testcaseD() {
T="$1"
P="$2"
# Fixup for shell handling of '\'
PX=`echon -n "$P" | sed -e 's/\\\\\\\\/\\\\/g'`
echon -e "path: $T: |$P| => |" >>tmp_pathcvt.txt
${NCPATHCVT} -B"@" ${DL} "$T" -x "$PX" >>tmp_pathcvt.txt
echo "|" >> tmp_pathcvt.txt
}

testcaseP() {
T="$1"
P="$2"
# Fixup for shell handling of '\'
PX=`echon -n "$P" | sed -e 's/\\\\\\\\/\\\\/g'`
echon -e "path: $T: |$P| => |" >>tmp_pathcvt.txt
${NCPATHCVT} -S';' -B"@" ${DL} "$T" -x "$PX" >>tmp_pathcvt.txt
echo "|" >> tmp_pathcvt.txt
}

# Note that -m is not tested as it is currently an alias for -w
testcase1() {
    testcaseD "-u" "$1"
    testcaseD "-c" "$1"
    testcaseD "-w" "$1"
}

testcase2() {
    testcaseP "-u" "$1"
    testcaseP "-c" "$1"
    testcaseP "-w" "$1"
}

rm -f tmp_pathcvt.txt

# '@' will get translated to embedded blank
TESTPATHS1="/xxx/x/y d:/x/y /cygdrive/d/x/y /d/x/y /cygdrive/d /d /cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn d:\\\\x\\\\y d:\\\\x\\\\y@w\\\\z"
for p in $TESTPATHS1 ; do
testcase1 "$p"
done

TESTPATHS2="/xxx/x/y;/cygdrive/d/x/y /d/x/y;/cygdrive/d cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn;d:\\\\x\\\\y d:\\\\x\\\\y@w\\\\z"
for p in $TESTPATHS2 ; do
testcase2 "$p"
done

diff -w ${srcdir}/ref_pathcvt.txt ./tmp_pathcvt.txt

exit 0