summaryrefslogtreecommitdiff
path: root/qa/013
blob: d21df5b0fb1c4dfce07716cb5b5501d51ffacb85 (plain)
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
#! /bin/sh
# PCP QA Test No. 013
# pmdumplog dumps core when fed a metadata file instead of a basename?
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

_filter_trace()
{
    sed \
	-e '/chkLabel:/d' \
	-e '/__pmLogChkLabel:/d' \
	-e '/__pmLogLoadMeta:/d' \
	-e '/__pmLogSetTime/d' \
	-e '/__pmLogRead/d'
}

trap "rm -f $tmp.* /tmp/bogus.* /tmp/fungus.* /tmp/fungus /tmp/bogus; exit 0" 0 1 2 3 15

# real QA test starts here
echo "For PCP 1.1 Expect cannot open archive error message, and no core file ..."
echo "For PCP 2.0 -l src/foo.meta is a synonym for -l src/foo, so this works ..."

$sudo rm -f /tmp/bogus.* /tmp/fungus.* /tmp/fungus
touch /tmp/bogus.verylongsuffix /tmp/fungus
for dir in /etc /sbin /bin /usr/sbin /usr/bin
do
    [ ! -f $dir/init ] && continue
    cp $dir/init /tmp/fungus
    break
done

for bad in src/foo.meta /tmp/fungus /tmp/bogus
do
    echo
    if [ -f $bad ]
    then
	echo "=== $bad: exists ==="
    else
	echo "=== $bad: does not exist ==="
    fi
    $sudo rm -f core*
    pmdumplog -D 128 -l $bad 2>$tmp.err >$tmp.out

    _filter_pmdumplog <$tmp.out
    if [ -s $tmp.err ]
    then
	# need sort 'cause "inspect file" diag order is not determinisitic
	echo "[filtered and sorted stderr]"
	_filter_trace <$tmp.err | LC_COLLATE=POSIX sort
    fi
    _check_core
done