Update ooo320-m1
[ooovba.git] / xmerge / source / palmtests / bin / verify_sane.pl
blob79c85a658889d9727d5b0a7935dc165452ceedb1
1 #!/usr/bin/perl
2 #########################################################################
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 #
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # $RCSfile: verify_sane.pl,v $
14 # $Revision: 1.4 $
16 # This file is part of OpenOffice.org.
18 # OpenOffice.org is free software: you can redistribute it and/or modify
19 # it under the terms of the GNU Lesser General Public License version 3
20 # only, as published by the Free Software Foundation.
22 # OpenOffice.org is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU Lesser General Public License version 3 for more details
26 # (a copy is included in the LICENSE file that accompanied this code).
28 # You should have received a copy of the GNU Lesser General Public License
29 # version 3 along with OpenOffice.org. If not, see
30 # <http://www.openoffice.org/license.html>
31 # for a copy of the LGPLv3 License.
33 #*************************************************************************
35 ####################################################################
36 # File Name: template.pl
37 # Version : 1.0
38 # Project : XMerge
39 # Author : Brian Cameron
40 # Date : 5th Sept. 2001
43 # Takes x and y from the command line and taps the screen there.
44 # Assumes pose is already running.
46 ##########################################################################
48 use POSIX "sys_wait_h"; # Need this for waitpid with WNOHANG
49 use EmRPC; # EmRPC::OpenConnection, CloseConnection
50 use EmFunctions;
51 use EmUtils;
53 if ($#ARGV != 0)
55 print "\nUsage: $0 timeout\n\n";
56 exit -1;
59 $timeout = $ARGV[0];
61 if (!defined($up_pid = fork()))
63 print "ERROR, problem forking.\n"
65 elsif ($up_pid)
67 print "\nChecking to see if pose is started properly.\n";
69 # Parent process
71 sleep($timeout);
73 waitpid($up_pid, WNOHANG);
75 if (kill(0, $up_pid))
77 print "Pose did not start successfully...\n";
78 kill(9, $up_pid);
79 exit(-1);
81 else
83 # The child process exited okay, so we know it will not
84 # hang...but the open_connection will just die if pose
85 # isn't started...so try it in the parent.
87 open_connection();
88 close_connection();
90 print "Verified pose started successfully...\n";
91 exit(0);
94 else
96 # Child process - Try to open/close the connection. This
97 # can hang if pose did not start properly...
99 open_connection();
100 close_connection();
103 sub open_connection
105 print "opening connection\n";
106 EmRPC::OpenConnection(6415, "localhost");
109 sub close_connection
111 print "closing connection\n";
112 EmRPC::CloseConnection();