File: 1541

package info (click to toggle)
pcp 7.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 253,896 kB
  • sloc: ansic: 1,488,097; sh: 185,322; xml: 160,462; cpp: 83,813; python: 25,576; perl: 18,365; yacc: 6,877; lex: 2,864; makefile: 2,759; exp: 250; awk: 165; fortran: 60; java: 22
file content (172 lines) | stat: -rwxr-xr-x 4,049 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/sh
# PCP QA Test No. 1541
# exercise the ./refactor test rewriting script
#
# Copyright (c) 2024 Ken McDonell.  All Rights Reserved.
#
# refactor-all-ok

if [ $# -eq 0 ]
then
    seq=`basename $0`
    echo "QA output created by $seq"
else
    # use $seq from caller, unless not set
    [ -n "$seq" ] || seq=`basename $0`
    echo "QA output created by `basename $0` $*"
fi

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

# ./refactor needs 4-arg version of split() added to gawk in version 4.0
#
which gawk >/dev/null 2>&1 || _notrun "gawk is not installed"
gawk_ver=`gawk --version | sed -n -e '1{
s/GNU //
s/[Aa]wk //
p
q
}'`
case "$gawk_ver"
in
	[123].*)
		_notrun "gawk version $gawk_ver < 4.0"
		;;
esac

_cleanup()
{
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

status=0	# success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

_filter()
{
    sed \
	-e "s@$tmp@TMP@g" \
	-e 's/[ 	][ 	]*20..-[01][0-9]-.*/ DATESTAMP/' \
	-e '/+++/s/+++ [^ 	][^ 	]*/+++ TMP.out/' \
    # end
}


# real QA test starts here
#

cat <<'End-of-File' >$tmp.in

# expect these all to to be rewritten
#
_change_config foo bar
_change_config x y
_wait_for_pmcd
_wait_pmcd_end	# tab comment
_wait_for_pmcd_stop
_wait_for_pmlogger # space comment
_wait_for_pmlogger pid
_wait_for_pmlogger -P path
_wait_for_pmlogger pid path delay
_wait_pmlogger_end pid
_wait_for_pmie
_wait_pmie_end	# tab comment
_wait_for_pmproxy
_wait_pmproxy_end # space comment
_disable_loggers
_get_primary_logger_pid
_prepare_pmda_install foo
_restore_pmda_install bar
_setup_purify prog
_sighup_pmcd
_check_metric sample.bin
_check_metric sample.bin remotehost
_service pmcd start
_service pmcd start >foo
_service pmcd start 2>foo_err
    _service pmcd stop | foo cmd
_service pmcd stop 2>&1 | foo cmd

# expect these to be warnings
#
_change_config foo bar || echo "expect warning"
_wait_for_pmcd || echo "expect warning"
_wait_pmcd_end && babble
_wait_for_pmcd_stop 10
_wait_for_pmlogger && echo "expect warning"
_wait_pmlogger_end pid &
_wait_for_pmie warning	# comment
_wait_pmie_end warning # comment
_wait_for_pmproxy port_warning
_wait_for_pmproxy -P logfile__warning
_wait_pmproxy_end || warning
_disable_loggers >warning
_get_primary_logger_pid ; warning
_prepare_pmda_install foo & true_warning
_restore_pmda_install bar || foo_warning
_setup_purify prog foo_warning
_wait_for_pmcd;warning
_sighup_pmcd>warning
_get_config foo
c=`_get_config pmie`
c=$(_get_config bar)
w=`_get_word_size warning`
w="`_get_word_size warning`"
w=$(_get_word_size)
w="$(_get_word_size)"
e=`_get_endian warning`
_check_metric foo bar warning
_service pmcd >foo start

# no changes or warnings ...
#
_change_config foo bar || echo nothing	# refactor-ok
_wait_for_pmcd	# refactor-ok
_wait_for_pmlogger	# refactor-ok
_wait_pmlogger_end	# refactor-ok
x_get_word_size
_get_word_sizex
    if _get_word_size
    if _get_endian
my_get_endian_mumble
_get_config pmie >$tmp.tmp || _exit 1
if _check_metric simple.now; then :; else _exit 8; fi
_check_metric sample.seconds $hosts_32 || _exit 1
space at the end of the line 
tab at the end of the line	

# no refactoring here ...
#
_cleanup()
{
    _change_config foo	# no change expected
    _wait_for_pmcd	# no change expected
    _wait_pmcd_end	# no change expected
    _wait_for_pmcd_stop	# no change expected
    _wait_for_pmlogger	# no change expected
    _wait_pmlogger_end	# no change expected
    _wait_for_pmie	# no change expected
    _wait_pmie_end	# no change expected
    _wait_for_pmproxy	# no change expected
    _wait_pmproxy_end	# no change expected
    _disable_loggers	# no change expected
    _get_primary_logger_pid	# no change expected
    _prepare_pmda_install	# no change expected
    _restore_pmda_install	# no change expected
    _setup_purify	# no change expected
    _sighup_pmcd	# no change expected
    _service pmlogger stop	# no change expected
}

End-of-File
./refactor -nvv $tmp.in 2>&1 | _filter

# TODO trap not _cleanup pattern
#

# success, all done
exit