Commit graph

46 commits

Author SHA1 Message Date
Christopher Ferris
6d2c0bdf6e Move isolated test runner out of bionic.
Use a global gtest isolation runner rather than the custom one in
bionic.

Test: Ran all unit tests and verified same behavior before and after.

Change-Id: I24a7cf17cf8e018d0f51969c64b53ce9059cc779
2018-09-27 22:22:17 -07:00
dimitry
21557cdd2e Ignore output to stderr while enumerating tests
Bug: http://b/114304197
Test: adb unroot && run CtsBionicTestCases
Change-Id: I75880934fa1c25be6c76e866f97efc14d5ccd0a1
2018-09-25 12:23:33 +02:00
Yi Kong
32bc0fcf69 Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2018-08-02 18:09:44 -07:00
Tao Bao
afacaaba8c The --gtest_color flag should take a priority.
This along with commit c1ef5eb034 should
get back to the initial behavior prior to the change in commit
83b6379783.

Fixes: 111396376
Test: `adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_color=yes`
      shows colored output.
Test: `adb shell -t /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_color=no`
      doesn't add color escapes.
Change-Id: I88530e8b264cd0c259c16b09bdf867cdd2e88224
2018-07-17 19:08:13 -07:00
Haibo Huang
c1ef5eb034 Only use color in supported terminal.
Test: compile
Change-Id: Ibb962597e065ebb90a53dd8bc62c4b774a2e4f10
2018-07-16 22:53:49 +00:00
Haibo Huang
83b6379783 Remove bionic test's dependency on gtest internal.
It is wrong to depend on internal ABI. And in the new version, they
explicitly disabled that.
b3d9be5c1d

Test: run test
Change-Id: I194a1e9417df2c52872b6eca6b61fb392e07cd29
2018-07-10 15:45:31 -07:00
Tao Bao
9932789996 Exit gracefully on invalid --gtest_* flag.
My gtest run crashed when I provided wrong flag (e.g. --gtest_list),
because it tried to call std::vector::back() on empty testcase_list.

Test: /data/nativetest/bionic-unit-tests/bionic-unit-tests works.
Test: `/d/n/b/bionic-unit-tests --gtest_invalid` dumps the gtest help
      message.
Change-Id: I5f63c7fa6476d8749248c9b54d3023446f3e0e77
2018-03-23 09:40:21 -07:00
Elliott Hughes
5cec377f49 Address a bunch of clang-tidy complaints.
There were a bunch more unreasonable/incorrect ones, but these ones
seemed legit. Nothing very interesting, though.

Bug: N/A
Test: ran tests, benchmarks
Change-Id: If66971194d4a7b4bf6d0251bedb88e8cdc88a76f
2018-01-19 15:56:12 -08:00
Elliott Hughes
cabc77f917 Always wrap waitpid in TEMP_FAILURE_RETRY.
Strictly not needed in the WNOHANG case, but it's probably best to have
every waitpid wrapped for future copy & pasters.

Bug: https://issuetracker.google.com/69525592
Test: ran tests
Change-Id: I013b0a52d2753e3d32638e9b84c79af7327fb405
2017-11-28 12:55:19 -08:00
Yabin Cui
5e235c85bb Fix support for typed tests and parameterized tests.
Bug: http://b/69425095
Test: run bionic_unit_tests --bionic-selftest
Change-Id: Ifa23288f2ad84978b7748da0ea93d650fae926a8
2017-11-16 16:20:28 -08:00
Elliott Hughes
10ba4bd6d1 Reduce unnecessary quoting for --gtest_filter.
Use posix_spawn rather than popen, to remove a surprising extra shell.

Bug: http://b/68949647
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter=stdio.swprintf_1$ju_UINTMAX_MAX
Change-Id: Id90afab04ee799932de9f5ca7e580e61ecfde7a4
2017-11-15 09:30:16 -08:00
Elliott Hughes
93a89f84e4 Make xfail passes not failures.
Bug: http://b/63703384
Test: ran tests
Change-Id: I02dfc92cfc0e07831b8f3a974803be384bc02f1e
2017-07-21 18:51:06 -07:00
wy
828b9e162f Fix clang-tidy perfomrance warnings.
Change-Id: Ibf3d32a5ba1cb70158d857be3d20aa3d1a870341
Test: build with WITH_TIDY=1
2017-05-10 15:57:26 -07:00
Dimitry Ivanov
5b2cd3a358 Use libbase for realpath and dirname
Test: run bionic-unit-tests
Bug: http://b/31396973
Change-Id: Ie8dc60348b9c57892a77be6a24dadb42241f6b62
2017-03-16 11:47:08 -07:00
Josh Gao
7d15dc388a Add tests for pthread TLS leak.
Add tests that ensure that threads don't leak memory mappings after
they exit.

