OSDN Git Service

3fe96e9345c291f05dc26cfca4eaa6904ae0806b
[lha/lha.git] / tests / lha-test11
1 # -*- shell-script -*-
2 message testing the long filename support
3 # long long filename
4 # assume that we are allowed to create 255 bytes filename (not path name).
5 # the _POSIX_PATH_MAX (the maximam length of relative path name) value may
6 # be 255.
7 #
8 # Note that on Cygwin/MinGW, on NTFS, the maximam length of whole path
9 # name (contain the drive letter) is limited probably. it seems to be 259 (?)
10 #
11
12 # 255 bytes
13 file=123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345
14
15 mkdir test-tmp1
16 case $(uname) in
17 MS-DOS* | CYGWIN*)
18   # omit the length of current path.
19   file=$(echo $file | cut -c$((echo X: && cd test-tmp1 && pwd && echo test-tmp1-hg) | wc -c)-)
20   ;;
21 *)
22 esac
23 (cd test-tmp1 && touch $file)
24                                                         check $? $LINENO
25 $lha cg  test-tmp1-hg.lzh test-tmp1 2> test-stderr
26                                                         check $? $LINENO
27 # on Cygwin/MinGW, skip this test.
28 # the length of pathname does not amount to the limit of level 0 header.
29 case $(uname) in
30 MS-DOS* | CYGWIN*) true ;;
31 *) test -s test-stderr ;;
32 esac
33                                                         check $? $LINENO
34 $lha c0  test-tmp1-h0.lzh test-tmp1 2> test-stderr
35                                                         check $? $LINENO
36 # on Cygwin/MinGW, skip this test.
37 # the length of pathname does not amount to the limit of level 0 header.
38 case $(uname) in
39 MS-DOS* | CYGWIN*) true ;;
40 *) test -s test-stderr ;;
41 esac
42                                                         check $? $LINENO
43 $lha c1  test-tmp1-h1.lzh test-tmp1
44                                                         check $? $LINENO
45 $lha c2  test-tmp1-h2.lzh test-tmp1
46                                                         check $? $LINENO
47 $lha xw=test-tmp1-hg  test-tmp1-hg.lzh
48                                                         check $? $LINENO
49 $lha xw=test-tmp1-h0  test-tmp1-h0.lzh
50                                                         check $? $LINENO
51 $lha xw=test-tmp1-h1  test-tmp1-h1.lzh
52                                                         check $? $LINENO
53 $lha xw=test-tmp1-h2  test-tmp1-h2.lzh
54                                                         check $? $LINENO
55 # for logging
56 $lha vv test-tmp1-hg.lzh
57                                                         check $? $LINENO
58 $lha vv test-tmp1-h0.lzh
59                                                         check $? $LINENO
60 $lha vv test-tmp1-h1.lzh
61                                                         check $? $LINENO
62 $lha vv test-tmp1-h2.lzh
63                                                         check $? $LINENO
64 $lha vv test-tmp1-hg.lzh | egrep '\[0\].?$'
65                                                         check $? $LINENO
66 $lha vv test-tmp1-h0.lzh | egrep '\[0\].?$'
67                                                         check $? $LINENO
68 $lha vv test-tmp1-h1.lzh | egrep '\[1\].?$'
69                                                         check $? $LINENO
70 $lha vv test-tmp1-h2.lzh | egrep '\[2\].?$'
71                                                         check $? $LINENO
72 test -f test-tmp1-hg/$(echo test-tmp1/$file | cut -c-233)
73                                                         check $? $LINENO
74 test -f test-tmp1-h0/$(echo test-tmp1/$file | cut -c-221)
75                                                         check $? $LINENO
76 test -f test-tmp1-h1/test-tmp1/$file
77                                                         check $? $LINENO
78 test -f test-tmp1-h2/test-tmp1/$file
79                                                         check $? $LINENO
80 # 0x100 is never set on the header size field on level 2 header
81 file=test-tmp9012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
82 touch $file
83 if [ $? -ne 0 ]; then
84   echo "$FILENAME: Warning: current directory is too deep. skip this test..." >&2
85 else
86
87   $lha c2 test-tmp4-h2.lzh $file
88                                                         check $? $LINENO
89   $lha vv test-tmp4-h2.lzh
90                                                         check $? $LINENO
91   $lha vv test-tmp4-h2.lzh | egrep '\[2\].?$'
92                                                         check $? $LINENO
93   rm -f $file
94                                                         check $? $LINENO
95   $lha x test-tmp4-h2.lzh
96                                                         check $? $LINENO
97   test x"`$lha vvvq test-tmp4-h2.lzh | head -1`" = x"00  2: 257(0x0101)"
98                                                         check $? $LINENO
99   test -f $file
100                                                         check $? $LINENO
101 fi