summaryrefslogtreecommitdiff
path: root/qadevOOo/runner/org
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2009-07-03 10:14:57 +0000
committerRelease Engineers <releng@openoffice.org>2009-07-03 10:14:57 +0000
commitb37f665758a8eebc1cbeb0155d7d24787ca3401e (patch)
treeb864924e5b8d77a106fe477881de7ccdc10bc91a /qadevOOo/runner/org
parent6a64591a8774d2cb7057fff5af1af21c6e6c01b2 (diff)
CWS-TOOLING: integrate CWS perftest08
2009-07-02 10:03:16 +0200 lla r273621 : #159516# support systems with no JAVA_HOME 2009-07-02 10:00:25 +0200 lla r273620 : #159516# if path is null this not an error 2009-07-01 14:36:05 +0200 lla r273583 : #159516# add check for wrong cygwin path 2009-06-22 13:18:14 +0200 lla r273223 : #159516# add PipeConnectionString 2009-06-18 21:44:59 +0200 lla r273137 : #159516# cleanups 2009-06-18 21:44:17 +0200 lla r273136 : #159516# handle null 2009-06-18 21:42:56 +0200 lla r273135 : #159516# add getElementCount() function 2009-06-15 10:40:05 +0200 lla r272966 : CWS-TOOLING: rebase CWS perftest08 to trunk@272827 (milestone: DEV300:m50) 2009-06-02 09:06:22 +0200 lla r272480 : CWS-TOOLING: rebase CWS perftest08 to trunk@272291 (milestone: DEV300:m49) 2009-05-08 11:40:22 +0200 mib r271710 : #159717#: File name info for performance test (added void to hasLogFile() parameter list) 2009-05-05 14:14:25 +0200 mib r271514 : #159717#: File name info for performance test 2009-05-04 15:23:01 +0200 mib r271466 : #159717#: File name infor for performance test 2009-05-04 15:22:27 +0200 mib r271465 : #159717#: File name infor for performance test 2009-05-04 15:21:56 +0200 mib r271464 : #159717#: File name infor for performance test 2009-05-04 15:21:18 +0200 mib r271462 : #159717#: File name infor for performance test 2009-04-29 16:23:40 +0200 lla r271383 : #159516# cleanups 2009-04-29 16:23:20 +0200 lla r271382 : #159516# cleanups 2009-04-08 12:23:01 +0200 lla r270631 : #159516# typo 2009-04-07 10:30:35 +0200 lla r270580 : #159516# add prototype 2009-04-07 10:21:15 +0200 lla r270579 : #159516# cleanup 2009-04-03 09:05:26 +0200 lla r270448 : #159516# small cleanups 2009-03-30 13:22:26 +0200 lla r270221 : #159517# merge perftest07
Diffstat (limited to 'qadevOOo/runner/org')
-rw-r--r--qadevOOo/runner/org/openoffice/Runner.java158
1 files changed, 128 insertions, 30 deletions
diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java
index 305700b08ff6..47216ad8d815 100644
--- a/qadevOOo/runner/org/openoffice/Runner.java
+++ b/qadevOOo/runner/org/openoffice/Runner.java
@@ -27,16 +27,17 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package org.openoffice;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.StringTokenizer;
import lib.TestParameters;
import util.DynamicClassLoader;
import base.TestBase;
import helper.ClParser;
import helper.CfgParser;
-
/**
* The main class, will call ClParser and CfgParser to <br>
* fill the TestParameters.<br>
@@ -44,6 +45,7 @@ import helper.CfgParser;
*/
public class Runner
{
+
private static long m_nStartTime;
private static long getStartTime()
@@ -51,30 +53,32 @@ public class Runner
return m_nStartTime;
}
/*
- simple helper functions to start/stop a timer, to know how long a process need in milliseconds
+ simple helper functions to start/stop a timer, to know how long a process need in milliseconds
*/
+
private static long getTime()
- {
- return System.currentTimeMillis();
- }
+ {
+ return System.currentTimeMillis();
+ }
+
private static void setStartTime(long _nStartTime)
- {
- m_nStartTime = _nStartTime;
- }
+ {
+ m_nStartTime = _nStartTime;
+ }
/*
- return the time, which is done until last startTime()
+ return the time, which is done until last startTime()
*/
private static long meanTime(long _nCurrentTimer)
+ {
+ if (_nCurrentTimer == 0)
{
- if (_nCurrentTimer == 0)
- {
- System.out.println("Forgotten to initialise a start timer?");
- return 0;
- }
- long nMeanTime = getTime();
- return nMeanTime - _nCurrentTimer;
+ System.out.println("Forgotten to initialise a start timer?");
+ return 0;
}
+ long nMeanTime = getTime();
+ return nMeanTime - _nCurrentTimer;
+ }
private static String beautifyTime(long _nTime)
{
@@ -82,15 +86,107 @@ public class Runner
long min = (_nTime / (60 * 1000)) % 60;
long hour = _nTime / (60 * 60 * 1000);
StringBuffer aTime = new StringBuffer();
- aTime.append(helper.StringHelper.createValueString((int)hour, 2)).
- append(':').
- append(helper.StringHelper.createValueString((int)min, 2)).
- append(':').
- append(helper.StringHelper.createValueString((int)sec, 2));
+ aTime.append(helper.StringHelper.createValueString((int) hour, 2)).
+ append(':').
+ append(helper.StringHelper.createValueString((int) min, 2)).
+ append(':').
+ append(helper.StringHelper.createValueString((int) sec, 2));
return aTime.toString();
}
- public static void main(String[] args) {
+ /**
+ Helper to check if there are problems with Cygwin Path variables.
+ */
+ private static boolean checkVariableForCygwin(String _sVariable)
+ {
+ if (_sVariable == null)
+ {
+ return false;
+ }
+ if (_sVariable.startsWith("/cygdrive"))
+ {
+ return true;
+ }
+ return false;
+ }
+ private static boolean checkPathVariable(String _sPath, String delim)
+ {
+ String sPath = System.getProperty(_sPath);
+ if (sPath != null)
+ {
+ StringTokenizer aTokenEnum = new StringTokenizer(sPath, delim);
+ while (aTokenEnum.hasMoreElements())
+ {
+ String sToken = (String)aTokenEnum.nextElement();
+ if (checkVariableForCygwin(sToken))
+ {
+ System.err.println("ERROR: OOoRunner detect cygwin path in '" + _sPath + "'");
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static void checkAllVariablesForCygwinPath(TestParameters _aParams)
+ {
+ // ----- check all System.getProperty(key) variables -----
+ String sOsName = System.getProperty("os.name");
+ if (! sOsName.toLowerCase().startsWith("windows"))
+ {
+ // we need to check only on windows
+ return;
+ }
+
+ Properties aProps = System.getProperties();
+ Enumeration aEnum = aProps.propertyNames();
+ // Enumeration aEnum = aProps.elements(); // these are only the values
+ boolean bEmergencyStop = false;
+
+ while (aEnum.hasMoreElements())
+ {
+ String sKey = (String)aEnum.nextElement();
+ String sValue = System.getProperty(sKey);
+
+ if (checkVariableForCygwin(sValue))
+ {
+ System.err.println("ERROR: OOoRunner detect cygwin path in '" + sKey + ":=" + sValue + "'");
+ bEmergencyStop = true;
+ }
+ }
+
+ // ----- check path variables separatly -----
+ String sDelim = System.getProperty("path.separator");
+ bEmergencyStop |= checkPathVariable("java.library.path", sDelim);
+ bEmergencyStop |= checkPathVariable("java.class.path", sDelim);
+ bEmergencyStop |= checkPathVariable("sun.boot.class.path", sDelim);
+
+ // ----- check all TestParameters -----
+ aEnum = _aParams.keys();
+ while (aEnum.hasMoreElements())
+ {
+ String sKey = (String)aEnum.nextElement();
+ if (_aParams.get(sKey) instanceof String)
+ {
+ String sValue = (String)_aParams.get(sKey);
+
+ if (checkVariableForCygwin(sValue))
+ {
+ System.err.println("ERROR: OOoRunner detect cygwin path in '" + sKey + ":=" + sValue + "'");
+ bEmergencyStop = true;
+ }
+ }
+ }
+
+ if (bEmergencyStop)
+ {
+ System.exit(-1);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ System.out.println("OOoRunner Main()");
setStartTime(getTime());
@@ -122,11 +218,12 @@ public class Runner
//parse the commandline arguments
// TODO: no right error message, if no parameter given!
- cli.getCommandLineParameter(param,args);
+ cli.getCommandLineParameter(param, args);
Object tj = param.get("TestJob");
- if (tj==null) {
+ if (tj == null)
+ {
System.out.println("==========================================================================");
System.out.println("No TestJob given, please make sure that you ");
System.out.println("a.) called the OOoRunner with the paramter -o <job> or -sce <scenarioFile>");
@@ -136,10 +233,11 @@ public class Runner
System.exit(-1);
}
- System.out.println("TestJob: "+tj);
+ System.out.println("TestJob: " + tj);
+ String sName = "base." + (String) param.get("TestBase");
+ TestBase toExecute = (TestBase) dcl.getInstance(sName);
- TestBase toExecute = (TestBase) dcl.getInstance("base."+
- (String)param.get("TestBase"));
+ checkAllVariablesForCygwinPath(param);
boolean worked = toExecute.executeTest(param);
long nTime = meanTime(getStartTime());
@@ -149,12 +247,12 @@ public class Runner
if (!worked)
{
- System.out.println("Job "+param.get("TestJob")+" failed");
+ System.out.println("Job " + param.get("TestJob") + " failed");
System.exit(-1);
}
else
{
- System.out.println("Job "+param.get("TestJob")+" done");
+ System.out.println("Job " + param.get("TestJob") + " done");
System.exit(0);
}
}