Commit graph

26 commits

Author SHA1 Message Date
Mitch Phillips
1a8405f827 Add MTE ELF note to makefile-generated native tests.
The MTE ELF note is intended to be added to all aarch64 test binaries.
This is already implemented for cc_test in soong, but we should also add
it to makefile-generated tests.

Bug: 156029370
Bug: 181133973

Test: atest CtsBionicTestCases on QEMU+MTE, observe previously-failing
      tests will now succeed.
Test: m camera_client_test; readelf -t <snip>/camera_client_test | grep
      memtag, make sure there's the elf note.

Change-Id: I2e7c4d1379ccdef04f05dd7aff675e6834d4799b
2021-03-15 10:45:05 -07:00
Sasha Smundak
da25b691d3 Eliminate ENABLE_DEFAULT_TEST_LOCATION as it is always true
Bug: 117224272
Test: treehugger
Change-Id: Idd47ead31fcd89dbf728f140dc3353e5013ba352
2019-03-25 13:26:03 -07:00
Nelson Li
1f8357fe7d Revert "Revert "Build System: Solve dependency problem for test""
This reverts commit 6fe7f194b9.

Reason for revert: Fixed all build break.

Change-Id: I0a4842df1225399752515a4cd7a7c14173a5bf7b
2019-03-14 01:05:36 +00:00
Nelson Li
6fe7f194b9 Revert "Build System: Solve dependency problem for test"
This reverts commit 224e103308.

Reason for revert: Build Breakage in git_pi-dev-plus-aosp/docs @5366136
make -j110 docs showcommands dist DIST_DIR=/buildbot/dist_dirs/git_pi-dev-plus-aosp-linux-docs/5366136 checkbuild
FAILED:
 Dependencies in out found with no rule to create them:
 out/target/product/generic/data/app/CtsVerifierTester/CtsVerifierTester.apk
 out/target/product/generic/data/app/TradeFedTestApp/TradeFedTestApp.apk
 out/target/product/generic/data/app/TradeFedUiTestApp/TradeFedUiTestApp.apk
 15:53:46 stopping
and
make -j50 showcommands dist TARGET_PRODUCT=cf_x86_phone DIST_DIR=/buildbot/dist_dirs/git_master-linux-ndk_translation_all/5366149 ndk_translation_all
FAILED: ninja: 'out/target/product/vsoc_x86/data/nativetest/arm/arm_insn_tests_arm_static/arm_insn_tests_arm_static', needed by 'out/target/product/vsoc_x86/obj/PACKAGING/ndk_translation_tests_intermediates/arm_insn_tests_arm_static_result.xml', missing and no known rule to make it
15:55:38 ninja failed with: exit status 1
make: *** [run_soong_ui] Error 1
Return Code: 2

Change-Id: Idf95ef2e06526a0a31690420c923207db627605f
2019-03-11 16:48:29 +00:00
nelsonli
224e103308 Build System: Solve dependency problem for test
1. A test can add a runtime dependent test module by just setting
   LOCAL_REQUIRED_MODULES or LOCAL_TARGET_REQUIRED_MODULES. Then the dependent test
   module will be copied to testcase folder.
2. Do not install to $(TARGET_OUT_DATA) for testcase

BUG: 117224272

Test: 1. (a) vi cts/tests/tests/text/Android.mk
         (b) add LOCAL_REQUIRED_MODULES := CtsPrintTestCases
         (c) m -j CtsTextTestCases
         (d) Then, CtsPrintTestCases should also be built to testcase folder like below.
             ./target/product/generic_arm64/testcases/CtsPrintTestCases

Change-Id: I24ea3783486c54a05cfa9d3d0375b977afc230f8
2019-03-07 14:08:35 +08:00
Dan Albert
19fbd1ce39 Remove support for stlport.
Test: make checkbuild
Bug: None
Change-Id: Iaaaecbe2608fe7a880236f3bbad0fcfcf62b5096
2018-01-05 11:49:43 -08:00
Dan Albert
94f95cf504 Remove support for gnustl.
Test: make checkbuild
Bug: None
Change-Id: Iaddd40b32f84395a76efaaa74be38770085617d5
2018-01-05 11:49:43 -08:00
Dan Willemsen
9416c20b79 Support non-gtest NATIVE_TESTS
We've had this in Soong for a while, but never supported it in Make.

