soong_config_modules_test.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. // Copyright 2019 Google Inc. All rights reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package android
  15. import (
  16. "fmt"
  17. "path/filepath"
  18. "testing"
  19. )
  20. type soongConfigTestDefaultsModule struct {
  21. ModuleBase
  22. DefaultsModuleBase
  23. }
  24. func soongConfigTestDefaultsModuleFactory() Module {
  25. m := &soongConfigTestDefaultsModule{}
  26. m.AddProperties(&soongConfigTestModuleProperties{})
  27. InitDefaultsModule(m)
  28. return m
  29. }
  30. type soongConfigTestModule struct {
  31. ModuleBase
  32. DefaultableModuleBase
  33. props soongConfigTestModuleProperties
  34. outputPath ModuleOutPath
  35. }
  36. type soongConfigTestModuleProperties struct {
  37. Cflags []string
  38. }
  39. func soongConfigTestModuleFactory() Module {
  40. m := &soongConfigTestModule{}
  41. m.AddProperties(&m.props)
  42. InitAndroidModule(m)
  43. InitDefaultableModule(m)
  44. return m
  45. }
  46. func (t *soongConfigTestModule) GenerateAndroidBuildActions(ctx ModuleContext) {
  47. t.outputPath = PathForModuleOut(ctx, "test")
  48. }
  49. var prepareForSoongConfigTestModule = FixtureRegisterWithContext(func(ctx RegistrationContext) {
  50. ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory)
  51. ctx.RegisterModuleType("test", soongConfigTestModuleFactory)
  52. })
  53. func TestSoongConfigModule(t *testing.T) {
  54. configBp := `
  55. soong_config_module_type {
  56. name: "acme_test",
  57. module_type: "test",
  58. config_namespace: "acme",
  59. variables: ["board", "feature1", "FEATURE3", "unused_string_var"],
  60. bool_variables: ["feature2", "unused_feature", "always_true"],
  61. value_variables: ["size", "unused_size"],
  62. properties: ["cflags", "srcs", "defaults"],
  63. }
  64. soong_config_string_variable {
  65. name: "board",
  66. values: ["soc_a", "soc_b", "soc_c", "soc_d"],
  67. }
  68. soong_config_string_variable {
  69. name: "unused_string_var",
  70. values: ["a", "b"],
  71. }
  72. soong_config_bool_variable {
  73. name: "feature1",
  74. }
  75. soong_config_bool_variable {
  76. name: "FEATURE3",
  77. }
  78. `
  79. importBp := `
  80. soong_config_module_type_import {
  81. from: "SoongConfig.bp",
  82. module_types: ["acme_test"],
  83. }
  84. `
  85. bp := `
  86. test_defaults {
  87. name: "foo_defaults",
  88. cflags: ["DEFAULT"],
  89. }
  90. acme_test {
  91. name: "foo",
  92. cflags: ["-DGENERIC"],
  93. defaults: ["foo_defaults"],
  94. soong_config_variables: {
  95. board: {
  96. soc_a: {
  97. cflags: ["-DSOC_A"],
  98. },
  99. soc_b: {
  100. cflags: ["-DSOC_B"],
  101. },
  102. soc_c: {},
  103. conditions_default: {
  104. cflags: ["-DSOC_CONDITIONS_DEFAULT"],
  105. },
  106. },
  107. size: {
  108. cflags: ["-DSIZE=%s"],
  109. conditions_default: {
  110. cflags: ["-DSIZE=CONDITIONS_DEFAULT"],
  111. },
  112. },
  113. feature1: {
  114. conditions_default: {
  115. cflags: ["-DF1_CONDITIONS_DEFAULT"],
  116. },
  117. cflags: ["-DFEATURE1"],
  118. },
  119. feature2: {
  120. cflags: ["-DFEATURE2"],
  121. conditions_default: {
  122. cflags: ["-DF2_CONDITIONS_DEFAULT"],
  123. },
  124. },
  125. FEATURE3: {
  126. cflags: ["-DFEATURE3"],
  127. },
  128. },
  129. }
  130. test_defaults {
  131. name: "foo_defaults_a",
  132. cflags: ["DEFAULT_A"],
  133. }
  134. test_defaults {
  135. name: "foo_defaults_b",
  136. cflags: ["DEFAULT_B"],
  137. }
  138. test_defaults {
  139. name: "foo_defaults_always_true",
  140. cflags: ["DEFAULT_ALWAYS_TRUE"],
  141. }
  142. acme_test {
  143. name: "foo_with_defaults",
  144. cflags: ["-DGENERIC"],
  145. defaults: ["foo_defaults"],
  146. soong_config_variables: {
  147. board: {
  148. soc_a: {
  149. cflags: ["-DSOC_A"],
  150. defaults: ["foo_defaults_a"],
  151. },
  152. soc_b: {
  153. cflags: ["-DSOC_B"],
  154. defaults: ["foo_defaults_b"],
  155. },
  156. soc_c: {},
  157. },
  158. size: {
  159. cflags: ["-DSIZE=%s"],
  160. },
  161. feature1: {
  162. cflags: ["-DFEATURE1"],
  163. },
  164. feature2: {
  165. cflags: ["-DFEATURE2"],
  166. },
  167. FEATURE3: {
  168. cflags: ["-DFEATURE3"],
  169. },
  170. always_true: {
  171. defaults: ["foo_defaults_always_true"],
  172. conditions_default: {
  173. // verify that conditions_default is skipped if the
  174. // soong config variable is true by specifying a
  175. // non-existent module in conditions_default
  176. defaults: ["//nonexistent:defaults"],
  177. }
  178. },
  179. },
  180. }
  181. `
  182. fixtureForVendorVars := func(vars map[string]map[string]string) FixturePreparer {
  183. return FixtureModifyProductVariables(func(variables FixtureProductVariables) {
  184. variables.VendorVars = vars
  185. })
  186. }
  187. run := func(t *testing.T, bp string, fs MockFS) {
  188. testCases := []struct {
  189. name string
  190. preparer FixturePreparer
  191. fooExpectedFlags []string
  192. fooDefaultsExpectedFlags []string
  193. }{
  194. {
  195. name: "withValues",
  196. preparer: fixtureForVendorVars(map[string]map[string]string{
  197. "acme": {
  198. "board": "soc_a",
  199. "size": "42",
  200. "feature1": "true",
  201. "feature2": "false",
  202. // FEATURE3 unset
  203. "unused_feature": "true", // unused
  204. "unused_size": "1", // unused
  205. "unused_string_var": "a", // unused
  206. "always_true": "true",
  207. },
  208. }),
  209. fooExpectedFlags: []string{
  210. "DEFAULT",
  211. "-DGENERIC",
  212. "-DF2_CONDITIONS_DEFAULT",
  213. "-DSIZE=42",
  214. "-DSOC_A",
  215. "-DFEATURE1",
  216. },
  217. fooDefaultsExpectedFlags: []string{
  218. "DEFAULT_A",
  219. "DEFAULT_ALWAYS_TRUE",
  220. "DEFAULT",
  221. "-DGENERIC",
  222. "-DSIZE=42",
  223. "-DSOC_A",
  224. "-DFEATURE1",
  225. },
  226. },
  227. {
  228. name: "empty_prop_for_string_var",
  229. preparer: fixtureForVendorVars(map[string]map[string]string{
  230. "acme": {
  231. "board": "soc_c",
  232. "always_true": "true",
  233. }}),
  234. fooExpectedFlags: []string{
  235. "DEFAULT",
  236. "-DGENERIC",
  237. "-DF2_CONDITIONS_DEFAULT",
  238. "-DSIZE=CONDITIONS_DEFAULT",
  239. "-DF1_CONDITIONS_DEFAULT",
  240. },
  241. fooDefaultsExpectedFlags: []string{
  242. "DEFAULT_ALWAYS_TRUE",
  243. "DEFAULT",
  244. "-DGENERIC",
  245. },
  246. },
  247. {
  248. name: "unused_string_var",
  249. preparer: fixtureForVendorVars(map[string]map[string]string{
  250. "acme": {
  251. "board": "soc_d",
  252. "always_true": "true",
  253. }}),
  254. fooExpectedFlags: []string{
  255. "DEFAULT",
  256. "-DGENERIC",
  257. "-DF2_CONDITIONS_DEFAULT",
  258. "-DSIZE=CONDITIONS_DEFAULT",
  259. "-DSOC_CONDITIONS_DEFAULT", // foo does not contain a prop "soc_d", so we use the default
  260. "-DF1_CONDITIONS_DEFAULT",
  261. },
  262. fooDefaultsExpectedFlags: []string{
  263. "DEFAULT_ALWAYS_TRUE",
  264. "DEFAULT",
  265. "-DGENERIC",
  266. },
  267. },
  268. {
  269. name: "conditions_default",
  270. preparer: fixtureForVendorVars(map[string]map[string]string{
  271. "acme": {
  272. "always_true": "true",
  273. }}),
  274. fooExpectedFlags: []string{
  275. "DEFAULT",
  276. "-DGENERIC",
  277. "-DF2_CONDITIONS_DEFAULT",
  278. "-DSIZE=CONDITIONS_DEFAULT",
  279. "-DSOC_CONDITIONS_DEFAULT",
  280. "-DF1_CONDITIONS_DEFAULT",
  281. },
  282. fooDefaultsExpectedFlags: []string{
  283. "DEFAULT_ALWAYS_TRUE",
  284. "DEFAULT",
  285. "-DGENERIC",
  286. },
  287. },
  288. }
  289. for _, tc := range testCases {
  290. t.Run(tc.name, func(t *testing.T) {
  291. result := GroupFixturePreparers(
  292. tc.preparer,
  293. PrepareForTestWithDefaults,
  294. PrepareForTestWithSoongConfigModuleBuildComponents,
  295. prepareForSoongConfigTestModule,
  296. fs.AddToFixture(),
  297. FixtureWithRootAndroidBp(bp),
  298. ).RunTest(t)
  299. foo := result.ModuleForTests("foo", "").Module().(*soongConfigTestModule)
  300. AssertDeepEquals(t, "foo cflags", tc.fooExpectedFlags, foo.props.Cflags)
  301. fooDefaults := result.ModuleForTests("foo_with_defaults", "").Module().(*soongConfigTestModule)
  302. AssertDeepEquals(t, "foo_with_defaults cflags", tc.fooDefaultsExpectedFlags, fooDefaults.props.Cflags)
  303. })
  304. }
  305. }
  306. t.Run("single file", func(t *testing.T) {
  307. run(t, configBp+bp, nil)
  308. })
  309. t.Run("import", func(t *testing.T) {
  310. run(t, importBp+bp, map[string][]byte{
  311. "SoongConfig.bp": []byte(configBp),
  312. })
  313. })
  314. }
  315. func TestNonExistentPropertyInSoongConfigModule(t *testing.T) {
  316. bp := `
  317. soong_config_module_type {
  318. name: "acme_test",
  319. module_type: "test",
  320. config_namespace: "acme",
  321. bool_variables: ["feature1"],
  322. properties: ["made_up_property"],
  323. }
  324. acme_test {
  325. name: "foo",
  326. cflags: ["-DGENERIC"],
  327. soong_config_variables: {
  328. feature1: {
  329. made_up_property: true,
  330. },
  331. },
  332. }
  333. `
  334. fixtureForVendorVars := func(vars map[string]map[string]string) FixturePreparer {
  335. return FixtureModifyProductVariables(func(variables FixtureProductVariables) {
  336. variables.VendorVars = vars
  337. })
  338. }
  339. GroupFixturePreparers(
  340. fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}),
  341. PrepareForTestWithDefaults,
  342. PrepareForTestWithSoongConfigModuleBuildComponents,
  343. prepareForSoongConfigTestModule,
  344. FixtureWithRootAndroidBp(bp),
  345. ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{
  346. // TODO(b/171232169): improve the error message for non-existent properties
  347. `unrecognized property "soong_config_variables`,
  348. })).RunTest(t)
  349. }
  350. func TestDuplicateStringValueInSoongConfigStringVariable(t *testing.T) {
  351. bp := `
  352. soong_config_string_variable {
  353. name: "board",
  354. values: ["soc_a", "soc_b", "soc_c", "soc_a"],
  355. }
  356. soong_config_module_type {
  357. name: "acme_test",
  358. module_type: "test",
  359. config_namespace: "acme",
  360. variables: ["board"],
  361. properties: ["cflags", "srcs", "defaults"],
  362. }
  363. `
  364. fixtureForVendorVars := func(vars map[string]map[string]string) FixturePreparer {
  365. return FixtureModifyProductVariables(func(variables FixtureProductVariables) {
  366. variables.VendorVars = vars
  367. })
  368. }
  369. GroupFixturePreparers(
  370. fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}),
  371. PrepareForTestWithDefaults,
  372. PrepareForTestWithSoongConfigModuleBuildComponents,
  373. prepareForSoongConfigTestModule,
  374. FixtureWithRootAndroidBp(bp),
  375. ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{
  376. // TODO(b/171232169): improve the error message for non-existent properties
  377. `Android.bp: soong_config_string_variable: values property error: duplicate value: "soc_a"`,
  378. })).RunTest(t)
  379. }
  380. type soongConfigTestSingletonModule struct {
  381. SingletonModuleBase
  382. props soongConfigTestSingletonModuleProperties
  383. }
  384. type soongConfigTestSingletonModuleProperties struct {
  385. Fragments []struct {
  386. Apex string
  387. Module string
  388. }
  389. }
  390. func soongConfigTestSingletonModuleFactory() SingletonModule {
  391. m := &soongConfigTestSingletonModule{}
  392. m.AddProperties(&m.props)
  393. InitAndroidModule(m)
  394. return m
  395. }
  396. func (t *soongConfigTestSingletonModule) GenerateAndroidBuildActions(ModuleContext) {}
  397. func (t *soongConfigTestSingletonModule) GenerateSingletonBuildActions(SingletonContext) {}
  398. var prepareForSoongConfigTestSingletonModule = FixtureRegisterWithContext(func(ctx RegistrationContext) {
  399. ctx.RegisterSingletonModuleType("test_singleton", soongConfigTestSingletonModuleFactory)
  400. })
  401. func TestSoongConfigModuleSingletonModule(t *testing.T) {
  402. bp := `
  403. soong_config_module_type {
  404. name: "acme_test_singleton",
  405. module_type: "test_singleton",
  406. config_namespace: "acme",
  407. bool_variables: ["coyote"],
  408. properties: ["fragments"],
  409. }
  410. acme_test_singleton {
  411. name: "wiley",
  412. fragments: [
  413. {
  414. apex: "com.android.acme",
  415. module: "road-runner",
  416. },
  417. ],
  418. soong_config_variables: {
  419. coyote: {
  420. fragments: [
  421. {
  422. apex: "com.android.acme",
  423. module: "wiley",
  424. },
  425. ],
  426. },
  427. },
  428. }
  429. `
  430. for _, test := range []struct {
  431. coyote bool
  432. expectedFragments string
  433. }{
  434. {
  435. coyote: false,
  436. expectedFragments: "[{Apex:com.android.acme Module:road-runner}]",
  437. },
  438. {
  439. coyote: true,
  440. expectedFragments: "[{Apex:com.android.acme Module:road-runner} {Apex:com.android.acme Module:wiley}]",
  441. },
  442. } {
  443. t.Run(fmt.Sprintf("coyote:%t", test.coyote), func(t *testing.T) {
  444. result := GroupFixturePreparers(
  445. PrepareForTestWithSoongConfigModuleBuildComponents,
  446. prepareForSoongConfigTestSingletonModule,
  447. FixtureWithRootAndroidBp(bp),
  448. FixtureModifyProductVariables(func(variables FixtureProductVariables) {
  449. variables.VendorVars = map[string]map[string]string{
  450. "acme": {
  451. "coyote": fmt.Sprintf("%t", test.coyote),
  452. },
  453. }
  454. }),
  455. ).RunTest(t)
  456. // Make sure that the singleton was created.
  457. result.SingletonForTests("test_singleton")
  458. m := result.ModuleForTests("wiley", "").module.(*soongConfigTestSingletonModule)
  459. AssertStringEquals(t, "fragments", test.expectedFragments, fmt.Sprintf("%+v", m.props.Fragments))
  460. })
  461. }
  462. }
  463. func TestSoongConfigModuleTrace(t *testing.T) {
  464. bp := `
  465. soong_config_module_type {
  466. name: "acme_test",
  467. module_type: "test",
  468. config_namespace: "acme",
  469. variables: ["board", "feature1", "FEATURE3", "unused_string_var"],
  470. bool_variables: ["feature2", "unused_feature", "always_true"],
  471. value_variables: ["size", "unused_size"],
  472. properties: ["cflags", "srcs", "defaults"],
  473. }
  474. soong_config_module_type {
  475. name: "acme_test_defaults",
  476. module_type: "test_defaults",
  477. config_namespace: "acme",
  478. variables: ["board", "feature1", "FEATURE3", "unused_string_var"],
  479. bool_variables: ["feature2", "unused_feature", "always_true"],
  480. value_variables: ["size", "unused_size"],
  481. properties: ["cflags", "srcs", "defaults"],
  482. }
  483. soong_config_string_variable {
  484. name: "board",
  485. values: ["soc_a", "soc_b", "soc_c"],
  486. }
  487. soong_config_string_variable {
  488. name: "unused_string_var",
  489. values: ["a", "b"],
  490. }
  491. soong_config_bool_variable {
  492. name: "feature1",
  493. }
  494. soong_config_bool_variable {
  495. name: "FEATURE3",
  496. }
  497. test_defaults {
  498. name: "test_defaults",
  499. cflags: ["DEFAULT"],
  500. }
  501. test {
  502. name: "normal",
  503. defaults: ["test_defaults"],
  504. }
  505. acme_test {
  506. name: "board_1",
  507. defaults: ["test_defaults"],
  508. soong_config_variables: {
  509. board: {
  510. soc_a: {
  511. cflags: ["-DSOC_A"],
  512. },
  513. },
  514. },
  515. }
  516. acme_test {
  517. name: "board_2",
  518. defaults: ["test_defaults"],
  519. soong_config_variables: {
  520. board: {
  521. soc_a: {
  522. cflags: ["-DSOC_A"],
  523. },
  524. },
  525. },
  526. }
  527. acme_test {
  528. name: "size",
  529. defaults: ["test_defaults"],
  530. soong_config_variables: {
  531. size: {
  532. cflags: ["-DSIZE=%s"],
  533. },
  534. },
  535. }
  536. acme_test {
  537. name: "board_and_size",
  538. defaults: ["test_defaults"],
  539. soong_config_variables: {
  540. board: {
  541. soc_a: {
  542. cflags: ["-DSOC_A"],
  543. },
  544. },
  545. size: {
  546. cflags: ["-DSIZE=%s"],
  547. },
  548. },
  549. }
  550. acme_test_defaults {
  551. name: "board_defaults",
  552. soong_config_variables: {
  553. board: {
  554. soc_a: {
  555. cflags: ["-DSOC_A"],
  556. },
  557. },
  558. },
  559. }
  560. acme_test_defaults {
  561. name: "size_defaults",
  562. soong_config_variables: {
  563. size: {
  564. cflags: ["-DSIZE=%s"],
  565. },
  566. },
  567. }
  568. test {
  569. name: "board_and_size_with_defaults",
  570. defaults: ["board_defaults", "size_defaults"],
  571. }
  572. `
  573. fixtureForVendorVars := func(vars map[string]map[string]string) FixturePreparer {
  574. return FixtureModifyProductVariables(func(variables FixtureProductVariables) {
  575. variables.VendorVars = vars
  576. })
  577. }
  578. preparer := fixtureForVendorVars(map[string]map[string]string{
  579. "acme": {
  580. "board": "soc_a",
  581. "size": "42",
  582. "feature1": "true",
  583. "feature2": "false",
  584. // FEATURE3 unset
  585. "unused_feature": "true", // unused
  586. "unused_size": "1", // unused
  587. "unused_string_var": "a", // unused
  588. "always_true": "true",
  589. },
  590. })
  591. t.Run("soong config trace hash", func(t *testing.T) {
  592. result := GroupFixturePreparers(
  593. preparer,
  594. PrepareForTestWithDefaults,
  595. PrepareForTestWithSoongConfigModuleBuildComponents,
  596. prepareForSoongConfigTestModule,
  597. FixtureRegisterWithContext(func(ctx RegistrationContext) {
  598. ctx.FinalDepsMutators(registerSoongConfigTraceMutator)
  599. }),
  600. FixtureWithRootAndroidBp(bp),
  601. ).RunTest(t)
  602. // Hashes of modules not using soong config should be empty
  603. normal := result.ModuleForTests("normal", "").Module().(*soongConfigTestModule)
  604. AssertDeepEquals(t, "normal hash", normal.base().commonProperties.SoongConfigTraceHash, "")
  605. AssertDeepEquals(t, "normal hash out", normal.outputPath.RelativeToTop().String(), "out/soong/.intermediates/normal/test")
  606. board1 := result.ModuleForTests("board_1", "").Module().(*soongConfigTestModule)
  607. board2 := result.ModuleForTests("board_2", "").Module().(*soongConfigTestModule)
  608. size := result.ModuleForTests("size", "").Module().(*soongConfigTestModule)
  609. // Trace mutator sets soong config trace hash correctly
  610. board1Hash := board1.base().commonProperties.SoongConfigTrace.hash()
  611. board1Output := board1.outputPath.RelativeToTop().String()
  612. AssertDeepEquals(t, "board hash calc", board1Hash, board1.base().commonProperties.SoongConfigTraceHash)
  613. AssertDeepEquals(t, "board hash path", board1Output, filepath.Join("out/soong/.intermediates/board_1", board1Hash, "test"))
  614. sizeHash := size.base().commonProperties.SoongConfigTrace.hash()
  615. sizeOutput := size.outputPath.RelativeToTop().String()
  616. AssertDeepEquals(t, "size hash calc", sizeHash, size.base().commonProperties.SoongConfigTraceHash)
  617. AssertDeepEquals(t, "size hash path", sizeOutput, filepath.Join("out/soong/.intermediates/size", sizeHash, "test"))
  618. // Trace should be identical for modules using the same set of variables
  619. AssertDeepEquals(t, "board trace", board1.base().commonProperties.SoongConfigTrace, board2.base().commonProperties.SoongConfigTrace)
  620. AssertDeepEquals(t, "board hash", board1.base().commonProperties.SoongConfigTraceHash, board2.base().commonProperties.SoongConfigTraceHash)
  621. // Trace hash should be different for different sets of soong variables
  622. AssertBoolEquals(t, "board hash not equal to size hash", board1.base().commonProperties.SoongConfigTraceHash == size.commonProperties.SoongConfigTraceHash, false)
  623. boardSize := result.ModuleForTests("board_and_size", "").Module().(*soongConfigTestModule)
  624. boardSizeDefaults := result.ModuleForTests("board_and_size_with_defaults", "").Module()
  625. // Trace should propagate
  626. AssertDeepEquals(t, "board_size hash calc", boardSize.base().commonProperties.SoongConfigTrace.hash(), boardSize.base().commonProperties.SoongConfigTraceHash)
  627. AssertDeepEquals(t, "board_size trace", boardSize.base().commonProperties.SoongConfigTrace, boardSizeDefaults.base().commonProperties.SoongConfigTrace)
  628. AssertDeepEquals(t, "board_size hash", boardSize.base().commonProperties.SoongConfigTraceHash, boardSizeDefaults.base().commonProperties.SoongConfigTraceHash)
  629. })
  630. }