Skip to content

Commit 35d0c75

Browse files
roypatdianpopa
authored andcommitted
Fix test_dependencies only checking dependency cnt
This allowed dependencies to be replaced without the test failing, as long as the overall number of lines in the dependencies.txt file was correct. Note that due to the use of pprint automatically wrapping lines at 80 characters, the file contained more lines than dependencies, making the check even more inaccurate (dependencies with long paths/git urls werevbroken up into multiple lines, leading to a leniency of two dependencies that could be added without the test failing). This commit changes to the to 1. fix the above issues 2. ignore dependency versions, and only care about their names (meaning updates to a dependency will not trigger the test) Signed-off-by: Patrick Roy <[email protected]>
1 parent 56b5fa5 commit 35d0c75

File tree

2 files changed

+104
-113
lines changed

2 files changed

+104
-113
lines changed

tests/framework/dependencies.txt

Lines changed: 94 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,94 @@
1-
['aead v0.5.1',
2-
'aes v0.8.2',
3-
'aes-gcm v0.10.1',
4-
'aho-corasick v0.7.20',
5-
'api_server v0.1.0 (/firecracker/src/api_server)',
6-
'arch v0.1.0 (/firecracker/src/arch)',
7-
'arch_gen v0.1.0 (/firecracker/src/arch_gen)',
8-
'autocfg v1.1.0',
9-
'base64 v0.13.1',
10-
'bincode v1.3.3',
11-
'bindgen v0.60.1',
12-
'bitflags v1.3.2',
13-
'cc v1.0.77',
14-
'cexpr v0.6.0',
15-
'cfg-if v1.0.0',
16-
'cipher v0.4.3',
17-
'clang-sys v1.4.0',
18-
'cpufeatures v0.2.5',
19-
'cpuid v0.1.0 (/firecracker/src/cpuid)',
20-
'crc64 v1.0.0',
21-
'crypto-common v0.1.6',
22-
'ctr v0.9.2',
23-
'derive_more v0.99.17 (proc-macro)',
24-
'devices v0.1.0 (/firecracker/src/devices)',
25-
'dumbo v0.1.0 (/firecracker/src/dumbo)',
26-
'event-manager v0.3.0',
27-
'firecracker v1.1.0 (/firecracker/src/firecracker)',
28-
'generic-array v0.14.6',
29-
'getrandom v0.2.8',
30-
'ghash v0.5.0',
31-
'glob v0.3.0',
32-
'inout v0.1.3',
33-
'io-lifetimes v0.6.1',
34-
'io_uring v0.1.0 (/firecracker/src/io_uring)',
35-
'itoa v1.0.4',
36-
'jailer v1.1.0 (/firecracker/src/jailer)',
37-
'kvm-bindings v0.6.0 '
38-
'(https://github.com/firecracker-microvm/kvm-bindings?tag=v0.6.0-1#e8359204)',
39-
'kvm-ioctls v0.12.0',
40-
'lazy_static v1.4.0',
41-
'lazycell v1.3.0',
42-
'libc v0.2.137',
43-
'libloading v0.7.4',
44-
'linux-loader v0.8.0',
45-
'linux-raw-sys v0.0.46',
46-
'log v0.4.17',
47-
'logger v0.1.0 (/firecracker/src/logger)',
48-
'memchr v2.5.0',
49-
'memoffset v0.6.5',
50-
'micro_http v0.1.0 '
51-
'(https://github.com/firecracker-microvm/micro-http?rev=4b18a04#4b18a043)',
52-
'minimal-lexical v0.2.1',
53-
'mmds v0.1.0 (/firecracker/src/mmds)',
54-
'net_gen v0.1.0 (/firecracker/src/net_gen)',
55-
'nix v0.23.1',
56-
'nom v7.1.1',
57-
'opaque-debug v0.3.0',
58-
'peeking_take_while v0.1.2',
59-
'polyval v0.6.0',
60-
'proc-macro2 v1.0.47',
61-
'quote v1.0.21',
62-
'rand_core v0.6.4',
63-
'rate_limiter v0.1.0 (/firecracker/src/rate_limiter)',
64-
'rebase-snap v1.1.0 (/firecracker/src/rebase-snap)',
65-
'regex v1.7.0',
66-
'regex-syntax v0.6.28',
67-
'rustc-hash v1.1.0',
68-
'rustix v0.34.8',
69-
'ryu v1.0.11',
70-
'seccompiler v1.1.0 (/firecracker/src/seccompiler)',
71-
'serde v1.0.147',
72-
'serde_derive v1.0.147 (proc-macro)',
73-
'serde_json v1.0.89',
74-
'shlex v1.1.0',
75-
'snapshot v0.1.0 (/firecracker/src/snapshot)',
76-
'subtle v2.4.1',
77-
'syn v1.0.103',
78-
'thiserror v1.0.37',
79-
'thiserror-impl v1.0.37 (proc-macro)',
80-
'timerfd v1.3.0',
81-
'typenum v1.15.0',
82-
'unicode-ident v1.0.5',
83-
'universal-hash v0.5.0',
84-
'userfaultfd v0.5.0',
85-
'userfaultfd-sys v0.4.2',
86-
'utils v0.1.0 (/firecracker/src/utils)',
87-
'version_check v0.9.4',
88-
'versionize v0.1.9',
89-
'versionize_derive v0.1.4 (proc-macro)',
90-
'virtio_gen v0.1.0 (/firecracker/src/virtio_gen)',
91-
'vm-allocator v0.1.0',
92-
'vm-fdt v0.2.0',
93-
'vm-memory v0.10.0',
94-
'vm-memory v0.3.0 (/firecracker/src/vm-memory)',
95-
'vm-superio v0.7.0',
96-
'vmm v0.1.0 (/firecracker/src/vmm)',
97-
'vmm-sys-util v0.11.0']
1+
['aead',
2+
'aes',
3+
'aes-gcm',
4+
'aho-corasick',
5+
'api_server',
6+
'arch',
7+
'arch_gen',
8+
'autocfg',
9+
'base64',
10+
'bincode',
11+
'bindgen',
12+
'bitflags',
13+
'cc',
14+
'cexpr',
15+
'cfg-if',
16+
'cipher',
17+
'clang-sys',
18+
'cpufeatures',
19+
'cpuid',
20+
'crc64',
21+
'crypto-common',
22+
'ctr',
23+
'derive_more',
24+
'devices',
25+
'dumbo',
26+
'event-manager',
27+
'firecracker',
28+
'generic-array',
29+
'getrandom',
30+
'ghash',
31+
'glob',
32+
'inout',
33+
'io-lifetimes',
34+
'io_uring',
35+
'itoa',
36+
'jailer',
37+
'kvm-bindings',
38+
'kvm-ioctls',
39+
'lazy_static',
40+
'lazycell',
41+
'libc',
42+
'libloading',
43+
'linux-loader',
44+
'linux-raw-sys',
45+
'log',
46+
'logger',
47+
'memchr',
48+
'memoffset',
49+
'micro_http',
50+
'minimal-lexical',
51+
'mmds',
52+
'net_gen',
53+
'nix',
54+
'nom',
55+
'opaque-debug',
56+
'peeking_take_while',
57+
'polyval',
58+
'proc-macro2',
59+
'quote',
60+
'rand_core',
61+
'rate_limiter',
62+
'rebase-snap',
63+
'regex',
64+
'regex-syntax',
65+
'rustc-hash',
66+
'rustix',
67+
'ryu',
68+
'seccompiler',
69+
'serde',
70+
'serde_derive',
71+
'serde_json',
72+
'shlex',
73+
'snapshot',
74+
'subtle',
75+
'syn',
76+
'thiserror',
77+
'thiserror-impl',
78+
'timerfd',
79+
'typenum',
80+
'unicode-ident',
81+
'universal-hash',
82+
'userfaultfd',
83+
'userfaultfd-sys',
84+
'utils',
85+
'version_check',
86+
'versionize',
87+
'versionize_derive',
88+
'virtio_gen',
89+
'vm-allocator',
90+
'vm-fdt',
91+
'vm-memory',
92+
'vm-superio',
93+
'vmm',
94+
'vmm-sys-util']

