shill: Update TESTING to reflect build using platform2 target.
BUG=None
TEST=None
Change-Id: I531a273680dd81e8617ea7590c93b326d72d6144
Reviewed-on: https://chromium-review.googlesource.com/186493
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/TESTING b/TESTING
index f93d4a8..e0bc863 100644
--- a/TESTING
+++ b/TESTING
@@ -10,34 +10,22 @@
Running unit tests
------------------
+Here ${BOARD} is a valid board name, like link or x86-generic.
- build the shill_unittest target
- run the resulting shill_unittest binary
-- if you're using our ebuild scripts, you can do both by running
- (chroot)$ cros_run_unit_tests -p shill
- run the unit tests from your host machine under gdb
- (chroot)$ FEATURES="test noclean" emerge-x86-generic shill
- (chroot)$ gdb_x86_local --board x86-generic \
- /build/x86-generic/tmp/portage/chromeos-base/shill-9999/work/shill-9999/shill_unittest
+ (chroot)$ FEATURES=test emerge-${BOARD} platform2
+ (chroot)$ gdb_x86_local --board ${BOARD} \
+ /build/${BOARD}/var/cache/portage/chromeos-base/platform2/out/Default/shill_unittest
(Of course if the unit tests segfaulted, you wouldn't need the emerge
step since the build directory would have been retained in the course
of the test failing.)
-
-- for an incremental workflow, you can setup like this:
- (chroot)$ cros_workon --board x86-generic shill
-- incrementally build like this (note: this may not work if your
- host architecture does not match that of the target):
- (chroot)$ CXXFLAGS=-g cros_workon_make --board x86-generic --reconf --test shill
-- and then debug tests like this:
- (chroot)$ gdb_x86_local --board x86-generic /path/to/checkout/src/platform/shill/shill_unittest
-
-- you can specify arguments to the unit tests like this:
- - full workflow:
- (chroot)$ GTEST_ARGS="--v=1000 --gtest_filter=WiFiPropertyTest.*" \
- FEATURES="test" emerge-x86-generic shill
- - incremental workflow:
- (chroot)$ GTEST_ARGS="--v=1000 --gtest_filter=WiFiPropertyTest.*" \
- CXXFLAGS=-g cros_workon_make --board x86-generic --reconf --test shill
-
+- The emerge workflow given above is incremental. It uses ninja to rebuild only
+ relevant objects in the shill target.
+- You can restrict the test runs to only shill unittests by using
+ (chroot)$ P2_TEST_FILTER="shill::*" FEATURES=test emerge-${BOARD} platform2
+ The filter can be made more specific to include googletest filters like
+ "shill::CellularTest.StartGSMRegister"
- if you want to set a breakpoint in gdb, make sure to include the shill
namespace. e.g., run
(cros-gdb) b shill::EthernetService::GetStorageIdentifier
@@ -47,26 +35,28 @@
Function "EthernetService::GetStorageIdentifier" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
-- alternate build arguments:
+- alternate build command:
+ - Another way to build which uses the emerge command behind the scenes:
+ (chroot)$ cros_workon_make --board ${BOARD} platform2
- to see the actual compiler commands that are run:
(chroot)$ CFLAGS="-print-cmdline" cros_workon_make --reconf \
- --board=link shill
+ --board=${BOARD} platform2
- to abort compilation on the first error
- (chroot)$ MAKEFLAGS="--stop" cros_workon_make --test --board=link \
- --reconf shill
+ (chroot)$ MAKEFLAGS="--stop" cros_workon_make --test --board=${BOARD} \
+ --reconf platform2
Running integration tests
-------------------------
- build a test image, suitable for a VM:
- (chroot) src/scripts$ ./build_packages --board=x86-generic
- (chroot) src/scripts$ ./build_image --board=x86-generic \
+ (chroot) src/scripts$ ./build_packages --board=${BOARD}
+ (chroot) src/scripts$ ./build_image --board=${BOARD} \
--noenable_rootfs_verification test
- (chroot) src/scripts$ ./image_to_vm.sh --board=x86-generic --test_image
+ (chroot) src/scripts$ ./image_to_vm.sh --board=${BOARD} --test_image
- start the VM
(host)$ sudo kvm -m 2048 -vga std -pidfile /tmp/kvm.pid \
-net nic,model=virtio -net user,hostfwd=tcp::9222-:22 \
- -hda <path to chroot>/src/build/images/x86-generic/latest/chromiumos_qemu_image.bin
+ -hda <path to chroot>/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
- DO NOT log in on the console.
(doing so will load a user profile onto shill's profile stack; this
@@ -76,25 +66,26 @@
the image, and then restart shill:
(chroot) src/scripts$ ./start_devserver
(chroot) src/scripts$ ssh-keygen -R '[127.0.0.1]:9222'
+ (chroot) src/scripts$ emerge-${BOARD} platform2
+ (chroot) src/scripts$ cros deploy 127.0.0.1:9222 platform2
+
(chroot) src/scripts$ ssh -p 9222 root@127.0.0.1
- localhost / # FEATURES="nostrip" gmerge shill
localhost / # restart shill
- run the tests
- (chroot) src/scripts$ ./run_remote_tests.sh --board=x86-generic \
- --remote=127.0.0.1 --ssh_port 9222 \
- --args="config_file=wifi_vm_config" WiFiManager
+ (chroot) src/scripts$ test_that 127.0.0.1 WiFiManager
+ --args="config_file=wifi_vm_config"
+ --ssh_options="-p 9222"
To run a specific test out of the test suite, use test_pat option to --args.
-
# Example: To just run the 035CheckWEPKeySyntax test:
- (chroot) src/scripts$ ./run_remote_tests.sh --board=x86-generic \
- --remote=127.0.0.1 --ssh_port 9222 \
- --args="config_file=wifi_vm_config test_pat=035CheckWEPKeySyntax" WiFiManager
+ (chroot) src/scripts$ test_that 127.0.0.1 WiFiManager
+ --args="config_file=wifi_vm_config test_pat=035CheckWEPKeySyntax"
+ --ssh_options="-p 9222"
- configuration note: if you use a different port
(e.g. hostfwd=tcp::9223-:22), you'll need to change:
- - the ssh_port argument to run_remote_tests
+ - the ssh_port argument to test_that
- the port numbers in
<chroot>/third_party/autotest/files/client/config/wifi_vm_config
@@ -110,9 +101,9 @@
- check how far the test got before it failed
$ grep -a ': step ' <test output>/<suite name>/<suite name>.<test name>/debug/<suite name>.<test name>.INFO
e.g.
- (chroot) $ grep -a ': step ' /tmp/run_remote_tests.abcd/network_WiFiRoaming/network_WiFiRoaming.002Suspend/debug/network_WiFiRoaming.002Suspend.INFO
+ (chroot) $ grep -a ': step ' /tmp/test_that_latest/network_WiFiRoaming/network_WiFiRoaming.002Suspend/debug/network_WiFiRoaming.002Suspend.INFO
- read the log file
- (chroot) $ LESSOPEN= less /tmp/run_remote_tests.abcd/network_WiFiRoaming/network_WiFiRoaming.002Suspend/debug/network_WiFiRoaming.002Suspend.INFO
+ (chroot) $ LESSOPEN= less /tmp/test_that_latest/network_WiFiRoaming/network_WiFiRoaming.002Suspend/debug/network_WiFiRoaming.002Suspend.INFO
(LESSOPEN= prevents less from misinterpreting the logs as binary files,
and piping them through hexdump.)