Fix race CommonGlobalCflags when running tests in parallel.
Clone the commonGlobalCflags global variable when modifying it so that it gets a unique object per context. Test: go test -race ./... Change-Id: Ia4b91c40939d4b4d338bd11e4d4f523521874548
This commit is contained in:
parent
6c7e8ff86f
commit
bcf53701b7
1 changed files with 2 additions and 1 deletions
|
@ -16,6 +16,7 @@ package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
@ -400,7 +401,7 @@ func init() {
|
||||||
exportedVars.ExportStringList("CommonGlobalCflags", commonGlobalCflags)
|
exportedVars.ExportStringList("CommonGlobalCflags", commonGlobalCflags)
|
||||||
|
|
||||||
pctx.VariableFunc("CommonGlobalCflags", func(ctx android.PackageVarContext) string {
|
pctx.VariableFunc("CommonGlobalCflags", func(ctx android.PackageVarContext) string {
|
||||||
flags := commonGlobalCflags
|
flags := slices.Clone(commonGlobalCflags)
|
||||||
|
|
||||||
// http://b/131390872
|
// http://b/131390872
|
||||||
// Automatically initialize any uninitialized stack variables.
|
// Automatically initialize any uninitialized stack variables.
|
||||||
|
|
Loading…
Reference in a new issue