tests/integration_tests/build/test_dependencies.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,19 @@ def test_num_dependencies(dep_file):
4040
# appear multiple times).
4141
for line in deps:
4242
if line and "(*)" not in line:
43-
current_deps.add(line)
43+
# only care about dependency name, not version/path/github repo
44+
current_deps.add(line.split()[0])
4445

4546
# Use the code below to update the expected dependencies.
46-
# from pprint import pprint
4747
# with open(dep_file, "w", encoding='utf-8') as prev_deps:
48-
# pprint(sorted(current_deps), stream=prev_deps)
48+
# prev_deps.write(repr(sorted(current_deps)).replace(',', ',\n'))
4949

5050
with open(dep_file, encoding="utf-8") as prev_deps:
5151
prev_deps = ast.literal_eval(prev_deps.read())
52-
if len(current_deps) > len(prev_deps):
53-
difference = current_deps - set(prev_deps)
54-
msg = (
55-
"The number of build dependencies has increased."
56-
" Is this expected? New dependencies {}".format(list(difference))
57-
)
58-
assert False, msg
59-
elif len(current_deps) != len(prev_deps):
60-
msg = (
61-
"The build dependencies have changed."
62-
" Use the code above to modify the {} file.".format(dep_file)
63-
)
64-
assert False, msg
52+
53+
difference = current_deps - set(prev_deps)
54+
55+
if difference:
56+
assert (
57+
False
58+
), f"New build dependencies detected. Is this expected? New dependencies {difference}"

0 commit comments

Comments
 (0)