You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mh...@apache.org on 2005/04/19 22:32:18 UTC
cvs commit: xml-xalan/c/Tests/Performance Parameters.cpp Parameters.hpp comparereport.xsl config.xml perf.cpp
mhoyt 2005/04/19 13:32:18
Modified: c/Tests/Performance Parameters.cpp Parameters.hpp
comparereport.xsl config.xml perf.cpp
Log:
Fixes and improvements to test tool
Revision Changes Path
1.2 +19 -11 xml-xalan/c/Tests/Performance/Parameters.cpp
Index: Parameters.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/Tests/Performance/Parameters.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Parameters.cpp 7 Apr 2005 07:03:05 -0000 1.1
+++ Parameters.cpp 19 Apr 2005 20:32:18 -0000 1.2
@@ -68,19 +68,20 @@
const XalanDOMString& runFileName,
const XalanDOMString& testDirectory,
const XalanDOMString& resultDirectory,
+ const XalanDOMString& baselineDirectory,
const XalanDOMString& reportDirectory,
XalanFileUtility& fileUtility,
Logger & logger) :
- m_name(),
- m_description(),
+ m_name("default"),
+ m_description(""),
m_resultDirectory(resultDirectory),
m_resultFile("results"),
m_threshold("5"),
- m_baselineDirectory(),
- m_baselineFile(),
+ m_baselineDirectory(baselineDirectory),
+ m_baselineFile(""),
m_defaultTestCase(),
m_testDirectory(testDirectory),
- m_goldDirectory(),
+ m_goldDirectory(""),
m_reportDirectory(reportDirectory),
m_transformer(),
m_initialized(false),
@@ -279,7 +280,11 @@
attributeNode = attributeParams->getNamedItem(XalanDOMString("file-path"));
if (attributeNode != 0)
{
- m_baselineDirectory = attributeNode->getNodeValue();
+ if (!m_baselineDirectory.empty())
+ {
+ m_baselineDirectory += getPathSep();
+ }
+ m_baselineDirectory += attributeNode->getNodeValue();
}
// baseline file
XalanNode * baselineNode = currentNode->getFirstChild();
@@ -417,10 +422,13 @@
return false;
}
- if (!fileUtility.checkDir(m_goldDirectory))
+ if (m_goldDirectory.empty())
{
- logger.error() << "Invalid gold directory: " << m_goldDirectory.c_str() << endl;
- return false;
+ logger.message() << "No gold directory specified" << endl;
+ if (!fileUtility.checkDir(m_goldDirectory))
+ {
+ logger.warning() << "Invalid gold directory: " << m_goldDirectory.c_str() << endl;
+ }
}
fileUtility.checkAndCreateDir(m_resultDirectory);
@@ -431,7 +439,7 @@
fileUtility.getDirectoryNames(m_testDirectory, dirNames);
FileNamesType::iterator dirIter = dirNames.begin();
-
+
// for each test directory
while (dirIter != dirNames.end())
{
@@ -458,7 +466,7 @@
fileUtility.generateFileName(testCase.stylesheet, "xml", testCase.inputDocument, &status);
if (status != true)
{
- logger.warning() << "No matching input file for" << testCase.stylesheet.c_str() << endl;
+ logger.warning() << "No matching input file for: " << testCase.stylesheet.c_str() << endl;
++xslIter;
continue;
}
1.2 +1 -0 xml-xalan/c/Tests/Performance/Parameters.hpp
Index: Parameters.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/Tests/Performance/Parameters.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Parameters.hpp 7 Apr 2005 07:03:05 -0000 1.1
+++ Parameters.hpp 19 Apr 2005 20:32:18 -0000 1.2
@@ -53,6 +53,7 @@
const XalanDOMString& runFileName,
const XalanDOMString& testDirectory,
const XalanDOMString& resultDirectory,
+ const XalanDOMString& baselineDirectory,
const XalanDOMString& reportDirectory,
XalanFileUtility& fileUtility,
Logger& log);
1.2 +12 -6 xml-xalan/c/Tests/Performance/comparereport.xsl
Index: comparereport.xsl
===================================================================
RCS file: /home/cvs/xml-xalan/c/Tests/Performance/comparereport.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- comparereport.xsl 7 Apr 2005 07:03:05 -0000 1.1
+++ comparereport.xsl 19 Apr 2005 20:32:18 -0000 1.2
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
- <xsl:param name="baseline" select="'R2.xml'"/>
+ <xsl:param name="baseline" select="ResultReport_latest.xml"/>
<xsl:param name="threshold" select="5"/>
<xsl:template match="/">
@@ -184,7 +184,10 @@
<xsl:when test="$n-new > $n-orig">
<xsl:variable name="difference" select="(($n-new div $n-orig) - 1) * 100"/>
<xsl:choose>
- <xsl:when test="$difference > ($threshold div 100)">
+ <xsl:when test="$difference = 0">
+ <td align="center">--</td>
+ </xsl:when>
+ <xsl:when test="$difference > $threshold">
<td bgcolor="red">
<xsl:value-of select="concat($difference,'%')"/>
</td>
@@ -199,7 +202,10 @@
<xsl:otherwise>
<xsl:variable name="difference" select="(1 - ($n-new div $n-orig)) * 100"/>
<xsl:choose>
- <xsl:when test="$difference > ($threshold div 100)">
+ <xsl:when test="$difference = 0">
+ <td align="center">--</td>
+ </xsl:when>
+ <xsl:when test="$difference > $threshold">
<td bgcolor="#10F0F0">
<xsl:value-of select="concat($difference,'%')"/>
</td>
@@ -215,6 +221,9 @@
</xsl:when>
<xsl:otherwise>
<xsl:choose>
+ <xsl:when test="not($orig) and not($new)">
+ <td></td>
+ </xsl:when>
<xsl:when test="$orig = $new">
<td>Same</td>
</xsl:when>
@@ -227,6 +236,3 @@
</xsl:template>
</xsl:stylesheet>
-
-
-
1.2 +9 -7 xml-xalan/c/Tests/Performance/config.xml
Index: config.xml
===================================================================
RCS file: /home/cvs/xml-xalan/c/Tests/Performance/config.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- config.xml 7 Apr 2005 07:03:05 -0000 1.1
+++ config.xml 19 Apr 2005 20:32:18 -0000 1.2
@@ -1,27 +1,29 @@
<?xml version="1.0"?>
<!-- Test configuration file that describes the testing parameters -->
<testconfig name="DefaultRun">
- <description>This is a sample test configuratoin file</description>
+ <description>This is a sample test configuration file</description>
<!-- Location to place results along with Report name prefix.
- Default is the working directory. -->
+ Default is the working directory.
+ Default is results directory and ResultReport prefix -->
<results file-path="SampleTestRunResults">ResultReport</results>
<!-- Location where previous result to be used for comparison is located.
Threshold is percentage of variance to highlight.
- Default is the working directory -->
- <!--<baseline threshold="5" file-path="BaseLineResults">Standard.xml</baseline> -->
+ Default is the result directory and ResultReport_latest.xml -->
+ <baseline threshold="5" file-path="BaseLineResults">Baseline.xml</baseline>
<!-- Parameters for the test cases:
num-iterations number of iterations
min-time-to-execute minimum time of process (milliseconds)
verify-result compare against the gold file (yes|no)
+ (verify only operates with 'file' result)
input-mode mode to provide input (file|stream) -->
<default-parameter-set
num-iterations="10"
min-time-to-execute="1"
input-mode="stream"
- verify-result="yes">
+ verify-result="no">
<!-- Init options: N/A at this time -->
<!-- <init-options/> -->
@@ -31,7 +33,7 @@
<!-- Parse options for Xalan:
xst XalanSourceTree (default)
xerces-dom XercesDOM -->
- <!-- <parse-options processor="Xalan">xst</parse-options> -->
+ <parse-options processor="Xalan">xerces-dom</parse-options>
<!-- Result options for Xalan:
file File (default)
@@ -39,7 +41,7 @@
xerces-dom XercesDOM
null Null
stream Stream -->
- <!-- <result-options processor="Xalan">file</result-options> -->
+ <result-options processor="Xalan">xerces-dom</result-options>
<!-- Transform options: N/A at this time -->
<!-- <transform-options processor="Xalan"/> -->
1.44 +21 -1 xml-xalan/c/Tests/Performance/perf.cpp
Index: perf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/Tests/Performance/perf.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- perf.cpp 7 Apr 2005 07:03:05 -0000 1.43
+++ perf.cpp 19 Apr 2005 20:32:18 -0000 1.44
@@ -69,6 +69,7 @@
<< " [options]"
<< " -test [test directory ]"
<< " -result [result directory ]"
+ << " -baseline [baseline directory]"
<< " -report [report directory ]"
<< " configfile" << endl
<< "Options:" << endl
@@ -133,8 +134,12 @@
htmlCompareReport += params.getUniqId();
htmlCompareReport += XalanDOMString(".html");
+ XalanDOMString baselineFileStr = XalanDOMString("'");
+ baselineFileStr += baselineFile;
+ baselineFileStr += XalanDOMString("'");
+
transformer.setStylesheetParam(XalanDOMString("threshold"),params.getThreshold());
- transformer.setStylesheetParam(XalanDOMString("baseline"), baselineFile);
+ transformer.setStylesheetParam(XalanDOMString("baseline"), baselineFileStr);
if (checkFileExists(compareReportFileXSL))
{
@@ -185,6 +190,7 @@
{
XalanDOMString testDirectory;
XalanDOMString resultDirectory;
+ XalanDOMString baselineDirectory;
XalanDOMString reportDirectory;
XalanDOMString runFileName;
@@ -214,6 +220,17 @@
}
resultDirectory.assign(argv[i]);
}
+ else if (stricmp(argv[i],"-baseline") == 0)
+ {
+ ++i;
+ if (i >= argc)
+ {
+ logger.error() << "Baseline directory missing" << endl;
+ usage();
+ exit(1);
+ }
+ baselineDirectory.assign(argv[i]);
+ }
else if (stricmp(argv[i],"-report") == 0)
{
++i;
@@ -245,6 +262,8 @@
}
+ logger.message() << "Loading configuration file: " << runFileName.c_str() << endl;
+
XalanFileUtility fileUtility(XalanMemMgrs::getDefaultXercesMemMgr());
// setup testing parameters
@@ -252,6 +271,7 @@
runFileName,
testDirectory,
resultDirectory,
+ baselineDirectory,
reportDirectory,
fileUtility,
logger);
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org