blob: 88fd4d4e3cecafae383c4287cbf7f6fb0510895b [file] [log] [blame]
mukesh agrawal70d3ebe2011-10-13 14:45:54 -07001Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2Use of this source code is governed by a BSD-style license that can be
3found in the LICENSE file.
4
5Intro
6-----
7We test shill using two sets of tests: unit tests, and integration
8tests. The unit tests are built using Google Test [1] and Google Mock
9[2]; the integration tests use autotest [3].
10
11Running unit tests
12------------------
13- build the shill_unittest target
14- run the resulting shill_unittest binary
15- if you're using our ebuild scripts, you can do both by running
16 (chroot)$ FEATURES="test" emerge-x86-generic shill
17
18Running integration tests
19-------------------------
20- build a test image, suitable for a VM:
21 (chroot) src/scripts$ ./build_packages --board=x86-generic
22 (chroot) src/scripts$ ./build_image --board=x86-generic --withdev \
23 --test --noenable_rootfs_verification
24 (chroot) src/scripts$ ./image_to_vm.sh --board=x86-generic --test_image
25
26- start the VM
27 (host)$ sudo kvm -m 1024 -vga std -pidfile /tmp/kvm.pid \
28 -net nic,model=virtio -net user,hostfwd=tcp::9222-:22 \
29 -hda <path to chroot>/src/build/images/x86-generic/latest/chromiumos_qemu_image.bin
30
31- open a root shell on the VM console
32 - in VM console, log in as guest
33 - hit C-A-t to open a shell (use right control and alt, to avoid escaping
34 out of VM's mouse capture)
35
36 crosh> shell
37 chronos@localhost / $ sudo bash
38
39- load shill onto VM image
40 localhost / # FEATURES="nostrip" gmerge shill
41
42- stop flimflam, and start shill
43 localhost / # stop flimflam
44 localhost / # shill --v=1000 \
45 --device-black-list=managed0,managed1,mon.managed0,mon.managed1
46 (the black list keep shill from configuring the devices used by the hostapd
47 processes.)
48
49- run the tests
50 (chroot) src/scripts$ ./run_remote_tests.sh --board=x86-generic \
51 --remote=127.0.0.1 --ssh_port 9222 \
52 --args="config_file=wifi_vm_config" WiFiManager
53
Gaurav Shahd52caa52011-10-25 10:46:03 -070054 To run a specific test out of the test suite, use test_pat option to --args.
55
56 # Example: To just run the 035CheckWEPKeySyntax test:
57 (chroot) src/scripts$ ./run_remote_tests.sh --board=x86-generic \
58 --remote=127.0.0.1 --ssh_port 9222 \
59 --args="config_file=wifi_vm_config test_pat=035CheckWEPKeySyntax" WiFiManager
60
mukesh agrawal70d3ebe2011-10-13 14:45:54 -070061- configuration note: if you use a different port
62 (e.g. hostfwd=tcp::9223-:22), you'll need to change:
63 - the ssh_port argument to run_remote_tests
64 - the port numbers in
65 <chroot>/third_party/autotest/files/client/config/wifi_vm_config
66
67- debugging test failures
68 - "grep shill /var/log/messages" for log messages
69 - "grep wpa_supplicant /var/log/messages" for supplicant log messages
70 - "wpa_debug debug" to increase supplicant log level
71 - try resetting the test infrastructure
72 - rmmod mac80211_hwsim mac80211 cfg80211
73 - restart wpasupplicant
74 - rm /tmp/hostapd-test.control/*
75
76- additional test suites: we have a number of other WiFi test suites
77 (in addition to WiFiManager). these are: WiFiMatFunc, WiFiPerf,
78 WiFiRoaming, WiFiSecMat. the WiFiPerf tests are probably not too
79 relevant to shill (just yet), but the rest probably are.
80
81[1] http://code.google.com/p/googletest/
82[2] http://code.google.com/p/googlemock/
83[3] http://autotest.kernel.org/,
Gaurav Shahd52caa52011-10-25 10:46:03 -070084 http://www.chromium.org/chromium-os/testing/testing-faq