Bug: 33819328
Test: Change LOCAL_GTEST on a module, check m -j ... showcommands
Change-Id: Id8f4b9908c82c05d9a986a38945b33bac578e991
2016-12-21 20:27:06 -08:00
Dan Albert
f5d024d31a Update NDK gtest lib names.
The NDK gtest libs are always suffixed to simplify the make macro
that generates the test modules.

Bug: http://b/16574165
Change-Id: I1c9647e90aff2f1e9da4a88cad30199b1e423757
2016-09-08 23:10:20 -07:00
Dan Willemsen
e1c6deab10 Finish refactoring tests to NATIVE_TESTS
Now that the source trees all use NATIVE_TESTS for intermediate files
and generated sources, make it a requirement.

Change-Id: Id5718fabe63f6e8dde7981a6f0f5bd89e0ec7ee5
2016-06-22 00:27:54 -07:00
Dan Willemsen
7fe992c0cc Add NATIVE_TESTS class, move host native tests
Host native tests have been getting installed into
out/host/linux-x86/bin/..., but this pollutes the bin directory with a
lot of poorly named tests. Also, to support 32-bit and 64-bit tests, we
need to have different names with different suffixes. This causes
problems when tests expect to be named something specific (like gtest).
It's also convenient to store test data next to the test itself.

So with this change, native tests will be installed in
out/host/linux-x86/nativetest[64]/$(LOCAL_MODULE)/$(LOCAL_MODULE_STEM)
just like target tests get installed into /data/nativetest[64].

Implement this using a new NATIVE_TESTS class, which is like
EXECUTABLES, but sets up the install path differently, and configures
the rpath to load shared libraries with the proper relative path.
LOCAL_MODULE_RELATIVE_PATH can be used to control the directory name, it
will default to $(LOCAL_MODULE). This way multiple related tests can be
grouped together.

Target native tests also use NATIVE_TESTS now, but nothing should change
other than LOCAL_MODULE_RELATIVE_PATH can be used.

Change-Id: I535e42b1a6b21c5b8d6a580aa2f944d2be35e27d
2016-05-24 12:43:16 -07:00
Dan Albert
b05cf54432 Add support for multiple flavors of the NDK gtest.
Since gtest depends on the STL, we need one version for each STL.

Bug: http://b/27801981
Change-Id: Id1a5571b043e2513d0184a9ab45a473dd545da84
2016-03-23 13:25:06 -07:00
Dan Albert
e5ecdc967d Get gtest includes from the exported headers.
Change-Id: I47db781a36318664fabff8a5e75031c6bee674e4
2016-03-02 13:05:46 -08:00
Colin Cross
3a0a8918b2 Link libgtest_main before libgtest
libgtest_main uses symbols from libgtest.  If libgtest_main is linked
after libgtest, and the test .o files don't reference libgtest (which is
unlikely), then the libgtest .o files will be ignored and libgtest_main
won't be able to find its symbols from libgtest.

Change-Id: Ica3bc679bd9d14e9a3065be927f085cf52faab64
2015-09-25 16:11:31 -07:00
Dan Albert
8914f71cc0 Remove logic for platform stlport gtest.
Now that the platforms stlport linked gtest is gone, we don't need the
logic for this any more. All platform tests will use libc++ (which has
been renamed to libgtest without a suffix).

Note that tests built with the NDK will still use stlport, but they
will use the NDK's stlport, not the platform's.

