aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-12-02 13:22:21 -0800
committerElliott Hughes <enh@google.com>2016-12-05 13:48:04 -0800
commit0e8804e1544ae3a3fd1df664e6edfa4f7b4df159 (patch)
tree6591cd7d508247a016c9fa3b88dd256b03e15cb8 /README.md
parentb2d36b4ec7de0b8cb88622c0398d8d9a7302ee6f (diff)
downloadandroid_bionic-0e8804e1544ae3a3fd1df664e6edfa4f7b4df159.tar.gz
android_bionic-0e8804e1544ae3a3fd1df664e6edfa4f7b4df159.tar.bz2
android_bionic-0e8804e1544ae3a3fd1df664e6edfa4f7b4df159.zip
Document how to run CTS in the public documentation too.
Bug: N/A Test: N/A Change-Id: Ib9f46d09b56795d5202ec7167328042381cdc667
Diffstat (limited to 'README.md')
-rw-r--r--README.md29
1 files changed, 26 insertions, 3 deletions
diff --git a/README.md b/README.md
index 0dd7490e9..61314b6c1 100644
--- a/README.md
+++ b/README.md
@@ -200,9 +200,8 @@ The tests are all built from the tests/ directory.
### Device tests
- $ mma
- $ adb remount
- $ adb sync
+ $ mma # In $ANDROID_ROOT/bionic.
+ $ adb root && adb remount && adb sync
$ adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests32
$ adb shell \
/data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static32
@@ -216,6 +215,30 @@ options documented at
<https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#running-test-programs-advanced-options>,
in particular for test isolation and parallelism (both on by default).
+### Device tests via CTS
+
+Most of the unit tests are executed by CTS. By default, CTS runs as
+a non-root user, so the unit tests must also pass when not run as root.
+Some tests cannot do any useful work unless run as root. In this case,
+the test should check `getuid() == 0` and do nothing otherwise (typically
+we log in this case to prevent accidents!). Obviously, if the test can be
+rewritten to not require root, that's an even better solution.
+
+Currently, the list of bionic CTS tests is generated at build time by
+running a host version of the test executable and dumping the list of
+all tests. In order for this to continue to work, all architectures must
+have the same number of tests, and the host version of the executable
+must also have the same number of tests.
+
+Running the gtests directly is orders of magnitude faster than using CTS,
+but in cases where you really have to run CTS:
+
+ $ make cts # In $ANDROID_ROOT.
+ $ adb unroot # Because real CTS doesn't run as root.
+ # This will sync any *test* changes, but not *code* changes:
+ $ cts-tradefed \
+ run singleCommand cts --skip-preconditions -m CtsBionicTestCases
+
### Host tests
The host tests require that you have `lunch`ed either an x86 or x86_64 target.