summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@amd.com>2024-07-26 11:22:33 -0500
committerSteve Sakoman <steve@sakoman.com>2024-08-06 19:11:18 -0700
commitc80d82054e9c34305d3372b9c644b147187b36e9 (patch)
tree0b3a550422c4f53ac5a4a9ccdfe4b4d8a31330c6
parent0d017528d4477172a34d7a805cf4888e642708d8 (diff)
downloadpoky-c80d82054e9c34305d3372b9c644b147187b36e9.tar.gz
selftest-hardlink: Add additional test cases
Additional test cases for debug symlink generation both binaries and static libraries. This also has the side effect of testing for race conditions in the hardlink debug generation and stripping. (From OE-Core rev: 39823d3211411e661320e1164ba4c50370804425) Signed-off-by: Mark Hatle <mark.hatle@amd.com> Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 7171f41c07a39a7543bb64f075d38b8e74563089) Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb13
-rw-r--r--meta/lib/oeqa/selftest/cases/package.py26
2 files changed, 39 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
index be346b8a0e..052bf0c92a 100644
--- a/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
+++ b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
@@ -10,6 +10,9 @@ S = "${WORKDIR}"
10 10
11do_compile () { 11do_compile () {
12 ${CC} hello.c -o hello1 ${CFLAGS} ${LDFLAGS} 12 ${CC} hello.c -o hello1 ${CFLAGS} ${LDFLAGS}
13
14 ${CC} hello.c -c -o hello.o ${CFLAGS}
15 ${AR} rcs libhello.a hello.o
13} 16}
14 17
15do_install () { 18do_install () {
@@ -22,9 +25,19 @@ do_install () {
22 ln ${D}${bindir}/hello1 ${D}${libexecdir}/hello3 25 ln ${D}${bindir}/hello1 ${D}${libexecdir}/hello3
23 ln ${D}${bindir}/hello1 ${D}${libexecdir}/hello4 26 ln ${D}${bindir}/hello1 ${D}${libexecdir}/hello4
24 27
28 # We need so many hardlink copies to look for specific race conditions
29 install -d ${D}${libdir}
30 install -m 0644 libhello.a ${D}${libdir}
31 for num in `seq 1 100` ; do
32 ln ${D}${libdir}/libhello.a ${D}${libdir}/libhello-${num}.a
33 done
34
25 dd if=/dev/zero of=${D}${bindir}/sparsetest bs=1 count=0 seek=1M 35 dd if=/dev/zero of=${D}${bindir}/sparsetest bs=1 count=0 seek=1M
26} 36}
27 37
28RDEPENDS:${PN}-gdb += "gdb" 38RDEPENDS:${PN}-gdb += "gdb"
29PACKAGES =+ "${PN}-gdb" 39PACKAGES =+ "${PN}-gdb"
30FILES:${PN}-gdb = "${bindir}/gdb.sh" 40FILES:${PN}-gdb = "${bindir}/gdb.sh"
41
42PACKAGE_STRIP_STATIC = "1"
43PACKAGE_DEBUG_STATIC_SPLIT = "1"
diff --git a/meta/lib/oeqa/selftest/cases/package.py b/meta/lib/oeqa/selftest/cases/package.py
index 1aa6c03f8a..38ed7173fe 100644
--- a/meta/lib/oeqa/selftest/cases/package.py
+++ b/meta/lib/oeqa/selftest/cases/package.py
@@ -103,11 +103,37 @@ class PackageTests(OESelftestTestCase):
103 103
104 dest = get_bb_var('PKGDEST', 'selftest-hardlink') 104 dest = get_bb_var('PKGDEST', 'selftest-hardlink')
105 bindir = get_bb_var('bindir', 'selftest-hardlink') 105 bindir = get_bb_var('bindir', 'selftest-hardlink')
106 libdir = get_bb_var('libdir', 'selftest-hardlink')
107 libexecdir = get_bb_var('libexecdir', 'selftest-hardlink')
106 108
107 def checkfiles(): 109 def checkfiles():
108 # Recipe creates 4 hardlinked files, there is a copy in package/ and a copy in packages-split/ 110 # Recipe creates 4 hardlinked files, there is a copy in package/ and a copy in packages-split/
109 # so expect 8 in total. 111 # so expect 8 in total.
110 self.assertEqual(os.stat(dest + "/selftest-hardlink" + bindir + "/hello1").st_nlink, 8) 112 self.assertEqual(os.stat(dest + "/selftest-hardlink" + bindir + "/hello1").st_nlink, 8)
113 self.assertEqual(os.stat(dest + "/selftest-hardlink" + libexecdir + "/hello3").st_nlink, 8)
114
115 # Check dbg version
116 # 2 items, a copy in both package/packages-split so 4
117 self.assertEqual(os.stat(dest + "/selftest-hardlink-dbg" + bindir + "/.debug/hello1").st_nlink, 4)
118 self.assertEqual(os.stat(dest + "/selftest-hardlink-dbg" + libexecdir + "/.debug/hello1").st_nlink, 4)
119
120 # Even though the libexecdir name is 'hello3' or 'hello4', that isn't the debug target name
121 self.assertEqual(os.path.exists(dest + "/selftest-hardlink-dbg" + libexecdir + "/.debug/hello3"), False)
122 self.assertEqual(os.path.exists(dest + "/selftest-hardlink-dbg" + libexecdir + "/.debug/hello4"), False)
123
124 # Check the staticdev libraries
125 # 101 items, a copy in both package/packages-split so 202
126 self.assertEqual(os.stat(dest + "/selftest-hardlink-staticdev" + libdir + "/libhello.a").st_nlink, 202)
127 self.assertEqual(os.stat(dest + "/selftest-hardlink-staticdev" + libdir + "/libhello-25.a").st_nlink, 202)
128 self.assertEqual(os.stat(dest + "/selftest-hardlink-staticdev" + libdir + "/libhello-50.a").st_nlink, 202)
129 self.assertEqual(os.stat(dest + "/selftest-hardlink-staticdev" + libdir + "/libhello-75.a").st_nlink, 202)
130
131 # Check static dbg
132 # 101 items, a copy in both package/packages-split so 202
133 self.assertEqual(os.stat(dest + "/selftest-hardlink-dbg" + libdir + "/.debug-static/libhello.a").st_nlink, 202)
134 self.assertEqual(os.stat(dest + "/selftest-hardlink-dbg" + libdir + "/.debug-static/libhello-25.a").st_nlink, 202)
135 self.assertEqual(os.stat(dest + "/selftest-hardlink-dbg" + libdir + "/.debug-static/libhello-50.a").st_nlink, 202)
136 self.assertEqual(os.stat(dest + "/selftest-hardlink-dbg" + libdir + "/.debug-static/libhello-75.a").st_nlink, 202)
111 137
112 # Test a sparse file remains sparse 138 # Test a sparse file remains sparse
113 sparsestat = os.stat(dest + "/selftest-hardlink" + bindir + "/sparsetest") 139 sparsestat = os.stat(dest + "/selftest-hardlink" + bindir + "/sparsetest")