* [poky][master][PATCH] test_buildhistory: Add test to verify that LICENSE is added
@ 2021-07-26 3:46 sana kazi
2021-08-09 6:26 ` sana kazi
0 siblings, 1 reply; 2+ messages in thread
From: sana kazi @ 2021-07-26 3:46 UTC (permalink / raw)
To: Openembedded-core; +Cc: nishaparrakat
From: Sana Kazi <Sana.Kazi@kpit.com>
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.
Signed-off-by: Sana Kazi <Sana.Kazi@kpit.com>
---
.../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
diff --git a/meta-selftest/recipes-test/glibc/glibc_%.bbappend b/meta-selftest/recipes-test/glibc/glibc_%.bbappend
new file mode 100644
index 0000000000..205720982c
--- /dev/null
+++ b/meta-selftest/recipes-test/glibc/glibc_%.bbappend
@@ -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
diff --git a/meta/lib/oeqa/selftest/cases/test_buildhistory.py b/meta/lib/oeqa/selftest/cases/test_buildhistory.py
new file mode 100644
index 0000000000..2f1bd54599
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/test_buildhistory.py
@@ -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\"')
+ 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)
+ 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\"')
+ 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)
+ 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [poky][master][PATCH] test_buildhistory: Add test to verify that LICENSE is added
2021-07-26 3:46 [poky][master][PATCH] test_buildhistory: Add test to verify that LICENSE is added sana kazi
@ 2021-08-09 6:26 ` sana kazi
0 siblings, 0 replies; 2+ messages in thread
From: sana kazi @ 2021-08-09 6:26 UTC (permalink / raw)
To: Openembedded-core; +Cc: nishaparrakat
[-- Attachment #1: Type: text/plain, Size: 3859 bytes --]
Hi,
Could you please review below patch?
Regards,
Sana Kazi
On Mon, 26 Jul 2021 at 09:16, Sana Kazi <sanakazisk19@gmail.com> wrote:
> From: Sana Kazi <Sana.Kazi@kpit.com>
>
> 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.
>
> Signed-off-by: Sana Kazi <Sana.Kazi@kpit.com>
> ---
> .../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
>
> diff --git a/meta-selftest/recipes-test/glibc/glibc_%.bbappend
> b/meta-selftest/recipes-test/glibc/glibc_%.bbappend
> new file mode 100644
> index 0000000000..205720982c
> --- /dev/null
> +++ b/meta-selftest/recipes-test/glibc/glibc_%.bbappend
> @@ -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
> diff --git a/meta/lib/oeqa/selftest/cases/test_buildhistory.py
> b/meta/lib/oeqa/selftest/cases/test_buildhistory.py
> new file mode 100644
> index 0000000000..2f1bd54599
> --- /dev/null
> +++ b/meta/lib/oeqa/selftest/cases/test_buildhistory.py
> @@ -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\"')
> + 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)
> + 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\"')
> + 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)
> + 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
>
>
[-- Attachment #2: Type: text/html, Size: 4907 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-09 6:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 3:46 [poky][master][PATCH] test_buildhistory: Add test to verify that LICENSE is added sana kazi
2021-08-09 6:26 ` sana kazi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.