summaryrefslogtreecommitdiff
path: root/rust/test_test.go
AgeCommit message (Collapse)Author
2025-02-12Don't panic in ModuleForTests and friends Colin Cross
Panicking in ModuleForTests and similar test helper functions was a mistake. Go's test runner stops running tests as soon as any test panics, which means debugging multiple tests panicking requires rerunning all the tests after fixing each panic to find the next one. Pass the *testing.T into ModuleForTests and friends so that it can call t.Fatalf instead. Test: all soong tests pass Change-Id: I5d0f2424eaf04fb795079e6d1e4b9469d8c7033c
2024-08-21Access output files thru providers in Soong tests. Yu Liu
The outputFiles field on ModuleBase will be removed next. Bug: 358425833 Test: CI Change-Id: I6d665ac13134d9278e5908f64c454366bc6bca5e
2024-06-24Add OutputFilesProvider support for singleton mrziwang
This CL also changes to use OutputFilesProvider on rust module, which has singleton involved. Test: CI Bug: 339477385 Bug: 348494466 Change-Id: Idc5c0fb9f8425f09184d5b73531ee3052e5a076c
2023-11-17Fix soong for go test ./... Colin Cross
Fix various issues that prevent building or running tests with the Go tools: Remove testing/test_spec_proto/go.mod. There's already a go.mod at the top level, and adding testing/test_spec_proto/go.mod breaks compiling with the Go tools in IntelliJ or from the command line. Fix go vet issues when trying to print []DataPath. Fix aconfig_conversion_test.go and add it to Android.bp so it runs in presubmit. Test: go test ./... Change-Id: I18af2f05631446fe507744a2951e4b02c7ab59be
2022-04-28Put rust_test.data_libs under lib[64] Jooyung Han
Rust test binary depending on native libraries would require them under lib[64] directory so that the test binary can open them with default rpath values. Bug: 204562227 Test: presubmit Change-Id: I029bb32c4c98fba21bd28e579a9df9f184a7f045
2021-11-15rust: Add data_libs and data_bins to rust_test Ivan Lozano
Allows defining data binaries and libraries that should be installed alongside a rust_test module, similar to cc_test. This refactors cc_test as well so it can define rust_ffi_shared and rust_binary modules as data. Bug: 171710847 Test: New Soong tests pass. Test: Example module installs data appropriately. Change-Id: I0b56098fb475ec54f9b7a761220d260fe68cbee1
2021-01-29rust: Allow rust_tests to include data files. Ivan Lozano
Adds the ability to define data files that should be installed alongside the test. This also fixes a bug wherein rust_test properties were duplicated. Bug: 171710847 Test: rust_test module with "data" property installs files to device. Change-Id: I091489afaf7e76b751a33a28049590d9fb39fe5f
2020-10-09Revert "Make lots of tests run in parallel" Colin Cross
This reverts commit 323dc60712491c71ccdc5363c42df61f0a192487. Reason for revert: Possible cause of test instability Bug: 170513220 Test: soong tests Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-06Make lots of tests run in parallel Colin Cross
Putting t.Parallel() in each test makes them run in parallel. Additional t.Parallel() could be added to each subtest, although that requires making a local copy of the loop variable for table driven tests. Test: m checkbuild Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2020-09-18rust: Add libstd linkage mutator for rlibs. Ivan Lozano
The current state of linkage is that device targets always link libstd dynamically except for rust_ffi_static which requires a static libstd linkage. However this prevents producing rust_ffi_static modules which depend on other Rust libraries as those dependencies will link libstd dynamically and cause a collision. We also want our rust_test modules to statically link in libstd as well. This adds a linkage mutator for rlibs that creates a variant for each libstd linkage. Dependent modules can then select the variant that matches their linkage of libstd. Also fixes an issue where installation paths were being generated for rlibs and static libs even though they weren't being installed. This broke when adding the linkage mutator as Make would complain about multiple targets producing the same output. Bug: 168729404 Test: rust_ffi_static module with other rustlib dependency can be built. Change-Id: I955b484bf5809e8fc5517750c7f8df82d3ca8895
2020-06-11Make rust_test file output more similar to cc_test. Ivan Lozano
This changes the way the output filename is calculated for rust_test binaries to be more similar to cc_test. This also removes the option to define multiple test binaries in a single rust_test module via the TestPerSrc mutator. Now each rust_test module corresponds to a single test binary. Bug: 158500462 Test: m -j pin-utils_tests_pin_utils Test: m -j unicode-xid_device_tests_unicode_xid Change-Id: I6e0f79dcb4e49fa49d6ebb36abeef67a9eb180a0
2019-11-14Add TestProperties, gen test config, fix names Chih-Hung Hsieh
* Rename testBinaryDecorator to testDecorator * Add TestProperties * Add install function for testDecorator to install config files * Add tradefed.AutoGenRustHostTestConfig * Depend on new build/make/core/rust_host_test_config_template.xml and new tradefed.testtype.rust.RustBinaryHostTest class * Add autogenTemplateWithName in tradefed/autogen.go to generate config files with customized(mutated) executable name. * Make rust_test module names more robust and easy to use. * Use crate name instead of source file name as the Stem for single source file modules, to match original user specified output file name in Cargo.toml. * Do not set up test module SubName when Stem is empty or when the module name already contains Stem suffix. That happens when TestPerSrcMutator is disabled or when there is only one source file with renamed output file name. * In TEST_MAPPING, references to mutated rust_test modules should be (1) <module_name> for single source file modules without mutation, or (2) <module_name>_<crate_name> for single source file modules, or (3) <module_name>_<source_file_base_name> for multi-file modules. Bug: 140938178 Test: mm in rust projects, check output test file names Change-Id: Ifdbfa14d5eed4f10b4fb983f82c93bbb9be3f899
2019-10-29Add rust_test and rust_test_host. Chih-Hung Hsieh
* 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