Skip to content. Skip to navigation

Ian Lawrence

Personal tools
You are here: Home Blog Using Autotest for Mobile testing

Using Autotest for Mobile testing

Autotest lets you manage jobs, client hosts and look at test results. Here is one way to set it up on Ubuntu Gutsy. Later on some mobile tests will be added

root@ian-laptop:/usr/local# svn checkout autotest
Checked out revision 1111.

Look at what was checked out:
root@ian-laptop:/usr/local# cd autotest/
root@ian-laptop:/usr/local/autotest# ls
client conmux Documentation mirror results server tko
CODING_STYLE DCO LICENSE queue scheduler server.old ui

Install the database:
root@ian-laptop:/usr/local/autotest# apt-get install mysql-server-5.0 python-mysqldb python-gd gnuplot
(on ubuntu this will prompt for a root password for mysql)

Now log into the main database as root:
$ mysql -u root -p

mysql> create database tko;
mysql> grant all privileges on tko.* TO 'autotest_tko'@'localhost' identified by 'a_password';
(change a_password if required)
mysql> grant SELECT on tko.* TO 'nobody'@'localhost';
mysql> grant SELECT on tko.* TO 'nobody'@'%';
mysql> quit

Now move into the tko directory:
ian@ian-laptop:/usr/local/autotest$ cd tko/
Create the database schema inside the "tko" database:
$ mysql -u autotest_tko -pa_password tko < create_db
Autotest uses two accounts to access the database - a priviledged account that's read/write and an unpriviledged one that's read/only. For parse to work, you need to tell it how to log in - create a .priv_login file
root@ian-laptop:/usr/local/autotest/tko$ vi .priv_login

with two lines:

root@ian-laptop:/usr/local/autotest/tko$ chmod 600 .priv_login

Next run some tests (the command below runs all tests so it takes some time) so we can put some results in the database
ian@ian-laptop:/usr/local/autotest/tko$ cd ..
root@ian-laptop:/usr/local/autotest# client/bin/autotest client/samples/all_tests

parse the results into the database:
root@ian-laptop:/usr/local/autotest/tko# ./parse /usr/local/autotest/client/results/default

this gave an error of:
/usr/local/autotest/tko/ DeprecationWarning: raising a string exception is deprecated
raise "Could not figure out machine name"
Traceback (most recent call last):
File "./parse", line 153, in
do_parse(jobname, path)
File "./parse", line 103, in do_parse
job = parse.job(path)
File "/usr/local/autotest/tko/", line 91, in __init__
File "/usr/local/autotest/tko/", line 113, in get_machine
raise "Could not figure out machine name"
Could not figure out machine name

On ubuntu I needed to add this on line 114 of
# for ubuntu machines
if os.path.isfile("/etc/hostname"):
hostname = "/etc/hostname"
self.machine = open(hostname, 'r').readline().rstrip()

so the complete get_machine() function looks like:
100     def get_machine(self):
101 try:
102 hostname = os.path.join(self.dir, "sysinfo/hostname")
103 self.machine = open(hostname, 'r').readline().rstrip()
104 return
105 except:
106 pass
107 try:
108 uname = os.path.join(self.dir, "sysinfo/uname_-a")
109 self.machine = open(uname, 'r').readline().split()[1]
110 return
111 except:
112 pass
113 # for ubuntu machines
114 try:
115 if os.path.isfile("/etc/hostname"):
116 hostname = "/etc/hostname"
117 self.machine = open(hostname, 'r').readline().rstrip()
118 return
119 except:
120 pass
121 raise "Could not figure out machine name"

this parses as:

STATUS: GOOD dbench dbench timestamp=1199817550 localtime=Jan 08 14:39:10 completed successfully
GROPE_STATUS: ['GOOD', 'dbench', 'dbench', 'timestamp=1199817550\tlocaltime=Jan 08 14:39:10\tcompleted successfully']
set group_subdir: dbench
incorrect indent level 2 != 0, ignoring
+ Parsing /usr/local/autotest/client/results/default/dbench
* jobname, kernel version: dbench

Setting up Apache

Make a symbolic link in /var/www to the autotest tko directory:
root@ian-laptop:/var/www# ln -s /usr/local/autotest/tko mobile-tests

In /etc/apache2/httpd.conf add the line:
AddHandler cgi-script .cgi

then the Directory information:
<Directory /var/www/mobile-tests>
Options +ExecCGI

then go to:

and you will see the results of the tests displayed in the browser
Autotest Backend
Wednesday, January 16, 2008 in CodeWork  | Permalink |  Comments (0)   Digg   Yahoo   Google   Spurl
« June 2019 »
Su Mo Tu We Th Fr Sa
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
Borala (4)
Bricolabs (12)
Code (57)
Estudiolivre (12)
Life (26)
MetaReciclagem (9)
Thoughts (16)
Work (41)