summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-12-26 20:10:00 +0100
committerKhem Raj <raj.khem@gmail.com>2025-12-26 17:36:58 -0800
commitcecee4bb94e97a4db4f6e65c611d665346bb0b09 (patch)
tree5e5567c309e38e266c4eb994fc4577b23f59c997
parentd53205ad36358c723cc79d49595665e5e96738ef (diff)
downloadmeta-openembedded-cecee4bb94e97a4db4f6e65c611d665346bb0b09.tar.gz
unionfs-fuse: add ptest support
It takes about a second to execute. Added two patches: - One adapts the testuite to ptest, to test the installed binary instead of testing the one from the build folder. - Another that fixes a bug in unionfsctl, which made the test fail. This patch is submitted upstream. Sample output: root@qemux86-64:~# ptest-runner START: ptest-runner 2025-12-26T19:03 BEGIN: /usr/lib/unionfs-fuse/ptest ptestuser:!:20448:0:99999:7::: PASS: test_all.IOCTL_TestCase.test_debug PASS: test_all.IOCTL_TestCase.test_wrong_args PASS: test_all.UnionFS_Help.test_help [...many lines...] PASS: test_all.UnionFS_RW_RW_PreserveBranch_TestCase.test_permissions_after_creating_directories PASS: test_all.UnionFS_Sync.test_sync PASS: test_all.UnionFS_Version.test_help ============================================================================ Testsuite summary DURATION: 0 END: /usr/lib/unionfs-fuse/ptest 2025-12-26T19:03 STOP: ptest-runner TOTAL: 1 FAIL: 0 Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-filesystems/conf/include/ptest-packagelists-meta-filesystems.inc1
-rw-r--r--meta-filesystems/recipes-filesystems/unionfs-fuse/files/0001-adapt-tests-to-ptest.patch43
-rw-r--r--meta-filesystems/recipes-filesystems/unionfs-fuse/files/0001-fix-debug-ioctl-call.patch58
-rw-r--r--meta-filesystems/recipes-filesystems/unionfs-fuse/files/run-ptest9
-rw-r--r--meta-filesystems/recipes-filesystems/unionfs-fuse/unionfs-fuse_3.7.bb13
5 files changed, 122 insertions, 2 deletions
diff --git a/meta-filesystems/conf/include/ptest-packagelists-meta-filesystems.inc b/meta-filesystems/conf/include/ptest-packagelists-meta-filesystems.inc
index 875a2f139a..3dc6986d6f 100644
--- a/meta-filesystems/conf/include/ptest-packagelists-meta-filesystems.inc
+++ b/meta-filesystems/conf/include/ptest-packagelists-meta-filesystems.inc
@@ -8,6 +8,7 @@
8 8
9PTESTS_FAST_META_FILESYSTEMS = "\ 9PTESTS_FAST_META_FILESYSTEMS = "\
10 e2tools \ 10 e2tools \
11 unionfs-fuse \
11" 12"
12 13
13PTESTS_SLOW_META_FILESYSTEMS = "\ 14PTESTS_SLOW_META_FILESYSTEMS = "\
diff --git a/meta-filesystems/recipes-filesystems/unionfs-fuse/files/0001-adapt-tests-to-ptest.patch b/meta-filesystems/recipes-filesystems/unionfs-fuse/files/0001-adapt-tests-to-ptest.patch
new file mode 100644
index 0000000000..1361501d4e
--- /dev/null
+++ b/meta-filesystems/recipes-filesystems/unionfs-fuse/files/0001-adapt-tests-to-ptest.patch
@@ -0,0 +1,43 @@
1From 8de40703857e63483a5c1b83ee7a5b6323c0b7d3 Mon Sep 17 00:00:00 2001
2From: Gyorgy Sarvari <skandigraun@gmail.com>
3Date: Fri, 26 Dec 2025 19:50:20 +0100
4Subject: [PATCH] adapt tests to ptest
5
6The tests are expected to be executed after compilation, and
7they look for the tested binaries in the build folder. However
8for ptests we want to test the already installed binaries,
9so change the tests to use them.
10
11Also, adapt the fusermount executable name to what's installed
12in the ptest images.
13
14Upstream-Status: Inappropriate [oe-specific]
15Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
16---
17 test_all.py | 6 +++---
18 1 file changed, 3 insertions(+), 3 deletions(-)
19
20diff --git a/test_all.py b/test_all.py
21index 6ead5b4..bb167a9 100755
22--- a/test_all.py
23+++ b/test_all.py
24@@ -41,8 +41,8 @@ def get_osxfuse_unionfs_mounts():
25
26 class Common:
27 def setUp(self):
28- self.unionfs_path = os.path.abspath('src/unionfs')
29- self.unionfsctl_path = os.path.abspath('src/unionfsctl')
30+ self.unionfs_path = 'unionfs'
31+ self.unionfsctl_path = 'unionfsctl'
32
33 self.tmpdir = tempfile.mkdtemp()
34 self.original_cwd = os.getcwd()
35@@ -81,7 +81,7 @@ class Common:
36 if platform.system() == 'Darwin':
37 call('umount %s' % self.mount_device)
38 else:
39- call('fusermount -u union')
40+ call('fusermount3 -u union')
41
42 os.chdir(self.original_cwd)
43 shutil.rmtree(self.tmpdir)
diff --git a/meta-filesystems/recipes-filesystems/unionfs-fuse/files/0001-fix-debug-ioctl-call.patch b/meta-filesystems/recipes-filesystems/unionfs-fuse/files/0001-fix-debug-ioctl-call.patch
new file mode 100644
index 0000000000..a29128d22a
--- /dev/null
+++ b/meta-filesystems/recipes-filesystems/unionfs-fuse/files/0001-fix-debug-ioctl-call.patch
@@ -0,0 +1,58 @@
1From bf552c479a0c0b0ef2d52d8456030c56b8cc6dbb Mon Sep 17 00:00:00 2001
2From: Gyorgy Sarvari <skandigraun@gmail.com>
3Date: Fri, 26 Dec 2025 19:33:54 +0100
4Subject: [PATCH] fix debug ioctl call
5
6When calling the ioctl to set a debug file, the ioctl expects to receive a datatype
7that is specified in the ioctl definition: char[PATHLEN_MAX]
8
9However when passing the pointer from getopts, this is only true if the passed path
10has the maximal allowed length. Since usually this path is shorter than the max,
11the kernel is trying to read over the end of the argument, and returns "EFAULT/Bad address".
12
13To solve this, copy the argument to a buffer that has the exact size of what the ioctl
14expects, and pass this buffer to the ioctl.
15
16Upstream-Status: Submitted [https://github.com/rpodgorny/unionfs-fuse/pull/164]
17Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
18---
19 src/unionfsctl.c | 11 +++++++----
20 1 file changed, 7 insertions(+), 4 deletions(-)
21
22diff --git a/src/unionfsctl.c b/src/unionfsctl.c
23index 74c4d33..efed505 100644
24--- a/src/unionfsctl.c
25+++ b/src/unionfsctl.c
26@@ -44,25 +44,28 @@ int main(int argc, char **argv) {
27
28 int opt;
29 const char* argument_param;
30+ char debug_file[PATHLEN_MAX];
31 int debug_on_off;
32 int ioctl_res;
33 while ((opt = getopt(argc, argv, "d:p:")) != -1) {
34 switch (opt) {
35 case 'p':
36- argument_param = optarg;
37- if (strlen(argument_param) < 1) {
38+ if (strlen(optarg) < 1) {
39 fprintf(stderr,
40 "Not a valid debug path given!\n");
41 print_help(progname);
42 exit(1);
43 }
44
45- if (strlen(argument_param) > PATHLEN_MAX) {
46+ if (strlen(optarg) > PATHLEN_MAX) {
47 fprintf(stderr, "Debug path too long!\n");
48 exit(1);
49 }
50
51- ioctl_res = ioctl(fd, UNIONFS_SET_DEBUG_FILE, argument_param);
52+ memset(debug_file, 0, PATHLEN_MAX);
53+ strncpy(debug_file, optarg, PATHLEN_MAX - 1);
54+
55+ ioctl_res = ioctl(fd, UNIONFS_SET_DEBUG_FILE, debug_file);
56 if (ioctl_res == -1) {
57 fprintf(stderr, "debug-file ioctl failed: %s\n",
58 strerror(errno) );
diff --git a/meta-filesystems/recipes-filesystems/unionfs-fuse/files/run-ptest b/meta-filesystems/recipes-filesystems/unionfs-fuse/files/run-ptest
new file mode 100644
index 0000000000..a92ef0a8f7
--- /dev/null
+++ b/meta-filesystems/recipes-filesystems/unionfs-fuse/files/run-ptest
@@ -0,0 +1,9 @@
1#!/bin/sh
2# not all tests can run with root, so create a test user
3# if it doesn't exist yet
4
5if ! grep ptestuser /etc/shadow; then
6 useradd ptestuser
7fi
8
9su ptestuser -c "python3 -m putao.unittest"
diff --git a/meta-filesystems/recipes-filesystems/unionfs-fuse/unionfs-fuse_3.7.bb b/meta-filesystems/recipes-filesystems/unionfs-fuse/unionfs-fuse_3.7.bb
index 5ba202b90c..b5c5bb847c 100644
--- a/meta-filesystems/recipes-filesystems/unionfs-fuse/unionfs-fuse_3.7.bb
+++ b/meta-filesystems/recipes-filesystems/unionfs-fuse/unionfs-fuse_3.7.bb
@@ -6,11 +6,20 @@ LIC_FILES_CHKSUM = "file://src/unionfs.c;beginline=3;endline=8;md5=30fa8de70fd8a
6 file://LICENSE;md5=0e75c95b3e0e1c01489b39e7fadd3e2d \ 6 file://LICENSE;md5=0e75c95b3e0e1c01489b39e7fadd3e2d \
7" 7"
8 8
9SRC_URI = "git://github.com/rpodgorny/${BPN}.git;branch=master;protocol=https;tag=v${PV}" 9SRC_URI = "git://github.com/rpodgorny/${BPN}.git;branch=master;protocol=https;tag=v${PV} \
10 file://run-ptest \
11 file://0001-fix-debug-ioctl-call.patch \
12 file://0001-adapt-tests-to-ptest.patch \
13"
14
10SRCREV = "3fcbd11f78b9a9e02ea0e861d741840fe45dc9c8" 15SRCREV = "3fcbd11f78b9a9e02ea0e861d741840fe45dc9c8"
11 16
12DEPENDS = "fuse3" 17DEPENDS = "fuse3"
13RDEPENDS:${PN} = "bash" 18RDEPENDS:${PN} = "bash"
19RDEPENDS:${PN}-ptest += "python3-core python3-unittest python3-unittest-automake-output"
14 20
21inherit cmake pkgconfig ptest
15 22
16inherit cmake pkgconfig 23do_install_ptest(){
24 install ${S}/test_all.py ${D}${PTEST_PATH}
25}