This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtest_sync_known_issues.py
179 lines (142 loc) · 5.54 KB
/
test_sync_known_issues.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import sync_known_issues
import pytest
from random import shuffle
def test_parse_files():
config_file = "test_data/test-issues.yaml"
config_data = sync_known_issues.parse_files([config_file])
assert "LKFT-ltp-staging" in config_data
assert len(config_data["LKFT-ltp-staging"]["environments"]) == 3
assert "known_issues" in config_data["LKFT-ltp-staging"]
def test_issue_equal_is_equal():
config_file = "test_data/test-issues.yaml"
config_data = sync_known_issues.parse_files([config_file])
a = config_data["LKFT-ltp-staging"]["known_issues"][0]
b = a.copy()
b["id"] = 10 # Set an 'id' field in b. Should still be equal
shuffle(b["environments"]) # Randomize environments list order
b["notes"] = b["notes"] + "\n" # Add newline to b's 'note'
is_equal = sync_known_issues.issues_equal(a, b)
assert is_equal
def test_issue_equal_not_equal():
config_file = "test_data/test-issues.yaml"
config_data = sync_known_issues.parse_files([config_file])
a = config_data["LKFT-ltp-staging"]["known_issues"][0]
b = a.copy()
b["id"] = 10 # Set an 'id' field in b. Should still be equal
b["title"] = "Foo is my Title"
is_equal = sync_known_issues.issues_equal(a, b)
assert not is_equal
def test_issue_url_note_null():
config_file = "test_data/test-issues.yaml"
config_data = sync_known_issues.parse_files([config_file])
a = config_data["LKFT-ltp-staging"]["known_issues"][0]
b = a.copy()
b["url"] = None
b["notes"] = None
is_equal = sync_known_issues.issues_equal(a, b)
assert not is_equal
def test_squad_known_issue_happy_path():
config_file = "test_data/test-issues.yaml"
config_data = sync_known_issues.parse_files([config_file])
a = sync_known_issues.SquadProject(config_data["LKFT-ltp-staging"])
assert a.projects == [
"lkft/linux-mainline-oe",
"lkft/linux-next-oe",
"lkft/linux-stable-rc-4.17-oe",
]
assert a.environments == ["hi6220-hikey", "juno-r2", "x86"]
assert len(a.known_issues) == 6
def test_squad_known_issue_happy_path_2():
config_file = "test_data/test-issues.yaml"
config_data = sync_known_issues.parse_files([config_file])
a = sync_known_issues.SquadProject(config_data["LKFT-ltp-staging"])
# Find issue named ltp-syscalls-tests/fork10 in the list
for issue in a.known_issues:
if issue.test_name == "ltp-syscalls-tests/fork10":
break
else:
assert False, "test_name ltp-syscalls-tests/fork10 not found"
assert issue.active
assert issue.intermittent is None
assert issue.projects_environments == {
"lkft/linux-mainline-oe": {"x86", "hi6220-hikey", "juno-r2"},
"lkft/linux-next-oe": {"hi6220-hikey"},
"lkft/linux-stable-rc-4.17-oe": {"hi6220-hikey"},
}
def test_squad_known_issue_dupe_detection():
config_file = "test_data/dupe-issue.yaml"
config_data = sync_known_issues.parse_files([config_file])
with pytest.raises(AssertionError) as exc_info:
sync_known_issues.SquadProject(config_data["LKFT-ltp-staging"])
assert "Error, test name ltp-syscalls-tests/fork13 defined twice" in str(exc_info)
def test_matrix_apply_kselftest_bug():
config_file = "test_data/test-issues-2.yaml"
config_data = sync_known_issues.parse_files([config_file])
a = sync_known_issues.SquadProject(config_data["LKFT"])
# Find issue named ltp-syscalls-tests/fork10 in the list
for issue in a.known_issues:
if issue.test_name == "kselftest/bpf_test_align":
break
else:
assert False, "test_name kselftest/bpf_test_align not found"
assert issue.projects_environments == {
"lkft/linux-stable-rc-4.14-oe": {
"dragonboard-410c",
"hi6220-hikey",
"i386",
"x86",
"qemu_arm64",
"qemu_x86_64",
"qemu_arm",
"qemu_i386",
"x15",
"juno-r2",
},
"lkft/linux-stable-rc-4.9-oe": {
"dragonboard-410c",
"hi6220-hikey",
"i386",
"x86",
"qemu_arm64",
"qemu_x86_64",
"qemu_arm",
"qemu_i386",
"x15",
"juno-r2",
},
"lkft/linux-stable-rc-4.4-oe": {
"dragonboard-410c",
"hi6220-hikey",
"i386",
"x86",
"qemu_arm64",
"qemu_x86_64",
"qemu_arm",
"qemu_i386",
"x15",
"juno-r2",
},
"lkft/linaro-hikey-stable-rc-4.4-oe": {
"dragonboard-410c",
"hi6220-hikey",
"i386",
"x86",
"qemu_arm64",
"qemu_x86_64",
"qemu_arm",
"qemu_i386",
"x15",
"juno-r2",
},
"lkft/linux-mainline-oe": {"qemu_i386", "x15", "qemu_arm", "i386"},
"lkft/linux-stable-rc-4.19-oe": {"qemu_i386", "x15", "qemu_arm", "i386"},
"lkft/linux-stable-rc-5.1-oe": {"qemu_i386", "x15", "qemu_arm", "i386"},
"lkft/linux-stable-rc-5.2-oe": {"qemu_i386", "x15", "qemu_arm", "i386"},
"lkft/linux-stable-rc-5.3-oe": {"qemu_i386", "x15", "qemu_arm", "i386"},
}
def test_test_names_as_string():
config_file = "test_data/test-names-as-string.yaml"
config_data = sync_known_issues.parse_files([config_file])
with pytest.raises(AssertionError) as exc_info:
sync_known_issues.SquadProject(config_data["LKFT-ltp-staging"])
assert "Error, string (not list) passed to test_names" in str(exc_info)