Merge "update bp2build tests for cc_yasm + add to CI"

This commit is contained in:
Treehugger Robot
2022-08-09 01:49:37 +00:00
committed by Gerrit Code Review
2 changed files with 31 additions and 30 deletions

View File

@@ -49,6 +49,7 @@ bootstrap_go_package {
"cc_prebuilt_library_conversion_test.go",
"cc_prebuilt_library_shared_test.go",
"cc_prebuilt_library_static_test.go",
"cc_yasm_conversion_test.go",
"conversion_test.go",
"filegroup_conversion_test.go",
"genrule_conversion_test.go",

View File

@@ -20,9 +20,9 @@ import (
"android/soong/cc"
)
func runYasmTestCase(t *testing.T, tc bp2buildTestCase) {
func runYasmTestCase(t *testing.T, tc Bp2buildTestCase) {
t.Helper()
runBp2BuildTestCase(t, registerYasmModuleTypes, tc)
RunBp2BuildTestCase(t, registerYasmModuleTypes, tc)
}
func registerYasmModuleTypes(ctx android.RegistrationContext) {
@@ -34,20 +34,20 @@ func registerYasmModuleTypes(ctx android.RegistrationContext) {
}
func TestYasmSimple(t *testing.T) {
runYasmTestCase(t, bp2buildTestCase{
description: "Simple yasm test",
moduleTypeUnderTest: "cc_library",
moduleTypeUnderTestFactory: cc.LibraryFactory,
filesystem: map[string]string{
runYasmTestCase(t, Bp2buildTestCase{
Description: "Simple yasm test",
ModuleTypeUnderTest: "cc_library",
ModuleTypeUnderTestFactory: cc.LibraryFactory,
Filesystem: map[string]string{
"main.cpp": "",
"myfile.asm": "",
},
blueprint: `
Blueprint: `
cc_library {
name: "foo",
srcs: ["main.cpp", "myfile.asm"],
}`,
expectedBazelTargets: append([]string{
ExpectedBazelTargets: append([]string{
makeBazelTarget("yasm", "foo_yasm", map[string]string{
"include_dirs": `["."]`,
"srcs": `["myfile.asm"]`,
@@ -63,24 +63,24 @@ cc_library {
}
func TestYasmWithIncludeDirs(t *testing.T) {
runYasmTestCase(t, bp2buildTestCase{
description: "Simple yasm test",
moduleTypeUnderTest: "cc_library",
moduleTypeUnderTestFactory: cc.LibraryFactory,
filesystem: map[string]string{
runYasmTestCase(t, Bp2buildTestCase{
Description: "Simple yasm test",
ModuleTypeUnderTest: "cc_library",
ModuleTypeUnderTestFactory: cc.LibraryFactory,
Filesystem: map[string]string{
"main.cpp": "",
"myfile.asm": "",
"include1/foo/myinclude.inc": "",
"include2/foo/myinclude2.inc": "",
},
blueprint: `
Blueprint: `
cc_library {
name: "foo",
local_include_dirs: ["include1/foo"],
export_include_dirs: ["include2/foo"],
srcs: ["main.cpp", "myfile.asm"],
}`,
expectedBazelTargets: append([]string{
ExpectedBazelTargets: append([]string{
makeBazelTarget("yasm", "foo_yasm", map[string]string{
"include_dirs": `[
"include1/foo",
@@ -104,15 +104,15 @@ cc_library {
}
func TestYasmConditionalBasedOnArch(t *testing.T) {
runYasmTestCase(t, bp2buildTestCase{
description: "Simple yasm test",
moduleTypeUnderTest: "cc_library",
moduleTypeUnderTestFactory: cc.LibraryFactory,
filesystem: map[string]string{
runYasmTestCase(t, Bp2buildTestCase{
Description: "Simple yasm test",
ModuleTypeUnderTest: "cc_library",
ModuleTypeUnderTestFactory: cc.LibraryFactory,
Filesystem: map[string]string{
"main.cpp": "",
"myfile.asm": "",
},
blueprint: `
Blueprint: `
cc_library {
name: "foo",
srcs: ["main.cpp"],
@@ -122,7 +122,7 @@ cc_library {
},
},
}`,
expectedBazelTargets: append([]string{
ExpectedBazelTargets: append([]string{
makeBazelTarget("yasm", "foo_yasm", map[string]string{
"include_dirs": `["."]`,
"srcs": `select({
@@ -141,16 +141,16 @@ cc_library {
}
func TestYasmPartiallyConditional(t *testing.T) {
runYasmTestCase(t, bp2buildTestCase{
description: "Simple yasm test",
moduleTypeUnderTest: "cc_library",
moduleTypeUnderTestFactory: cc.LibraryFactory,
filesystem: map[string]string{
runYasmTestCase(t, Bp2buildTestCase{
Description: "Simple yasm test",
ModuleTypeUnderTest: "cc_library",
ModuleTypeUnderTestFactory: cc.LibraryFactory,
Filesystem: map[string]string{
"main.cpp": "",
"myfile.asm": "",
"mysecondfile.asm": "",
},
blueprint: `
Blueprint: `
cc_library {
name: "foo",
srcs: ["main.cpp", "myfile.asm"],
@@ -160,7 +160,7 @@ cc_library {
},
},
}`,
expectedBazelTargets: append([]string{
ExpectedBazelTargets: append([]string{
makeBazelTarget("yasm", "foo_yasm", map[string]string{
"include_dirs": `["."]`,
"srcs": `["myfile.asm"] + select({