Merge changes I3db6310e,I061be2b9,I7e81936d,If0684cf1,I404b138f am: e4442b7df6
am: 07da3e7574
Original change: https://android-review.googlesource.com/c/platform/build/+/1964245 Change-Id: I6f21753d9e05d169b54efbab45a07f2291ae4ff9
This commit is contained in:
@@ -19,58 +19,58 @@ package {
|
||||
|
||||
blueprint_go_binary {
|
||||
name: "bom",
|
||||
srcs: ["cmd/bom.go"],
|
||||
srcs: ["cmd/bom/bom.go"],
|
||||
deps: ["compliance-module"],
|
||||
testSrcs: ["cmd/bom_test.go"],
|
||||
testSrcs: ["cmd/bom/bom_test.go"],
|
||||
}
|
||||
|
||||
blueprint_go_binary {
|
||||
name: "checkshare",
|
||||
srcs: ["cmd/checkshare.go"],
|
||||
srcs: ["cmd/checkshare/checkshare.go"],
|
||||
deps: ["compliance-module"],
|
||||
testSrcs: ["cmd/checkshare_test.go"],
|
||||
testSrcs: ["cmd/checkshare/checkshare_test.go"],
|
||||
}
|
||||
|
||||
blueprint_go_binary {
|
||||
name: "listshare",
|
||||
srcs: ["cmd/listshare.go"],
|
||||
srcs: ["cmd/listshare/listshare.go"],
|
||||
deps: ["compliance-module"],
|
||||
testSrcs: ["cmd/listshare_test.go"],
|
||||
testSrcs: ["cmd/listshare/listshare_test.go"],
|
||||
}
|
||||
|
||||
blueprint_go_binary {
|
||||
name: "dumpgraph",
|
||||
srcs: ["cmd/dumpgraph.go"],
|
||||
srcs: ["cmd/dumpgraph/dumpgraph.go"],
|
||||
deps: ["compliance-module"],
|
||||
testSrcs: ["cmd/dumpgraph_test.go"],
|
||||
testSrcs: ["cmd/dumpgraph/dumpgraph_test.go"],
|
||||
}
|
||||
|
||||
blueprint_go_binary {
|
||||
name: "dumpresolutions",
|
||||
srcs: ["cmd/dumpresolutions.go"],
|
||||
srcs: ["cmd/dumpresolutions/dumpresolutions.go"],
|
||||
deps: ["compliance-module"],
|
||||
testSrcs: ["cmd/dumpresolutions_test.go"],
|
||||
testSrcs: ["cmd/dumpresolutions/dumpresolutions_test.go"],
|
||||
}
|
||||
|
||||
blueprint_go_binary {
|
||||
name: "htmlnotice",
|
||||
srcs: ["cmd/htmlnotice.go"],
|
||||
srcs: ["cmd/htmlnotice/htmlnotice.go"],
|
||||
deps: ["compliance-module"],
|
||||
testSrcs: ["cmd/htmlnotice_test.go"],
|
||||
testSrcs: ["cmd/htmlnotice/htmlnotice_test.go"],
|
||||
}
|
||||
|
||||
blueprint_go_binary {
|
||||
name: "shippedlibs",
|
||||
srcs: ["cmd/shippedlibs.go"],
|
||||
srcs: ["cmd/shippedlibs/shippedlibs.go"],
|
||||
deps: ["compliance-module"],
|
||||
testSrcs: ["cmd/shippedlibs_test.go"],
|
||||
testSrcs: ["cmd/shippedlibs/shippedlibs_test.go"],
|
||||
}
|
||||
|
||||
blueprint_go_binary {
|
||||
name: "textnotice",
|
||||
srcs: ["cmd/textnotice.go"],
|
||||
srcs: ["cmd/textnotice/textnotice.go"],
|
||||
deps: ["compliance-module"],
|
||||
testSrcs: ["cmd/textnotice_test.go"],
|
||||
testSrcs: ["cmd/textnotice/textnotice_test.go"],
|
||||
}
|
||||
|
||||
bootstrap_go_package {
|
||||
@@ -81,14 +81,14 @@ bootstrap_go_package {
|
||||
"doc.go",
|
||||
"graph.go",
|
||||
"noticeindex.go",
|
||||
"policy/policy.go",
|
||||
"policy/resolve.go",
|
||||
"policy/resolvenotices.go",
|
||||
"policy/resolveshare.go",
|
||||
"policy/resolveprivacy.go",
|
||||
"policy/shareprivacyconflicts.go",
|
||||
"policy/shipped.go",
|
||||
"policy/walk.go",
|
||||
"policy_policy.go",
|
||||
"policy_resolve.go",
|
||||
"policy_resolvenotices.go",
|
||||
"policy_resolveshare.go",
|
||||
"policy_resolveprivacy.go",
|
||||
"policy_shareprivacyconflicts.go",
|
||||
"policy_shipped.go",
|
||||
"policy_walk.go",
|
||||
"readgraph.go",
|
||||
"resolution.go",
|
||||
"resolutionset.go",
|
||||
@@ -97,14 +97,14 @@ bootstrap_go_package {
|
||||
"condition_test.go",
|
||||
"conditionset_test.go",
|
||||
"readgraph_test.go",
|
||||
"policy/policy_test.go",
|
||||
"policy/resolve_test.go",
|
||||
"policy/resolvenotices_test.go",
|
||||
"policy/resolveshare_test.go",
|
||||
"policy/resolveprivacy_test.go",
|
||||
"policy/shareprivacyconflicts_test.go",
|
||||
"policy/shipped_test.go",
|
||||
"policy/walk_test.go",
|
||||
"policy_policy_test.go",
|
||||
"policy_resolve_test.go",
|
||||
"policy_resolvenotices_test.go",
|
||||
"policy_resolveshare_test.go",
|
||||
"policy_resolveprivacy_test.go",
|
||||
"policy_shareprivacyconflicts_test.go",
|
||||
"policy_shipped_test.go",
|
||||
"policy_walk_test.go",
|
||||
"resolutionset_test.go",
|
||||
"test_util.go",
|
||||
],
|
||||
@@ -113,5 +113,5 @@ bootstrap_go_package {
|
||||
"golang-protobuf-encoding-prototext",
|
||||
"license_metadata_proto",
|
||||
],
|
||||
pkgPath: "compliance",
|
||||
pkgPath: "android/soong/tools/compliance",
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compliance"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -24,6 +23,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"android/soong/tools/compliance"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -69,12 +70,12 @@ func main() {
|
||||
} else {
|
||||
dir, err := filepath.Abs(filepath.Dir(*outputFile))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fi, err := os.Stat(dir)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if !fi.IsDir() {
|
||||
@@ -102,7 +103,7 @@ func main() {
|
||||
if *outputFile != "-" {
|
||||
err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
@@ -17,11 +17,22 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Change into the parent directory before running the tests
|
||||
// so they can find the testdata directory.
|
||||
if err := os.Chdir(".."); err != nil {
|
||||
fmt.Printf("failed to change to testdata directory: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func Test(t *testing.T) {
|
||||
tests := []struct {
|
||||
condition string
|
||||
@@ -275,7 +286,7 @@ func Test(t *testing.T) {
|
||||
|
||||
err := billOfMaterials(&ctx, rootFiles...)
|
||||
if err != nil {
|
||||
t.Fatalf("bom: error = %w, stderr = %v", err, stderr)
|
||||
t.Fatalf("bom: error = %v, stderr = %v", err, stderr)
|
||||
return
|
||||
}
|
||||
if stderr.Len() > 0 {
|
@@ -15,13 +15,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"compliance"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"android/soong/tools/compliance"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -51,7 +52,6 @@ var (
|
||||
failNoLicenses = fmt.Errorf("No licenses")
|
||||
)
|
||||
|
||||
|
||||
// byError orders conflicts by error string
|
||||
type byError []compliance.SourceSharePrivacyConflict
|
||||
|
@@ -17,10 +17,21 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Change into the parent directory before running the tests
|
||||
// so they can find the testdata directory.
|
||||
if err := os.Chdir(".."); err != nil {
|
||||
fmt.Printf("failed to change to testdata directory: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
type outcome struct {
|
||||
target string
|
||||
privacyCondition string
|
@@ -15,7 +15,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"compliance"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -23,6 +22,8 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"android/soong/tools/compliance"
|
||||
)
|
||||
|
||||
var (
|
@@ -17,10 +17,21 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Change into the parent directory before running the tests
|
||||
// so they can find the testdata directory.
|
||||
if err := os.Chdir(".."); err != nil {
|
||||
fmt.Printf("failed to change to testdata directory: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func Test_plaintext(t *testing.T) {
|
||||
tests := []struct {
|
||||
condition string
|
||||
@@ -1217,7 +1228,7 @@ func Test_graphviz(t *testing.T) {
|
||||
outList := strings.Split(stdout.String(), "\n")
|
||||
outLine := 0
|
||||
if outList[outLine] != "strict digraph {" {
|
||||
t.Errorf("dumpgraph: got 1st line %v, want strict digraph {")
|
||||
t.Errorf("dumpgraph: got 1st line %v, want strict digraph {", outList[outLine])
|
||||
}
|
||||
outLine++
|
||||
if strings.HasPrefix(strings.TrimLeft(outList[outLine], " \t"), "rankdir") {
|
@@ -15,7 +15,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"compliance"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -23,6 +22,8 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"android/soong/tools/compliance"
|
||||
)
|
||||
|
||||
var (
|
@@ -16,12 +16,24 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compliance"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"android/soong/tools/compliance"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Change into the parent directory before running the tests
|
||||
// so they can find the testdata directory.
|
||||
if err := os.Chdir(".."); err != nil {
|
||||
fmt.Printf("failed to change to testdata directory: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func Test_plaintext(t *testing.T) {
|
||||
tests := []struct {
|
||||
condition string
|
||||
@@ -3305,7 +3317,7 @@ func Test_graphviz(t *testing.T) {
|
||||
outList := strings.Split(stdout.String(), "\n")
|
||||
outLine := 0
|
||||
if outList[outLine] != "strict digraph {" {
|
||||
t.Errorf("dumpresolutions: got 1st line %v, want strict digraph {")
|
||||
t.Errorf("dumpresolutions: got 1st line %v, want strict digraph {", outList[outLine])
|
||||
}
|
||||
outLine++
|
||||
if strings.HasPrefix(strings.TrimLeft(outList[outLine], " \t"), "rankdir") {
|
@@ -16,7 +16,6 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compliance"
|
||||
"flag"
|
||||
"fmt"
|
||||
"html"
|
||||
@@ -25,6 +24,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"android/soong/tools/compliance"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -74,12 +75,12 @@ func main() {
|
||||
} else {
|
||||
dir, err := filepath.Abs(filepath.Dir(*outputFile))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fi, err := os.Stat(dir)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if !fi.IsDir() {
|
||||
@@ -107,7 +108,7 @@ func main() {
|
||||
if *outputFile != "-" {
|
||||
err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -139,13 +140,13 @@ func htmlNotice(ctx *context, files ...string) error {
|
||||
}
|
||||
|
||||
fmt.Fprintln(ctx.stdout, "<!DOCTYPE html>")
|
||||
fmt.Fprintln(ctx.stdout, "<html><head>\n")
|
||||
fmt.Fprintln(ctx.stdout, "<html><head>")
|
||||
fmt.Fprintln(ctx.stdout, "<style type=\"text/css\">")
|
||||
fmt.Fprintln(ctx.stdout, "body { padding: 2px; margin: 0; }")
|
||||
fmt.Fprintln(ctx.stdout, "ul { list-style-type: none; margin: 0; padding: 0; }")
|
||||
fmt.Fprintln(ctx.stdout, "li { padding-left: 1em; }")
|
||||
fmt.Fprintln(ctx.stdout, ".file-list { margin-left: 1em; }")
|
||||
fmt.Fprintln(ctx.stdout, "</style>\n")
|
||||
fmt.Fprintln(ctx.stdout, "</style>")
|
||||
if 0 < len(ctx.title) {
|
||||
fmt.Fprintf(ctx.stdout, "<title>%s</title>\n", html.EscapeString(ctx.title))
|
||||
}
|
@@ -39,6 +39,16 @@ var (
|
||||
libReference = regexp.MustCompile(`^\s*<li><a href="#[^"]{32}">(.*)</a>\s*$`)
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Change into the parent directory before running the tests
|
||||
// so they can find the testdata directory.
|
||||
if err := os.Chdir(".."); err != nil {
|
||||
fmt.Printf("failed to change to testdata directory: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func Test(t *testing.T) {
|
||||
tests := []struct {
|
||||
condition string
|
||||
@@ -560,7 +570,7 @@ func Test(t *testing.T) {
|
||||
|
||||
err := htmlNotice(&ctx, rootFiles...)
|
||||
if err != nil {
|
||||
t.Fatalf("htmlnotice: error = %w, stderr = %v", err, stderr)
|
||||
t.Fatalf("htmlnotice: error = %v, stderr = %v", err, stderr)
|
||||
return
|
||||
}
|
||||
if stderr.Len() > 0 {
|
@@ -15,7 +15,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"compliance"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -23,6 +22,8 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"android/soong/tools/compliance"
|
||||
)
|
||||
|
||||
func init() {
|
@@ -16,10 +16,22 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Change into the parent directory before running the tests
|
||||
// so they can find the testdata directory.
|
||||
if err := os.Chdir(".."); err != nil {
|
||||
fmt.Printf("failed to change to testdata directory: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func Test(t *testing.T) {
|
||||
type projectShare struct {
|
||||
project string
|
@@ -16,13 +16,14 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compliance"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"android/soong/tools/compliance"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -66,12 +67,12 @@ func main() {
|
||||
} else {
|
||||
dir, err := filepath.Abs(filepath.Dir(*outputFile))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fi, err := os.Stat(dir)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if !fi.IsDir() {
|
||||
@@ -99,7 +100,7 @@ func main() {
|
||||
if *outputFile != "-" {
|
||||
err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
@@ -17,11 +17,22 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Change into the parent directory before running the tests
|
||||
// so they can find the testdata directory.
|
||||
if err := os.Chdir(".."); err != nil {
|
||||
fmt.Printf("failed to change to testdata directory: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func Test(t *testing.T) {
|
||||
tests := []struct {
|
||||
condition string
|
||||
@@ -194,7 +205,7 @@ func Test(t *testing.T) {
|
||||
|
||||
err := shippedLibs(&ctx, rootFiles...)
|
||||
if err != nil {
|
||||
t.Fatalf("shippedLibs: error = %w, stderr = %v", err, stderr)
|
||||
t.Fatalf("shippedLibs: error = %v, stderr = %v", err, stderr)
|
||||
return
|
||||
}
|
||||
if stderr.Len() > 0 {
|
@@ -16,7 +16,6 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compliance"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -24,6 +23,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"android/soong/tools/compliance"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -69,12 +70,12 @@ func main() {
|
||||
} else {
|
||||
dir, err := filepath.Abs(filepath.Dir(*outputFile))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fi, err := os.Stat(dir)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if !fi.IsDir() {
|
||||
@@ -102,7 +103,7 @@ func main() {
|
||||
if *outputFile != "-" {
|
||||
err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err)
|
||||
fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
@@ -28,6 +28,16 @@ var (
|
||||
horizontalRule = regexp.MustCompile("^===[=]*===$")
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Change into the parent directory before running the tests
|
||||
// so they can find the testdata directory.
|
||||
if err := os.Chdir(".."); err != nil {
|
||||
fmt.Printf("failed to change to testdata directory: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func Test(t *testing.T) {
|
||||
tests := []struct {
|
||||
condition string
|
||||
@@ -474,7 +484,7 @@ func Test(t *testing.T) {
|
||||
|
||||
err := textNotice(&ctx, rootFiles...)
|
||||
if err != nil {
|
||||
t.Fatalf("textnotice: error = %w, stderr = %v", err, stderr)
|
||||
t.Fatalf("textnotice: error = %v, stderr = %v", err, stderr)
|
||||
return
|
||||
}
|
||||
if stderr.Len() > 0 {
|
@@ -363,7 +363,7 @@ func TestConditionSet(t *testing.T) {
|
||||
}
|
||||
actualConditions := actual.AsList()
|
||||
if len(actualConditions) != len(expectedConditions) {
|
||||
t.Errorf("len(MatchingAny(%d).AsList()): got %d, want %d",
|
||||
t.Errorf("len(MatchingAny(%s).AsList()): got %d, want %d",
|
||||
data, len(actualNames), len(expectedNames))
|
||||
} else {
|
||||
for i := 0; i < len(actualNames); i++ {
|
||||
@@ -452,7 +452,7 @@ func TestConditionSet(t *testing.T) {
|
||||
for i := 0; i < len(actualConditions); i++ {
|
||||
if actualConditions[i] != expectedConditions[i] {
|
||||
t.Errorf("actual.AsList()[%d]: got %s, want %s",
|
||||
i, actualConditions[i], expectedConditions[i])
|
||||
i, actualConditions[i].Name(), expectedConditions[i].Name())
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -552,7 +552,7 @@ func TestConditionSet(t *testing.T) {
|
||||
for i := 0; i < len(actualConditions); i++ {
|
||||
if actualConditions[i] != expectedConditions[i] {
|
||||
t.Errorf("actual.AsList()[%d}: got %s, want %s",
|
||||
i, actualConditions[i], expectedConditions[i])
|
||||
i, actualConditions[i].Name(), expectedConditions[i].Name())
|
||||
break
|
||||
}
|
||||
}
|
||||
|
18
tools/compliance/go.mod
Normal file
18
tools/compliance/go.mod
Normal file
@@ -0,0 +1,18 @@
|
||||
module android/soong/tools/compliance
|
||||
|
||||
require google.golang.org/protobuf v0.0.0
|
||||
|
||||
replace google.golang.org/protobuf v0.0.0 => ../../../../external/golang-protobuf
|
||||
|
||||
require android/soong v0.0.0
|
||||
|
||||
replace android/soong v0.0.0 => ../../../soong
|
||||
// Indirect deps from golang-protobuf
|
||||
exclude github.com/golang/protobuf v1.5.0
|
||||
|
||||
replace github.com/google/go-cmp v0.5.5 => ../../../../external/go-cmp
|
||||
|
||||
// Indirect dep from go-cmp
|
||||
exclude golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
||||
|
||||
go 1.18
|
@@ -143,7 +143,6 @@ func LicenseConditionSetFromNames(tn *TargetNode, names ...string) LicenseCondit
|
||||
return cs
|
||||
}
|
||||
|
||||
|
||||
// Resolution happens in three phases:
|
||||
//
|
||||
// 1. A bottom-up traversal propagates (restricted) license conditions up to
|
||||
@@ -182,7 +181,6 @@ func LicenseConditionSetFromNames(tn *TargetNode, names ...string) LicenseCondit
|
||||
// Not all restricted licenses are create equal. Some have special rules or
|
||||
// exceptions. e.g. LGPL or "with classpath excption".
|
||||
|
||||
|
||||
// depConditionsPropagatingToTarget returns the conditions which propagate up an
|
||||
// edge from dependency to target.
|
||||
//
|
||||
@@ -270,7 +268,6 @@ func conditionsAttachingAcrossEdge(lg *LicenseGraph, e *TargetEdge, universe Lic
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
// edgeIsDynamicLink returns true for edges representing shared libraries
|
||||
// linked dynamically at runtime.
|
||||
func edgeIsDynamicLink(e *TargetEdge) bool {
|
@@ -226,7 +226,7 @@ func TestPolicy_edgeConditions(t *testing.T) {
|
||||
fs[tt.edge.dep] = []byte(meta[tt.edge.dep])
|
||||
lg, err := ReadLicenseGraph(&fs, stderr, []string{tt.edge.target})
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error reading graph: %w", err)
|
||||
t.Errorf("unexpected error reading graph: %s", err)
|
||||
return
|
||||
}
|
||||
edge := lg.Edges()[0]
|
@@ -332,7 +332,7 @@ func TestResolveBottomUpConditions(t *testing.T) {
|
||||
stderr := &bytes.Buffer{}
|
||||
lg, err := toGraph(stderr, tt.roots, tt.edges)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected test data error: got %w, want no error", err)
|
||||
t.Errorf("unexpected test data error: got %s, want no error", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ func TestResolveTopDownConditions(t *testing.T) {
|
||||
stderr := &bytes.Buffer{}
|
||||
lg, err := toGraph(stderr, tt.roots, tt.edges)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected test data error: got %w, want no error", err)
|
||||
t.Errorf("unexpected test data error: got %s, want no error", err)
|
||||
return
|
||||
}
|
||||
|
@@ -457,7 +457,7 @@ func TestResolveNotices(t *testing.T) {
|
||||
stderr := &bytes.Buffer{}
|
||||
lg, err := toGraph(stderr, tt.roots, tt.edges)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected test data error: got %w, want no error", err)
|
||||
t.Errorf("unexpected test data error: got %s, want no error", err)
|
||||
return
|
||||
}
|
||||
expectedRs := toResolutionSet(lg, tt.expectedResolutions)
|
@@ -76,7 +76,7 @@ func TestResolveSourcePrivacy(t *testing.T) {
|
||||
stderr := &bytes.Buffer{}
|
||||
lg, err := toGraph(stderr, tt.roots, tt.edges)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected test data error: got %w, want no error", err)
|
||||
t.Errorf("unexpected test data error: got %s, want no error", err)
|
||||
return
|
||||
}
|
||||
expectedRs := toResolutionSet(lg, tt.expectedResolutions)
|
@@ -286,7 +286,7 @@ func TestResolveSourceSharing(t *testing.T) {
|
||||
stderr := &bytes.Buffer{}
|
||||
lg, err := toGraph(stderr, tt.roots, tt.edges)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected test data error: got %w, want no error", err)
|
||||
t.Errorf("unexpected test data error: got %s, want no error", err)
|
||||
return
|
||||
}
|
||||
expectedRs := toResolutionSet(lg, tt.expectedResolutions)
|
@@ -99,7 +99,7 @@ func TestConflictingSharedPrivateSource(t *testing.T) {
|
||||
stderr := &bytes.Buffer{}
|
||||
lg, err := toGraph(stderr, tt.roots, tt.edges)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected test data error: got %w, want no error", err)
|
||||
t.Errorf("unexpected test data error: got %s, want no error", err)
|
||||
return
|
||||
}
|
||||
expectedConflicts := toConflictList(lg, tt.expectedConflicts)
|
@@ -108,7 +108,7 @@ func TestShippedNodes(t *testing.T) {
|
||||
stderr := &bytes.Buffer{}
|
||||
lg, err := toGraph(stderr, tt.roots, tt.edges)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected test data error: got %w, want no error", err)
|
||||
t.Errorf("unexpected test data error: got %s, want no error", err)
|
||||
return
|
||||
}
|
||||
t.Logf("graph:")
|
@@ -620,7 +620,7 @@ func TestWalkResolutionsForCondition(t *testing.T) {
|
||||
stderr := &bytes.Buffer{}
|
||||
lg, err := toGraph(stderr, tt.roots, tt.edges)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected test data error: got %w, want no error", err)
|
||||
t.Errorf("unexpected test data error: got %s, want no error", err)
|
||||
return
|
||||
}
|
||||
expectedRs := toResolutionSet(lg, tt.expectedResolutions)
|
||||
@@ -1228,7 +1228,7 @@ func TestWalkActionsForCondition(t *testing.T) {
|
||||
stderr := &bytes.Buffer{}
|
||||
lg, err := toGraph(stderr, tt.roots, tt.edges)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected test data error: got %w, want no error", err)
|
||||
t.Errorf("unexpected test data error: got %s, want no error", err)
|
||||
return
|
||||
}
|
||||
expectedAs := toActionSet(lg, tt.expectedActions)
|
@@ -88,9 +88,9 @@ func TestReadLicenseGraph(t *testing.T) {
|
||||
lg, err := ReadLicenseGraph(tt.fs, stderr, tt.roots)
|
||||
if err != nil {
|
||||
if len(tt.expectedError) == 0 {
|
||||
t.Errorf("unexpected error: got %w, want no error", err)
|
||||
t.Errorf("unexpected error: got %s, want no error", err)
|
||||
} else if !strings.Contains(err.Error(), tt.expectedError) {
|
||||
t.Errorf("unexpected error: got %w, want %q", err, tt.expectedError)
|
||||
t.Errorf("unexpected error: got %s, want %q", err, tt.expectedError)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@@ -65,7 +65,6 @@ func (rs ResolutionSet) AttachesTo() TargetNodeList {
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
// AttachesToTarget returns true if the set contains conditions that
|
||||
// are `attachedTo`.
|
||||
func (rs ResolutionSet) AttachesToTarget(target *TargetNode) bool {
|
||||
@@ -73,7 +72,6 @@ func (rs ResolutionSet) AttachesToTarget(target *TargetNode) bool {
|
||||
return isPresent
|
||||
}
|
||||
|
||||
|
||||
// Resolutions returns the list of resolutions that `attachedTo`
|
||||
// target must resolve. Returns empty list if no conditions apply.
|
||||
func (rs ResolutionSet) Resolutions(attachesTo *TargetNode) ResolutionList {
|
||||
|
@@ -219,7 +219,6 @@ func (l byEdge) Less(i, j int) bool {
|
||||
return l[i].target < l[j].target
|
||||
}
|
||||
|
||||
|
||||
// annotated describes annotated test data edges to define test graphs.
|
||||
type annotated struct {
|
||||
target, dep string
|
||||
|
Reference in New Issue
Block a user