Here is the problem.
fstatat01.c file logic assumes that one of the two: __NR_fstatat64 or
__NR_newfstatat is defined, and compiles the test to run with one or
another.
BUT: both __NR_fstatat64 AND __NR_newfstatat are in stubs list - that is
both will always be defined, and the test as coded blindly prefers
__NR_fstatat64, even if it is stub - and runs to fail with it in that
case.
The proper fix could be not to stub one of the two if the other is
already defined, but that would be a change in build scripts.
Alternative is to detect stubs and not to use them if a good alternative
present.
Proposed patch:
Tested on mips64 Octeon platform, Linux 2.6.27
Vlad
========================================================================
=======================
Signed-off by : Vlad Malov [EMAIL PROTECTED]
--- testcases/kernel/syscalls/fstatat/fstatat01.c.orig 2008-10-06
09:39:24.000000000 -0700
+++ testcases/kernel/syscalls/fstatat/fstatat01.c 2008-10-06
09:56:29.000000000 -0700
@@ -78,23 +81,31 @@
int expected_errno[TEST_CASES] = { 0, 0, ENOTDIR, EBADF, EINVAL, 0 };
int flags[TEST_CASES] = { 0, 0, 0, 0, 9999, 0 };
-#ifdef __NR_fstatat64
+#if (defined __NR_fstatat64) && (__NR_fstatat64 != 0)
struct stat64 statbuf;
#else
struct stat statbuf;
#endif
-#ifdef __NR_fstatat64
+/* __NR_fstatat64 and __NR_fstatat64 if not defined are ALWAYS stubbed
by
+ * linux_syscall_numbers.h Need to check for 0 to avoid testing with
stubs */
+#if (defined __NR_fstatat64) && (__NR_fstatat64 != 0)
int myfstatat(int dirfd, const char *filename, struct stat64 *statbuf,
int flags)
{
return syscall(__NR_fstatat64, dirfd, filename, statbuf, flags);
}
-#else
+#elif (defined __NR_newfstatat) && (__NR_newfstatat != 0)
int myfstatat(int dirfd, const char *filename, struct stat *statbuf,
int flags)
{
return syscall(__NR_newfstatat, dirfd, filename, statbuf, flags);
}
+#else
+/* stub - will never run */
+int myfstatat(int dirfd, const char *filename, struct stat *statbuf,
int flags)
+{
+ return syscall(0, dirfd, filename, statbuf, flags);
+}
#endif
int main(int ac, char **av)
@@ -111,6 +122,18 @@
exit(0);
}
+ /* report failure when run with stubs */
+#ifdef __NR_fstatat64
+ if(__NR_fstatat64 == 0)
+#endif
+#ifdef __NR_newfstatat
+ if(__NR_newfstatat == 0)
+#endif
+ {
+ tst_resm(TFAIL, "fstatat() Failed, neither __NR_fstatat64 "
+ "no __NR_newfstatat is implemented ");
+ exit(0);
+ }
/***************************************************************
* parse standard options
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list