Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 192875fd authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Regression testcase for shipped vs nonshipped." am: 3a065630

Original change: https://android-review.googlesource.com/c/platform/build/+/1946016

Change-Id: I1e37a97e0600ee5155de3ca2b5a0bc8baa367bf6
parents 1dd148f7 3a065630
Loading
Loading
Loading
Loading
+92 −0
Original line number Diff line number Diff line
@@ -357,6 +357,98 @@ func Test(t *testing.T) {
			roots:       []string{"lib/libd.so.meta_lic"},
			expectedOut: []projectShare{},
		},
		{
			condition: "regressgpl1",
			name:      "container",
			roots:     []string{"container.zip.meta_lic"},
			expectedOut: []projectShare{
				{
					project:    "bin/threelibraries",
					conditions: []string{"restricted"},
				},
				{
					project:    "container/zip",
					conditions: []string{"restricted"},
				},
			},
		},
		{
			condition: "regressgpl1",
			name:      "containerplus",
			roots:     []string{"container.zip.meta_lic", "lib/libapache.so.meta_lic", "lib/libc++.so.meta_lic"},
			expectedOut: []projectShare{
				{
					project:    "bin/threelibraries",
					conditions: []string{"restricted"},
				},
				{
					project:    "container/zip",
					conditions: []string{"restricted"},
				},
				{
					project:    "lib/apache",
					conditions: []string{"restricted"},
				},
				{
					project:    "lib/c++",
					conditions: []string{"restricted"},
				},
			},
		},
		{
			condition: "regressgpl2",
			name:      "container",
			roots:     []string{"container.zip.meta_lic"},
			expectedOut: []projectShare{
				{
					project:    "bin/threelibraries",
					conditions: []string{"restricted"},
				},
				{
					project:    "container/zip",
					conditions: []string{"restricted"},
				},
				{
					project:    "lib/apache",
					conditions: []string{"restricted"},
				},
				{
					project:    "lib/c++",
					conditions: []string{"restricted"},
				},
				{
					project:    "lib/gpl",
					conditions: []string{"restricted"},
				},
			},
		},
		{
			condition: "regressgpl2",
			name:      "containerplus",
			roots:     []string{"container.zip.meta_lic", "lib/libapache.so.meta_lic", "lib/libc++.so.meta_lic"},
			expectedOut: []projectShare{
				{
					project:    "bin/threelibraries",
					conditions: []string{"restricted"},
				},
				{
					project:    "container/zip",
					conditions: []string{"restricted"},
				},
				{
					project:    "lib/apache",
					conditions: []string{"restricted"},
				},
				{
					project:    "lib/c++",
					conditions: []string{"restricted"},
				},
				{
					project:    "lib/gpl",
					conditions: []string{"restricted"},
				},
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.condition+" "+tt.name, func(t *testing.T) {
+4 −1
Original line number Diff line number Diff line
## Test data

Each directory under testdata/ defines a similar build graph.
Each non-regression directory under testdata/ defines a similar build graph.
All have the same structure, but different versions of the graph have different
license metadata.

The regression* directories can have whatever structure is required for the
specific test case.

### Testdata build graph structure:

The structure is meant to simulate some common scenarios:
+32 −0
Original line number Diff line number Diff line
## Shipped versus non-shipped libraries with restricted license

### Testdata build graph structure:

A restricted licensed library sandwiched between a notice library and a notice
binary. The source-code for the libraries only needs to be shared if shipped
alongside the container with the binaries.

```dot
strict digraph {
	rankdir=LR;
	bin1 [label="bin/bin1.meta_lic\nnotice"];
	bin2 [label="bin/bin2.meta_lic\nnotice"];
	bin3 [label="bin/bin3.meta_lic\nnotice"];
	container [label="container.zip.meta_lic\nnotice"];
	libapache [label="lib/libapache.so.meta_lic\nnotice"];
	libcxx [label="lib/libc++.so.meta_lic\nnotice"];
	libgpl [label="lib/libgpl.so.meta_lic\nrestricted"];
	container -> bin1[label="static"];
	container -> bin2 [label="static"];
	container -> bin3 [label="static"];
	bin1 -> libcxx [label="dynamic"];
	bin2 -> libapache [label="dynamic"];
	bin2 -> libcxx [label="dynamic"];
	bin3 -> libapache [label="dynamic"];
	bin3 -> libcxx [label="dynamic"];
	bin3 -> libgpl [label="dynamic"];
	libapache -> libcxx [label="dynamic"];
	libgpl -> libcxx [label="dynamic"];
	{rank=same; container}
}
```
+14 −0
Original line number Diff line number Diff line
package_name:  "Android"
module_classes: "EXECUTABLES"
projects:  "bin/onelibrary"
license_kinds:  "SPDX-license-identifier-Apache-2.0"
license_conditions:  "notice"
license_texts:  "build/soong/licenses/LICENSE"
is_container:  false
built:  "out/target/product/fictional/obj/EXECUTABLES/bin_intermediates/bin1"
installed:  "out/target/product/fictional/system/bin/bin1"
sources:  "out/target/product/fictional/system/lib/libc++.so"
deps:  {
  file:  "testdata/regressgpl1/lib/libc++.so.meta_lic"
  annotations:  "dynamic"
}
+19 −0
Original line number Diff line number Diff line
package_name:  "Android"
module_classes: "EXECUTABLES"
projects:  "bin/twolibraries"
license_kinds:  "SPDX-license-identifier-Apache-2.0"
license_conditions:  "notice"
license_texts:  "build/soong/licenses/LICENSE"
is_container:  false
built:  "out/target/product/fictional/obj/EXECUTABLES/bin_intermediates/bin2"
installed:  "out/target/product/fictional/system/bin/bin2"
sources:  "out/target/product/fictional/system/lib/libc++.so"
sources:  "out/target/product/fictional/system/lib/libapache.so"
deps:  {
  file:  "testdata/regressgpl1/lib/libc++.so.meta_lic"
  annotations:  "dynamic"
}
deps:  {
  file:  "testdata/regressgpl1/lib/libapache.so.meta_lic"
  annotations:  "dynamic"
}
Loading