Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 570
blobaa4fcf955dc239e686566f5a859fc3630b8f8370
1 #! /bin/sh
2 # PCP QA Test No. 570
3 # pmnscomp -f /dev/null et al, #690735
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 _notrun "pmnscomp retired in PCP 3.6"
18 status=1 # failure is the default!
19 trap "cd $here; rm -rf $tmp; exit \$status" 0 1 2 3 15
21 _ls()
23 if [ -r $1 -o -w $1 -o -x $1 ] ; then
24 # filter ls -ld output
25 #-rwxr-xr-x 1 kenmcd ptg 2386 Apr 29 04:52 570
26 #drwxrwxr-x 13 kenmcd ptg 52736 Apr 29 04:33 .
27 #crw-rw-rw- 1 root sys 1, 2 Apr 29 04:57 /dev/null
28 #Cannot access nofile: No such file or directory
29 LC_TIME=POSIX ls -ld $1 \
30 | sed \
31 -e 's/-rw-r--r--\./-rw-r--r--/' \
32 -e 's/crw-rw-rw-\./crw-rw-rw-/' \
33 -e 's/drwxr-xr-x\./drwxr-xr-x/' \
34 | $PCP_AWK_PROG '
35 NF == 9 && /^-/ { print $1,"...",$5,"...",$9; next }
36 NF == 9 && /^d/ { print $1,"...",$9; next }
37 NF == 10 && /^[cb]/ { print $1,"...",$10; next }
38 { print }'
39 else
40 echo "Cannot access $1: No such file or directory"
44 umask 022
46 rm -rf $tmp
47 mkdir $tmp
48 chmod 755 $tmp
49 cd $tmp
51 cat >pmns <<End-of-File
52 root {
53 one 0:1:1
54 node
57 node {
58 two 0:2:2
60 End-of-File
62 # real QA test starts here
64 echo
65 echo "dir is writeable, output file does not exist"
66 rm -f root.bin
67 pmnscomp -n pmns -f root.bin
68 _ls root.bin
69 rm -rf root.bin
71 echo
72 echo "dir is writeable, output file exists and is writeable"
73 touch root.bin
74 chmod 644 root.bin
75 pmnscomp -n pmns -f root.bin
76 _ls root.bin
77 rm -rf root.bin
79 echo
80 echo "dir is writeable, output file exists and is non-writeable"
81 touch root.bin
82 chmod 444 root.bin
83 pmnscomp -n pmns -f root.bin
84 _ls root.bin
85 rm -rf root.bin
87 echo
88 echo "dir is writeable, output file exists but is hidden"
89 mkdir hide
90 touch hide/root.bin
91 chmod 0 hide
92 pmnscomp -n pmns -f hide/root.bin
93 chmod 755 hide
94 _ls hide/root.bin
95 rm -rf hide
97 echo
98 echo "dir is writeable, output \"file\" is /dev/null"
99 pmnscomp -n pmns -f /dev/null
100 _ls /dev/null
102 echo
103 echo "dir is writeable, output \"file\" is a directory"
104 rm -rf mydir
105 mkdir mydir
106 pmnscomp -n pmns -f mydir
107 _ls mydir
109 echo
110 echo "dir is non-writeable, output file does not exist"
111 rm -f root.bin
112 chmod 555 .
113 pmnscomp -n pmns -f root.bin
114 chmod 755 .
115 _ls root.bin
116 rm -rf root.bin
118 echo
119 echo "dir is non-writeable, output file exists and is writeable"
120 touch root.bin
121 chmod 644 root.bin
122 chmod 555 .
123 pmnscomp -n pmns -f root.bin
124 chmod 755 .
125 _ls root.bin
126 rm -rf root.bin
128 echo
129 echo "dir does not exist"
130 pmnscomp -n pmns -f no/such/path/root.bin
131 _ls no/such/path/root.bin
133 echo
134 echo "some options errors"
135 pmnscomp -n pmns -v 3 -f root.bin 2| sed -e 's/0 or 1/0, 1 or 2/g'
136 pmnscomp -n pmns
137 pmnscomp
139 echo
140 echo "duplicate PMIDs in pmns"
141 sed -e 's/2/1/g' pmns >pmns.dup
142 pmnscomp -n pmns.dup -f root.bin
143 _ls root.bin
144 rm -rf root.bin
145 echo "and again with -d"
146 pmnscomp -n pmns.dup -f -d root.bin
147 _ls root.bin
148 rm -rf root.bin
150 # success, all done
151 status=0
152 exit