From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15895 invoked by alias); 17 Jun 2009 22:43:05 -0000 Received: (qmail 15884 invoked by uid 22791); 17 Jun 2009 22:43:05 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Jun 2009 22:42:57 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id EA30F7C09B; Wed, 17 Jun 2009 22:42:55 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id CD02E7C09A; Wed, 17 Jun 2009 22:42:55 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1MH3qJ-0002wF-BO; Wed, 17 Jun 2009 18:42:55 -0400 Date: Wed, 17 Jun 2009 22:43:00 -0000 From: 'Daniel Jacobowitz' To: Pierre Muller Cc: 'Joel Brobecker' , gdb-patches@sourceware.org Subject: Re: [RFC] Improve testsuite for poor expect behavior Message-ID: <20090617224255.GA11265@caradoc.them.org> Mail-Followup-To: Pierre Muller , 'Joel Brobecker' , gdb-patches@sourceware.org References: <001201c9ebb1$96414b10$c2c3e130$@u-strasbg.fr> <20090613150505.GA28157@caradoc.them.org> <000001c9ec65$9bf13ca0$d3d3b5e0$@u-strasbg.fr> <20090613235454.GA1893@caradoc.them.org> <20090614002516.GO25703@adacore.com> <000001c9ed8a$21cfdc30$656f9490$@u-strasbg.fr> <20090616145756.GB7730@adacore.com> <000c01c9eeda$022d8a70$06889f50$@u-strasbg.fr> <20090617133626.GA24310@caradoc.them.org> <001a01c9ef9c$29d21420$7d763c60$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001a01c9ef9c$29d21420$7d763c60$@u-strasbg.fr> User-Agent: Mutt/1.5.17 (2008-05-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00459.txt.bz2 On Thu, Jun 18, 2009 at 12:37:14AM +0200, Pierre Muller wrote: > > +#ifdef _WIN32 > > + /* A Cygwin ssh session may not look like a terminal to the Windows > > + runtime; ensure unbuffered output. */ > > + setvbuf (stdout, NULL, _IONBF, BUFSIZ); > > + setvbuf (stderr, NULL, _IONBF, BUFSIZ); > > +#endif > > + > > Could we use something that would also work for Win64 compilation? Sure, if you tell us what it is - I figured _WIN32 still worked. > > +#ifdef __MINGW32__ > > + /* In textmode, a '\n' is automatically expanded into "\r\n". When > > + driving the testsuite from a linux host, the '\n' is also > > + expanded into "\r\n". This results in expect seing "\r\r\n". > > + The tests aren't prepared currently for other forms of eol. As a > > + workaround, we force the output to binary mode. Do this only if > > + the files are pipes (cygwin ttys are Windows pipes behind the > > + scenes). */ > > + { > > + int in = fileno (stdin); > > + int out = fileno (stdout); > > + int err = fileno (stderr); > > + HANDLE hin = (HANDLE) _get_osfhandle (in); > > + HANDLE hout = (HANDLE) _get_osfhandle (out); > > + HANDLE herr = (HANDLE) _get_osfhandle (err); > > + if (GetFileType (hin) == FILE_TYPE_PIPE) > > + setmode (in, O_BINARY); > > + if (GetFileType (hout) == FILE_TYPE_PIPE) > > + setmode (out, O_BINARY); > > + if (GetFileType (herr) == FILE_TYPE_PIPE) > > + setmode (err, O_BINARY); > > + } > > +#endif > > + > > gdb_stdout = stdio_fileopen (stdout); > > gdb_stderr = stdio_fileopen (stderr); > > gdb_stdlog = gdb_stderr; /* for moment */ > > > > Wouldn't it be better to move all this into > mingw-hdep.c file in the _initialize_mingw_hdep function, > the conditional can then be completely removed, no? IIRC you can't do that because you must setmode before anything writes to the file. -- Daniel Jacobowitz CodeSourcery