* [LTP] testcases/kernel/syscalls/mount test cases of mount2 and mount3 faild in JUNE 2012 STABLE :ltp-full-20120614
@ 2012-07-12 7:14 Wangyicheng
2012-10-17 16:32 ` chrubis
0 siblings, 1 reply; 2+ messages in thread
From: Wangyicheng @ 2012-07-12 7:14 UTC (permalink / raw)
To: ltp-list@lists.sourceforge.net; +Cc: Dingguofu
[-- Attachment #1.1: Type: text/plain, Size: 2808 bytes --]
Hi:
When I run ltp testcases (the latest version, JUNE 2012 STABLE :ltp-full-20120614),I find tow testcases are broken( mount2 and mount3 in " testcases/kernel/syscalls/mount" directory):
# ./mount02 -D /dev/loop2 -T ext3
mount02 1 TPASS : mount got expected failure: errno=ENODEV(19): No such device
mount02 2 TPASS : mount got expected failure: errno=ENOTBLK(15): Block device required
mount02 3 TPASS : mount got expected failure: errno=EBUSY(16): Device or resource busy
mount02 4 TBROK : umount of mnt_18620 failed: errno=EBUSY(16): Device or resource busy
mount02 5 TBROK : Remaining cases broken
mount02 0 TWARN : tst_rmdir: rmobj(/tmp/mouSyPao1) failed: remove(/tmp/mouSyPao1/mnt_18620) failed; errno=16: Device or resource busy
# ./mount03 -D /dev/loop2 -T ext3
mount03 1 TBROK : stat for setuid_test failed
mount03 2 TBROK : Remaining cases broken
In mount02.c, the global array variable exp_enos is defined as :
static int exp_enos[] = { ENODEV, ENOTBLK, EBUSY, EINVAL, EFAULT, ENAMETOOLONG, ENOENT, ENOTDIR, 0};
There are egiht items in the exp_enos, but the value of TST_TOTAL is 13, it means there are 13 checkpoints int the testcase. As a result ,in the setup_test function , there are 13 switch-cases ( case 0、case1 ... case 12)
But the number of the expect result in the exp_enos array is mismatch with the number of checkpoint, so the TBROK happend.
In mount03.c, there are three issues:
1、In setup function, the setuid_test file is in the testhome_path instead of the temporary directory Path_name. It results "stat for setuid_test failed"
2、In setup function, snprintf(Path_name, PATH_MAX, "%s/%s/", Path_name, mntpoint), it can not implement appending the mntpoint string to the Path_name string;
3、In test_rwflag function, in the part of "case 2"(at line 280 in mount03.c), if the "execlp(file, basename(file), NULL)" will return (actually it will return),
the return value of test_rwflag is always 1 (1 means fail),so the testcase is always failed; Another hand, if it will not return (if kernel bug exists), the process
will terminate unexpectedly.
I fix them in the patch (See the attachment), and both of the tow testcase can get pass. Pls check the patch attachmented.
This e-mail and its attachments contain confidential information from HUAWEI, which
is intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!
[-- Attachment #1.2: Type: text/html, Size: 11479 bytes --]
[-- Attachment #2: fix_mount2_mount3_bug.patch --]
[-- Type: application/octet-stream, Size: 2601 bytes --]
diff -uNr ltp-full-20120614/testcases/kernel/syscalls/mount/mount02.c ltp-full-20120614.bugfix/testcases/kernel/syscalls/mount/mount02.c
--- ltp-full-20120614/testcases/kernel/syscalls/mount/mount02.c 2012-07-12 10:59:29.000000000 +0800
+++ ltp-full-20120614.bugfix/testcases/kernel/syscalls/mount/mount02.c 2012-07-12 11:01:37.000000000 +0800
@@ -123,8 +123,8 @@
static int Tflag = 0;
static int Dflag = 0;
-static int exp_enos[] = { ENODEV, ENOTBLK, EBUSY, EINVAL, EFAULT, ENAMETOOLONG,
- ENOENT, ENOTDIR, 0
+static int exp_enos[] = { ENODEV, ENOTBLK, EBUSY, EBUSY, EINVAL, EINVAL, EINVAL,EFAULT, EFAULT, ENAMETOOLONG,
+ ENOENT, ENOENT, ENOTDIR, 0
};
int TST_TOTAL = (sizeof(exp_enos) / sizeof(exp_enos[0])) - 1;
@@ -427,4 +427,4 @@
printf("-T type : specifies the type of filesystem to be mounted."
" Default ext2. \n");
printf("-D device : device used for mounting \n");
-}
\ No newline at end of file
+}
diff -uNr ltp-full-20120614/testcases/kernel/syscalls/mount/mount03.c ltp-full-20120614.bugfix/testcases/kernel/syscalls/mount/mount03.c
--- ltp-full-20120614/testcases/kernel/syscalls/mount/mount03.c 2012-07-12 10:59:29.000000000 +0800
+++ ltp-full-20120614.bugfix/testcases/kernel/syscalls/mount/mount03.c 2012-07-12 11:09:57.000000000 +0800
@@ -277,7 +277,9 @@
tst_resm(TWARN|TERRNO, "opening %s failed", file);
} else {
close(fd);
- execlp(file, basename(file), NULL);
+ if(system(file)) {
+ return 0;
+ }
}
return 1;
case 3:
@@ -460,11 +462,18 @@
if (getcwd(Path_name, sizeof(Path_name)) == NULL) {
tst_brkm(TBROK, cleanup, "getcwd failed");
}
+ /*
+ * under temporary directory
+ */
+ snprintf(Path_name + strlen(Path_name), PATH_MAX, "/%s/", mntpoint);
if (chmod(Path_name, DIR_MODE) != 0) {
tst_brkm(TBROK, cleanup, "chmod(%s, %#o) failed",
Path_name, DIR_MODE);
}
- snprintf(file, PATH_MAX, "%ssetuid_test", Path_name);
+
+ snprintf(testhome_path, PATH_MAX, "%s/setuid_test", test_home);
+
+ snprintf(file, PATH_MAX, "%s", testhome_path);
if (stat(file, &setuid_test_stat) < 0) {
tst_brkm(TBROK, cleanup, "stat for setuid_test failed");
} else {
@@ -480,14 +489,6 @@
}
}
- /*
- * under temporary directory
- */
- snprintf(Path_name, PATH_MAX, "%s/%s/", Path_name, mntpoint);
-
- strcpy(testhome_path, test_home);
- strcat(testhome_path, "/setuid_test");
-
TEST_PAUSE;
}
@@ -517,4 +518,4 @@
printf("-T type : specifies the type of filesystem to be mounted."
" Default ext2. \n");
printf("-D device : device used for mounting \n");
-}
\ No newline at end of file
+}
[-- Attachment #3: Type: text/plain, Size: 395 bytes --]
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [LTP] testcases/kernel/syscalls/mount test cases of mount2 and mount3 faild in JUNE 2012 STABLE :ltp-full-20120614
2012-07-12 7:14 [LTP] testcases/kernel/syscalls/mount test cases of mount2 and mount3 faild in JUNE 2012 STABLE :ltp-full-20120614 Wangyicheng
@ 2012-10-17 16:32 ` chrubis
0 siblings, 0 replies; 2+ messages in thread
From: chrubis @ 2012-10-17 16:32 UTC (permalink / raw)
To: Wangyicheng; +Cc: ltp-list@lists.sourceforge.net, Dingguofu
Hi!
> There are egiht items in the exp_enos, but the value of TST_TOTAL is
> 13, it means there are 13 checkpoints int the testcase. As a result
> ,in the setup_test function , there are 13 switch-cases ( case
> 0??case1 ... case 12)
>
> But the number of the expect result in the exp_enos array is mismatch
> with the number of checkpoint, so the TBROK happend.
That seems to be correct. Could you please send signed patch against
latest LTP git? Ideally attached as well as inline (the best way to send
git patches is using the 'git send-email').
Also please check your coding style (which could be easily done by
checkpatch.pl script that is shipped with linux kernel sources).
> In mount03.c, there are three issues:
>
> 1??In setup function, the setuid_test file is in the testhome_path
> instead of the temporary directory Path_name. It results "stat for
> setuid_test failed"
>
> 2??In setup function, snprintf(Path_name, PATH_MAX, "%s/%s/",
> Path_name, mntpoint)?? it can not implement appending the mntpoint
> string to the Path_name string;
There is still quite a lot of unnecessary string handling. Couldn't the
whole setup be done with two or three snprintf()?
> 3??In test_rwflag function, in the part of "case 2"(at line 280 in
> mount03.c), if the "execlp(file, basename(file), NULL)" will return
> (actually it will return), the return value of test_rwflag is always
> 1 (1 means fail),so the testcase is always failed; Another hand, if
> it will not return (if kernel bug exists), the process will
> terminate unexpectedly.
I'm not sure that I follow, but you changed execlp to system so that the
file gets executed in child and the return value gets passed to the
test?
> I fix them in the patch (See the attachment), and both of the tow
> testcase can get pass. Pls check the patch attachmented.
And while you are looking at these files, there are several things that
could be fixed too. These tests should use tst_require_root(NULL)
instead of if (getuid() != 0). There are unnecessary casts for pointers
returned from malloc() and useless comments like /* this is loop counter */.
If you care enough to fix them, these should be ideally fixed in separate patch.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-17 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12 7:14 [LTP] testcases/kernel/syscalls/mount test cases of mount2 and mount3 faild in JUNE 2012 STABLE :ltp-full-20120614 Wangyicheng
2012-10-17 16:32 ` chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox