ReferencePlatforms/Test/Foopy

From MozillaWiki
Jump to: navigation, search

TODO: Review the striked content to see what is still relevant and remove what is not.

Currently, most of our foopies are linux based. They can be used for either tegras, android pandas and b2g pandas. The foopies these days are setup with puppet.

Setup for B2G/panda testing

  • Make sure that every panda that the foopy is going to manage is listed in devices.json:
   "panda-0082": {
       "foopy": "foopy39"
   },
  • Make sure that slavealloc has entries for each foopy
name,distro,bitlength,speed,datacenter,trustlevel,environment,purpose,pool,basedir,enabled
panda-0000,panda,32,mini,scl3,try,core,tests,tests-panda,/builds/panda-0000,1
  • Run this on the foopy as root
#!/usr/bin/env python

import os
import json
import sys

if len(sys.argv) < 2:
    sys.exit('Usage: %s [foopy-name]' % sys.argv[0])

with open('/builds/tools/buildfarm/mobile/devices.json') as devices:
    pandas = json.load(devices)

for p in pandas:
    if pandas[p]['foopy'] == sys.argv[1]:
        panda_path = os.path.join('/', 'builds', p)
        try:
            os.mkdir(panda_path)
            os.chown(panda_path, 'cltbld', 'cltbld')
        except OSError:
            print "directory already exists for panda", p

Setup for Android/panda testing

kmoir wrote this: https://etherpad.mozilla.org/new-foopy-for-panda

Set up a Mac based foopy

Rescued from Aki's text file. Will probably change to be linux at some point.

Initial setup

  • Rev{1,2} mini -- install Snow Leopard
  • Rev 5 or later mini -- install Lion
  • File bug for DNS/static IP in DHCP with MAC address

Setup steps

If you're using a box set up by IT, you can skip to #Config changes from IT image:

  • set up cltbld account; remove passwordless Mozilla Corporation account
    • System Preferences -> Accounts
    • Add cltbld account, check "Allow user to administer this computer"
    • Make sure to turn off Automatic Login for Mozilla Corporation before logging out
    • Log out, log in as cltbld
      • This may log you in as moco again; turn off Automatic Login and try again
    • Remove Mozilla Corporation account
    • Disable Guest Account sharing (needed ?)
  • Add Terminal to the dock. Not needed, just a preference.
    • Finder -> Applications -> Utilities, drag Terminal into dock
  • remote login
    • System Preferences -> Sharing
    • Set computer name
    • Enable Remote Login

Config changes from IT image

Log in via GUI to account 'cltbld' for these actions:

  • remote desktop
    • System Preferences -> Users & Groups
      • change password to real cltbld one, if needed (not from cli passwd tool)
      • "Login Options" -> "Automatic Login" -> "Off"
    • In System Preferences -> Sharing
    • set computer name to foopyXX (for ease of identifying VNC sessions later)
    • Enable Remote Management
    • Click all checkboxes
    • Computer Settings
    • VNC viewers may control screen with password: (enter cltbld pass)
    • N.B. if you click the wrong button at the wrong time, you can kill your GUI access. To restore see this Apple doc. Note that you may need to activate & deactivate several times to restore functionality.
  • turn off bluetooth
    • System Preferences -> Bluetooth
    • Uncheck "On".
    • click "Advanced" button
      • uncheck "Open Bluetooth Setup Assistant at startup if no keyboard is detected"
      • uncheck "Open Bluetooth Setup Assistant at startup if no mouse or keyboard
      • note - if the bluetooth setup assistant runs, it re-enables bluetooth (so helpful)
  • turn off energy saver
    • System Preferences -> Energy Saver
    • Computer sleep: Never
    • Uncheck Put the hard disk(s) to sleep when possible
    • Start up automatically after power failure
  • Kill spotlight
    • System Preferences -> Spotlight -> Privacy
      • Click "+" button; add the entire hard drive to the list of folders not to search
  • optional: set up ssh (only) so you can do next steps from your terminal, not vnc
  • xcode
    • for pre-Lion (use 3.x only to avoid requiring app store setup)
      • Aki has scp'd XCode 3.2.2 to the various foopys and installing (since that's the dmg I have), and depending on the following software update to bring me up to date.
      • Installed defaults (do not install 10.4 SDK)
    • xcode for Lion
      • if possible, copy over the "Xcode Installer.app" from another foopy
        • if not, use the releng+aid@mozilla.com Apple ID for the store
    • verify Xcode starts up okay: open /Developer/Applications/Xcode.app
      • if you are prompted to install java - do so
  • software update, then turn off updates
    • Close the prompted software update, then recheck after installing XCode
    • Apple menu -> Software Update
    • System Preferences -> Software Update
    • Uncheck 'Check for updates'
  • macports - download & install one of:
sudo port selfupdate 
# next one takes about 20 minutes
sudo port install mercurial wget py26-lint py26-virtualenv py26-yaml
sudo port select --set python python26
cd ~/
hg clone http://hg.mozilla.org/build/buildbot
cd ~/buildbot
hg up -r production-0.8
sudo su -
cd /Users/cltbld/buildbot/master
# next one takes about 5 minutes
/opt/local/bin/python setup.py install # (need to sudo su -; sudo python setup.py won't work)
cd ../slave
/opt/local/bin/python setup.py install # (need to sudo su -; sudo python setup.py won't work)
exit

The buildslave install above didn't seem to create a /opt/local/bin/twistd symlink so I had to run the following manually (all 1 line):

sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/twistd /opt/local/bin/twistd

