zsh completions: minor tweaks
[pcp.git] / qa / 794
blob0508179560d3047c53b88d0a9ac492dba280a3fa
1 #!/bin/sh
2 # PCP QA Test No. 794
3 # Copyright (c) 2015 Red Hat. All Rights Reserved.
5 # Exercise "container switching" using pmStore.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 . ./common.docker
13 _check_containers
14 _check_docker_images busybox
15 count=`_count_docker_containers`
16 [ "$count" -gt 0 ] && \
17 _notrun "Needs quiesced docker setup ($count running containers found)"
19 _cleanup()
21 if [ -n "$container" ]
22 then
23 echo "== removing container" | tee -a $seq.full
24 _remove_docker_containers $container
25 container=""
26 fi
27 rm -rf $tmp.*
30 status=1 # failure is the default!
31 $sudo rm -rf $tmp.* $seq.full
32 trap "_cleanup; exit \$status" 0 1 2 3 15
34 _filter()
36 sed \
37 -e "s/\[.*\]: /[INST]: /g" \
38 -e "s/$container/CONTAINER/g" \
39 -e "s/$container_hostname/CONTAINER_HOSTNAME/g" \
40 -e "s/$localhost_hostname/LOCALHOST_HOSTNAME/g" \
41 -e "/pmcd.client.whoami/d" \
42 #end
45 _exclude_clients()
47 # remove any long-running clients (pmlogger/pmie)
48 pminfo -f pmcd.client.whoami | \
49 egrep ' pmlogger | pmie ' | \
50 sed -e 's/ *inst \[\([0-9][0-9]*\) or .*/-x \1 /g'
53 # real QA test starts here
54 xargs=`_exclude_clients`
55 echo "Exclusions: $xargs" >> $seq.full
57 container=`$docker run -d busybox sleep 15`
58 echo "== container: $container" >> $seq.full
60 echo "== get host and container hostname " | tee -a $seq.full
61 # expect a different hostname to local hostname
62 pmprobe --values --container=$container pmcd.hostname > $tmp.chost
63 pmprobe --values pmcd.hostname > $tmp.host
64 eval container_hostname=`awk '{ print $3 }' $tmp.chost`
65 eval localhost_hostname=`awk '{ print $3 }' $tmp.host`
67 cat $tmp.chost $tmp.host >> $seq.full
68 echo container hostname: $container_hostname >> $seq.full
69 echo localhost hostname: $localhost_hostname >> $seq.full
71 # switch to container, then back, reporting pmcd.hostname
72 echo "== switch to container, reset, repeat" | tee -a $seq.full
73 $here/src/storepmcd $xargs "$container" "" "$container" "" | _filter
75 # success, all done
76 status=0
77 exit