Native compiler flags are currently applied in approximately:
global cflags
local cflags
local include dirs
global include dirs
global conlyflags
local conlyflags
global cppflags
local cppflags
This means that a flag that is enabled in the global cppflags
cannot be disabled in the local cflags, and an Android.bp author
must know to disable it in the local cppflags. A better order
would be:
global cflags
global conlyflags
global cppflags
local cflags
local conlyflags
local cppflags
local include dirs
global include dirs
We are mixing both the global and local cflags into a single
variable, and similar for conlyflags and cppflags, which
prevents reordering them. This CL prepares to reorder them
by splitting the global and local cflags into separate variables.
Bug: 143713277
Test: m native
Change-Id: Ic55a8c3516c331dc5f2af9d00e59ceca9d3e6c15
* Rust tests are like binary files compiled with --test.
New test.go follows binary.go code patterns and reuses
some code in binary.go.
* Generate one test per source file as testPerSrc in cc/test.go.
The "all tests" variation feature of cc/test.go is not copied yet.
Fix some Stem and SubName settings to make testPerSrc work.
* Move cc.CheckDuplicate to android.CheckDuplicate,
which is now shared by cc and rust.
* Refactor tests in binary_test.go and add new test_test.go.
Bug: 140938178
Test: mm in rust projects, added rust_test and rust_test_host
Change-Id: Ia6fec8b4cf2572fd352ab1938a1f3c7b5cca2212
Attribute `auto_gen_config` is added to test modules.
Test config will be generated if:
the attribute is not set and AndroidTest.xml doesn't exists
or
the attribute is set to true, whether or not AndroidTest.xml exists.
Test config will NOT be auto-generated if:
the attribute is not set and AndroidTest.xml exists
or
the attribute is set to false, whether or not AndroidTest.xml exists.
Bug: 141684102
Test: build test module with auto_gen_config set to true
Change-Id: I64fb003a83d8c32a967835e5f8d12fe4476043be
The new option will allow the auto-generated test config for cc_test to
include MinApiLevelModuleController and check the api-level before test.
Bug: 140912549
Test: 1. $vi platform_testing/tests/example/native/Android.bp
2. add
test_min_api_level: 29,
or
test_min_sdk_version: 29,
3. $m -j hello_world_test
4. check hello_world_test.config
Change-Id: Ic742d41898928df1637890bec87796d90e886516
The new option will allow the auto-generated test config for cc_test to
include RunCommandTargetPreparer to disable framework before the test
run and re-enable it after the test run.
Bug: 140065309
Test: test hello_world_test with the new option.
Change-Id: If2189e9474f5b11bd0d0471e231a2cae14155389
If a test module with a `test_per_src` property set to `true` is
included in an APEX module, add all the variants for mutator
`test_per_src` as dependencies of the APEX module (not just the
first one).
This is done by adding variation "" of mutator `test_per_src` when
adding a test dependency to an APEX module, which creates an indirect
dependency of the APEX module on all the `test_per_src` variants of
the test module. When generating outputs for the APEX bundle, fetch
and include the set of test outputs from the "" variant.
Test: m (`apex/apex_test.go` amended)
Bug: 129534335
Change-Id: I1c99855971a8a9b2fc5b964a420e882b6791d4e6
Have `cc.testPerSrcMutator` create an additional variation named "",
having no sources (and generating no output file), but depending on
all other `test_per_src` variations and collecting their output files
in a new field named `cc.Module.testPerSrcOutputFiles`. This is useful
in the case where a module depends on all the `test_per_src`
variations of a test module.
Test: m
Bug: 129534335
Change-Id: I905decc0b9417f47cee9113466677d3bb61ad7b6
If liblog is a static library, then unit tests cannot properly
override log functions.
Test: Build isolated tests and run them.
Change-Id: Id202c5950518408ce66ceea70988dde8080fd1f9
require_root is added to allow auto-generated test config to include
RootTargetPreparer so the test runs with root permission.
Bug: 134509111
Test: add "require_root: true" to init_benchmarks and libpower_test
build the modules, confirm the extra target preparer is added in the
test configs.
Change-Id: Ia07503e338935d6aa92560e7cf7b18d2a4c51243
Added synopsis to the following modules under cc package:
* cc_binary
* cc_binary_host
* cc_defaults
* cc_genrule
* cc_test
* cc_test_host
Bug: b/128337482
Test: Generated the documentation and verified that the
synopsis was added to each of the module.
Change-Id: I23b7eda449c340783d7cc592df5d2bd399255bf9
Feature request from developer, support setting uid in Android.bp.
This relands I5604af5f20c45728d19f4c01396a20a74997f8a8 on top of
I2210c15b84f9b30e1cc23b426d463b34cf9ef94f.
Bug: 113359343
Test: source build/envsetup.sh ; lunch
vim platform_testing/tests/example/native/Android.bp
add
test_options: {
run_test_as: "1234",
},
in cc_test
make hello_world_test
cat out/target/product/xxxx/testcases/hello_world_test/hello_world_test.config
Will see <option name="run-test-as" value="1234" />
below <test class="com.android.tradefed.testtype.GTest" >
Change-Id: I0b167c44c00ff0eab51443fc93dd8fa2abbe54cf
Move the logic from ctx.ExpandSources into android.PathsForModuleSrc
and ctx.ExpandSource into android.PathForModuleSrc, and deprecate
them. When combined with the pathDepsMutator this will let all
properties that take source paths also take filegroups or genrule
outputs, as long as they are tagged with `android:"path"`.
Test: All soong tests
Change-Id: I01625e76b5da19240e9649bf26a014eeeafcab8f
Add `android:"path"` to all properties that take paths to source
files, and remove the calls to ExtractSource(s)Deps, the
pathsDepsMutator will add the necessary SourceDepTag dependency.
Test: All soong tests
Change-Id: I488ba1a5d680aaa50b04fc38acf693e23c6d4d6d
In general "srcs" property allows duplication in the list.
But when cc_test's "test_per_src" property is set "true",
there will be variants according to "srcs" list.
Therefore, it should fail if there is a duplicate entry
in srcs list.
Bug: 113629474
Test: mma
Change-Id: I543624459c30dd296494a3a80e28ce5503a3ea2f
If an Android.bp specifies Isolated=true, make sure
it's tagged as not-shardable, since b/126376458 is not
resolved.
Test: make bionic-benchmarks-tests (with and without isolated=true)
Bug: 124024827
Change-Id: I2210c15b84f9b30e1cc23b426d463b34cf9ef94f
Current soong use source code's under cts as the rule for judgement.
Should change to use test_suites define instead.
Bug: 124313692
Test: m hello_world_test, make sure test config be auog-enerated.
Modified platform_testing/tests/example/native/Android.bp
m hello_world_test, make sure test config not be auto-generatetd.
Change-Id: I1bc5216f73329d2a82d9ff29ccbede436dd2976c
This reverts commit d30b940dff.
Reason for revert: sed -i requires an argument on mac, break build on mac.
Change-Id: Iba2db061ae888d265e02b750e50959019cf0f168
* Allow module owner to specify a test_config_template in Android.bp
* The rule goes:
1. When "test_config" is set, Soong uses specified test config
2. If 1 is not true, check if "AndroidTest.xml" exist in the
directory, if so, use "AndroidTest.xml
3. If 1 and 2 are not true, check if "test_config_template" is set.
If so, use module specific template to generate test config
4. Otherwise, use Soong default template for test config for autogen
Bug: 113359343
Test: make
Change-Id: I9fb4b2b266be9e0c7cf23da4a51e1c8ae67cd857
Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.
Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
error while loading shared libraries: libc++.so:
cannot open shared object file: No such file or directory
BUG: N/A
Test: make -j16 hello_world_test
out/host/linux-x86/testcases/hello_world_test/x86_64/hello_world_test
out/host/linux-x86/testcases/hello_world_test/x86/hello_world_test
Change-Id: I0ecb1955cd67295abe12fc19ab811fe046ac5f23
there's no use case for prepending/appending to bool, and string
properties within module struct. Declearing "*bool" and "*string" almost
cover everything user need.
I did see one case that user specify relative_install_path as
path prefix in cc_defaults, and concatenate with the one in real module
to get the final relative install path in Android.bp <bionic/tests/libs>.
Test: m -j checkbuild
Bug: b/68853585
Change-Id: If3a7a2689c3fc307aae136af6bc9c57f27a1e1a0
libm is a default library for device builds, so default it for host
builds as well.
Also removes duplicate additions of -ldl, -lpthread, -lm and -lrt.
Test: m host
Change-Id: I8f7e799d48a1f427e48dcfb1d0ccba93c5f9780b
In most cases, we don't care about arm vs x86 when selecting whether a
module is in a test suite or not, but we do care about whether we need
to add the host or device module(s) to the suite. So enable the arch
mutator.
Test: Add android-specific test_suites property, look in out/soong/Android.mk
Change-Id: I1e258d6e97e18c8d20297568cd8ee8d4161d5023
Change module factories from returning a blueprint.Module and a list
of property structs to returning an android.Module, which holds the
list of property structs.
Test: build.ninja identical except for Factory: comment lines
Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
Add a test_suites property that is passed through to make as
LOCAL_COMPATIBILITY_SUITES.
Test: m -j checkbuild, examine out/soong/Android-${TARGET_PRODUCT}.mk
Bug: 35394669
Change-Id: If05b0f5f7d6dd85228546123bebe32859bcc8186
Allow tests to specify a data property that lists files or filegroup
modules that will be packaged alongside the test. Also add a path
property to filegroup modules to allow shifting the path of the
packaged files, and add ExpandSourcesSubDir to expand the filegroup
sources while including a shifted relative path in the Paths objects.
Test: soong tests, manually adding data to a module
Change-Id: I52a48942660e12755d313ef13279313361b4fc35
Some external test suites (LTP in this case), have their own expected
layout, and don't fit well with our
/data/nativetest/<testname>/<testname> layout, nor do they work with
test_per_src.
So allow setting no_named_install_directory along with
relative_module_path to specify a custom test path:
no_named_install_directory: true,
relative_module_path: "ltp/testcases/bin",
Test: Convert LTP
Change-Id: Ib002c058674e8b960a4fdc3af1a25c8bcaeb1d63
Pass a DepsContext that embeds android.BottomUpMutatorContext
instead of android.BaseContext so that dependency methods can
directly add dependencies.
Test: m -j
Change-Id: Id4c157975d3d6f03efd99785d217bef486a76139
NewLibrary is going to be used for header only libraries. Instead
of adding more boolean arguments, replace the existing ones with
BuildOnlyStatic and BuildOnlyShared calls on the libraryDecorator
returned by NewLibrary.
Test: m -j, compare build.ninja
Change-Id: Id390b66cbf2a5f0932b32f40a5e18eb9e3852ee7
Mutator registration is tightly coupled with the android package, move
all registration from the soong package to the android package.
Test: build.ninja identical
Change-Id: Ie183d0b52cc7431c9e05b231934d189208ef1efe
The google-benchmark library is disabled on Darwin, so we cannot create
host benchmarks. Instead of having every user specify this, put the
logic in Soong. Then if we decide to support it later, it's an easier
switch.
Test: build.ninja identical before/after on Linux
Test: Ignores failing cc_benchmark_host on Darwin
Change-Id: I61f3a571fd160d8e479a512992bc68601f1c9b28
Make gtest property a *bool so it can be overriden by defaults.
Make per-test install directory come after relative_install_path
property.
Change-Id: I2da38965c99c40415a39bf97b706b2d40bb082d6
These had only been exposed for shared libraries.
Also fixes testDecorator to not have two baseInstallers both being
written out to the Android.mk.
Bug: 31158868
Test: manual diff of out/soong/Android-aosp_flounder.mk
Test: Verify installed windows binaries end in .exe
Change-Id: I2bded5fb090117d48ade575b4438e0dedd2e3763