File: 769

package info (click to toggle)
pcp 4.3.2%2Breally4.3.1-0.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 175,188 kB
  • sloc: ansic: 261,305; sh: 123,606; xml: 107,279; cpp: 72,127; perl: 18,283; python: 15,453; yacc: 8,249; lex: 2,585; makefile: 1,957; fortran: 60; java: 52
file content (96 lines) | stat: -rwxr-xr-x 2,136 bytes parent folder | download
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
# PCP QA Test No. 769
# Check if the "chkconfig" controls and tests for the init scripts
# and as used in the QA tests really work.
#
# Copyright (c) 2014 Ken McDonell.  All Rights Reserved.
#

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

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

# chconfig controls just don't work on some platforms ...
#
[ -f /etc/gentoo-release ] && _notrun "chkconfig does not work for Gentoo"
[ -f /etc/slackware-version ] && _notrun "chkconfig does not work for Slackware"

status=1	# failure is the default!
$sudo rm -rf $tmp.* $seq.full $seq.out
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15

VERBOSE_CONFIG=false
PMWEBD_INSTALLED=false
PMMGR_INSTALLED=false
FULL_LIST="pmcd pmie pmlogger pmproxy"

. $PCP_SHARE_DIR/lib/rc-proc.sh

_check_chk()
{
    if is_chkconfig_on $1
    then
	echo "is_chkconfig_on $1 returns true"
    else
	echo "is_chkconfig_on $1 returns false"
    fi
}

ln -f $seq.out.1 $seq.out || exit 1
if [ -f $PCP_BINADM_DIR/pmwebd ]
then
    PMWEBD_INSTALLED=true
    FULL_LIST="pmcd pmie pmlogger pmproxy pmwebd"
    ln -f $seq.out.2 $seq.out || exit 1
fi
if [ -f $PCP_BINADM_DIR/pmmgr ]
then
    PMMGR_INSTALLED=true
    if $PMWEBD_INSTALLED ;
    then
	FULL_LIST="pmcd pmie pmlogger pmmgr pmproxy pmwebd"
	ln -f $seq.out.4 $seq.out || exit 1
    else
	FULL_LIST="pmcd pmie pmlogger pmmgr pmproxy"
	ln -f $seq.out.3 $seq.out || exit 1
    fi
    
fi

# real QA test starts here

VERBOSE_CONFIG=true
is_chkconfig_on pmie >>$seq.full
VERBOSE_CONFIG=false

for svc in $FULL_LIST
do
    save=off
    is_chkconfig_on $svc && save=on
    echo "initial state for $svc: $save" >>$seq.full
    for state in off on
    do
	echo "=== $svc $state ==="
	if [ -f $PCP_RC_DIR/$svc ]
	then
	    _change_config $svc $state
	    _check_chk $svc
	else
	    # fake output when init script not installed
	    #
	    xpect=true
	    [ $state = off ] && xpect=false
	    echo "is_chkconfig_on $svc returns $xpect"
	fi
    done
    [ -f $PCP_RC_DIR/$svc ] && _change_config $svc $save
done

# success, all done
status=0

exit