Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 867
blob33d950f2730cf9244bb2c70b57e2a73d127f950a
1 #!/bin/sh
2 # PCP QA Test No. 867
3 # Exercise libpcp_web HTTP client interfaces.
5 # Copyright (c) 2016 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 . ./common.webapi
12 which pmwebd >/dev/null 2>&1 || _notrun "pmwebd not installed"
13 [ -f "$PCP_SHARE_DIR/webapps/index.html" ] || _notrun "No webapps installed"
15 signal=$PCP_BINADM_DIR/pmsignal
16 status=1 # failure is the default!
17 username=`id -u -n`
18 $sudo rm -rf $tmp $tmp.* $seq.full
19 trap "cd $here; _cleanup; exit \$status" 0 1 2 3 15
21 _cleanup()
23 [ -z "$webpid" ] || $signal $webpid
24 $sudo rm -fr $tmp.dir
25 $sudo rm -f $tmp.*
28 unset http_proxy
29 unset HTTP_PROXY
30 webport=`_find_free_port`
32 # real QA test starts here
33 pmwebd -U $username -P -l $tmp.out -p $webport 2>$tmp.err &
34 webpid=$!
35 _wait_for_pmwebd $webport
37 echo "pmwebd pid=$webpid port=$webport" >>$seq.full
39 echo "== Check simple path fetch" | tee -a $seq.full
40 $here/src/httpfetch "http://localhost:$webport/index.html" 2>&1 >> $seq.full
41 [ $? -eq 0 ] && echo OK
43 echo "== Exercise http redirect" | tee -a $seq.full
44 $here/src/httpfetch "http://localhost:$webport" 2>&1 >> $seq.full
45 [ $? -eq 0 ] && echo OK
47 echo "--- pmwebd log ---" >>$seq.full
48 cat $tmp.out >>$seq.full
49 echo "--- pmwebd stderr ---" >>$seq.full
50 cat $tmp.err >>$seq.full
52 # success, all done
53 status=0
54 exit