diff options
3 files changed, 38 insertions, 1 deletions
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 0000000000..8a0e6336aa --- /dev/null +++ b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb | |||
@@ -0,0 +1,19 @@ | |||
1 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
2 | |||
3 | LICENSE = "MIT" | ||
4 | |||
5 | SRC_URI = "file://hello.c" | ||
6 | |||
7 | S = "${WORKDIR}" | ||
8 | |||
9 | do_compile () { | ||
10 | ${CC} hello.c -o hello ${CFLAGS} ${LDFLAGS} | ||
11 | } | ||
12 | |||
13 | do_install () { | ||
14 | install -d ${D}${bindir} | ||
15 | install -m 755 hello ${D}${bindir}/hello | ||
16 | ln ${D}${bindir}/hello ${D}${bindir}/hello2 | ||
17 | ln ${D}${bindir}/hello ${D}${bindir}/hello3 | ||
18 | ln ${D}${bindir}/hello ${D}${bindir}/hello4 | ||
19 | } | ||
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 0000000000..5c45dc60bd --- /dev/null +++ b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink/hello.c | |||
@@ -0,0 +1,5 @@ | |||
1 | #include <stdio.h> | ||
2 | |||
3 | int main() { | ||
4 | printf("Hello World!\n"); | ||
5 | } \ 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 ef6eabef66..1e171b5ebe 100644 --- a/meta/lib/oeqa/selftest/cases/package.py +++ b/meta/lib/oeqa/selftest/cases/package.py | |||
@@ -1,6 +1,7 @@ | |||
1 | from oeqa.selftest.case import OESelftestTestCase | 1 | from oeqa.selftest.case import OESelftestTestCase |
2 | from oeqa.core.decorator.oeid import OETestID | 2 | from oeqa.core.decorator.oeid import OETestID |
3 | from oeqa.utils.commands import bitbake, get_bb_vars | 3 | from oeqa.utils.commands import bitbake, get_bb_vars, get_bb_var |
4 | import stat | ||
4 | import subprocess, os | 5 | import subprocess, os |
5 | import oe.path | 6 | import oe.path |
6 | 7 | ||
@@ -84,3 +85,15 @@ class VersionOrdering(OESelftestTestCase): | |||
84 | status = subprocess.call(command, env=env) | 85 | status = subprocess.call(command, env=env) |
85 | self.assertIn(status, (99, 100, 101)) | 86 | self.assertIn(status, (99, 100, 101)) |
86 | self.assertEqual(status - 100, sort, "%s %s (%d) failed" % (ver1, ver2, sort)) | 87 | self.assertEqual(status - 100, sort, "%s %s (%d) failed" % (ver1, ver2, sort)) |
88 | |||
89 | class PackageTests(OESelftestTestCase): | ||
90 | # Verify that a recipe which sets up hardlink files has those preserved into split packages | ||
91 | def test_preserve_hardlinks(self): | ||
92 | result = bitbake("selftest-hardlink") | ||
93 | |||
94 | dest = get_bb_var('PKGDEST', 'selftest-hardlink') | ||
95 | bindir = get_bb_var('bindir', 'selftest-hardlink') | ||
96 | |||
97 | # Recipe creates 4 hardlinked files, there is a copy in package/ and a copy in packages-split/ | ||
98 | # so expect 8 in total. | ||
99 | self.assertEqual(os.stat(dest + "/selftest-hardlink" + bindir + "/hello").st_nlink, 8) | ||