syscalls/fsetxattr02.c: Fix missing ramdisk module error

Message ID 20181008154620.25237-1-rafael.tinoco@linaro.org
State Accepted
Headers show
Series
  • syscalls/fsetxattr02.c: Fix missing ramdisk module error
Related show

Commit Message

Rafael David Tinoco Oct. 8, 2018, 3:46 p.m.
This test depends on CONFIG_BLK_DEV_RAM kernel config option. If not,
then errors like:

safe_macros.c:225: BROK: fsetxattr02.c:214:
open(mntpoint/fsetxattr02blk,0,00) failed: ENXIO safe_macros.c:225:
BROK: fgetxattr02.c:244: open(fgetxattr02blk,0,00) failed: ENXIO

might happen. By using recent "needs_drivers" option we are able to
mitigate this.

Link: https://bugs.linaro.org/show_bug.cgi?id=4011
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
---
 testcases/kernel/syscalls/fsetxattr/fsetxattr02.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Cyril Hrubis Oct. 9, 2018, 2:17 p.m. | #1
Hi!
> +#define DRVRAMDISK "brd"

I find it a bit silly to define a macro for a string that is used
exactly once. Why can't we just write "brd", in the needed_drivers?
Rafael David Tinoco Oct. 9, 2018, 2:25 p.m. | #2
On 10/9/18 11:17 AM, Cyril Hrubis wrote:
> Hi!
>> +#define DRVRAMDISK "brd"
> 
> I find it a bit silly to define a macro for a string that is used
> exactly once. Why can't we just write "brd", in the needed_drivers?

I got it from from an existing test Cyril. I confess I thought the same 
=), was afraid of being an etiquette or something. Feel free to drop it, 
no hard feelings!
Cyril Hrubis Oct. 9, 2018, 2:26 p.m. | #3
Hi!
> > I find it a bit silly to define a macro for a string that is used
> > exactly once. Why can't we just write "brd", in the needed_drivers?
> 
> I got it from from an existing test Cyril. I confess I thought the same 
> =), was afraid of being an etiquette or something. Feel free to drop it, 
> no hard feelings!

There is still a lot of silly code in LTP, just send a patch if you see
some :-).
Cyril Hrubis Oct. 19, 2018, 1:06 p.m. | #4
Hi!
I got rid of the macro and pushed, thanks.

Patch

diff --git a/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c b/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
index b0d4a84fb..89279c384 100644
--- a/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
+++ b/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
@@ -58,6 +58,8 @@ 
 #define BLK      MNTPOINT"/fsetxattr02blk"
 #define SOCK     "fsetxattr02sock"
 
+#define DRVRAMDISK "brd"
+
 struct test_case {
 	char *fname;
 	int fd;
@@ -241,6 +243,11 @@  static void cleanup(void)
 	}
 }
 
+static const char *const needed_drivers[] = {
+	DRVRAMDISK,
+	NULL,
+};
+
 static struct tst_test test = {
 	.setup = setup,
 	.test = verify_fsetxattr,
@@ -249,6 +256,7 @@  static struct tst_test test = {
 	.needs_devfs = 1,
 	.mntpoint = MNTPOINT,
 	.needs_root = 1,
+	.needs_drivers = needed_drivers,
 };
 
 #else /* HAVE_SYS_XATTR_H */