blob: e406aa0cc0bfe50807e68b7a57aaee5ac627b95a [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
Paul Stewart85a1bad2011-10-21 22:36:38 -070017- run the unit tests from your host machine under gdb
18 (chroot)$ FEATURES="test noclean" emerge-x86-generic shill
19 (chroot)$ gdb_x86_local --board x86-generic \
20 /build/x86-generic/tmp/portage/chromeos-base/shill-9999/work/shill-9999/shill_unittest
21 (Of course if the unit tests segfaulted, you wouldn't need the emerge
22 step since the build directory would have been retained in the course
23 of the test failing.)
mukesh agrawal70d3ebe2011-10-13 14:45:54 -070024
25Running integration tests
26-------------------------
27- build a test image, suitable for a VM:
28 (chroot) src/scripts$ ./build_packages --board=x86-generic
29 (chroot) src/scripts$ ./build_image --board=x86-generic --withdev \
30 --test --noenable_rootfs_verification
31 (chroot) src/scripts$ ./image_to_vm.sh --board=x86-generic --test_image
32
33- start the VM
34 (host)$ sudo kvm -m 1024 -vga std -pidfile /tmp/kvm.pid \
35 -net nic,model=virtio -net user,hostfwd=tcp::9222-:22 \
36 -hda <path to chroot>/src/build/images/x86-generic/latest/chromiumos_qemu_image.bin
37
38- open a root shell on the VM console
39 - in VM console, log in as guest
40 - hit C-A-t to open a shell (use right control and alt, to avoid escaping
41 out of VM's mouse capture)
42
43 crosh> shell
44 chronos@localhost / $ sudo bash
45
46- load shill onto VM image
47 localhost / # FEATURES="nostrip" gmerge shill
48
49- stop flimflam, and start shill
50 localhost / # stop flimflam
51 localhost / # shill --v=1000 \
52 --device-black-list=managed0,managed1,mon.managed0,mon.managed1
53 (the black list keep shill from configuring the devices used by the hostapd
54 processes.)
55
56- run the tests
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" WiFiManager
60
Gaurav Shahd52caa52011-10-25 10:46:03 -070061 To run a specific test out of the test suite, use test_pat option to --args.
62
63 # Example: To just run the 035CheckWEPKeySyntax test:
64 (chroot) src/scripts$ ./run_remote_tests.sh --board=x86-generic \
65 --remote=127.0.0.1 --ssh_port 9222 \
66 --args="config_file=wifi_vm_config test_pat=035CheckWEPKeySyntax" WiFiManager
67
mukesh agrawal70d3ebe2011-10-13 14:45:54 -070068- configuration note: if you use a different port
69 (e.g. hostfwd=tcp::9223-:22), you'll need to change:
70 - the ssh_port argument to run_remote_tests
71 - the port numbers in
72 <chroot>/third_party/autotest/files/client/config/wifi_vm_config
73
74- debugging test failures
75 - "grep shill /var/log/messages" for log messages
76 - "grep wpa_supplicant /var/log/messages" for supplicant log messages
77 - "wpa_debug debug" to increase supplicant log level
78 - try resetting the test infrastructure
79 - rmmod mac80211_hwsim mac80211 cfg80211
80 - restart wpasupplicant
81 - rm /tmp/hostapd-test.control/*
82
83- additional test suites: we have a number of other WiFi test suites
84 (in addition to WiFiManager). these are: WiFiMatFunc, WiFiPerf,
85 WiFiRoaming, WiFiSecMat. the WiFiPerf tests are probably not too
86 relevant to shill (just yet), but the rest probably are.
87
88[1] http://code.google.com/p/googletest/
89[2] http://code.google.com/p/googlemock/
90[3] http://autotest.kernel.org/,
Gaurav Shahd52caa52011-10-25 10:46:03 -070091 http://www.chromium.org/chromium-os/testing/testing-faq