[oe-commits] [openembedded-core] 05/14: oeqa/selftest: Add package hardlink test

git at git.openembedded.org git at git.openembedded.org
Tue Jul 31 21:56:15 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 751fc7802f57a836a0be5fc6a8d5fdf8b1769c39
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Mon Jul 30 23:33:27 2018 +0000

    oeqa/selftest: Add package hardlink test
    
    We keep breaking the preservation of hardlinks during the packaging process.
    Add a selftest which tests this to try and prevent this breaking again.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 .../selftest-hardlink/selftest-hardlink.bb            | 19 +++++++++++++++++++
 .../selftest-hardlink/selftest-hardlink/hello.c       |  5 +++++
 meta/lib/oeqa/selftest/cases/package.py               | 15 ++++++++++++++-
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
new file mode 100644
index 0000000..8a0e633
--- /dev/null
+++ b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
@@ -0,0 +1,19 @@
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+LICENSE = "MIT"
+
+SRC_URI = "file://hello.c"
+
+S = "${WORKDIR}"
+
+do_compile () {
+	${CC} hello.c -o hello ${CFLAGS} ${LDFLAGS}
+}
+
+do_install () {
+	install -d ${D}${bindir}
+	install -m 755 hello ${D}${bindir}/hello
+	ln ${D}${bindir}/hello ${D}${bindir}/hello2
+	ln ${D}${bindir}/hello ${D}${bindir}/hello3
+	ln ${D}${bindir}/hello ${D}${bindir}/hello4
+}
diff --git a/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink/hello.c b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink/hello.c
new file mode 100644
index 0000000..5c45dc6
--- /dev/null
+++ b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink/hello.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+int main() {
+	printf("Hello World!\n");
+}
\ No newline at end of file
diff --git a/meta/lib/oeqa/selftest/cases/package.py b/meta/lib/oeqa/selftest/cases/package.py
index ef6eabe..1e171b5 100644
--- a/meta/lib/oeqa/selftest/cases/package.py
+++ b/meta/lib/oeqa/selftest/cases/package.py
@@ -1,6 +1,7 @@
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.core.decorator.oeid import OETestID
-from oeqa.utils.commands import bitbake, get_bb_vars
+from oeqa.utils.commands import bitbake, get_bb_vars, get_bb_var
+import stat
 import subprocess, os
 import oe.path
 
@@ -84,3 +85,15 @@ class VersionOrdering(OESelftestTestCase):
             status = subprocess.call(command, env=env)
             self.assertIn(status, (99, 100, 101))
             self.assertEqual(status - 100, sort, "%s %s (%d) failed" % (ver1, ver2, sort))
+
+class PackageTests(OESelftestTestCase):
+    # Verify that a recipe which sets up hardlink files has those preserved into split packages
+    def test_preserve_hardlinks(self):
+        result = bitbake("selftest-hardlink")
+
+        dest = get_bb_var('PKGDEST', 'selftest-hardlink')
+        bindir = get_bb_var('bindir', 'selftest-hardlink')
+
+        # Recipe creates 4 hardlinked files, there is a copy in package/ and a copy in packages-split/
+        # so expect 8 in total.
+        self.assertEqual(os.stat(dest + "/selftest-hardlink" + bindir + "/hello").st_nlink, 8)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list