From patchwork Tue Aug 11 12:10:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 40590 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7BCFWmv031169 for ; Tue, 11 Aug 2009 12:15:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753369AbZHKMIH (ORCPT ); Tue, 11 Aug 2009 08:08:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753366AbZHKMIG (ORCPT ); Tue, 11 Aug 2009 08:08:06 -0400 Received: from mx2.redhat.com ([66.187.237.31]:38883 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753190AbZHKMIC (ORCPT ); Tue, 11 Aug 2009 08:08:02 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7BC83DX023965; Tue, 11 Aug 2009 08:08:03 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n7BC8244016189; Tue, 11 Aug 2009 08:08:03 -0400 Received: from localhost.localdomain (dhcp-1-31.tlv.redhat.com [10.35.1.31]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7BC7wFA028452; Tue, 11 Aug 2009 08:08:01 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH v2 2/3] KVM test: add sample AutoIt script Date: Tue, 11 Aug 2009 15:10:43 +0300 Message-Id: <1ead606d64c4c3c8c4f7724700781df25ef27d39.1249992282.git.mgoldish@redhat.com> In-Reply-To: <35538aadbfdd5edaafca8b46f1d1c2b4e10c0420.1249992282.git.mgoldish@redhat.com> References: <1249992644-5111-1-git-send-email-mgoldish@redhat.com> <35538aadbfdd5edaafca8b46f1d1c2b4e10c0420.1249992282.git.mgoldish@redhat.com> In-Reply-To: <35538aadbfdd5edaafca8b46f1d1c2b4e10c0420.1249992282.git.mgoldish@redhat.com> References: <35538aadbfdd5edaafca8b46f1d1c2b4e10c0420.1249992282.git.mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add a sample autoit script under autoit/. The script is a modified version of the notepad1.au3 example script that ships with AutoIt. Signed-off-by: Michael Goldish --- client/tests/kvm/autoit/notepad1.au3 | 44 ++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-) create mode 100644 client/tests/kvm/autoit/notepad1.au3 diff --git a/client/tests/kvm/autoit/notepad1.au3 b/client/tests/kvm/autoit/notepad1.au3 new file mode 100644 index 0000000..af1d417 --- /dev/null +++ b/client/tests/kvm/autoit/notepad1.au3 @@ -0,0 +1,44 @@ +; This is a sample AutoIt script, based on the notepad1 sample script by Jonathan Bennett. +; It runs notepad, enters some text and exits. + + +; Exit with a nonzero exit status if the parameter equals 0. +; This is useful for functions that return 0 upon failure. +Func Assert($n) + If $n = 0 Then Exit(1) +EndFunc + +; Wait for a window to exist, activate it, and wait for it to become active. +; If timeout expires while waiting, exit with a nonzero exit status. +Func WaitForWindow($title, $text="", $timeout=60) + Assert(WinWait($title, $text, $timeout)) + WinActivate($title, $text) + Assert(WinWaitActive($title, $text, $timeout)) +EndFunc + +; Run Notepad +Assert(Run("notepad.exe")) + +; Wait up to 10 seconds for Notepad to become active -- +; it is titled "Untitled - Notepad" on English systems +WaitForWindow("Untitled - Notepad", "", 10) + +; Now that the Notepad window is active type some text +Send("Hello from Notepad.{ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}") +Sleep(500) +Send("+{UP 2}") +Sleep(500) + +; Now quit by pressing Alt-f and then x (File menu -> Exit) +Send("!f") +Send("x") + +; Now a screen will pop up and ask to save the changes, the window is called +; "Notepad" and has some text "Yes" and "No" +WaitForWindow("Notepad", "", 10) +Send("n") + +; Now wait for Notepad to close before continuing +WinWaitClose("Untitled - Notepad", "", 10) + +; Finished!