Merge "Make lots of tests run in parallel"
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
// Test that rustlibs default linkage is correct for binaries.
|
||||
func TestBinaryLinkage(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_binary {
|
||||
name: "fizz-buzz",
|
||||
@@ -86,6 +87,7 @@ func TestBinaryPreferRlib(t *testing.T) {
|
||||
|
||||
// Test that the path returned by HostToolPath is correct
|
||||
func TestHostToolPath(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_binary_host {
|
||||
name: "fizz-buzz",
|
||||
@@ -100,6 +102,7 @@ func TestHostToolPath(t *testing.T) {
|
||||
|
||||
// Test that the flags being passed to rust_binary modules are as expected
|
||||
func TestBinaryFlags(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_binary_host {
|
||||
name: "fizz-buzz",
|
||||
@@ -143,6 +146,7 @@ func TestStaticBinaryFlags(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLinkObjects(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_binary {
|
||||
name: "fizz-buzz",
|
||||
@@ -162,6 +166,7 @@ func TestLinkObjects(t *testing.T) {
|
||||
|
||||
// Test that stripped versions are correctly generated and used.
|
||||
func TestStrippedBinary(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_binary {
|
||||
name: "foo",
|
||||
|
@@ -20,6 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func TestRustBindgen(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_bindgen {
|
||||
name: "libbindgen",
|
||||
@@ -66,6 +67,7 @@ func TestRustBindgen(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRustBindgenCustomBindgen(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_bindgen {
|
||||
name: "libbindgen",
|
||||
|
@@ -17,6 +17,7 @@ package rust
|
||||
import "testing"
|
||||
|
||||
func TestSourceProviderCollision(t *testing.T) {
|
||||
t.Parallel()
|
||||
testRustError(t, "multiple source providers generate the same filename output: bindings.rs", `
|
||||
rust_binary {
|
||||
name: "source_collider",
|
||||
|
@@ -21,6 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestClippy(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bp := `
|
||||
// foo uses the default value of clippy_lints
|
||||
|
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
// Test that feature flags are being correctly generated.
|
||||
func TestFeaturesToFlags(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_library_host_dylib {
|
||||
name: "libfoo",
|
||||
@@ -44,6 +45,7 @@ func TestFeaturesToFlags(t *testing.T) {
|
||||
|
||||
// Test that we reject multiple source files.
|
||||
func TestEnforceSingleSourceFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
singleSrcError := "srcs can only contain one path for a rust file and source providers prefixed by \":\""
|
||||
|
||||
@@ -78,6 +80,7 @@ func TestEnforceSingleSourceFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInstallDir(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_library_dylib {
|
||||
name: "libfoo",
|
||||
@@ -108,6 +111,7 @@ func TestInstallDir(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLints(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bp := `
|
||||
// foo uses the default value of lints
|
||||
@@ -180,6 +184,7 @@ func TestLints(t *testing.T) {
|
||||
|
||||
// Test that devices are linking the stdlib dynamically
|
||||
func TestStdDeviceLinkage(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_binary {
|
||||
name: "fizz",
|
||||
|
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
// Test that coverage flags are being correctly generated.
|
||||
func TestCoverageFlags(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRustCov(t, `
|
||||
rust_library {
|
||||
name: "libfoo_cov",
|
||||
@@ -98,6 +99,7 @@ func TestCoverageFlags(t *testing.T) {
|
||||
|
||||
// Test coverage files are included correctly
|
||||
func TestCoverageZip(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRustCov(t, `
|
||||
rust_library {
|
||||
name: "libfoo",
|
||||
@@ -174,6 +176,7 @@ func TestCoverageZip(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCoverageDeps(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRustCov(t, `
|
||||
rust_binary {
|
||||
name: "fizz",
|
||||
|
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
// Test that variants are being generated correctly, and that crate-types are correct.
|
||||
func TestLibraryVariants(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx := testRust(t, `
|
||||
rust_library_host {
|
||||
@@ -71,6 +72,7 @@ func TestLibraryVariants(t *testing.T) {
|
||||
|
||||
// Test that dylibs are not statically linking the standard library.
|
||||
func TestDylibPreferDynamic(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_library_host_dylib {
|
||||
name: "libfoo",
|
||||
@@ -86,6 +88,7 @@ func TestDylibPreferDynamic(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateLibraryStem(t *testing.T) {
|
||||
t.Parallel()
|
||||
testRustError(t, "crate_name must be defined.", `
|
||||
rust_library_host {
|
||||
name: "libfoo",
|
||||
@@ -123,6 +126,7 @@ func TestValidateLibraryStem(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSharedLibrary(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_ffi_shared {
|
||||
name: "libfoo",
|
||||
@@ -145,6 +149,7 @@ func TestSharedLibrary(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStaticLibraryLinkage(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_ffi_static {
|
||||
name: "libfoo",
|
||||
@@ -162,6 +167,7 @@ func TestStaticLibraryLinkage(t *testing.T) {
|
||||
|
||||
// Test that variants pull in the right type of rustlib autodep
|
||||
func TestAutoDeps(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx := testRust(t, `
|
||||
rust_library_host {
|
||||
@@ -209,6 +215,7 @@ func TestAutoDeps(t *testing.T) {
|
||||
|
||||
// Test that stripped versions are correctly generated and used.
|
||||
func TestStrippedLibrary(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_library_dylib {
|
||||
name: "libfoo",
|
||||
@@ -240,6 +247,7 @@ func TestStrippedLibrary(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLibstdLinkage(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_library {
|
||||
name: "libfoo",
|
||||
|
@@ -20,6 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func TestRustProtobuf(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_protobuf {
|
||||
name: "librust_proto",
|
||||
|
@@ -135,6 +135,7 @@ func testRustError(t *testing.T, pattern string, bp string) {
|
||||
|
||||
// Test that we can extract the link path from a lib path.
|
||||
func TestLinkPathFromFilePath(t *testing.T) {
|
||||
t.Parallel()
|
||||
barPath := android.PathForTesting("out/soong/.intermediates/external/libbar/libbar/linux_glibc_x86_64_shared/libbar.so")
|
||||
libName := linkPathFromFilePath(barPath)
|
||||
expectedResult := "out/soong/.intermediates/external/libbar/libbar/linux_glibc_x86_64_shared/"
|
||||
@@ -146,6 +147,7 @@ func TestLinkPathFromFilePath(t *testing.T) {
|
||||
|
||||
// Test to make sure dependencies are being picked up correctly.
|
||||
func TestDepsTracking(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_ffi_host_static {
|
||||
name: "libstatic",
|
||||
@@ -207,6 +209,7 @@ func TestDepsTracking(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSourceProviderDeps(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_binary {
|
||||
name: "fizz-buzz-dep",
|
||||
@@ -294,6 +297,7 @@ func TestSourceProviderDeps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSourceProviderTargetMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
// This might error while building the dependency tree or when calling depsToPaths() depending on the lunched
|
||||
// target, which results in two different errors. So don't check the error, just confirm there is one.
|
||||
testRustError(t, ".*", `
|
||||
@@ -316,6 +320,7 @@ func TestSourceProviderTargetMismatch(t *testing.T) {
|
||||
|
||||
// Test to make sure proc_macros use host variants when building device modules.
|
||||
func TestProcMacroDeviceDeps(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_library_host_rlib {
|
||||
name: "libbar",
|
||||
@@ -343,6 +348,7 @@ func TestProcMacroDeviceDeps(t *testing.T) {
|
||||
|
||||
// Test that no_stdlibs suppresses dependencies on rust standard libraries
|
||||
func TestNoStdlibs(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_binary {
|
||||
name: "fizz-buzz",
|
||||
@@ -358,6 +364,7 @@ func TestNoStdlibs(t *testing.T) {
|
||||
|
||||
// Test that libraries provide both 32-bit and 64-bit variants.
|
||||
func TestMultilib(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_library_rlib {
|
||||
name: "libfoo",
|
||||
|
@@ -21,6 +21,7 @@ import (
|
||||
var stemRequiredError = "source_stem property is undefined but required for rust_bindgen modules"
|
||||
|
||||
func TestSourceProviderRequiredFields(t *testing.T) {
|
||||
t.Parallel()
|
||||
testRustError(t, stemRequiredError, `
|
||||
rust_bindgen {
|
||||
name: "libbindgen",
|
||||
|
@@ -22,6 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func TestRustTest(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_test_host {
|
||||
name: "my_test",
|
||||
@@ -37,6 +38,7 @@ func TestRustTest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRustTestLinkage(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testRust(t, `
|
||||
rust_test {
|
||||
name: "my_test",
|
||||
|
Reference in New Issue
Block a user