From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26482 invoked by alias); 24 Sep 2007 20:50:28 -0000 Received: (qmail 26472 invoked by uid 22791); 24 Sep 2007 20:50:28 -0000 X-Spam-Check-By: sourceware.org Received: from brmea-mail-2.Sun.COM (HELO brmea-mail-2.sun.com) (192.18.98.43) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 24 Sep 2007 20:50:22 +0000 Received: from fe-amer-09.sun.com ([192.18.109.79]) by brmea-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l8OKoLiU011099 for ; Mon, 24 Sep 2007 20:50:21 GMT Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JOW003012BWL900@mail-amer.sun.com> (original mail from David.Herron@Sun.COM) for mauve-discuss@sources.redhat.com; Mon, 24 Sep 2007 14:50:21 -0600 (MDT) Received: from [129.145.161.216] by mail-amer.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JOW005UM4JFIPD0@mail-amer.sun.com>; Mon, 24 Sep 2007 14:50:03 -0600 (MDT) Date: Mon, 24 Sep 2007 20:50:00 -0000 From: David Herron Subject: Re: Tweaking default java.awt.Robot settings In-reply-to: <4f2ee4520709241331o1a77379cudffb314dc1622914@mail.gmail.com> To: =?UTF-8?B?U3RldmUgTWNLYXnimIQ=?= Cc: mauve-discuss@sources.redhat.com Message-id: <46F8238C.8020606@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 8BIT References: <4f2ee4520709241331o1a77379cudffb314dc1622914@mail.gmail.com> User-Agent: Thunderbird 1.5.0.13 (X11/20070824) X-IsSubscribed: yes Mailing-List: contact mauve-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00023.txt.bz2 Steve McKay☄ wrote: > Hi All, > > I've noticed that at least some of the tests using java.awt.Robot are > non-deterministic due to lags is the underlying window system. The > java.awt.Component.keyPressTest, for example, fails some of the time > (on linux, windows, linux+wine, ...). It looks like enabling > autoWaitForIdle (waits for the awt EventQueue to be empty before > adding new events to the queue), and setting autoDelay (pauses for an > arbitrary period of time) to some magic number of millis well above > zero (I use 100) significantly reduces failures. Would anyone object > to configuring the Robot with settings like this by default? If no, > should the config mechanism be updated to allow tweaking these > settings? > > I don't know what the classpath implementation of Robot looks like, but I do know what Sun's Linux/Unix implementation looks like (having written the original version). Generally Robot has to request the OS or X11 to synthesize the event. On Windows there's a direct API call, while on Unix/Linux there is a child process which ends up calling XTEST extension methods. In both cases it means there is a nondeterministic delay due to the current process scheduling characteristics of the given system. In other words it depends on an external entity, who Robot cannot coerce into performing the request within a bounded set of time. I think that means depending on Robot doing it's thing within a given period of time is an invalid test. Robot does not add events to EventQueue but it requests the OS to synthesize an OS-level event. - David Herron