Revert ^2 "Prevent unspecified values in soong_config_string_variable""

This reverts commit 38944c70c4.

Reason for revert: I believe we're ready for this now, but run build_test 1-4 on internal master for at least master and tm-dev-plus-aosp on go/abtd before submitting

Change-Id: Id3bcd9a46f3087cf2d34dece5294828ea9436788
This commit is contained in:
Cole Faust
2022-10-20 00:34:00 +00:00
parent 38944c70c4
commit 135d987d7c
2 changed files with 64 additions and 1 deletions

View File

@@ -303,6 +303,10 @@ type soongConfigVars struct {
Bool_var interface{}
}
type stringSoongConfigVars struct {
String_var interface{}
}
func Test_PropertiesToApply(t *testing.T) {
mt, _ := newModuleType(&ModuleTypeProperties{
Module_type: "foo",
@@ -365,6 +369,51 @@ func Test_PropertiesToApply(t *testing.T) {
}
}
func Test_PropertiesToApply_String_Error(t *testing.T) {
mt, _ := newModuleType(&ModuleTypeProperties{
Module_type: "foo",
Config_namespace: "bar",
Variables: []string{"string_var"},
Properties: []string{"a", "b"},
})
mt.Variables = append(mt.Variables, &stringVariable{
baseVariable: baseVariable{
variable: "string_var",
},
values: []string{"a", "b", "c"},
})
stringVarPositive := &properties{
A: proptools.StringPtr("A"),
B: true,
}
conditionsDefault := &properties{
A: proptools.StringPtr("default"),
B: false,
}
actualProps := &struct {
Soong_config_variables stringSoongConfigVars
}{
Soong_config_variables: stringSoongConfigVars{
String_var: &boolVarProps{
A: stringVarPositive.A,
B: stringVarPositive.B,
Conditions_default: conditionsDefault,
},
},
}
props := reflect.ValueOf(actualProps)
_, err := PropertiesToApply(mt, props, Config(map[string]string{
"string_var": "x",
}))
expected := `Soong config property "string_var" must be one of [a b c], found "x"`
if err == nil {
t.Fatalf("Expected an error, got nil")
} else if err.Error() != expected {
t.Fatalf("Error message was not correct, expected %q, got %q", expected, err.Error())
}
}
func Test_Bp2BuildSoongConfigDefinitions(t *testing.T) {
testCases := []struct {
desc string