aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross2018-03-22 14:43:16 -0500
committerColin Cross2018-04-16 12:32:16 -0500
commit9c55d237f6b72896209344aee18a1702c2f9ac3e (patch)
tree9cc07e0ff8e5305611ad267d56bee111834ab1cf /androidmk
parentadee968a4bace28bd26253bc436043eb513f6117 (diff)
downloadplatform-build-soong-9c55d237f6b72896209344aee18a1702c2f9ac3e.tar.gz
platform-build-soong-9c55d237f6b72896209344aee18a1702c2f9ac3e.tar.xz
platform-build-soong-9c55d237f6b72896209344aee18a1702c2f9ac3e.zip
Merge matching properties in bpfix
androidmk will start to generate multiple static_libs: properties in a single module, add a pass in bpfix to fix them up into a single property. Test: bpfix_test.go Change-Id: I30955b6efbb767c02ba77f2f18d44951ef094bad
Diffstat (limited to 'androidmk')
-rw-r--r--androidmk/cmd/androidmk/androidmk_test.go26
1 files changed, 5 insertions, 21 deletions
diff --git a/androidmk/cmd/androidmk/androidmk_test.go b/androidmk/cmd/androidmk/androidmk_test.go
index 45df1a57..dd646efe 100644
--- a/androidmk/cmd/androidmk/androidmk_test.go
+++ b/androidmk/cmd/androidmk/androidmk_test.go
@@ -15,13 +15,11 @@
15package main 15package main
16 16
17import ( 17import (
18 "android/soong/bpfix/bpfix"
18 "bytes" 19 "bytes"
19 "fmt" 20 "fmt"
20 "os"
21 "strings" 21 "strings"
22 "testing" 22 "testing"
23
24 bpparser "github.com/google/blueprint/parser"
25) 23)
26 24
27var testCases = []struct { 25var testCases = []struct {
@@ -524,26 +522,12 @@ include $(call all-makefiles-under,$(LOCAL_PATH))
524 }, 522 },
525} 523}
526 524
527func reformatBlueprint(input string) string {
528 file, errs := bpparser.Parse("<testcase>", bytes.NewBufferString(input), bpparser.NewScope(nil))
529 if len(errs) > 0 {
530 for _, err := range errs {
531 fmt.Fprintln(os.Stderr, err)
532 }
533 panic(fmt.Sprintf("%d parsing errors in testcase:\n%s", len(errs), input))
534 }
535
536 res, err := bpparser.Print(file)
537 if err != nil {
538 panic(fmt.Sprintf("Error printing testcase: %q", err))
539 }
540
541 return string(res)
542}
543
544func TestEndToEnd(t *testing.T) { 525func TestEndToEnd(t *testing.T) {
545 for i, test := range testCases { 526 for i, test := range testCases {
546 expected := reformatBlueprint(test.expected) 527 expected, err := bpfix.Reformat(test.expected)
528 if err != nil {
529 t.Error(err)
530 }
547 531
548 got, errs := convertFile(fmt.Sprintf("<testcase %d>", i), bytes.NewBufferString(test.in)) 532 got, errs := convertFile(fmt.Sprintf("<testcase %d>", i), bytes.NewBufferString(test.in))
549 if len(errs) > 0 { 533 if len(errs) > 0 {