Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9a49dff authored by Sam Delmerico's avatar Sam Delmerico
Browse files

update bp2build tests for cc_yasm + add to CI

This test got missed in the change to export the bp2build testing
functionality because it wasn't listed in the Android.bp file to be run
as tests in CI.

Test: go test ./bp2build
Change-Id: Ic8f16bb0d5d75084592caa4ea3018384c1c7a30c
parent 439fbfc2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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",
+30 −30
Original line number Diff line number Diff line
@@ -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({