summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-selftest/recipes-test/binutils/binutils_%.bbappend2
-rw-r--r--meta/lib/oeqa/selftest/cases/sstatetests.py83
2 files changed, 85 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/binutils/binutils_%.bbappend b/meta-selftest/recipes-test/binutils/binutils_%.bbappend
new file mode 100644
index 0000000000..205720982c
--- /dev/null
+++ b/meta-selftest/recipes-test/binutils/binutils_%.bbappend
@@ -0,0 +1,2 @@
1# This bbappend is used to alter the recipe using the test_recipe.inc file created by tests.
2include test_recipe.inc
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py
index febafdb2f7..3fa3038218 100644
--- a/meta/lib/oeqa/selftest/cases/sstatetests.py
+++ b/meta/lib/oeqa/selftest/cases/sstatetests.py
@@ -691,3 +691,86 @@ TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"
691 self.maxDiff = None 691 self.maxDiff = None
692 self.assertCountEqual(files1, files2) 692 self.assertCountEqual(files1, files2)
693 693
694class SStateFindSiginfo(SStateBase):
695 def test_sstate_compare_sigfiles_and_find_siginfo(self):
696 """
697 Test the functionality of the find_siginfo: basic function and callback in compare_sigfiles
698 """
699 self.write_config("""
700TMPDIR = \"${TOPDIR}/tmp-sstates-findsiginfo\"
701TCLIBCAPPEND = \"\"
702MACHINE = \"qemux86-64\"
703require conf/multilib.conf
704MULTILIBS = "multilib:lib32"
705DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
706BB_SIGNATURE_HANDLER = "OEBasicHash"
707""")
708 self.track_for_cleanup(self.topdir + "/tmp-sstates-findsiginfo")
709
710 pns = ["binutils", "binutils-native", "lib32-binutils"]
711 target_configs = [
712"""
713TMPVAL1 = "tmpval1"
714TMPVAL2 = "tmpval2"
715do_tmptask1() {
716 echo ${TMPVAL1}
717}
718do_tmptask2() {
719 echo ${TMPVAL2}
720}
721addtask do_tmptask1
722addtask tmptask2 before do_tmptask1
723""",
724"""
725TMPVAL3 = "tmpval3"
726TMPVAL4 = "tmpval4"
727do_tmptask1() {
728 echo ${TMPVAL3}
729}
730do_tmptask2() {
731 echo ${TMPVAL4}
732}
733addtask do_tmptask1
734addtask tmptask2 before do_tmptask1
735"""
736 ]
737
738 for target_config in target_configs:
739 self.write_recipeinc("binutils", target_config)
740 for pn in pns:
741 bitbake("%s -c do_tmptask1 -S none" % pn)
742 self.delete_recipeinc("binutils")
743
744 with bb.tinfoil.Tinfoil() as tinfoil:
745 tinfoil.prepare(config_only=True)
746
747 def find_siginfo(pn, taskname, sigs=None):
748 result = None
749 tinfoil.set_event_mask(["bb.event.FindSigInfoResult",
750 "bb.command.CommandCompleted"])
751 ret = tinfoil.run_command("findSigInfo", pn, taskname, sigs)
752 if ret:
753 while True:
754 event = tinfoil.wait_event(1)
755 if event:
756 if isinstance(event, bb.command.CommandCompleted):
757 break
758 elif isinstance(event, bb.event.FindSigInfoResult):
759 result = event.result
760 return result
761
762 def recursecb(key, hash1, hash2):
763 nonlocal recursecb_count
764 recursecb_count += 1
765 hashes = [hash1, hash2]
766 hashfiles = find_siginfo(key, None, hashes)
767 self.assertCountEqual(hashes, hashfiles)
768 bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb)
769
770 for pn in pns:
771 recursecb_count = 0
772 filedates = find_siginfo(pn, "do_tmptask1")
773 self.assertGreaterEqual(len(filedates), 2)
774 latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:]
775 bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-1], recursecb)
776 self.assertEqual(recursecb_count,1)