diff options
author | Mark Hatle <mark.hatle@amd.com> | 2024-07-19 13:58:18 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-22 16:53:06 +0100 |
commit | 4462724cab96ed3990fdf9b30edcea2adc9095ee (patch) | |
tree | 006ca075dfb356b80fe2371490bd20d47a0a10d3 | |
parent | fa894486a99237b56469354c24ef913a96753aaf (diff) | |
download | poky-4462724cab96ed3990fdf9b30edcea2adc9095ee.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: 7171f41c07a39a7543bb64f075d38b8e74563089)
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>
-rw-r--r-- | meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb | 13 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/package.py | 26 |
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 5632bdac7a..64fea8ed95 100644 --- a/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb +++ b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb | |||
@@ -11,6 +11,9 @@ UNPACKDIR = "${S}" | |||
11 | 11 | ||
12 | do_compile () { | 12 | do_compile () { |
13 | ${CC} hello.c -o hello1 ${CFLAGS} ${LDFLAGS} | 13 | ${CC} hello.c -o hello1 ${CFLAGS} ${LDFLAGS} |
14 | |||
15 | ${CC} hello.c -c -o hello.o ${CFLAGS} | ||
16 | ${AR} rcs libhello.a hello.o | ||
14 | } | 17 | } |
15 | 18 | ||
16 | do_install () { | 19 | do_install () { |
@@ -23,9 +26,19 @@ do_install () { | |||
23 | ln ${D}${bindir}/hello1 ${D}${libexecdir}/hello3 | 26 | ln ${D}${bindir}/hello1 ${D}${libexecdir}/hello3 |
24 | ln ${D}${bindir}/hello1 ${D}${libexecdir}/hello4 | 27 | ln ${D}${bindir}/hello1 ${D}${libexecdir}/hello4 |
25 | 28 | ||
29 | # We need so many hardlink copies to look for specific race conditions | ||
30 | install -d ${D}${libdir} | ||
31 | install -m 0644 libhello.a ${D}${libdir} | ||
32 | for num in `seq 1 100` ; do | ||
33 | ln ${D}${libdir}/libhello.a ${D}${libdir}/libhello-${num}.a | ||
34 | done | ||
35 | |||
26 | dd if=/dev/zero of=${D}${bindir}/sparsetest bs=1 count=0 seek=1M | 36 | dd if=/dev/zero of=${D}${bindir}/sparsetest bs=1 count=0 seek=1M |
27 | } | 37 | } |
28 | 38 | ||
29 | RDEPENDS:${PN}-gdb += "gdb" | 39 | RDEPENDS:${PN}-gdb += "gdb" |
30 | PACKAGES =+ "${PN}-gdb" | 40 | PACKAGES =+ "${PN}-gdb" |
31 | FILES:${PN}-gdb = "${bindir}/gdb.sh" | 41 | FILES:${PN}-gdb = "${bindir}/gdb.sh" |
42 | |||
43 | PACKAGE_STRIP_STATIC = "1" | ||
44 | PACKAGE_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") |