Import paths for non-local tests because including tests
directly has proven to be fragile and burdensome. For example,
whenever a project removes or renames a test, all the TEST_MAPPING
files for its reverse dependencies must be updated or we get test
breakages. That can be many tens of projects that must updated to
prevent the reported breakage of tests that no longer exist.
Similarly when a test is added, it won't be run when the reverse
dependencies change unless/until update_crate_tests.py is run for its
depenencies. Importing TEST_MAPPING files instead of tests solves
both of these problems. When tests are removed, renamed, or added,
only files local to the project need to be modified. The downside is
that we potentially miss some tests. But this seems like a reasonable
tradeoff since it's primarily unit tests that are missing, and all
unit tests are always run on the host for every presubmit.
See aosp/2400500 as an example of what test mapping files now
look like after this change.
Test: run it over all projects in external/rust/crates
Change-Id: I2b644f9ebf97968c9928f5b1756b2ab199e8e7ca
The cargo2android.json config file now supports the key "variants" with
a list of entries containing keys and build name suffix. Each entry
will produce a different library (or binary). Keys supplied for each
variant will overwrite any existing ones specified in the config file.
See an example of the protobuf crate on aosp/2368788.
Test: None
Change-Id: Iaca67c7f22718c27b3cb118d9794f1ff01d31c84
The binary for bazel moved from tools/bazel to build/bazel/bin/bazel.
Test: run update_crate_tests.py in a Rust crate. Verify results.
Change-Id: I2e586b59876bfd7146cd92efc90055828bf60eac
Bug: 261529166
Ignore failures when sending the flush signal. Some processes may have
exited after we run `adb shell ps` but before we could send the flush signal.
Test: Successful run of coverage metrics using acov-llvm (as documented in go/android-native-coverage-local-workflow
Change-Id: I2fc0f71bf5f6d810b4124e28d7dd69ebfc2579b3
Signed-off-by: Shaju Mathew <shaju@google.com>
I previously skipped directories, but that can still lead to problems.
So instead, only add paths that are files.
Test: Ran over a stack that failed when trying to run llvm-readelf
Test: on a directory. After this fix, everything get line numbers.
Change-Id: Ide39c5a118d78a822057cc3977d0f532595f798b
The current build id check uses the file utility. Unfortunately, it
doesn't work on all systems. Replace with a call to llvm-readelf and
get the bitness and build id using that data.
Other small modifications:
- Only attempt to get the full path for a library once for each library.
- Do not add directories into the symbol libraries.
Test: Unit tests pass.
Test: Running using a libart.so that file doesn't understand and
Test: verifying the line numbers are correct.
Change-Id: I12c3d3c4599d201c3c01feeb48448fee6c633d71
That seems like a sign none of these are used. (Two of them haven't been
touched since their initial import in 2009!)
Test: treehugger
Change-Id: I76042f6c8fab84669c83aa72cd0b5df13f01ed7c
* Removed import of print function - we only support py3 now
* Switched from set() to a set literal
Bug: None
Test: Regenerated argh_derive
Change-Id: I78bc86ad22c747c5f6ad88e2caa5e707e1ffc381
Cargo now outputs
'unittests src/lib.rs'
where before it output
'unittests'.
Bug: 246384761
Test: Add "test": true to argh_derive, regenerate, observe same bp file
Change-Id: Ieeab83761f5fe7cff88af1ce8293818736a6bb9b
Don't fail the generation of the Android.bp file when those flags are
encountered.
Bug: 243662244
Test: Used on gdbstub, which fixed issues seen in aosp/2191020
Change-Id: I80a6ecd8df7980234552a98ddb1149dc29542ac7
Prevent the script from missing flags (minus-prefixed arguments) due to
the CLI argument being quoted (making the "-" its second character).
This removes the need to manually unquote the args in the few cases
where the code already handles them being in quotes.
Bug: 243662244
Test: -
Change-Id: I37b9aa96dcbbeb04616bddfca657d066b998d7c7
Example where it failed:
tests::sock_send_recv_event: test
1 test, 0 benchmarks
Doc-tests vm_control
0 tests, 0 benchmarks
the "1 test, 0 benchmarks" line wouldn't match the test regex, so it
would mistakenly parse the doc tests line instead and then fail to
generate a rust_test module.
Test: ran on crosvm repo
Change-Id: Id0286165405b58bf84b7261db842e272442c91e8
Previously, we only looked for LICENSE* files. This adds support for
detecting COPYING* files as an alternate representation of the license.
Bug: 234563254
Test: get_rust_pkg.py -add3prf quiche
Change-Id: Ic04ef42f349879be18a4307bd863288dfa81b5fc
If the last line of a Cargo.toml was a `[*]`, then appending
`[workspace]` without newlines would result in an invalid toml file.
external/crosvm/tracing/Cargo.toml is an example.
Test: ran on crosvm
Change-Id: Ib949e7f92d0205b1bc6433d1e231924832ddb536
This reverts commit 2adbd7ed89.
Reason for revert: This doesn't work in all cases. For now I'll
instead use local patches for Cargo.toml :(
Change-Id: I0621796e694e2654a01fe9a38a307fd0a4ab8b15
`Cargo --publish` strips dev-dependencies from Cargo.toml, an issue
that won't be fixed until [1] is resolved, which doesn't seem
likely as it has been open for ~5 years now.
cargo2android needs dev-dependencies listed in Cargo.toml in order
to generate the rust_test in Android.bp, add an option that tells
cargo2android to use the cargo.toml.orig instead of the cargo.toml.
With this change there are now two options that temporarily
update Cargo.toml, so I've pulled these out into a separate class
to clean up the code a bit.
[1] https://github.com/rust-lang/cargo/issues/4242
Test: run against projects with --add_workspace and
--orig-cargo-toml
Change-Id: I3b8633a807c9734981ebde0bef9b73868acf6774
Bug: 234744235
Test: Run cargo2android.py without --cargo_bin
Test: Run in the sandbox without providing --cargo_bin
Change-Id: I4c3744e0e391ab7e4fb6a857483fde5c0015f0ff
string-typed result groups would cause the comparison to fail with a
type error. Explicitly casting results to integer for comparison, then
back to string for concatenation causes things to work again.
Bug: 234744235
Test: Run tool with no --cargo_bin option (and the following patch)
(thus using local cargo version detection) and observe success.
Change-Id: I91d8de925c1b6eca7c9905ea85e1ad90e01fb1f9
The bulk of Rust packages in external/ are OS agnostic and do not care
about individual platform features. This change is intended to reduce
the churn of repeatedly adding new `apex_available` attributes to crates
by defaulting to availability. When landing a new crate which is either
platform revision specific or has an unstable file format, prefer to
set `apex_available: ["//apex_available:platform"]` until you have
thought things through.
Bug: 174862583
Test: Regenerate with no apex_available, see universal availability
Test: Regenerate with apex_available: [], see []
Test: Regenerate with apex_available: [foo], see [foo]
Change-Id: I958597789bfc966caec043d051996284dab7a927
Previous logic would place tests in both presubmit and postsubmit if the
postsubmit_tests configuration was not specified. This is both
unnecessary and wastes resources because presubmit tests are also run in
postsubmit.
Bug: 236006683
Test: Regenerate all TEST_MAPPINGs, manually check postsubmit removal
Change-Id: Ie8ff0e351776711e07bf7646efd916d970254e9c
These modules are not suitable for direct execution on cuttlefish, but
are still built as `rust_test` to get the harness.
Bug: 233924440
Test: Regenerate all TEST_MAPPINGs, pass presubmit
Change-Id: I4aebdb5e36cf3a80780483e0a7ebeb83e9735d29
update_crate_tests would previously assume test_mapping.json existed
when trying to generate a TEST_MAPPING update. This made updating
mappings for the majority of existing crates fail.
Bug: 233924440
Test: Regenerate all Rust TEST_MAPPINGs
Change-Id: I4d9b906f4db233ee0223a3035c1b63bf1ca681f4
I had made this change if there was an offset on the line,
but I didn't make if there is no offset present. Add the
no offset present case.
Bug: 206463081
Test: Ran unit tests.
Test: Modified a normal stack line with libart.so to be
Test: libart.so!libart.so and verified the line numbers
Test: are still present.
Change-Id: I75e3fbe5eaa3a5419a2dca2c4542731c61c7b971
Adds support for configuring TEST_MAPPING output in
update_crate_tests.py by defining a test_mapping_config.json.
The initial option that can be set is whether a test should be a
postsubmit test instead of a presubmit test.
Bug: 229727993
Test: update_crate_tests.py with test_mapping_config.json produces
postsubmit tests
Change-Id: I2f5a336c1af12630cc5df9d2c32ab63ac6099af8
For some reason, apex directory structure in the symbols directory
is not the same as on device.
This means that a directory on device like:
/apex/com.android.art/lib64/libart.so
Is really found in symbols as:
/apex/com.google.android.art/lib64/libart.so
Modify the script to look in both places for libraries.
Bug: 206463081
Test: Verified that libart.so in a backtrace now finds the symbols
Test: libart.so.
Change-Id: I67610e3a236765cc92397c70a769c4aa705f13ce
When the device is not on localhost, gdbclient won't connect to it
properly. If the serial is a tcp address, parse the host and pass that
to gdb-remote.
Bug: 228371506
Test: gdbclient.py -r /system/bin/ls /bin
Change-Id: I635d4bdc483a66ab908f5aa02aa94e2504976a45
aidl_test_rust_service_async is a helper binary and shouldn't be added
to TEST_MAPPINGs. diced_client_test does not work in presubmit yet.
Test: update_crate_tests.py no longer adds those tests.
Change-Id: I565680d2bee31e30bf5db224c46428385ed279a3