aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYeoh Ee Peng <ee.peng.yeoh@intel.com>2019-09-11 09:21:49 +0800
committerAnuj Mittal <anuj.mittal@intel.com>2019-09-11 12:27:52 +0800
commitf45cc044a52cb73efabff334c1220604c02fbf1a (patch)
tree37f07998971caf64f14c7d705c85faf88423f6ea
parent537d26a6f17df7ebdce3bc2b81301771a19c5dbf (diff)
downloadmeta-intel-warrior.tar.gz
meta-intel-warrior.tar.bz2
meta-intel-warrior.zip
oeqa/runtime/microcode: Enable microcode update testwarrior
With iucode-tool, identified the selected microcode to be used for microcode update by the specific processor. Compared the updated microcode from dmesg to the selected microcode, test failed if the updated microcode revision does not match the available selected microcode revision from the iucode-tool. Compute int from hexadecimal for comparison based on Naveen Kumar suggestion. Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r--lib/oeqa/runtime/cases/microcode.py36
1 files changed, 36 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..6ce36a6f
--- /dev/null
+++ b/lib/oeqa/runtime/cases/microcode.py
@@ -0,0 +1,36 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.runtime.decorator.package import OEHasPackage
+import re
+
+class MicrocodeTest(OERuntimeTestCase):
+
+ def get_revision_from_microcode_string_list(self, microcode_string_list, re_pattern):
+ re_compile = re.compile(re_pattern)
+ rev_list = []
+ for s in microcode_string_list:
+ matched_revs = re_compile.findall(s)
+ if matched_revs:
+ for mr in matched_revs:
+ rev_list.append(int(mr, 16))
+ return rev_list
+
+ @OEHasPackage(["iucode-tool"])
+ def test_microcode_update(self):
+ (status, output) = self.target.run('iucode_tool /lib/firmware/intel-ucode/ -tb -lS | grep rev')
+ if status:
+ self.skipTest("The iucode_tool detected no microcode for update.")
+
+ selected_microcodes = output.splitlines()
+ selected_rev_list = self.get_revision_from_microcode_string_list(selected_microcodes, "rev (\w*)")
+ self.assertTrue(selected_rev_list, msg="Could not find any rev from iucode_tool selected microcode.")
+
+ (status, output) = self.target.run('dmesg | grep microcode')
+ self.assertEqual(status, 0, msg='status and output: %s and %s' % (status, output))
+
+ updated_microcodes = output.splitlines()
+ updated_rev_list = self.get_revision_from_microcode_string_list(updated_microcodes, "revision=(\w*)")
+ self.assertTrue(updated_rev_list, msg="Could not find any updated revision from microcode dmesg.")
+
+ for ul in updated_rev_list:
+ self.assertTrue(ul in selected_rev_list, msg="Updated revision, %s, not in selected revision list (%s)" %
+ (ul, selected_rev_list))