Skip to content

Commit 91ab469

Browse files
committed
move test_licences from test_dependencies.py to test_licences.py
`test_dependencies.py` only contained a single test, which tested the licences of the dependencies. It only ran on Intel. Thus, it was a style check in all but name. Move it to `test_licences.py`, which is where it belongs. Signed-off-by: Patrick Roy <[email protected]>
1 parent ec7e13a commit 91ab469

File tree

2 files changed

+28
-42
lines changed

2 files changed

+28
-42
lines changed

tests/integration_tests/build/test_dependencies.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

tests/integration_tests/style/test_licenses.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import datetime
66

77
from framework import utils_repo
8+
from framework.defs import FC_WORKSPACE_DIR
9+
from host_tools.cargo_build import cargo
810

911
AMAZON_COPYRIGHT_YEARS = range(2018, datetime.datetime.now().year + 1)
1012
AMAZON_COPYRIGHT = (
@@ -116,5 +118,31 @@ def test_for_valid_licenses():
116118
assert not error_msg, f"Files {error_msg} have invalid licenses"
117119

118120

121+
def test_dependency_licenses():
122+
"""Ensure license compatibility for Firecracker.
123+
124+
For a list of currently allowed licenses checkout deny.toml in
125+
the root directory.
126+
"""
127+
toml_file = FC_WORKSPACE_DIR / "Cargo.toml"
128+
129+
_, stdout, stderr = cargo(
130+
"deny", f"--manifest-path {toml_file} check licenses bans"
131+
)
132+
assert "licenses ok" in stdout
133+
134+
# "cargo deny" should deny licenses by default but for some reason copyleft is allowed
135+
# by it and if we add a dependency which has copyleft licenses "cargo deny" won't report
136+
# it unless it is explicitly told to do so from the deny.toml.
137+
# Our current deny.toml seems to cover all the cases we need but,
138+
# if there is an exception like copyleft (where we don't want and don't deny
139+
# in deny.toml and is allowed by cardo deny), we don't want to be left in the dark.
140+
# For such cases check "cargo deny" output, make sure that there are no warnings reported
141+
# related to the license and take appropriate actions i.e. either add them to allow list
142+
# or remove them if they are incompatible with our licenses.
143+
license_res = [line for line in stderr.split("\n") if "license" in line]
144+
assert not license_res
145+
146+
119147
if __name__ == "__main__":
120148
test_for_valid_licenses()

0 commit comments

Comments
 (0)