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

Commit ecc659cc authored by Liz Kammer's avatar Liz Kammer
Browse files

Add test for static lib that specifies san

Test: golang tests
Change-Id: Ifd54f3e36f7091e16efbc2fc147b6a3a116ab01c
parent 66fc7450
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ func TestAsan(t *testing.T) {
			static_libs: [
				"libstatic",
				"libnoasan",
				"libstatic_asan",
			],
			sanitize: {
				address: true,
@@ -57,6 +58,7 @@ func TestAsan(t *testing.T) {
			static_libs: [
				"libstatic",
				"libnoasan",
				"libstatic_asan",
			],
		}

@@ -92,6 +94,15 @@ func TestAsan(t *testing.T) {
				address: false,
			}
		}

		cc_library_static {
			name: "libstatic_asan",
			host_supported: true,
			sanitize: {
				address: true,
			}
		}

	`

	result := android.GroupFixturePreparers(
@@ -125,6 +136,10 @@ func TestAsan(t *testing.T) {
		// Static library that never uses asan.
		libNoAsan := result.ModuleForTests("libnoasan", staticVariant)

		// Static library that specifies asan
		libStaticAsan := result.ModuleForTests("libstatic_asan", staticAsanVariant)
		libStaticAsanNoAsanVariant := result.ModuleForTests("libstatic_asan", staticVariant)

		// expectSharedLinkDep verifies that the from module links against the to module as a
		// shared library.
		expectSharedLinkDep := func(from, to android.TestingModule) {
@@ -176,6 +191,7 @@ func TestAsan(t *testing.T) {

		expectStaticLinkDep(binWithAsan, libStaticAsanVariant)
		expectStaticLinkDep(binWithAsan, libNoAsan)
		expectStaticLinkDep(binWithAsan, libStaticAsan)

		expectInstallDep(binWithAsan, libShared)
		expectInstallDep(binWithAsan, libAsan)
@@ -190,6 +206,7 @@ func TestAsan(t *testing.T) {

		expectStaticLinkDep(binNoAsan, libStaticNoAsanVariant)
		expectStaticLinkDep(binNoAsan, libNoAsan)
		expectStaticLinkDep(binNoAsan, libStaticAsanNoAsanVariant)

		expectInstallDep(binNoAsan, libShared)
		expectInstallDep(binNoAsan, libAsan)