* [LTP] [PATCHv2] syscalls/statx05: add mkfs.ext4 package version check
@ 2020-11-02 2:49 Po-Hsu Lin
2020-11-02 12:38 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Po-Hsu Lin @ 2020-11-02 2:49 UTC (permalink / raw)
To: ltp
The encryption feature was added in e2fsprogs 1.43:
e2fsprogs (1.43~WIP.2015.05.18-1) unstable; urgency=low
* Add support for file encryption feature
The test should be skipped when running with older package, otherwise
it will fail with:
Invalid filesystem option set: encrypt
Use popen and fscanf to get mkfs.ext4 -V output for version
comparison. This version checking by adding digits together does not
work with alphabets in the number like rc1, but in that case the test
will still be tested.
It will now be skipped with (Tested with Ubuntu Xenial + 4.15 kernel):
statx05.c:102: TCONF: Test needs mkfs.ext4 >= 1.43 for encrypt option, test skipped
Fixes: #542
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
---
testcases/kernel/syscalls/statx/statx05.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/statx/statx05.c b/testcases/kernel/syscalls/statx/statx05.c
index 77684e1ed..d7ac24418 100644
--- a/testcases/kernel/syscalls/statx/statx05.c
+++ b/testcases/kernel/syscalls/statx/statx05.c
@@ -17,6 +17,7 @@
* Second directory has no flags set.
*
* Minimum kernel version required is 4.11.
+ * Minimum e2fsprogs version required is 1.43.
*/
#define _GNU_SOURCE
@@ -24,6 +25,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include "tst_safe_stdio.h"
#include "tst_test.h"
#include "lapi/fs.h"
#include "lapi/stat.h"
@@ -86,9 +88,18 @@ static void run(unsigned int i)
static void setup(void)
{
+ FILE *f;
char opt_bsize[32];
const char *const fs_opts[] = {"-O encrypt", opt_bsize, NULL};
- int ret;
+ int ret, rc, major, minor, patch;
+
+ f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r");
+ rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch);
+ if (rc != 3)
+ tst_res(TWARN, "Unable parse version number");
+ else if (major * 10000 + minor * 100 + patch < 14300)
+ tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for encrypt option, test skipped");
+ pclose(f);
snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", getpagesize());
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [LTP] [PATCHv2] syscalls/statx05: add mkfs.ext4 package version check
2020-11-02 2:49 [LTP] [PATCHv2] syscalls/statx05: add mkfs.ext4 package version check Po-Hsu Lin
@ 2020-11-02 12:38 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2020-11-02 12:38 UTC (permalink / raw)
To: ltp
Hi!
Applied, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-02 12:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-02 2:49 [LTP] [PATCHv2] syscalls/statx05: add mkfs.ext4 package version check Po-Hsu Lin
2020-11-02 12:38 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).