Skip to contentSkip to conversation

tiny fixes for xfstests

PATCH New Hou Tao 1 participant 3 messages Jan 4, 2019

lore
Share & tools
lore

Hou Tao

author
#0 lore raw

v2 cover tiny fixes for xfstests

Hou Tao (2):
generic/131: wait until the server is ready or timeout
fsx: check ENOSYS in test_copy_range() & test_fallocate()

 ltp/fsx.c         |  5 +++--
 tests/generic/131 | 15 ++++++++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)
Signature · 1 line
2.16.2.dirty
author
#1 lore raw

PATCH v2 1/2 generic/131: wait until the server is ready or timeout

When running xfstests under KVM VM and the load of host is high, only delaying 1s and checking the readiness of server are not enough, and the test case will fail early.

Fix it by repeatedly checking the readiness signal until it's found, or timeout is triggered.

---
v2:
* add a timeout for the check of server readiness, else the test case may loop forever.

---
 tests/generic/131 | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
tests/generic/131 +12 -3
index d7c146ae..80929c23 100755
@@ -37,10 +37,19 @@ TESTFILE=$TEST_DIR/lock_file
 src/locktest $TESTFILE 2>&1 > $TEST_DIR/server.out &
 locktest_pid1=$!
 
-sleep 1
+timeout=30
+while [ $timeout -gt 0 ]; do
+	sleep 1
 
-PORT=$(cat $TEST_DIR/server.out | grep "^server port: " | awk '{print $3}')
-if [ -z $PORT ]; then
+	PORT=$(cat $TEST_DIR/server.out | grep "^server port: " | awk '{print $3}')
+	if [ -n "$PORT" ]; then
+		break
+	fi
+
+	let timeout=timeout-1
+done
+
+if [ -z "$PORT" ]; then
 	echo "Could not get server port"
 	exit 1
 fi
Signature · 1 line
2.16.2.dirty
author
#2 lore raw

PATCH v2 2/2 fsx: check ENOSYS in test_copy_range() & test_fallocate()

In reply to Hou Tao

In configure script, we only check whether or not the build of test program succeeds, but that doesn't mean the kernel has implemented the syscall, so checking for this case.

---
v2:
* also check ENOSYS for fallocate syscall

---
 ltp/fsx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
ltp/fsx.c +3 -2
index 316f08eb..f4a1c7cf 100644
@@ -1583,7 +1583,7 @@ test_copy_range(void)
 	loff_t o1 = 0, o2 = 0;
 
 	if (syscall(__NR_copy_file_range, fd, &o1, fd, &o2, 0, 0) == -1 &&
-	    (errno == EOPNOTSUPP || errno == ENOTTY)) {
+	    (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTTY)) {
 		if (!quiet)
 			fprintf(stderr,
 				"main: filesystem does not support "
@@ -2423,7 +2423,8 @@ __test_fallocate(int mode, const char *mode_str)
 #ifdef HAVE_LINUX_FALLOC_H
 	int ret = 0;
 	if (!lite) {
-		if (fallocate(fd, mode, file_size, 1) && errno == EOPNOTSUPP) {
+		if (fallocate(fd, mode, file_size, 1) &&
+		    (errno == ENOSYS || errno == EOPNOTSUPP)) {
 			if(!quiet)
 				fprintf(stderr,
 					"main: filesystem does not support "
Signature · 1 line
2.16.2.dirty