File: 575

package info (click to toggle)
pcp 7.0.5-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,916 kB
  • sloc: ansic: 1,478,844; sh: 177,285; xml: 160,462; cpp: 83,809; python: 24,349; perl: 18,303; yacc: 6,877; lex: 2,864; makefile: 2,694; awk: 165; fortran: 60; java: 52
file content (71 lines) | stat: -rwxr-xr-x 1,734 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
#! /bin/sh
# PCP QA Test No. 575
#
# Copyright (c) 2012 Red Hat.
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

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

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

_cleanup()
{
    if $pmie_was_running
    then
	_restore_auto_restart pmie
	[ "$pmie_state" = on ] && _change_config pmie on
	_service pmie start >>$seq_full 2>&1
    else
	_service pmie stop >>$seq_full 2>&1
	$sudo $PCP_BINADM_DIR/pmsignal -a -s TERM pmie >>$seq_full 2>&1
	_wait_pmie_end
	[ "$pmie_state" = on ] || _change_config pmie off
    fi
    rm -f $tmp.*
}

signal=$PCP_BINADM_DIR/pmsignal
status=1	# failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

_get_config pmie >$tmp.tmp || _exit 1
pmie_state=`cat $tmp.tmp`
rm -f $tmp.tmp
pmie_was_running=false
if [ -f $PCP_RUN_DIR/pmie.pid ]
then
    pmie_was_running=true
    echo "Found pmie PID `cat $PCP_RUN_DIR/pmie.pid` running @ start" >>$seq_full
    _stop_auto_restart pmie
    if ! _service pmie stop >>$seq_full 2>&1; then _exit 1; fi
fi
$sudo $signal -a pmie >/dev/null 2>&1
_wait_pmie_end || _exit 1

# real QA test starts here

_change_config pmie on || _exit 1
# The "pmie not running" message does not appear when systemd is in
# control, as the "stop" is a no-op if the service is not already
# running
# And the "Waiting for pmie process(es) to terminate ..." message
# depends on the platform and the state of the system.
#
if ! _service pmie stop; then _exit 1; fi \
| _filter_pmie_stop \
| sed \
    -e '/pmie not running/d' \
    -e '/Waiting for pmie process/d' \
# end

if ! _service pmie start; then _exit 1; fi \
| _filter_pmie_start

# success, all done
status=0
exit