Also hook up the test to Android.bp.
Test: unit test
Test: Ran with a tombstone file as parameter.
Test: Ran pasting in stack to stdin.
Change-Id: I25f40569cc49b7487553611bcc25d061179bfa8d
Generating a TEST_MAPPING file uses Bazel, which can be quite slow
(multiple minutes). Add a flag to allow skipping it. This is off by
default as it ideally will only be used for debugging.
Test: Run all four configurations of --tests and this flag.
Change-Id: I08bde29ea298fcf677addd86f6d953b6695e147f
The code that preserves license blocks currently also preserves
genrules if they come before a rust_ rule, causing them to be
duplicated. Let's fix that.
Test: Upgrade some crates
Change-Id: Ie4f62cd04c2f1dd0de788db0ca5e77502fb3b4c8
We currently seem to emit TEST_MAPPING files in an arbitrary order,
which causes diffs to look confusing even when nothing has changed.
Let's sort them by the test name, which is both stable and easier to
read.
Test: Run cargo2android multiple times and see no TEST_MAPPING diff.
Change-Id: I398aa84a4891380e4292223445bd53959c024421
This test looks like it basically never passed without this.
Test: Run cargo2android.py and see timeout.
Change-Id: Ic7ef5576efb84d78130dd45db67e50ebe41f6d9a
Bug: http://b/160401633
This is a tool for gathering coverage information from a device and
generating an LLVM coverage report from that information. See top of
the file for usage instructions.
Also redirect acov users to acov-llvm when CLANG_COVERAGE is set.
Test: acov-llvm.py wih clean-device, flush and report subcommands.
Change-Id: I5dba3a669bb6ac2797093903536f346228625c05
The path where the tests are uploaded by atest differs from the
path to unstripped binaries in the out directory. As a result,
the script can't symbolize the parts of the stack trace that
correspond to code in the test binary. Add a fixup to use the
correct path.
Test: Used the script on example crashes in framework and vendor
device tests - appears to work and give correct line numbers.
Change-Id: I5470e6342afb801ac596cbc0c0bf067850b1e09a
Change the license detection logic to return if a dual-license was
found. Update the metadata comment as discussed in b/179902335.
Add unit tests for add_module_license and decide_license_type.
Bug: 179902335
Test: atest --host add3prf_test; manually run add3prf.py in {ahash,
libloading, parking_lot, ring}
Change-Id: I3184b5cf0955d124170b9e5987308507bdef6e9a
If the TEST_MAPPING cannot be generated, print the reason, but
exit without error. It's not uncommon for the output of cargo2android
to fail to build e.g. if a new depencency is not satisfied, so we can
fall back to the previous TEST_MAPPING, or run update_crate_tests
locally once all dependencies are present.
Bug: 179132533
Test: tools/external_updater/updater.sh update rust/crates/textwrap
Test: tools/external_updater/updater.sh update rust/crates/libc
Change-Id: I4802c77332d1ab1d6604d48c47365f40bdbd1122
Allow this script to accept a path to the crate being updated.
This allows it to be run separately from cargo2android.
Also, fail gracefully on error. TEST_MAPPING update failures should
not block crate updates.
Test: tools/external_updater/updater.sh update rust/crates/libc
Bug: 179132533
Change-Id: I3a4229f479ab3d2793df16b470f0a0632b9ee495
The aidl tests and ChromeOS tests are not intended to be run in
presubmit, so exclude them.
Test: run cargo2android in external/rust/crates/libc.
Change-Id: I1ed92ed6e88886e3fea38612325ce5349db0fb69
This is important because:
1. Some crates do not have their own tests enabled in presubmit.
2. As much as possible, we try to stick with one version of each
crate. This often results in using different versions of
dependencies than a crate has specified in its Cargo.toml.
Ensuring that a crate's tests continue to pass when its dependencies
are upgraded improves our confidence that the update is safe.
The underlying implementation uses the new Bazel queryview
to query modules and reverse dependencies.
Bug: 168167373
Test: Run cargo2android.py on a number of crates including rusqlite,
scopeguard, lock_api.
Change-Id: Id24f2d3267cf8d5e0369ece2442f8971d4ab1343
Followup to aosp/1548356 to remove the now unused host parameter to add_test.
Test: Manually run script and verify the output.
Change-Id: Id00e56a2dc5523a44dc3cb473702c1ae8785d3db
Instead of generating TEST_MAPPING entries for host tests, we add a
test_options section to its Android.bp entry.
Fixes: 176097100
Test: Manually run cargo2android on a few crates and verify the output
Change-Id: Ia57a53dad6910410c7e7aab6d592fba79720f998
Add support for using lldb with vscode.
Test: lldbclient.py --setup-forwarding vscode -r dalvikvm
Bug: 176158605
Change-Id: I92a08b3b02a27a14be586582fe57acdd670a9ada
We no longer have the rust_library_shared and rust_library_static module
types. They've been renamed to rust_ffi_* instead. This brings
cargo2android.py up to date.
Bug: 175155132
Test: cargo2android's Android.bp for libquiche contains rust_ffi modules
Change-Id: I01bb8b4e56c41d36481ffd363f96aecb770d7cb8
Replace all references to gcc tools with llvm tools. This change still
uses c++filt until llvm-cxxfilt is put in the prebuilts.
Test: Ran a backtrace through this script and the old script and verified
Test: no major differences.
Test: Ran unittests for symbol.py and stack_core.py.
Change-Id: Ic31c1a0707dae11c5037f9637943cd7932badf46
"host: true" entry should go before "name:" to match the output of
json writers which sort by alphabetical order. This will help and
avoid unnecesary changes when adding new tests to TEST_MAPPING - e.g.
aosp/1488728
Bug: 168167373
Test: cargo2android.py --run --tests
verify output
Change-Id: Id346a7f8a2cd910115e7fcc448c589363209bee9
* Suggest --copy-out if it is not used, cargo output files are found,
and env!("CARGO_OUT") is found in .rs files.
* Expect to see this warning for libsqlite3-sys and grpcio-sys,
which fit to the use case of --copy-out but they have locally
defined .bp files and non-original output files.
* Fix one pylint warning of extra long line.
Bug: 172299436
Test: run cargo with same flags for all rust/crates/*
Test: run cargo without --copy-out for anyhow, protobuf, clang-sys, etc.
Change-Id: Ic346c8e1146b1bb77e63c4cb12947f202b0f458e
* The given patch file will be applied to ./Android.bp.
* Use --ignore-cargo-errors when it is impossible to
use the patch file to fix the error messages in Android.bp.
Bug: 172093078
Test: apply on external/rust/crates/*, some with this flag
Change-Id: Ibca2fd4c63e46a32f32c61afedbba960a684f5d7
* Save Cargo.lock before calling cargo, and restore it after the run.
* Use the --use-cargo-lock flag if the latest dependent crates failed
to build the current crate. In this case, the published Cargo.lock
will be used, but the generated .bp might not work with the other
latest dependent crates in external/rust/crates.
* Fix one gpylint warning.
Bug: 172016745
Test: run through all external/rust/crates/*
Change-Id: I1874a706ac15b74c1dd5a606983b107284d9b28a
* When --copy-out is used:
* copy build.rs output files to ./out
* add a genrule module to copy ./out/* files to its output dir
* add this copy-out genrule module into the srcs list
This makes include! with $OUT_DIR path work without local patch.
This only works for the root directory (package).
* Upgrade to python3 for some required shutil and glob functions.
* Unified dump_srcs_list for defaults and non-defaults modules.
* dump_android_property_list output only one line for a single item list.
Bug: 171659849
Test: regenerate all .bp files in rust/crates/*
Change-Id: Ia7dde0ccede2bcc068f23a046e85304c6f50b0b0
* Handle lower case file names like LICENSE-Apache.
* Use "license" key value in Cargo.toml if LICENSE-* files are missing.
* Recognize license type: ISC
* Improve readability of a sequence of if-statements.
Bug: 170254513
Test: get_rust_pkg.py --add3prf time-macros-impl
Test: run add3prf.py in current rust/crates/* projects
Change-Id: I9642f52090b20922302513a94fa97d41277f9762
* add3prf.py can be called in existing rust package directories
to normalize METADATA, OWNERS, and other LICENSE* files.
* Add option in get_rust_pkg.py to call add3prt.py and add
required files for 3rd party reviews.
Bug: 170254513
Test: call add3prf.py in external/rust/crates/*
Test: get_rust_pkg.py --add3prf quote remain paste
Change-Id: I70ed5942847716af2ca740a91e7ecde50543b7a0
* Now a host cargo build uses the same --target flag as a default
device build.
* When --device is given without --no-host or other device flag,
we can use one cargo build to get the required rustc flags for
both host and device builds.
* We still need merge_host_device because cargo build --test could
recompile a library and create duplicated calls to rustc.
* Fix a gpylint warning missing-function-docstring.
* This change also detected a bug in
external/rust/crates/structopt-derive/Android.bp
The cargo build --tests for device was optimized out
and the device test module was missing in Android.bp.
Bug: 169872957
Test: regenerate all .bp files in external/rust/crates
Change-Id: Ieabdc5a99534a60e4d459c9a966f7a867104c785
Binaries built from RBE are using a source path under /b/f/w. Also map that to local source path.
Test: lldbclient.py -r /system/bin/ls
Change-Id: I02a90a9c827189a14b2d83485ed2abda68f9e084
ro.product.name can be individual device name and not the lunch target
name.
466e289dc8 removed this check but we
still need this.
Bug: 166071019
Test: gdbclient.py -n vold # on eve
Change-Id: I60fc20e6cc02ca6dd01fef609c7f60e76c580876
* Problem to solve:
When cargo2android.py is run under external/crosvm,
it does not generate .bp file in some subdirectories like kvm.
* Use --add_workspace flag to append [workspace] in Cargo.toml
temporarily to generate correct relative source file paths.
Otherwise, the path will be based on parent/root package
such as external/crosvm.
* Use --global_defaults=default_name flag to insert a global
default module name like "crosvm_defaults" in every module.
* Use --no-subdir flag to generate .bp file in one directory,
and skip all changes to subdirectories.
* Sort the option names so they show up in order with --help.
* Use relative path for local dependent packages.
* Example: run in external/crosvm with flags;
--run --tests --dependencies --no-subdir
fix-up external/crosvm/Android.bp file,
and then run in each subdirectory with flags:
--run --tests --dependencies --add_workspace
--global_defaults=crosvm_defaults
* Add rename mapping:
libminijail ==> libminijail_rust
Bug: 161716839
Test: regen .bp files in external/crosvm subdirectories
Test: make && atest -m -c --include-subdirs external/crosvm
Change-Id: I0c08d358cc2f88f66e99b59032613d2a5b4ea5eb
* Accept both "-C flag" and "-Cflag" syntax.
* Newer cargo uses "-Cembed-bitcode=no".
* Some -C flags are filtered out, not used in .bp file,
because they are meaningless in .bp file build system.
* Remaining -C flags are passed to rustc in .bp files,
which was missing before this change.
* Look up cargo in the prebuilts directory.
* Now limit this script to run only on linux.
* Try to find cargo/rust version from
build/soong/rust/config/global.go first.
* Otherwise, use the latest (largest) version in prebuilt.
* Add a new --cargo_bin flag to use any user-selected cargo.
* Add the selected cargo directory to PATH before calling cargo,
so it can find rustc in the same directory.
Bug: 161825397
Bug: 161927172
Test: regenerate and check .bp files in external/rust/crates
Change-Id: Ica46f536c2b37b62238d1245ced59685deebad33