From 3794d01e0d62f5f93118ca6b3c75ddc84995d541 Mon Sep 17 00:00:00 2001 From: Peter Rosin Date: Mon, 23 Jan 2012 09:18:46 +0100 Subject: [PATCH] tests: improve diagnostics when write(2) fails MinGW programs can't redirect file descriptor 9, they can only redirect stdin, stdout and stderr. So, improve the information in the test log. See automake bug#10466. * tests/parallel-tests-fd-redirect.test (baz.c, zardoz.c): Check the return value from the write(2) call, and report detected errors. --- tests/parallel-tests-fd-redirect.test | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/parallel-tests-fd-redirect.test b/tests/parallel-tests-fd-redirect.test index 73a134e25..8b1637896 100755 --- a/tests/parallel-tests-fd-redirect.test +++ b/tests/parallel-tests-fd-redirect.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# Copyright (C) 2011, 2012 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -65,20 +65,26 @@ END chmod a+x foo.sh bar cat > baz.c <<'END' +#include #include int main (void) { - write (9, " bazbazbaz\n", 11); - return 0; + ssize_t res = write (9, " bazbazbaz\n", 11); + if (res < 0) + perror("write failed"); + return res != 11; } END cat > zardoz.c <<'END' +#include #include int main (void) { - write (9, " quxquxqux\n", 11); - return 0; + ssize_t res = write (9, " quxquxqux\n", 11); + if (res < 0) + perror("write failed"); + return res != 11; } END -- 2.47.2