Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | import os |
| 2 | import re |
| 3 | |
| 4 | from oeqa.selftest.case import OESelftestTestCase |
| 5 | from oeqa.utils.commands import bitbake, get_bb_var |
| 6 | |
| 7 | class 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 | |