test_buildhistory: Add test to verify that LICENSE is added
PATCH 1/1 test_buildhistory: Add test to verify that LICENSE is added
From: Sana Kazi <[email protected]>
Added test case which uses BUILDHISTORY_EXPORT_RECIPE_VARIABLES and BUILDHISTORY_EXPORT_PACKAGE_VARIABLES to add LICENSE for glibc as a sample recipe to buildhistory and the test verifies that expected license value is written in latest file.
--- .../recipes-test/glibc/glibc_%.bbappend | 2 + .../oeqa/selftest/cases/test_buildhistory.py | 48 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 meta-selftest/recipes-test/glibc/glibc_%.bbappend create mode 100644 meta/lib/oeqa/selftest/cases/test_buildhistory.py
meta-selftest/recipes-test/glibc/glibc_%.bbappend new file +2 -0
@@ -0,0 +1,2 @@ +# This bbappend is used to alter the recipe using the test_recipe.inc file created by tests. +include test_recipe.inc
meta/lib/oeqa/selftest/cases/test_buildhistory.py new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
2.17.1
Hi,
Could you please review below patch?
Regards,
Sana Kazi
Quoted 88 lines · Sana Kazi
From: Sana Kazi <[email protected]>
Added test case which uses
BUILDHISTORY_EXPORT_RECIPE_VARIABLESandBUILDHISTORY_EXPORT_PACKAGE_VARIABLESto add LICENSE for glibc as a sample recipe to buildhistory and the test verifies that expected license value is written in latest file.Signed-off-by Sana Kazi <[email protected]>--- .../recipes-test/glibc/glibc_%.bbappend | 2 + .../oeqa/selftest/cases/test_buildhistory.py | 48 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 meta-selftest/recipes-test/glibc/glibc_%.bbappend create mode 100644 meta/lib/oeqa/selftest/cases/test_buildhistory.pymeta-selftest/recipes-test/glibc/glibc_%.bbappend new file +1
-0@@ -0,0 +1,2 @@ +# This bbappend is used to alter the recipe using the test_recipe.incfile created by tests.
meta-selftest/recipes-test/glibc/glibc_%.bbappend new file +1
-0+include test_recipe.incmeta/lib/oeqa/selftest/cases/test_buildhistory.py new file +11
-0@@ -0,0 +1,48 @@ +import unittest +from oeqa.selftest.case import OESelftestTestCase +from oeqa.selftest.cases.buildhistory import BuildhistoryBase +from oeqa.utils.commands import bitbake, get_bb_var + +class BuildhistoryTests(BuildhistoryBase): + + def test_write_license_to_latest_recipe(self): + target = 'glibc' + recipe_variables = [] + self.write_recipeinc(target,'
BUILDHISTORY_EXPORT_RECIPE_VARIABLES+= \"LICENSE\"')meta/lib/oeqa/selftest/cases/test_buildhistory.py new file +7
-0+ self.run_buildhistory_operation(target) + add_buildhistory_config = 'PACKAGE_CLASSES = \"package_ipk\"' + self.append_config(add_buildhistory_config) + pkghistdir = get_bb_var('BUILDHISTORY_DIR') + PACKAGE_ARCH = get_bb_var('MULTIMACH_TARGET_SYS') + bitbake('-c package_write_ipk -f %s' % target) + infofile = "{}/packages/{}/{}/latest".format(pkghistdir,
PACKAGE_ARCH, target)meta/lib/oeqa/selftest/cases/test_buildhistory.py new file +14
-0+ expected = "LICENSE = GPLv2 & LGPLv2.1" + result = False + with open(infofile, "r") as f: + for line in f: + if line.strip() == expected: + result = True + break + if not result: + raise AssertionError("Expected License not found") + + def test_write_license_to_latest_package(self): + target = 'glibc' + recipe_variables = [] + self.write_recipeinc(target,'
BUILDHISTORY_EXPORT_PACKAGE_VARIABLES+= \"LICENSE\"')meta/lib/oeqa/selftest/cases/test_buildhistory.py new file +7
-0+ self.run_buildhistory_operation(target) + add_buildhistory_config = 'PACKAGE_CLASSES = \"package_ipk\"' + self.append_config(add_buildhistory_config) + bitbake('-c package_write_ipk -f %s' % target) + pkghistdir = get_bb_var('BUILDHISTORY_DIR') + PACKAGE_ARCH = get_bb_var('MULTIMACH_TARGET_SYS') + infofile = "{}/packages/{}/{}/{}-dbg/latest".format(pkghistdir,
PACKAGE_ARCH, target, target)meta/lib/oeqa/selftest/cases/test_buildhistory.py new file +9
-1+ expected = "LICENSE = GPLv2 & LGPLv2.1" + result = False + with open(infofile, "r") as f: + for line in f: + if line.strip() == expected: + result = True + break + if not result: + raise AssertionError("Expected License not found") --2.17.1