[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH v4 04/45] tests: Replace fprintf(st
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH v4 04/45] tests: Replace fprintf(stderr, "*\n" with error_report() |
Date: |
Thu, 9 Nov 2017 11:48:04 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 11/09/2017 11:38 AM, Eric Blake wrote:
> On 11/08/2017 04:56 PM, Alistair Francis wrote:
[...]
>> exit(-1); } qemu_thread_create(&threads[n_threads], "test", func,
>> &data[n_threads], @@ -417,7 +418,7 @@ static void
>> gtest_stress_10_5(void)
>>
>> static void usage(int argc, char *argv[]) { - fprintf(stderr,
>> "Usage: %s [nreaders [ perf | stress ] ]\n", argv[0]); +
>> error_report("Usage: %s [nreaders [ perf | stress ] ]",
>> argv[0]); exit(-1);
>
> Separate patch - but 'exit(-1)' is almost always wrong (it gives
> status 255 through wait()/waitpid(); meanwhile waitid() is required
> by POSIX to get at the full 32-bit value except that Linux doesn't
> obey that requirement). A process where wait() returns 255 makes
> xargs behave differently. We really want exit(1).
$ git grep 'exit(-' origin/master | wc -l
60
Candidate for another mechanical patch?
>
>> +++ b/tests/tcg/linux-test.c @@ -51,7 +51,7 @@ void error1(const
>> char *filename, int line, const char *fmt, ...) va_start(ap,
>> fmt); fprintf(stderr, "%s:%d: ", filename, line);
>> vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); +
>> error_report("");
>
> Umm, a blank line is not a useful error. This hunk is bogus; we
> probably want to stick with fprintf() for the entire message.
=)