blob: 23ca7d222b6c0eb231b165cf880712ee127a5f05 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001import os
2import re
3
4from oeqa.selftest.case import OESelftestTestCase
5from oeqa.utils.commands import bitbake, get_bb_var
6
7class CveCheckerTests(OESelftestTestCase):
8 def test_cve_checker(self):
9 image = "core-image-sato"
10
11 deploy_dir = get_bb_var("DEPLOY_DIR_IMAGE")
12 image_link_name = get_bb_var('IMAGE_LINK_NAME', image)
13
14 manifest_link = os.path.join(deploy_dir, "%s.cve" % image_link_name)
15
16 self.logger.info('CVE_CHECK_MANIFEST = "%s"' % manifest_link)
17 if (not 'cve-check' in get_bb_var('INHERIT')):
18 add_cve_check_config = 'INHERIT += "cve-check"'
19 self.append_config(add_cve_check_config)
20 self.append_config('CVE_CHECK_MANIFEST = "%s"' % manifest_link)
21 result = bitbake("-k -c cve_check %s" % image, ignore_status=True)
22 if (not 'cve-check' in get_bb_var('INHERIT')):
23 self.remove_config(add_cve_check_config)
24
25 isfile = os.path.isfile(manifest_link)
26 self.assertEqual(True, isfile, 'Failed to create cve data file : %s' % manifest_link)
27