# HG changeset patch # User Rik # Date 1384816021 28800 # Node ID c02b8bf0e1f91f57aa2764ab862706cc944cbf23 # Parent e036b96133ec714f6fc49fc6ccdb3794f7a2fc4c Fix failing test in syscalls.cc on MinGW platform (bug #40606). * syscalls.cc: On PC platforms, check whether sort program is Microsoft or UNIX-like version before using in %!test of popen2. diff -r e036b96133ec -r c02b8bf0e1f9 libinterp/corefcn/syscalls.cc --- a/libinterp/corefcn/syscalls.cc Mon Nov 18 22:28:16 2013 +0100 +++ b/libinterp/corefcn/syscalls.cc Mon Nov 18 15:07:01 2013 -0800 @@ -378,11 +378,19 @@ /* %!test +%! unix_sort = true; +%! cmd = {"sort", "-r"}; +%! if (ispc ()) +%! status = system ("sort /? 2> NUL"); +%! if (status == 0) +%! unix_sort = false; +%! cmd = {"sort", "/R"}; +%! endif +%! endif +%! [in, out, pid] = popen2 (cmd{:}); %! if (isunix ()) -%! [in, out, pid] = popen2 ("sort", "-r"); %! EAGAIN = errno ("EAGAIN"); %! else -%! [in, out, pid] = popen2 ("sort", "/R"); %! EAGAIN = errno ("EINVAL"); %! endif %! fputs (in, "these\nare\nsome\nstrings\n"); @@ -392,7 +400,7 @@ %! idx = 0; %! errs = 0; %! do -%! if (!isunix ()) +%! if (! isunix ()) %! errno (0); %! endif %! s = fgets (out); @@ -410,7 +418,7 @@ %! endif %! until (done) %! fclose (out); -%! if (isunix ()) +%! if (unix_sort) %! assert (str, {"these\n","strings\n","some\n","are\n"}); %! else %! assert (str, {"these\r\n","strings\r\n","some\r\n","are\r\n"});