Bug: 15193147
Change-Id: Ifcb2489ed60c41e4ed028096b516c1ee643de907
2014-11-11 17:45:45 -08:00
Dan Albert
93766b28ce Make libc++ the default STL.
Previously, code defaulted to using libstdc++ (which was GNU libstdc++
on the host, or Bionic's "libstdc++" on the target). Now we default to
libc++. The exception for this is when using mingw, because we cannot
build libc++ for mingw.

Change-Id: I68726fa26cdcb6263f17c838d3e859debd57fae1
2014-11-07 13:24:56 -08:00
Dan Albert
683c392e07 Fix detection of C++ STL for tests.
Target tests weren't approrpiately using the libc++ gtest for
libc++_static, and the hosts tests were still using the old check.

Change-Id: I13813d5f09673b144b2dfead93eb81cb4bae0e34
2014-09-26 15:45:33 -07:00
Dan Albert
4bbc6c790b Add option for generating coverage info.
To enable building with coverage, the environment variable
NATIVE_COVERAGE must be set to true.

Set `LOCAL_NATIVE_COVERAGE := true` to generate coverage information for
a given component.

This is currently not supported for clang (b/17574078, b/17583330).

If static library A is included in a binary B (dynamic or static
executable, or shared library), and A is built with coverage
information, B is required to link with libgcov.a. Since the make does
not offer a good way to track this dependency, link libgcov.a even if
LOCAL_NATIVE_COVERAGE is not set (but still guarded by NATIVE_COVERAGE).
This ensures that all of the libgcov dependencies will always be
resolved, and causes no change in the resulting binary if coverage is
not used.

Bug: 10134489
Change-Id: Id5a19f2c215e4be80e6eae27ecc19b582f2f6813
2014-09-23 15:19:02 -07:00
Dan Albert
b05f2ca150 Move selection of C++ STL into the build system.
Preparing for migration from stlport to libc++. STL selection is done
with LOCAL_CXX_STL (valid values are default, none, libc++,
libc++_static, stlport, stlport_static, bionic).

The selection of the STL is as follows:

    if LOCAL_CXX_STL == 'default'
      ifdef LOCAL_SDK_VERSION
        Use whatever STL the other NDK options have selected.
      else
        Use bionic's libstdc++ for target, GNU libstdc++ for host. This
        is compatible with the existing build options.
      endif
    else
      if LOCAL_CXX_STL == 'stlport'
        Use stlport.
      else if LOCAL_CXX_STL == 'libc++'
        Use libc++.
      else if LOCAL_CXX_STL == ''
        Don't use any STL.
      endif
    endif

Bug: 15193147
Change-Id: If712ba0ae7908d8147a69e29da5c453a183d6540
2014-09-18 16:38:20 -07:00
Ying Wang
4b1c95d8d2 More consistent use of 64-bit build variable.
Set up TARGET_IS_64_BIT and HOST_IS_64_BIT early so we don't need 2
mechanisms to judge if it's 64-bit build;
Remove the unnecessary 32-bit host variables.

Change-Id: I08d6d4d9ea70f91135fe2ee05463fb9a0d1cee42
2014-07-08 18:04:17 -07:00
Ying Wang
c02752473f Merge "build native tests for 32-bit and 64-bit" 2014-06-09 22:53:00 +00:00
Dan Albert
9b0c6ff69c Use libc++ versions of gtest libs when needed
Change-Id: Id8752ea946cbaa747dfa4fccf38d680dfeee5b45
2014-05-16 14:55:50 -07:00
Dan Albert
965bfefb6b Use libc++ versions of gtest libs when needed
Change-Id: I19aa58a83a9da680d441af5f3956a2fbdf18c4e4
2014-05-16 11:22:44 -07:00
Ben Cheng
e34bb09eab Explicitly link libstdc++.a for static gtest executables.
Change-Id: I29e3a4036264acd00dfa3229c9d0fc52ee20830e
2014-04-16 09:42:56 -07:00
Colin Cross
8c141e7e9f build native tests for 32-bit and 64-bit
32-bit tests will build into /data/nativetest
64-bit tests will build into /data/nativetest64

Change-Id: I31492c7d1273ba18bb2577fae150008a214c3bf4
2014-03-26 13:13:23 -07:00
Christopher Ferris
70ca5e5b39 Add library test makefile solutions.
Change-Id: Ibc8df9b0e2342683158936bf011425780df8f02a
2014-02-05 16:36:42 -08:00