3 # Exercise the new pmns/Rebuild
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard filters
16 [ $PCP_PLATFORM = irix
] || _notrun
"tests the IRIX Rebuild script"
20 scr_src
=$PCP_VAR_DIR/pmns
/
21 cp $scr_src/Rebuild
$1
22 if [ -f $scr_src/Xlate-irix-names
]
24 cp $scr_src/Xlate-irix-names
$1
32 -e 's/^\*\*\*.*[^*]$/*** old file/' \
33 -e 's/^---.*[^-]$/--- new file/'
39 export PMNS_OLD PMNS_NEW
40 rm -rf $PMNS_OLD $PMNS_NEW
43 echo >$PMNS_NEW/root
'root {
53 echo >$PMNS_NEW/root
'
64 echo >$PMNS_NEW/www.orphan
'
74 echo '/* new */' >$PMNS_NEW/xxx.N
75 cat $PMNS_NEW/xxx
>>$PMNS_NEW/xxx.N
82 echo '/* old */' >$PMNS_NEW/yyy.O
83 cat $PMNS_NEW/yyy
>>$PMNS_NEW/yyy.O
88 echo "Exit status: $1"
90 [ -d $PMNS_OLD ] && type=directory
91 [ -f $PMNS_OLD ] && type=file
92 [ -L $PMNS_OLD ] && type=symlink
93 echo "PMNS_OLD pathname is: $type"
94 echo "PMNS_NEW contents:"
96 $DO_VALIDATE && _validate
101 ( cd $PMNS_NEW; pmnscomp
-f -n root root.bin
)
103 pminfo
-m -n $PMNS_NEW/root
>$tmp.out
2>&1
108 for file in $PMNS_NEW/*
110 echo "=========================="
111 echo "new/`basename $file`"
112 echo "=========================="
121 if [ -f $1/Xlate-irix-names
]
123 rm -f $1/Xlate-irix-names
129 $sudo rm -f $tmp.
* $seq.full
131 trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
133 # real QA test starts here
135 echo "=== PMNS_OLD does not exist ==="
138 echo "=== PMNS_OLD does not exist ===" >>$seq.full
139 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
140 _copy_Rebuild
$PMNS_NEW
141 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
143 _remove_rebuild
$PMNS_NEW
148 echo "=== PMNS_OLD is empty ==="
150 echo "=== PMNS_OLD is empty ===" >>$seq.full
151 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
152 _copy_Rebuild
$PMNS_NEW
153 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
155 _remove_rebuild
$PMNS_NEW
160 echo "=== PMNS_OLD contains scripts that can safely be nuked ==="
162 touch $PMNS_OLD/Brand
$PMNS_OLD/Makefile
$PMNS_OLD/Rebuild
163 echo "=== PMNS_OLD contains scripts that can safely be nuked ===" >>$seq.full
164 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
165 _copy_Rebuild
$PMNS_NEW
166 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
168 _remove_rebuild
$PMNS_NEW
173 echo "=== PMNS_OLD contains files not in conflict with PMNS_NEW, copy them ==="
175 touch $PMNS_OLD/root.N
$PMNS_OLD/urk
$PMNS_OLD/urk.O
176 echo >$PMNS_OLD/xxx
'
180 echo "=== PMNS_OLD contains files not in conflict with PMNS_NEW, copy them ===" >>$seq.full
181 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
182 _copy_Rebuild
$PMNS_NEW
183 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
185 _remove_rebuild
$PMNS_NEW
190 echo "=== files in PMNS_OLD and PMNS_NEW are identical ==="
194 cp $PMNS_NEW/* $PMNS_OLD
195 echo "=== files in PMNS_OLD and PMNS_NEW are identical ===" >>$seq.full
196 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
197 _copy_Rebuild
$PMNS_NEW
198 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
200 _remove_rebuild
$PMNS_NEW
205 echo "=== salvage useful stuff from PMNS_OLD ==="
209 mv $PMNS_NEW/xxx
* $PMNS_OLD
213 echo "=== salvage useful stuff from PMNS_OLD ===" >>$seq.full
214 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
215 _copy_Rebuild
$PMNS_NEW
216 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
218 _remove_rebuild
$PMNS_NEW
223 echo "=== hard cases ==="
227 sed -e 's/two/three/' <$PMNS_NEW/xxx.N
>$PMNS_OLD/xxx
228 sed -e 's/two/three/' <$PMNS_NEW/yyy.O
>$PMNS_OLD/yyy
230 echo "=== hard cases ===" >>$seq.full
231 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
232 _copy_Rebuild
$PMNS_NEW
233 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
235 _remove_rebuild
$PMNS_NEW
240 echo "=== PMNS_OLD is a file (error) ==="
244 echo "=== PMNS_OLD is a file (error) ===" >>$seq.full
245 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
246 _copy_Rebuild
$PMNS_NEW
247 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
249 _remove_rebuild
$PMNS_NEW
254 echo "=== www.orphan, xxx.N and yyy.O in both places, waste the ones from PMNS_OLD ==="
257 touch $PMNS_OLD/www.orphan
$PMNS_OLD/xxx.N
$PMNS_OLD/yyy.O
259 echo "=== www.orphan, xxx.N and yyy.O in both places, waste the ones from PMNS_OLD ===" >>$seq.full
260 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
261 _copy_Rebuild
$PMNS_NEW
262 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
264 _remove_rebuild
$PMNS_NEW
269 echo "=== orphan (saveme) in PMNS_OLD ==="
271 touch $PMNS_OLD/saveme
272 echo "=== orphan (saveme) in PMNS_OLD ===" >>$seq.full
273 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
274 _copy_Rebuild
$PMNS_NEW
275 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
277 _remove_rebuild
$PMNS_NEW
282 echo "=== nested decls, a la DBMS PMDAS ==="
284 echo >$PMNS_NEW/root
'
290 echo >$PMNS_NEW/extra
'
298 echo >$PMNS_NEW/xxx
'
306 echo >$PMNS_NEW/yyy
'
314 echo >$PMNS_NEW/dummy
'
325 echo "=== nested decls, a la DBMS PMDAS ===" >>$seq.full
326 ls -lR $PMNS_OLD $PMNS_NEW >>$seq.full
2>&1
327 _copy_Rebuild
$PMNS_NEW
328 $sudo "cd $PMNS_NEW; ./Rebuild -uv" >$tmp.err
330 _remove_rebuild
$PMNS_NEW