Merge lp:~asac/ubuntu-test-cases/use-top-and-always-dumb-toplog into lp:ubuntu-test-cases

Proposed by Alexander Sack
Status: Superseded
Proposed branch: lp:~asac/ubuntu-test-cases/use-top-and-always-dumb-toplog
Merge into: lp:ubuntu-test-cases
Diff against target: 376 lines (+286/-0)
16 files modified
ifconfig/tc_control (+14/-0)
install/tc_control (+13/-0)
master.run (+5/-0)
netstat/tc_control (+13/-0)
ping/tc_control (+13/-0)
pwd/tc_control (+10/-0)
pwd/test.sh (+7/-0)
route/tc_control (+13/-0)
systemsettle/systemsettle.sh (+125/-0)
systemsettle/tc_control (+10/-0)
ts_control (+3/-0)
tslist.run (+11/-0)
uname/tc_control (+13/-0)
unity8/tc_control (+10/-0)
update/tc_control (+13/-0)
vmstat/tc_control (+13/-0)
To merge this branch: bzr merge lp:~asac/ubuntu-test-cases/use-top-and-always-dumb-toplog
Reviewer Review Type Date Requested Status
Ubuntu Test Case Developers Pending
Review via email: mp+180827@code.launchpad.net

This proposal has been superseded by a proposal from 2013-08-19.

Description of the change

+ use top in batchmode instead of vmstat
+ improve logging; echo cli arguments given as well as
+ dumb top_log regardless of success and failyure
+ top_log is now more useful to see what was going on as we dumb exactly what was measured

To post a comment you must log in.
14. By Alexander Sack

fix idle_avg calc to deal better with non-natural numbers getting passed

15. By Alexander Sack

improve systemsettle idle measurement run logging now that we don't run vmstat anymore

16. By Alexander Sack

since we now use top instead of vmstat, let's use s/vmstat/top/ for all variables as well

17. By Alexander Sack

don't log the top command used in systemsettle anymore

Unmerged revisions

17. By Alexander Sack

don't log the top command used in systemsettle anymore

16. By Alexander Sack

since we now use top instead of vmstat, let's use s/vmstat/top/ for all variables as well

15. By Alexander Sack

improve systemsettle idle measurement run logging now that we don't run vmstat anymore

14. By Alexander Sack

fix idle_avg calc to deal better with non-natural numbers getting passed

13. By Alexander Sack

improve logging; echo cli args used and always echo top_log regardless of success/fail

12. By Alexander Sack

use top instead of vmstat; this gives us top measurements all time during run

11. By Paul Larson

Add options and extra configurability to systemsettle.sh

10. By Andy Doan

add systemsettle test that waits for idle

9. By Paul Larson

Add a smoke test for detecting presence of the UI on ubuntu-touch

8. By Paul Larson

