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

Commit 12bebf95 authored by Yi Kong's avatar Yi Kong
Browse files

Switch host native tests to -Og

This helps to reduce build artifact size significantly, by 1.33GB for
`m cts` in the `out` directory on aosp-main. This should also make them
a lot faster to run.

Also turns off unused-result warning. This analysis is not run on -O0,
leaving behind a ton of code that triggers this warning. Since it is not
an important warning for tests anyway, turn it off by default for tests.

Right now, -Og is just an alias for -O1 in Clang. If the debuggability
is affected due to this change, we can identify and disable the relevant
optimization pass in -Og.

Change-Id: I84383cbc05a53d89c322ecb3679320f1338542e6
Bug: 294796809
Test: presubmit
parent 9ed8aff5
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -277,7 +277,10 @@ func (test *testDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {

	flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_HAS_STD_STRING")
	if ctx.Host() {
		flags.Local.CFlags = append(flags.Local.CFlags, "-O0", "-g")
		flags.Local.CFlags = append([]string{"-Og", "-g"}, flags.Local.CFlags...)

		// Turn off unused-result warning since it is not important for tests.
		flags.Local.CFlags = append(flags.Local.CFlags, "-Wno-error=unused-result")

		switch ctx.Os() {
		case android.Windows: