diff options
Diffstat (limited to 'lib/oeqa/runtime/cases/microcode.py')
-rw-r--r-- | lib/oeqa/runtime/cases/microcode.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/oeqa/runtime/cases/microcode.py b/lib/oeqa/runtime/cases/microcode.py new file mode 100644 index 00000000..52c1cdb4 --- /dev/null +++ b/lib/oeqa/runtime/cases/microcode.py | |||
@@ -0,0 +1,31 @@ | |||
1 | from oeqa.runtime.case import OERuntimeTestCase | ||
2 | from oeqa.runtime.decorator.package import OEHasPackage | ||
3 | import re | ||
4 | |||
5 | class MicrocodeTest(OERuntimeTestCase): | ||
6 | |||
7 | def get_revision_from_microcode_string_list(self, microcode_string_list, re_pattern): | ||
8 | re_compile = re.compile(re_pattern) | ||
9 | rev_list = [] | ||
10 | for s in microcode_string_list: | ||
11 | matched_revs = re_compile.findall(s) | ||
12 | if matched_revs: | ||
13 | for mr in matched_revs: | ||
14 | rev_list.append(int(mr, 16)) | ||
15 | return rev_list | ||
16 | |||
17 | @OEHasPackage(["iucode-tool"]) | ||
18 | def test_microcode_update(self): | ||
19 | (status, output) = self.target.run('iucode_tool /lib/firmware/intel-ucode/ -tb -l --scan-system=2 | grep rev') | ||
20 | |||
21 | selected_microcodes = output.splitlines() | ||
22 | selected_rev_list = self.get_revision_from_microcode_string_list(selected_microcodes, "rev (\w*)") | ||
23 | |||
24 | (status, output) = self.target.run("dmesg | grep 'microcode updated early'") | ||
25 | |||
26 | updated_microcodes = output.splitlines() | ||
27 | updated_rev_list = self.get_revision_from_microcode_string_list(updated_microcodes, "revision (\w*)") | ||
28 | |||
29 | for ul in updated_rev_list: | ||
30 | self.assertTrue(ul in selected_rev_list, msg="Updated revision, %s, not in selected revision list (%s)" % | ||
31 | (ul, selected_rev_list)) | ||