Merge "update bp2build tests for cc_yasm + add to CI"
This commit is contained in:
@@ -49,6 +49,7 @@ bootstrap_go_package {
|
|||||||
"cc_prebuilt_library_conversion_test.go",
|
"cc_prebuilt_library_conversion_test.go",
|
||||||
"cc_prebuilt_library_shared_test.go",
|
"cc_prebuilt_library_shared_test.go",
|
||||||
"cc_prebuilt_library_static_test.go",
|
"cc_prebuilt_library_static_test.go",
|
||||||
|
"cc_yasm_conversion_test.go",
|
||||||
"conversion_test.go",
|
"conversion_test.go",
|
||||||
"filegroup_conversion_test.go",
|
"filegroup_conversion_test.go",
|
||||||
"genrule_conversion_test.go",
|
"genrule_conversion_test.go",
|
||||||
|
@@ -20,9 +20,9 @@ import (
|
|||||||
"android/soong/cc"
|
"android/soong/cc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runYasmTestCase(t *testing.T, tc bp2buildTestCase) {
|
func runYasmTestCase(t *testing.T, tc Bp2buildTestCase) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
runBp2BuildTestCase(t, registerYasmModuleTypes, tc)
|
RunBp2BuildTestCase(t, registerYasmModuleTypes, tc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func registerYasmModuleTypes(ctx android.RegistrationContext) {
|
func registerYasmModuleTypes(ctx android.RegistrationContext) {
|
||||||
@@ -34,20 +34,20 @@ func registerYasmModuleTypes(ctx android.RegistrationContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestYasmSimple(t *testing.T) {
|
func TestYasmSimple(t *testing.T) {
|
||||||
runYasmTestCase(t, bp2buildTestCase{
|
runYasmTestCase(t, Bp2buildTestCase{
|
||||||
description: "Simple yasm test",
|
Description: "Simple yasm test",
|
||||||
moduleTypeUnderTest: "cc_library",
|
ModuleTypeUnderTest: "cc_library",
|
||||||
moduleTypeUnderTestFactory: cc.LibraryFactory,
|
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||||
filesystem: map[string]string{
|
Filesystem: map[string]string{
|
||||||
"main.cpp": "",
|
"main.cpp": "",
|
||||||
"myfile.asm": "",
|
"myfile.asm": "",
|
||||||
},
|
},
|
||||||
blueprint: `
|
Blueprint: `
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["main.cpp", "myfile.asm"],
|
srcs: ["main.cpp", "myfile.asm"],
|
||||||
}`,
|
}`,
|
||||||
expectedBazelTargets: append([]string{
|
ExpectedBazelTargets: append([]string{
|
||||||
makeBazelTarget("yasm", "foo_yasm", map[string]string{
|
makeBazelTarget("yasm", "foo_yasm", map[string]string{
|
||||||
"include_dirs": `["."]`,
|
"include_dirs": `["."]`,
|
||||||
"srcs": `["myfile.asm"]`,
|
"srcs": `["myfile.asm"]`,
|
||||||
@@ -63,24 +63,24 @@ cc_library {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestYasmWithIncludeDirs(t *testing.T) {
|
func TestYasmWithIncludeDirs(t *testing.T) {
|
||||||
runYasmTestCase(t, bp2buildTestCase{
|
runYasmTestCase(t, Bp2buildTestCase{
|
||||||
description: "Simple yasm test",
|
Description: "Simple yasm test",
|
||||||
moduleTypeUnderTest: "cc_library",
|
ModuleTypeUnderTest: "cc_library",
|
||||||
moduleTypeUnderTestFactory: cc.LibraryFactory,
|
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||||
filesystem: map[string]string{
|
Filesystem: map[string]string{
|
||||||
"main.cpp": "",
|
"main.cpp": "",
|
||||||
"myfile.asm": "",
|
"myfile.asm": "",
|
||||||
"include1/foo/myinclude.inc": "",
|
"include1/foo/myinclude.inc": "",
|
||||||
"include2/foo/myinclude2.inc": "",
|
"include2/foo/myinclude2.inc": "",
|
||||||
},
|
},
|
||||||
blueprint: `
|
Blueprint: `
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
local_include_dirs: ["include1/foo"],
|
local_include_dirs: ["include1/foo"],
|
||||||
export_include_dirs: ["include2/foo"],
|
export_include_dirs: ["include2/foo"],
|
||||||
srcs: ["main.cpp", "myfile.asm"],
|
srcs: ["main.cpp", "myfile.asm"],
|
||||||
}`,
|
}`,
|
||||||
expectedBazelTargets: append([]string{
|
ExpectedBazelTargets: append([]string{
|
||||||
makeBazelTarget("yasm", "foo_yasm", map[string]string{
|
makeBazelTarget("yasm", "foo_yasm", map[string]string{
|
||||||
"include_dirs": `[
|
"include_dirs": `[
|
||||||
"include1/foo",
|
"include1/foo",
|
||||||
@@ -104,15 +104,15 @@ cc_library {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestYasmConditionalBasedOnArch(t *testing.T) {
|
func TestYasmConditionalBasedOnArch(t *testing.T) {
|
||||||
runYasmTestCase(t, bp2buildTestCase{
|
runYasmTestCase(t, Bp2buildTestCase{
|
||||||
description: "Simple yasm test",
|
Description: "Simple yasm test",
|
||||||
moduleTypeUnderTest: "cc_library",
|
ModuleTypeUnderTest: "cc_library",
|
||||||
moduleTypeUnderTestFactory: cc.LibraryFactory,
|
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||||
filesystem: map[string]string{
|
Filesystem: map[string]string{
|
||||||
"main.cpp": "",
|
"main.cpp": "",
|
||||||
"myfile.asm": "",
|
"myfile.asm": "",
|
||||||
},
|
},
|
||||||
blueprint: `
|
Blueprint: `
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["main.cpp"],
|
srcs: ["main.cpp"],
|
||||||
@@ -122,7 +122,7 @@ cc_library {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}`,
|
}`,
|
||||||
expectedBazelTargets: append([]string{
|
ExpectedBazelTargets: append([]string{
|
||||||
makeBazelTarget("yasm", "foo_yasm", map[string]string{
|
makeBazelTarget("yasm", "foo_yasm", map[string]string{
|
||||||
"include_dirs": `["."]`,
|
"include_dirs": `["."]`,
|
||||||
"srcs": `select({
|
"srcs": `select({
|
||||||
@@ -141,16 +141,16 @@ cc_library {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestYasmPartiallyConditional(t *testing.T) {
|
func TestYasmPartiallyConditional(t *testing.T) {
|
||||||
runYasmTestCase(t, bp2buildTestCase{
|
runYasmTestCase(t, Bp2buildTestCase{
|
||||||
description: "Simple yasm test",
|
Description: "Simple yasm test",
|
||||||
moduleTypeUnderTest: "cc_library",
|
ModuleTypeUnderTest: "cc_library",
|
||||||
moduleTypeUnderTestFactory: cc.LibraryFactory,
|
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||||
filesystem: map[string]string{
|
Filesystem: map[string]string{
|
||||||
"main.cpp": "",
|
"main.cpp": "",
|
||||||
"myfile.asm": "",
|
"myfile.asm": "",
|
||||||
"mysecondfile.asm": "",
|
"mysecondfile.asm": "",
|
||||||
},
|
},
|
||||||
blueprint: `
|
Blueprint: `
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["main.cpp", "myfile.asm"],
|
srcs: ["main.cpp", "myfile.asm"],
|
||||||
@@ -160,7 +160,7 @@ cc_library {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}`,
|
}`,
|
||||||
expectedBazelTargets: append([]string{
|
ExpectedBazelTargets: append([]string{
|
||||||
makeBazelTarget("yasm", "foo_yasm", map[string]string{
|
makeBazelTarget("yasm", "foo_yasm", map[string]string{
|
||||||
"include_dirs": `["."]`,
|
"include_dirs": `["."]`,
|
||||||
"srcs": `["myfile.asm"] + select({
|
"srcs": `["myfile.asm"] + select({
|
||||||
|
Reference in New Issue
Block a user