Bug: http://b/36045112
Test: /data/nativetest/bionic-unit-tests/bionic-unit-tests --gtest_filter=*leak*
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter=*leak*
Change-Id: Id0c1194b5d2bb7d89947b1ade16eb0d768d8c5b7
2017-03-15 13:30:05 -07:00
Josh Gao
010522229c Add support for expected failures to gtest runner.
Bug: http://b/33251022
Test: manually added tests that unexpectedly failed
Test: bionic-unit-tests/bionic-unit-tests64 on bullhead
Change-Id: Ie9aef80014b9fd6512b68f0e42abc298732a9b6e
2017-01-10 12:56:25 -08:00
Yabin Cui
c641a95834 Fix gtest_filter of bionic gtest runner.
Bug: http://b/29514723
Test: run bionic-unit-tests --gtest-filter='*grp*'
Change-Id: I45ed561702bd601bae84c8d77824aa5769dbfa9c
2016-12-12 13:34:05 -08:00
Yabin Cui
cf75462012 Fix the way to find negative filter pattern.
Bug: http://b/29514723
Test: run CtsBionicTestCases --gtest_filter=-Fortify2_clang.strncpy --gtest_list_tests
Change-Id: Ia3adec1fc03252adee4aed238b9c88508da17faf
2016-12-09 15:49:09 -08:00
Dimitry Ivanov
d0b5c3ad65 Fix bionic-unit-tests-glibc
Also add another test for dlsym(RTLD_NEXT, ..)

Bug: http://b/33106624
Test: run bionic-unit-tests-glibc and bionic-unit-tests
Change-Id: I340165d66bf2360b0e3273d3561a08cb5e7bd025
2016-11-28 13:09:19 -08:00
Elliott Hughes
48de71e3cc Show amount of parallelism in gtest output.
Bug: http://b/19075519
Test: ran tests
Change-Id: Ia190f728cc28e2283636e9cfea927e525d6c10c8
2016-10-28 10:04:44 -07:00
Dimitry Ivanov
a36e59bb99 Move test libraries under /data/nativetests
Move libraries used in bionic-unit-tests out of system partition to
/data/nativetests../bionic-loader-test-libs

Bug: http://b/22182538
Test: build bionic and run bionic-unit-tests
Change-Id: I170177bef782839d0b4970ae4418bf54d0a77836
2016-09-02 14:27:47 -07:00
Elliott Hughes
a456fae45f List failing tests last, to reduce the amount of scrolling.
On actual devices, we have a lot of slow tests. Warnings about those
cause cause the failed tests to scroll off the display.

Also replace the made-up word "warnline".

Change-Id: I6b579521a21b56da8a1add08cd34888fc902646e
2016-08-31 14:49:32 -07:00
Dimitry Ivanov
5543746934 Pass argc/argv/envp to dso constructors
The glibc implementation of the loader passes argc/argv/envp
to all elf constructors. This change makes bionic linker
behave in the same way.

Bug: http://b/30145768
Change-Id: I1c65c42aa5305a5b133c64b5748205bbde869e0e
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*
2016-07-20 16:10:19 -07:00
Dimitry Ivanov
2ba1cf39ae Fix dlopen of main executable by absolute path
This CL adds initialization of inode for the main executable
which enables linker to resolve the correct soinfo when
application calls dlopen with absolute path to the
main executable.

Bug: http://b/28420266
Change-Id: I102e07bde454bd44c6e46075e3faeeb5092830d8
2016-05-17 13:55:46 -07:00
Dimitry Ivanov
d17a377c49 linker: print "not accessible" error message to the log
Print properties of the namespace on "library is not accessible"
error to better diagnose problems with native library accessiblity

Bug: http://b/27406143
Change-Id: Icf3d6c604f09dfa015de863fdb1267d343930d2a
(cherry picked from commit 350bdad61c)
2016-03-01 15:28:43 -08:00
Dan Albert
09a99641ec Escape failure messages in XML test output.
The gtest XML format requires escaped HTML characters in the test
results.

Change-Id: Ieb9519a55cb52093dfb10a88e883b569bc372cdb
2016-01-13 21:48:56 -08:00
Yabin Cui
a32fc8685d Don't use StringPrintf() in gtest runner.
Change-Id: I0cd0b3cbb952c65b1c449e88ce12964b93029538
2015-12-03 16:28:03 -08:00
Yabin Cui
d4c9b9d5ac Improve unit test runner.
1. Read unit test's output while the test is running. Previously
we only read output when the test finishes, which has trouble
when the test outputs too many stuff.
2. Report failed unit test's exit code. It is useful when the
test doesn't fail in ASSERT_xxx, but in somewhere else.

