Hi All,
I'd like to submit a change to be done on utimensat testcase.
This test performs a kernel version check both at build time and
runtime. At build time, the test performs a check at makefile level:
@set -e; $(MAKE) check_for_utimensat_support; \
if './check_for_utimensat_support' > /dev/null 2>&1; then \
$(MAKE) utimensat01; \
else echo "System does not support utimensat syscall support"; true; fi
check_for_utimensat_support: check_for_utimensat_support.c
$(CC) $(CFLAGS) -o $@ $< ../../../../lib/tst_kvercmp.c
-I../../../../include
The same check is also repeated in the "install" target of the same
Makefile.
Moreover, at runtime the script "utimensat_tests.sh" used to run the
test (by standard runltp script) performs again the same check:
if tst_kvercmp 2 6 22 ; then
tst_resm TCONF "System kernel version is less than 2.6.22"
tst_resm TCONF "Cannot execute test"
exit 0
fi
Now, my opinion about that is the following:
1) for i386 arch:
One of the above checks should be removed.
2) for cross-build:
The above structure of the test is really a problem. In fact, at build
time the Makefile (as it is) cross-builds (by ${CC} env var.) the binary
"check_for_utimensat_support" which, clearly, can't be executed on the
host side (even though it will detect the "host" kernel version and not
the "target" ones!).
I cross-build & run LTP on SH based archs so that the utimensat testcase
failed at runtime as the binary utimensat01 wasn't copied to
$LTPROOT/testcases/bin due to error on "check_for_utimensat_support"
execution (Exec format error. Wrong Architecture).
I've solved the above problem disabling the check of the kernel version
at build time (removing the check on the Makefile). I keep only the
check at runtime.
At the end, I'd like to suggest to use the macro(s) reported on the
header "linux/version.h" instead of a custom approach, for checking the
kernel version.
The attached patch shows the above approach applied to the
"check_for_utimensat_support.c" source file.
I'm using an LTP-20090131 + kernel 2.6.23. The hw is SH.
Please, let me know about the issues above described.
Thanks so much.
Best Regards,
FR
This patch removes the kernel version check at build time as it can't be used
for test cross-building. Moreover, the same check is also performed at runtime.
Signed-off-by: Francesco Rundo <[email protected]>
--- ltp-full-20090131/testcases/kernel/syscalls/utimensat/Makefile.original
2009-03-10 11:45:56.109998000 +0100
+++ ltp-full-20090131/testcases/kernel/syscalls/utimensat/Makefile
2009-03-10 13:44:35.889999000 +0100
@@ -23,10 +23,8 @@
TARGETS = $(patsubst %.c,%,$(SRCS))
all:
- @set -e; $(MAKE) check_for_utimensat_support; \
- if './check_for_utimensat_support' > /dev/null 2>&1; then \
- $(MAKE) utimensat01; \
- else echo "System does not support utimensat syscall support"; true; fi
+ @set -e; $(MAKE) check_for_utimensat_support;
+ $(MAKE) utimensat01;
check_for_utimensat_support: check_for_utimensat_support.c
$(CC) $(CFLAGS) -o $@ $< ../../../../lib/tst_kvercmp.c
-I../../../../include
@@ -35,9 +33,7 @@
@set -e; \
chmod 755 utimensat_tests.sh; \
ln -f utimensat_tests.sh ../../../bin/utimensat_tests.sh; \
- if './check_for_utimensat_support' > /dev/null 2>&1; then \
- for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done \
- else echo "System does not support utimensat syscall support"; true; fi
+ for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
clean:
rm -f $(TARGETS)
This patch replaces a custom method to check kernel version with a standard
ones.
Signed-off-by: Francesco Rundo <[email protected]>
---
ltp-full-20090131/testcases/kernel/syscalls/utimensat/check_for_utimensat_support.c.original
2009-03-10 11:11:20.669999000 +0100
+++
ltp-full-20090131/testcases/kernel/syscalls/utimensat/check_for_utimensat_support.c
2009-03-10 11:14:39.819997000 +0100
@@ -1,8 +1,9 @@
#include <stdio.h>
#include <test.h>
+#include <linux/version.h>
int kernel_support_available(void) {
- if (tst_kvercmp(2,6,22) < 0)
+ if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
return 1;
return 0;
}
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list