xfstests 131: kill locktest process in cleanup & better error msgs
authorEric Sandeen <sandeen@sandeen.net>
Sun, 17 Jan 2010 16:29:23 +0000 (10:29 -0600)
committerEric Sandeen <sandeen@sandeen.net>
Sun, 17 Jan 2010 16:29:23 +0000 (10:29 -0600)
I occasionally get failures in 131 like:

gethostbyname: Success

1) perror is the wrong thing for gethostbyname errors, so this
is confusing

2) the locktest thread doesn't get killed, so the fs
is busy and the next test fails when it can't unmount

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
131
src/locktest.c

diff --git a/131 b/131
index b095c2f4d01f3fde38c10ff8887db652c56ee54e..de83fe283c4965ac8db41adde78825868cb13216 100755 (executable)
--- a/131
+++ b/131
@@ -34,6 +34,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _cleanup()
 {
+    kill $locktest_pid2
+    kill $locktest_pid1
     _cleanup_testdir
 }
 
@@ -60,11 +62,13 @@ fi
 
 # Start the server
 src/locktest -p $PORT $TESTFILE > $testdir/server.out 2>&1 &
+locktest_pid1=$!
 
 sleep 1
 
 # Start the client
 src/locktest -p $PORT -h localhost $TESTFILE > $testdir/client.out 2>&1
+locktest_pid2=$!
 result=$?
 if [ $result -eq 0 ]; then
     echo success!
index e35f6a6ac5bb761281d18b7d0af6dbe67b9c426b..7552ace4eaf76d8f058ec2f1fb364ae3c286551c 100644 (file)
@@ -44,6 +44,8 @@
 #define PLATFORM_CLEANUP()  /*no-op*/
 #define LL                  "ll"
 
+extern int h_errno;
+
 #define inet_aton(STRING, INADDRP) \
     (((INADDRP)->s_addr = inet_addr(STRING)) == -1 ? 0 : 1)
 
@@ -937,7 +939,10 @@ main(int argc, char *argv[])
         struct hostent  *servInfo;
 
         if ((servInfo = gethostbyname(host)) == NULL) {
-            perror("gethostbyname");
+           printf("Couldn't get hostbyname for %s", host);
+           if (h_errno == HOST_NOT_FOUND)
+               printf(": host not found");
+           printf("\n");
             exit(1);
             /*NOTREACHED*/
         }