From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24647 invoked by alias); 13 Mar 2009 16:14:37 -0000 Received: (qmail 24638 invoked by uid 22791); 13 Mar 2009 16:14:35 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Mar 2009 16:14:30 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A57E82C88C7; Fri, 13 Mar 2009 12:14:28 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id nUz-W6xxOy+q; Fri, 13 Mar 2009 12:14:28 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 275942C88C4; Fri, 13 Mar 2009 12:14:27 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 43486F5C8D; Fri, 13 Mar 2009 09:14:23 -0700 (PDT) Date: Fri, 13 Mar 2009 16:47:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] testsuite: Fix a racy FAIL on gdb.base/multi-forks.exp Message-ID: <20090313161423.GF8368@adacore.com> References: <20090313152723.GA13673@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090313152723.GA13673@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.18 (2008-05-17) 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-03/txt/msg00209.txt.bz2 I am not very familiar with this testcase, so please consider this as an informal review. I started looking at this just because I was actually wondering about the availability of "close".... > Instead of the output suppression by `close (1)' some sleep would also fix it > if close (1) is not compatible enough. As far as I can tell, "close" is POSIX, so should be fairly portable. I'm not entirely sure about Windows, but I do think it's available. The symbol name might be _close, though. That being said, I see later in the same testcase that this problem is already handled a different way. Basically, we know that the inferiors are going to print a bunch of traces, so we just wait for all of them to be printed before we do the next test: # The output from the child processes can be interleaved arbitrarily # with the output from GDB and the parent process. If we don't # consume it all now, it can confuse later interactions. set seen_done 0 set seen_break 0 set seen_prompt 0 set seen_timeout 0 while { ($seen_done < 16 || ! $seen_prompt) && ! $seen_timeout } { # We don't know what order the interesting things will arrive in. # Using a pattern of the form 'x|y|z' instead of -re x ... -re y # ... -re z ensures that expect always chooses the match that # occurs leftmost in the input, and not the pattern appearing # first in the script that occurs anywhere in the input, so that # we don't skip anything. gdb_expect { -re "($decimal done)|(Breakpoint)|($gdb_prompt)" { if {[info exists expect_out(1,string)]} { incr seen_done } elseif {[info exists expect_out(2,string)]} { set seen_break 1 } elseif {[info exists expect_out(3,string)]} { set seen_prompt 1 } array unset expect_out } timeout { set seen_timeout 1 } } } Would it make sense to do the same in the case where we follow the child? On a side note, I try to avoid delays such as "sleep" like the plague. A one or two second delay on its own is not that bad, but they tend to add-up pretty quickly. Since our testsuite is sequential, it's time wasted doing nothing. So I only use them if I don't have any other choice. -- Joel