This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v5] elf: Add tst-ldconfig-bad-aux-cache test [BZ #18093]
- From: Florian Weimer <fweimer at redhat dot com>
- To: Alexandra Hájková <alexandra dot khirnova at gmail dot com>
- Cc: libc-alpha at sourceware dot org, mcermak at redhat dot com, Alexandra Hájková <ahajkova at redhat dot com>
- Date: Tue, 21 May 2019 15:15:18 +0200
- Subject: Re: [PATCH v5] elf: Add tst-ldconfig-bad-aux-cache test [BZ #18093]
- References: <20190516214903.11884-1-ahajkova@redhat.com>
* Alexandra Hájková:
> +static int
> +display_info (const char *fpath, const struct stat *sb,
> + int tflag, struct FTW *ftwbuf)
> +{
> + printf ("%-3s %2d %7jd %-40s %d %s\n",
> + (tflag == FTW_D) ? "d" : (tflag == FTW_DNR) ? "dnr" :
> + (tflag == FTW_DP) ? "dp" : (tflag == FTW_F) ? "f" :
> + (tflag == FTW_NS) ? "ns" : (tflag == FTW_SL) ? "sl" :
> + (tflag == FTW_SLN) ? "sln" : "???",
> + ftwbuf->level, (intmax_t) sb->st_size,
> + fpath, ftwbuf->base, fpath + ftwbuf->base);
> + /* To tell nftw to continue. */
> + return 0;
> +}
Maybe add an info: prefix to the line, to indicate that this output does
not reflect an error condition?
> + xwaitpid (pid, &status, 0);
> + if (!(WIFEXITED (status)))
> + FAIL_EXIT1 ("ldconfig was aborted");
> + xstat (path, &fs);
> + xwaitpid (pid, &status, 0);
> + if (!(WIFEXITED (status)))
> + FAIL_EXIT1 ("ldconfig exited with non-zero status");
I think we really expect exit status 0 in this case, so you could use
TEST_COMPARE (status, 0) in both cases.
> + if (truncate (path, new_size))
> + {
> + FAIL_EXIT1 ("truncation failed: %m");
> + }
> + if (nftw (path, display_info, 1000, 0) == -1)
> + {
> + FAIL_EXIT1 ("nftw failed.");
> + }
Here the braces are unnecessary.
Sorry for the piece-by-piece review, but we are definitely getting
close!
Thanks,
Florian