Bug: 25392375
Change-Id: Ie90823337f7c2ee25fa489a5534801d991258f95
2015-12-03 13:20:39 -08:00
Yabin Cui
bc6379d7da Remove the workaround which fixes JOB_COUNT in CTS test.
Bug: 24376925
Change-Id: Ib195ce1577ee9412068cc1b6223fc051b5bcfcaa
2015-10-06 16:30:14 -07:00
Elliott Hughes
0b2acdfcc9 Use const auto& in for loops.
Change-Id: Ic437c59797ee4e7dc38291da35c72d827bc89c8d
2015-10-02 18:25:19 -07:00
Christopher Ferris
daaaed18ce Force cts to only run one test at a time.
Also, slightly increase the timeout for each test run.

Bug: 24198050
Change-Id: I2b0ebdebb909023d0f179e0a433c564266a99161
2015-09-25 09:16:31 -07:00
Yabin Cui
767fb1c5c6 build bionic gtest runner on mac.
Change-Id: I39a7e94b6662256646dfaeb8f9ecd5c03cd5fbc6
2015-09-01 15:40:38 -07:00
Yabin Cui
bf830ade7f Omit comment when reading --gtest_list_tests option's output.
Gtest add comments when listing typed tests. And we should omit them.

Bug: 23040880
Change-Id: If6034af301337fc06eeab294d2dbe5317a6b7f91
2015-08-10 12:12:39 -07:00
Christopher Ferris
119cb55d43 gtest_repeat should allow negative values.
If you pass in a negative value to gtest_repeat, it should run forever.
The new runner didn't allow this, now it does.

Change-Id: Ie0002c12e2fdad22b264adca37c165cfcfe05c7a
2015-04-02 12:16:00 -07:00
Yabin Cui
64a9c4f697 Make gtest_main exit 1 when some test are failed.
This is the gtest behavior, which I think can make test status
judgement more convenient.

Change-Id: I7d3c210d1744b954a4148cd905dd5c353207fce8
2015-03-12 23:36:29 -07:00
Yabin Cui
f6237470a3 Make bionic gtest main be compatible with gtest output format for cts test.
Bug: 17589740
Change-Id: Ifab521da379a33bf0a7bf11c21386f936f0d494c
2015-02-26 19:03:54 -08:00
Yabin Cui
ea9c933f36 Make all output of child test go to parent process in gtest_main.
Change-Id: Iad460e89755051cdb99593cbf42c97d9a359f32b
2015-02-24 14:44:51 -08:00
Yabin Cui
ead08148bd Add path separator in bionic-unit-tests program path.
Bug: 19220800
Change-Id: I4245b1270363544cd5f083fe7ea7d9b11b46cdc0
2015-02-05 10:39:37 -08:00
Yabin Cui
1d4c780a2e Add signal handling in bionic gtest main.
The two bugs are very closely related and code amount is very small,
So I think they may be fixed in one change.

Bug: 19128558
Bug: 19129994
Change-Id: I44a35398e64dfca7e9676428cb8f4026e8f6e488
2015-02-04 19:06:07 -08:00
Yabin Cui
11c4353cdd Add --gtest-filter as synonym for --gtest_filter in bionic gtest main.
Bug: 19130480
Change-Id: I0d3df70ee8f692581cc4b9b742c5f347259fd0d2
2015-01-28 14:28:14 -08:00
Yabin Cui
0bc4e9697e Fix parse of gtest_filter in bionic gtest main.
Bug: 19130330
Change-Id: Id6a60570a8aab6ae7259ff228b3801285b378f77
2015-01-27 11:22:46 -08:00
Yabin Cui
4a82ede754 Rename "TIMEWARN" to "SLOW" in bionic gtest.
Bug: 19109188.
Change-Id: Idfe769ac652bf37642da24e4abb6061ca861d57e
2015-01-26 20:56:20 -08:00
Yabin Cui
657b1f9bef Support --gtest_ouput option in bionic gtest main.
Bug: 19109500
Change-Id: Ib18f90ad522e66ea62dd4e02e314585d9b36e15f
2015-01-26 16:53:05 -08:00
Yabin Cui
516eb53113 Remove testcase time printing in bionic-unit-tests.
Bug: 19075565
Change-Id: Icccb60657a2985e96abb1703673f0ebe2199586a
2015-01-20 14:46:03 -08:00
Yabin Cui
be837360c3 Make bionic-unit-tests default run isolate mode.
Fix bug of handling signal terminated tests.

Bug: 17589740
Bug: 18951146
Change-Id: I4803382b26cd5454693090202b3ba38e3dbe66e5
2015-01-08 20:34:58 -08:00
Yabin Cui
294d1e2c9e better gtest runner for bionic
1. option to run each test in a separate forked process: "--isolate".
2. warnings about slow tests: "--warnline".
3. run multiple tests at the same time: "-j N".

Bug: 17589740
Change-Id: Ife5f4cafec43aa051ad7bd9c9b2b7e2e437db0de
2014-12-13 18:53:34 -08:00