Following suggestions in b/194659728, update the python script to work
under python3.
Previous failure:
Traceback (most recent call last):
File "/android3/android/master/development/scripts/lldbclient.py", line 413, in <module>
main()
File "/android3/android/master/development/scripts/lldbclient.py", line 405, in main
do_main()
File "/android3/android/master/development/scripts/lldbclient.py", line 400, in do_main
raw_input("Press enter to shut down lldb-server")
NameError: name 'raw_input' is not defined
Bug: none
Test: "lldbclient.py --setup-forwarding vscode-lldb -r
/data/nativetest64/inputflinger_tests/inputflinger_tests
--gtest_filter=PalmRejectorTest.GenericAxisValue_IsNotSet"
Change-Id: I21d977cbc580894d6e2eb2f2f56dec04c65b0416
A recent change to remove empty tests runs cargo test --list. A few
crates produce build errors this way that they did not previously do.
This currently causes cargo2android.py to produce illegal Android.bp
files for these crates even though these should not be fatal errors.
We thus detect these errors and emit them as comments in the
Android.bp file, so developers can see them but the crate can still
compile.
Test: Run on crates with and without such errors.
Change-Id: I8664d3ca9a6b4c513ce0ef35821aa64d22949fc7
cargo2android.py prints out all of its arguments to the top of the
Android.bp file (and into a config file if that option was set) as a
way of persisting them. However, we do not want to persist the
--cargo_bin directory, as this is a proprety of the local setup and
not the crate itself. Thus ensure we don't print this.
Test: Run with argument.
Change-Id: If5292d1d740b08755ba6d31654239e93232fdc49
This reverts commit 4f4ac2f8f3.
This did not work for all crates (specifically, those with build.rs,
as they don't get passed RUSTFLAGS, as well as proc-macros, since they
get the flag but can't use LTO), so we're using a different approach
where this is not desired.
Test: Run script
Change-Id: Ib1a86d4822f51978cd8ec15ad657eb25c84e01a4
The latest compiler roll also enabled LTO. This broke
cargo2android.py, as the test prebuit uses LTO and so cannot be linked
with code built without. We fix this by enabling it in
cargo2android.py (and ensuring it doesn't add the flag into
Android.bp).
Test: Run
Change-Id: I6c6a813ff58a9e5064752aa59b78247c4af77a26
Use lru_cache(maxsize=None) instead which is equivalent,
and is available on older python versions as well.
Also fix a bug where null "lib" variable was dereferenced.
Bug: 204507951
Bug: 171980804
Test: Run script with python3.7
Change-Id: I922ee48451ad3c60c2237fb0554e1838c1bf81af
If the parsed backtrace has ELF build-ids, use them to
brute-force search for files in the symbols directory.
The search only considers files with the same basename,
so the number of candidates to check is very small.
This fixes issues when compile time directory does not
match the runtime directory on device (e.g. for apex).
Bug: 171980804
Test: ART crashes can be symbolized again
Change-Id: I0311a10c1e2eab92ee44f1b32c523d4763a54ee1
Fix a problem with python3 and the zipinfo processing of an apk.
Add sorting of the zipinfo data since it's not guaranteed that
the zip entries will be in sorted order, so sort them.
Bug: https://github.com/android/ndk/issues/1587
Test: Ran a apk stack line through the script.
Test: Ran the stack core unit tests.
Change-Id: Ie5ea67ad54a6b2de077e53740c82265f6bf783c6
To work with the updater, these files must have a certain prefix.
Test: Run with --help and upgrade a crate.
Change-Id: Icdc492479223865c39d6c6f10b84fe3d762f5d1d
cargo2android.py currently builds whatever cargo does, which includes
empty tests. We can filter those out by parsing the output of "cargo
test" and looking for things with no tests.
Fixes: 159039990
Test: Run on a crate with empty integration tests, one with empty unit
tests, and one with no empty tests.
Change-Id: If8b1126d82ce6c2851b90de738ea24b129b81feb
Previously we would keep the +x.y.z part, which caused errors in Soong.
See the diff between the first two patchsets in aosp/1833319 for an
example.
Test: Fix the above CL and run on a crate without a +.
Change-Id: I791c85545e67b54e2c8952428211688e7bbf580d
If you passed --no-pkg-vers to cargo2android.py, it would still
generate cargo_pkg_version with an empty string. Instead, simply
don't generate anything.
Test: Use with and without argument.
Change-Id: I544e4789312ccc3481da73c78f0f2cae2ad6619c
Modify the library lookup code to try and find the various places
that a library might really exist in the symbols directory. This
is for atest which can run executables in different locations
than the actual where the symbolized file exists.
Test: Ran using /data/local/tmp, /data/local/tests,
Test: /data/local/tests/vendor, /data/local/tests/unrestricted and
Test: verified the correct library was found.
Test: Used tombstones crash data and verified all libraries
Test: still found properly.
Test: Ran atest CtsBionicTestCases and verified the symbolized
Test: binary could be found using a real tombstone crash.
Test: Did the same as above, but changed the path in the tombstone
Test: crash data from /data/local/tmp to /data/local/tests and
Test: /data/local/tests/unrestricted.
Change-Id: Iaa121823ef6142eaf9f7de3232b147bd7389bea5
This is the one remaining feature in vendor/google/tools/stack that
isn't in the "One True" stack script.
Bug: http://b/199390145
Test: manual
Change-Id: I9dd832f6fb5767c3ad3263c1ffc7dfdb0103e535
The existing code only adds it to things without defaults. This adds
it to the defaults module itself, which should not overlap the
existing code.
Test: Run and see new entries.
Change-Id: Iaf3d0b47193bb1f54cdc605c88c2cd68034d963a
The previous commit to this file allowed it to create and upload a
commit when a TEST_MAPPING file changed. But it did not handle the
case where the TEST_MAPPING file did not previously exist. This fixes
that.
Test: Run script.
Change-Id: Id7b9e778c2b084f7ea2e4005a173c1fedeccd6c7
This will make it easier to run it on many crates and upload all of
the changes. It puts the uploaded CLs in a topic to save resources.
If the script does not change a TEST_MAPPING, it does not upload
anything.
Test: Run on a subset of crates.
Change-Id: I47b4756d968c54d7d810c8a19a8a7419aebc6e15
This argument has already been deprecated, but now there should be no
more uses of it. Let's remove it and the remaining logic.
Test: Run the updater.
Change-Id: I8ab6f6fadba3b462567237d18ddc02cc4c22e62f
When generating a config file from a commandline, cargo2android.py
should not dump the --config argument, as the point of the dump is to
generate a config file to use. This would not normally matter, but it
could help in scripts.
Test: Run and do not see --config in the dumped file.
Change-Id: Idc2911ba674e67272c9cf836c89607e10ca0dddd
Image support doesn't make sense for test modules.
Bug: 178565008
Test: Generate rustc-demangle-capi
Change-Id: Ie5a1d85f9828e0c105c3a3e994b22ef7664fe1db
staticlib and cdylib crate types generally want to export header files
for use by C code. Allow the location of these headers to be provided to
c2a for inclusion in blueprint.
Bug: 178565008
Test: Generate rustc-demangle-capi
Change-Id: I0aa9acfb081ea39a7e13315bfc8029d06b8f55d3
We no longer use the --dependencies argument, but it is still used in
a number of places. Let's remove its functionality but keep the
command-line option as a no-op so we can remove the uses over time.
Test: Run on crate that uses the option.
Change-Id: I954f68faf11d1a926f0ccf070afa8332385e3671
Only run cargo metadata on the main crate, not all of its dependencies.
Pass it the --format-version argument to avoid a warning and be
future-proof.
Test: Run.
Change-Id: Icdf88bc3b633d18266772ae813fc04b529b95765
Older versions of Python's subprocess do not have capture_output, so
just get stdout directly.
Also pass the full path to cargo in case it is not on PATH.
Test: Run
Change-Id: I368e905a93b344bca6635c6ab7a60def809e88d5
If there are multiple packages present in the workspace, attempt
to determine what the current package is by checking the emitted
crate_name value against the package name. If this still fails, a new
`--no-pkg-vers` flag is added to skip this behavior.
Bug: 196803495
Test: New logic finds package if package.name is used for crate_name
Test: New flag prevents emitting the pkg version.
Change-Id: I152e94a0520f09f37622a6cec340ae35842d56ea
This parses a module's Cargo.toml file for package version number,
setting it to cargo_pkg_version. Also sets cargo_env_compat true by
default.
Bug: 171011485
Test: generated Android.bp includes cargo_env_compat, cargo_pkg_version.
Change-Id: Ibb8021633719650e2021b90806374a5d3c6a161a
The branch needs to be specified in our generated OWNERS file or some
tooling will fail to find the correct OWNERS file.
Bug: 191797059
Test: New OWNERS file works as expected.
Change-Id: I91f2af6c5f489daee859b66ae0bd3c19a0bc0a3b
Some tests load data from files. These files thus need to be copied
to the correct location on the host/device so that the tests can
access them. This adds an option to cargo2android.py so that it can
generate these data properties.
Bug: 171710847
Test: Use for a crate.
Change-Id: I14a1ad8aca4625cc5f09807d19ffd7499fcf3689
Adds flags to emit vendor_available and vendor_ramdisk_available flags
to generated modules.
Bug: 194078853
Test: Calling script with new flags generates intended properties.
Change-Id: I4f7a6870b4f210b6627054c98962f50e98bc3e03
The test blocklist was failing when multiple tests were merged into
one. To fix this, when merging tests we prefer ones that are not
blocklisted.
Fixes: 193790055
Test: Run on the previously failing crate and another.
Change-Id: I53d1179bebef824ce80ac4f977015b04a26f8607
This patch ensures that rust_defaults for tests have _tests in the
name. This can make the Android.bp file a bit more readable.
Test: Run on a crate and build it.
Change-Id: I5d034c456052b892bd01c3c041b2572bc9364692