Fix bug #1192166 - pwd test fails on touch images

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'ifconfig'
=== added file 'ifconfig/tc_control'
--- ifconfig/tc_control 1970-01-01 00:00:00 +0000
+++ ifconfig/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,14 @@
1description: make sure wlan0 exists
2dependencies: none
3action: |
4 1. ifconfig
5 2. Make sure there is a wlan0
6expected_results: |
7 1. there is a wlan0 on the system
8type: userland
9timeout: 60
10command: ifconfig; ifconfig | grep wlan0
11run_as: phablet
12#build_cmd:
13#tc_setup:
14#tc_cleanup:
015
=== added directory 'install'
=== added file 'install/tc_control'
--- install/tc_control 1970-01-01 00:00:00 +0000
+++ install/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,13 @@
1description: apt-get install works
2dependencies: openssh-server
3action: |
4 1. apt-get install -y curl
5expected_results: |
6 1. apt-get install can install a package and ends with exit code 0
7type: userland
8timeout: 120
9command: apt-get install -y curl
10run_as: root
11#build_cmd:
12#tc_setup:
13tc_cleanup: apt-get remove -y curl
014
=== added file 'master.run'
--- master.run 1970-01-01 00:00:00 +0000
+++ master.run 2013-08-19 10:31:04 +0000
@@ -0,0 +1,5 @@
1---
2testsuites:
3 - name: smoke_touch
4 fetch_method: bzr # one of 'bzr', 'bzr-export', 'dev', 'git'
5 fetch_location: lp:ubuntu-test-cases/touch
06
=== added directory 'netstat'
=== added file 'netstat/tc_control'
--- netstat/tc_control 1970-01-01 00:00:00 +0000
+++ netstat/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,13 @@
1description: netstat -l lists all the services
2dependencies: none
3action: |
4 1. netstat -l
5expected_results: |
6 1. netstat shows output and exists cleanly
7type: userland
8timeout: 60
9command: netstat -l
10run_as: phablet
11#build_cmd:
12#tc_setup:
13#tc_cleanup:
014
=== added directory 'ping'
=== added file 'ping/tc_control'
--- ping/tc_control 1970-01-01 00:00:00 +0000
+++ ping/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,13 @@
1description: ping -c 5 10.97.0.1
2dependencies: None
3action: |
4 1. ping -c 5 10.97.0.1
5expected_results: |
6 1. ping ends without an error
7type: userland
8timeout: 60
9command: ping -c 5 10.97.0.1
10run_as: phablet
11#build_cmd:
12#tc_setup:
13#tc_cleanup:
014
=== added directory 'pwd'
=== added file 'pwd/tc_control'
--- pwd/tc_control 1970-01-01 00:00:00 +0000
+++ pwd/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,10 @@
1description: pwd works
2dependencies: none
3action: |
4 1. cd to /tmp and verify which is the current directory
5expected_results: |
6 1. Current directory is /tmp
7type: userland
8timeout: 60
9command: ./test.sh
10run_as: phablet
011
=== added file 'pwd/test.sh'
--- pwd/test.sh 1970-01-01 00:00:00 +0000
+++ pwd/test.sh 2013-08-19 10:31:04 +0000
@@ -0,0 +1,7 @@
1#!/bin/bash
2echo pwd is: $(pwd)
3echo Changing to /tmp...
4cd /tmp
5echo Checking that cd worked...
6echo directory is now $(pwd), should be /tmp
7/usr/bin/test $(pwd) == '/tmp'
08
=== added directory 'route'
=== added file 'route/tc_control'
--- route/tc_control 1970-01-01 00:00:00 +0000
+++ route/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,13 @@
1description: route shows wlan0 routes
2dependencies: none
3action: |
4 1. route | grep wlan0
5expected_results: |
6 1. route shows wlan0 routes
7type: userland
8timeout: 60
9command: route | grep wlan0
10run_as: phablet
11#build_cmd:
12#tc_setup:
13#tc_cleanup:
014
=== added directory 'systemsettle'
=== added file 'systemsettle/systemsettle.sh'
--- systemsettle/systemsettle.sh 1970-01-01 00:00:00 +0000
+++ systemsettle/systemsettle.sh 2013-08-19 10:31:04 +0000
@@ -0,0 +1,125 @@
1#!/bin/bash
2
3set -e
4
5# default exit code storage
6dump_error=1
7
8calc () { awk "BEGIN{ print $* }" ;}
9
10cleanup () {
11 if ! test "$dump_error" = 0; then
12 echo "Check out the following top log taken at each retry:"
13
14 echo
15 # dumb toplog indented
16 while read line; do
17 echo " $line"
18 done < $top_log
19 # dont rerun this logic in case we get multiple signals
20 dump_error=0
21 fi
22 rm -f $top_log $vmstat_log $vmstat_log.reduced
23}
24
25function show_usage() {
26 echo "Usage:"
27 echo " $0 [options]"
28 echo "Options:"
29 echo " -r run forever without exiting"
30 echo " -p minimum idle percent to wait for (Default: 99)"
31 echo " -c number of times to run vmstat at each iteration (Default: 10)"
32 echo " -d seconds to delay between each vmstat iteration (Default: 6)"
33 echo " -i vmstat measurements to ignore from each loop (Default: 1)"
34 echo " -m maximum loops of vmstat before giving up if minimum idle"
35 echo " percent is not reached (Default: 1)"
36 exit 129
37}
38
39while getopts "h?rp:c:d:i:m:" opt; do
40 case "$opt" in
41 h|\?) show_usage
42 ;;
43 r) settle_prefix='-'
44 ;;
45 p) idle_avg_min=$OPTARG
46 ;;
47 c) vmstat_repeat=$OPTARG
48 ;;
49 d) vmstat_wait=$OPTARG
50 ;;
51 i) vmstat_ignore=$OPTARG
52 ;;
53 m) settle_max=$OPTARG
54 ;;
55 esac
56done
57
58# minimum average idle level required to succeed
59idle_avg_min=${idle_avg_min:-99}
60# measurement details: vmstat $vmstat_wait $vmstat_repeat
61vmstat_repeat=${vmstat_repeat:-10}
62vmstat_wait=${vmstat_wait:-6}
63# how many samples to ignore
64vmstat_ignore=${vmstat_ignore:-1}
65# how many total attempts to settle the system
66settle_max=${settle_max:-10}
67
68# set and calc more runtime values
69vmstat_tail=`calc $vmstat_repeat - $vmstat_ignore`
70settle_count=0
71idle_avg=0
72
73echo "System Settle run - quiesce the system"
74echo "--------------------------------------"
75echo
76echo " cmd = 'top -b -d $vmstat_wait -n $vmstat_repeat' ignoring first $vmstat_ignore (tail: $vmstat_tail)"
77echo " idle_avg_min = '$idle_avg_min'"
78echo " vmstat_repeat = '$vmstat_repeat'"
79echo " vmstat_wait = '$vmstat_wait'"
80echo " vmstat_ignore = '$vmstat_ignore'"
81echo " settle_max = '$settle_max'"
82echo " run_forever = '$settle_prefix' (- = yes)"
83echo
84
85trap cleanup EXIT INT QUIT ILL KILL SEGV TERM
86vmstat_log=`mktemp -t`
87top_log=`mktemp -t`
88
89while test `calc $idle_avg '<' $idle_avg_min` = 1 -a "$settle_prefix$settle_count" -lt "$settle_max"; do
90 echo Starting settle run $settle_count:
91
92 # get vmstat
93 echo "TOP DUMP (after settle run: $settle_count)" >> $top_log
94 echo "========================" >> $top_log
95 top -b -d $vmstat_wait -n $vmstat_repeat >> $top_log
96 cat $top_log | grep '.Cpu.*' | tail -n $vmstat_tail > $vmstat_log.reduced
97 echo >> $top_log
98
99 # calc average of idle field for this measurement
100 sum=0
101 count=0
102 while read line; do
103 idle=`echo $line | sed -e 's/.* \([0-9\.]*\) id.*/\1/'`
104 sum=`calc $sum + $idle`
105 count=`calc $count + 1`
106 done < $vmstat_log.reduced
107
108 idle_avg=`calc $sum.0 / $count.0`
109 settle_count=`calc $settle_count + 1`
110
111 echo
112 echo "Measurement:"
113 echo " + idle level: $idle_avg"
114 echo " + idle sum: $sum / count: $count"
115 echo
116done
117
118if test `calc $idle_avg '<' $idle_avg_min` = 1; then
119 echo "system not settled. FAIL"
120 exit 1
121else
122 echo "system settled. SUCCESS"
123 exit 0
124fi
125
0126
=== added file 'systemsettle/tc_control'
--- systemsettle/tc_control 1970-01-01 00:00:00 +0000
+++ systemsettle/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,10 @@
1description: check if system settles to idle average > 99.25%
2dependencies: none
3action: |
4 1. Take CPU load samples for 10 minutes and fail if average idle never goes above 99.25% percent
5expected_results: |
6 1. When doing nothing, system calms down to at least 99.25% idle level
7type: userland
8timeout: 720
9command: ./systemsettle.sh -p 99.25
10run_as: root
011
=== added file 'ts_control'
--- ts_control 1970-01-01 00:00:00 +0000
+++ ts_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,3 @@
1#build_cmd: echo building
2#ts_setup: echo setting up
3#ts_cleanup: echo cleaning up
04
=== added file 'tslist.run'
--- tslist.run 1970-01-01 00:00:00 +0000
+++ tslist.run 2013-08-19 10:31:04 +0000
@@ -0,0 +1,11 @@
1- test: pwd
2- test: uname
3- test: vmstat
4- test: systemsettle
5- test: netstat
6- test: ifconfig
7- test: route
8- test: ping
9- test: update
10- test: install
11- test: unity8
012
=== added directory 'uname'
=== added file 'uname/tc_control'
--- uname/tc_control 1970-01-01 00:00:00 +0000
+++ uname/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,13 @@
1description: uname shows an ubuntu-phablet image installed
2dependencies: CHANGE_ME
3action: |
4 1. uname -a|grep ubuntu-phablet
5expected_results: |
6 1. ubuntu-phablet is installed as expected
7type: userland
8timeout: 60
9command: uname -a | grep ubuntu-phablet
10run_as: phablet
11#build_cmd:
12#tc_setup:
13#tc_cleanup:
014
=== added directory 'unity8'
=== added file 'unity8/tc_control'
--- unity8/tc_control 1970-01-01 00:00:00 +0000
+++ unity8/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,10 @@
1description: check for unity8 process
2dependencies: None
3action: |
4 1. pgrep unity8
5expected_results: |
6 1. pgrep exits with 0, indicating it found a matching process
7type: userland
8timeout: 60
9command: /usr/bin/pgrep unity8
10run_as: phablet
011
=== added directory 'update'
=== added file 'update/tc_control'
--- update/tc_control 1970-01-01 00:00:00 +0000
+++ update/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,13 @@
1description: apt-get update works
2dependencies: apt
3action: |
4 1. apt-get update
5expected_results: |
6 1. apt-get update works
7type: userland
8timeout: 120
9command: apt-get update
10run_as: root
11#build_cmd:
12#tc_setup:
13#tc_cleanup:
014
=== added directory 'vmstat'
=== added file 'vmstat/tc_control'
--- vmstat/tc_control 1970-01-01 00:00:00 +0000
+++ vmstat/tc_control 2013-08-19 10:31:04 +0000
@@ -0,0 +1,13 @@
1description: Execute vmstat and capture output
2dependencies: none
3action: |
4 1. vmstat
5expected_results: |
6 1. vmstat finishes without an error
7type: userland
8timeout: 60
9command: vmstat
10run_as: phablet
11#build_cmd:
12#tc_setup:
13#tc_cleanup:

Subscribers

People subscribed via source and target branches