Create the /builds directory (requires sudo, so can't be done from ./foopies.sh):

sudo mkdir /builds
sudo chown cltbld:admin /builds

helper scripts to populate /builds

Locate the tools/buildfarm/mobile/ directory on your laptop and follow these directions to complete the setup of the foopy.

  • Preparation - several key files used in setting up ssh are not checked in. Grab these from a known good production foopy:
 FOOP=foopyXX # know good foopy
 scp ctlbld@$FOOP:.ssh/{id_rsa{,.pub},authorized_keys} .
 mv -i authorized_keys foopy-authorized_keys
 scp ctlbld@$FOOP:.screenrc foopy-screenrc
  • If your ssh key isn't already in the distributed authorized_keys, do
 cat ~/.ssh/id_rsa.pub >> foopy-authorized_keys
  • One time ssh environment setup (where XX is the foopy number):
./foopies.sh ssh ##
./foopies.sh ##

After the above has been run, it's time to setup the cronjobs: Note: most likely the scp commands will not have set +x for any /builds/*.sh scripts

On the new foopy:

cd /builds
crontab crontab.foopy
./tegra_stats.sh

Running tegra_stats.sh manually once allow you to check that it is working :), but more importantly it also allows you to answer "yes" to the ssh question about connecting to the remote host.

test basic foopy functionality

If you want to test basic foopy sanity prior to full tegra deployment, here's the process:

  1. borrow a tegra from staging
    • convention take one from foopy05 that looks idle
    • run cd /builds; ./stop_cp.sh tegra-XXX for the one you're stealing
  2. tweak your local laptop copy of foopies.sh to configure only the borrowed tegra
  3. finalize configuration using ./foopies.sh ##
  4. start your tegra
    • on foopy, run cd /builds; ./start_cp.sh
  5. verify right number of processes running
    • ps awx | grep tegra-XXX
    • should be at least 1 twistd & 2 clientproxies
  6. verify contents of /builds/tegra-XXX directory
    • should be log files, buildbot.tac, clientproxy.py
  7. verify tegra shows on buildbot master
  8. verify tegra online
    • telnet tegra-XXX 20701
  9. stop your borrowed tegra
    • cd /builds; ./stop_cp.sh
  10. return the tegra to staging
    • log into its real foopy (likely foopy05)
    • run cd /builds ; ./start_cp tegra-XXX
  11. remove the test configration on your new foopy
    • cd /builds ; ls -d tegra-*
    • you should only see the one borrowed tegra
    • rm -rf *

Future reference

Rev 1 mini foopy port list

For future reference:

foopy02:~ cltbld$ sudo port list active
Warning: port definitions are more than two weeks old, consider using selfupdate
bzip2                          @1.0.6          archivers/bzip2
db46                           @4.6.21         databases/db46
expat                          @2.0.1          textproc/expat
gdbm                           @1.8.3          databases/gdbm
gettext                        @0.18.1.1       devel/gettext
gperf                          @3.0.4          devel/gperf
libiconv                       @1.13.1         textproc/libiconv
libidn                         @1.19           mail/libidn
mercurial                      @1.7.2          devel/mercurial
ncurses                        @5.7            devel/ncurses
ncursesw                       @5.7            devel/ncursesw
openssl                        @1.0.0c         devel/openssl
py26-distribute                @0.6.14         python/py26-distribute
py26-lint                      @0.22.0         python/py26-lint
py26-logilab-astng             @0.21.0         python/py26-logilab-astng
py26-logilab-common            @0.53.0         python/py26-logilab-common
py26-virtualenv                @1.5.1          python/py26-virtualenv
py26-yaml                      @3.09           python/py26-yaml
python26                       @2.6.6          lang/python26
readline                       @6.1.002        devel/readline
sqlite3                        @3.7.3          databases/sqlite3
wget                           @1.12           net/wget
zlib                           @1.2.5          archivers/zlib

Rev 5 mini foopy port list

foopy18:builds cltbld$ port list active
bzip2                          @1.0.6          archivers/bzip2
curl-ca-bundle                 @7.23.1         net/curl-ca-bundle
db46                           @4.6.21         databases/db46
expat                          @2.0.1          textproc/expat
gdbm                           @1.10           databases/gdbm
gettext                        @0.18.1.1       devel/gettext
glib2                          @2.30.2         devel/glib2
gnutls                         @2.12.11        devel/gnutls
gperf                          @3.0.4          devel/gperf
libedit                        @20110802-3.0   devel/libedit
libffi                         @3.0.10         devel/libffi
libgcrypt                      @1.5.0          devel/libgcrypt
libgpg-error                   @1.10           devel/libgpg-error
libiconv                       @1.14           textproc/libiconv
libidn                         @1.22           mail/libidn
libtasn1                       @2.9            devel/libtasn1
lzo2                           @2.05           archivers/lzo2
mercurial                      @2.0            devel/mercurial
ncurses                        @5.9            devel/ncurses
ncursesw                       @5.8            devel/ncursesw
openssl                        @1.0.0e         devel/openssl
perl5                          @5.12.3         lang/perl5
perl5.12                       @5.12.3         lang/perl5.12
pkgconfig                      @0.26           devel/pkgconfig
py26-distribute                @0.6.24         python/py-distribute
py26-lint                      @0.24.0         python/py26-lint
py26-logilab-astng             @0.22.0         python/py26-logilab-astng
py26-logilab-common            @0.56.0         python/py26-logilab-common
py26-virtualenv                @1.6.1          python/py26-virtualenv
py26-yaml                      @3.09           python/py26-yaml
python26                       @2.6.7          lang/python26
python27                       @2.7.2          lang/python27
python_select                  @0.3            sysutils/python_select
readline                       @6.2.000        devel/readline
sqlite3                        @3.7.9          databases/sqlite3
wget                           @1.13.4         net/wget
xz                             @5.0.3          archivers/xz
zlib                           @1.2.5          archivers/zlib