xfs
[Top] [All Lists]

Re: [PATCH] xfstests 131: kill locktest process in cleanup & better erro

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH] xfstests 131: kill locktest process in cleanup & better error msgs
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Sun, 17 Jan 2010 06:43:44 -0500
Cc: xfs-oss <xfs@xxxxxxxxxxx>
In-reply-to: <4B51220F.7020703@xxxxxxxxxxx>
References: <4B51220F.7020703@xxxxxxxxxxx>
User-agent: Mutt/1.5.19 (2009-01-05)
On Fri, Jan 15, 2010 at 08:18:55PM -0600, Eric Sandeen wrote:
> I occasionally get failures in 131 like:
> 
> gethostbyname: Success
> 
> 1) perror is the wrong thing for gethostbyname errors, so this
> is confusing

Indeed.

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

Yeah, this was always causing problems for me when running xfstests on
a system without networking for some unknown reason.

> --- a/src/locktest.c
> +++ b/src/locktest.c
> @@ -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");

Might be worth using herror or hsterror, although the manpage marks them
as obsolete..


Anyway, good enough to put in, so:


Reviewed-by: Christoph Hellwig <hch@xxxxxx>

<Prev in Thread] Current Thread [Next in Thread>