Support OUT_DIR for license graph.
Bug: 226066987
Test: OUT_DIR=/tmp/outdir m all listshare checkshare htmlnotice rtrace dumpgraph dumpresolutions compliancenotice_bom compliancenotice_shippedlibs
Test: OUT_DIR=/tmp/outdir m /tmp/outdir/target/product/bonito/obj/NOTICE.xml.gz
Test: m all listshare checkshare htmlnotice rtrace dumpgraph dumpresolutions compliancenotice_bom compliancenotice_shippedlibs
Test: m out/target/product/bonito/obj/NOTICE.xml.gz
Change-Id: I6282c647a389c5935d5ce7c79193f86d32c76365
diff --git a/tools/compliance/cmd/dumpgraph/dumpgraph_test.go b/tools/compliance/cmd/dumpgraph/dumpgraph_test.go
index 67b2b40..d1deed3 100644
--- a/tools/compliance/cmd/dumpgraph/dumpgraph_test.go
+++ b/tools/compliance/cmd/dumpgraph/dumpgraph_test.go
@@ -20,6 +20,8 @@
"os"
"strings"
"testing"
+
+ "android/soong/tools/compliance"
)
func TestMain(m *testing.M) {
@@ -36,6 +38,7 @@
tests := []struct {
condition string
name string
+ outDir string
roots []string
ctx context
expectedOut []string
@@ -491,7 +494,7 @@
for _, r := range tt.roots {
rootFiles = append(rootFiles, "testdata/"+tt.condition+"/"+r)
}
- err := dumpGraph(&tt.ctx, stdout, stderr, rootFiles...)
+ err := dumpGraph(&tt.ctx, stdout, stderr, compliance.GetFS(tt.outDir), rootFiles...)
if err != nil {
t.Fatalf("dumpgraph: error = %v, stderr = %v", err, stderr)
return
@@ -583,6 +586,7 @@
tests := []struct {
condition string
name string
+ outDir string
roots []string
ctx context
expectedOut []getMatcher
@@ -1217,7 +1221,7 @@
rootFiles = append(rootFiles, "testdata/"+tt.condition+"/"+r)
}
tt.ctx.graphViz = true
- err := dumpGraph(&tt.ctx, stdout, stderr, rootFiles...)
+ err := dumpGraph(&tt.ctx, stdout, stderr, compliance.GetFS(tt.outDir), rootFiles...)
if err != nil {
t.Fatalf("dumpgraph: error = %v, stderr = %v", err, stderr)
return