This document will go over how to set up a local Autotest server for developing purposes. You will want to do this for changes that are not easily testable in the production server. Generally this will not be needed for test development. This is if you are changing RPCs, The Scheduler, Any of the frontend GUI or common library changes. Debian/UbuntuThese instructions will only work with a Debian based installation. Most likely you can use the package names to set up Autotest for Fedora/Redhat. Base deb packages to installAfter installing all of the packages below you will end up with a server running MySQL, Apache, and have the supporting libraries need to bootstrap the Autotest installation. **Be sure to remember the password you set up for the root user in Mysql (If any) sudo apt-get install mysql-server mysql-common libapache2-mod-python python-mysqldb gnuplot apache2-mpm-prefork unzip python-imaging libpng12-dev libfreetype6-dev sqlite3 python-pysqlite2 git-core pbzip2 openjdk-6-jre openjdk-6-jdk python-crypto python-dev subversion build-essential python-setuptools *Note you will be prompted to enter a 'root' user password for MySQL this is reserved for administering the MySQL instance itself. You should not use this for the next section but do not forget it either. Setup MySQL DBsAutotest use MySQL for all of its result storing and queuing jobs for the scheduler to interface with. Setup the Autotest MYSQL user: mysql -u root -pcreate database chromeos_autotest_db;grant all privileges on chromeos_autotest_db.* TO 'chromeosqa-admin'@'localhost' identified by 'some_password'; FLUSH PRIVILEGES;*some_password can be whatever you want. Make note of it as you will need it later on. Setup Autotest Directory on the serverNOTE: Do not try to make the autotest server run directly from your home directory and DO follow the "/usr/local/autotest" bind mount or checkout. Changing all the paths in the source and making it work at the same time seems downright impossible. *Preferred way, if you have a Chromium OS checkout you should already have the Autotest soure. CHECKOUT=/your/chromiumos/checkoutmkdir /usr/local/autotestsudo mount --bind $CHECKOUT/src/third_party/autotest/files /usr/local/autotestIf you don't have a Chromium OS checkout and just want the Autotest bits: mkdir /usr/local/autotestgit clone http://git.chromium.org/chromiumos/third_party/autotest.git /usr/local/autotestEdit the global_config.ini, or better yet, create a shadow configuration (place it in shadow_config.ini) to update the following areas: [AUTOTEST_WEB]
[SERVER]
Build external packages for use in Autotest# Run this as the user you want to run the Autotest server as. /usr/local/autotest/utils/build_externals.pySetup Initial db/usr/local/autotest/database/migrate.py sync/usr/local/autotest/frontend/manage.py syncdb# You may have to run this twice. Setup ApacheIf you ran the above package install command you should already have a running apache server. All we need to do is point that configuration at the Autotest configuration. sudo ln -s /usr/local/autotest/apache/apache-conf /etc/apache2/sites-available/autotest-server# disable currently active defaultsudo a2dissite default# enable autotest serversudo a2ensite autotest-server# Enable rewrite modulesudo a2enmod rewrite# Enable mod-pythonsudo a2enmod python# Setup permissions so that Apache web user can read the proper files. # restart serversudo /etc/init.d/apache2 restartImport Tests Add Hosts and Start SchedulerImport tests /usr/local/autotest/utils/test_importer.py***This is the end of what is done for you by setup_dev_autotest.sh.*** Add hosts /usr/local/autotest/cli/atest host create hostnameStart the scheduler. *You may want to run the scheduler in screen /usr/local/autotest/scheduler/monitor_db.py /usr/local/autotest/resultsSSH Keys for connecting to devicesThe user that started the scheduler needs to have root access to the devices you are connecting to. All test images include a authorized key that developers have access to. You can get the key from the chromiumos checkout under chromiumos/src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa If the user you are using is specifically for testing you can add this key in the default ssh key path under ~/.ssh/id_rsa and it will automatically get used when connections are tried to any computer with SSH. If this is not an option you need to either set up an SSH agent (http://upc.lbl.gov/docs/user/sshagent.shtml) or configure your ~/.ssh/config file to use the testing_rsa key above when specific hosts are connected to. Example host entry in ~/.ssh/config Host 172.12.12.55 User root IdentitiyFile %d/.ssh/testing_rsaYou can test any of these set ups by trying to connect to the system as root: ssh root@172.12.12.55Viewing test logs from jobs run via the schedulerTo view logs of a currently running job from the AFE click on the "Debug logs" link. From there you have a few different choices, you will most likely want to look at all the logs which are all in autoserv.DEBUG. Although this file does not automatically update when viewed in your browser if you refresh your view you will see the progress of the job. All logs from jobs run via the scheduler are stored under: /usr/local/autotest/results. If you get 403 Forbidden when viewing the results, or if the AFE starts giving Error 500 and strugging to import code, then you either need to re-run # Setup permissions so that Apache web user can read the proper files. Or (recommended) edit /etc/apache2/envvars so that it reads export APACHE_RUN_USER=<user> export APACHE_RUN_GROUP=<group> where <user> is what is returned by running |id -un| and <group> is the result of running |id -gn| |
