diff options
author | 2017-12-01 17:10:33 -0800 | |
---|---|---|
committer | 2017-12-04 17:44:32 -0800 | |
commit | b274ed3252dfadfd5a7edf70e470b61cf074c0de (patch) | |
tree | d9b6240f71a17911de306631868ca851d7163887 /android/namespace_test.go | |
parent | 5c3886de5a1eabb81e7d166a86c29ca324dabf49 (diff) |
Make ninja file deterministic even with dup module names
Bug: 65683273
Test: ./build/soong/scripts/diff_build_graphs.sh \
--products=aosp_arm '' ''
Change-Id: Ie01ff579d69e94b12363f53aec5d25810211c451
Diffstat (limited to 'android/namespace_test.go')
-rw-r--r-- | android/namespace_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/android/namespace_test.go b/android/namespace_test.go index 13da88b42..9ab186b00 100644 --- a/android/namespace_test.go +++ b/android/namespace_test.go @@ -19,6 +19,7 @@ import ( "io/ioutil" "os" "path/filepath" + "reflect" "testing" "github.com/google/blueprint" @@ -562,6 +563,25 @@ func TestDeclaringNamespaceInNonAndroidBpFile(t *testing.T) { } } +// so that the generated .ninja file will have consistent names +func TestConsistentNamespaceNames(t *testing.T) { + ctx := setupTest(t, + map[string]string{ + "dir1": "soong_namespace{}", + "dir2": "soong_namespace{}", + "dir3": "soong_namespace{}", + }) + + ns1, _ := ctx.NameResolver.namespaceAt("dir1") + ns2, _ := ctx.NameResolver.namespaceAt("dir2") + ns3, _ := ctx.NameResolver.namespaceAt("dir3") + actualIds := []string{ns1.id, ns2.id, ns3.id} + expectedIds := []string{"1", "2", "3"} + if !reflect.DeepEqual(actualIds, expectedIds) { + t.Errorf("Incorrect namespace ids.\nactual: %s\nexpected: %s\n", actualIds, expectedIds) + } +} + // some utils to support the tests func mockFiles(bps map[string]string) (files map[string][]byte) { |