xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbert...@apache.org
Subject cvs commit: xml-xalan/c/Tests/PerfT PerfT.dsp perft.cpp
Date Fri, 25 Jan 2002 00:34:51 GMT
dbertoni    02/01/24 16:34:51

  Modified:    c/Tests/Extensions extensions.cpp
               c/Tests/InputSource inputsource.cpp
               c/Tests/Params Params.cpp
               c/Tests/PerfT PerfT.dsp perft.cpp
  Log:
  Major clean-up.
  
  Revision  Changes    Path
  1.16      +107 -65   xml-xalan/c/Tests/Extensions/extensions.cpp
  
  Index: extensions.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Extensions/extensions.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- extensions.cpp	17 Dec 2001 14:40:26 -0000	1.15
  +++ extensions.cpp	25 Jan 2002 00:34:50 -0000	1.16
  @@ -67,11 +67,7 @@
   #include <crtdbg.h>
   #endif
   
  -// XERCES HEADERS...
  -//	Are included by HarnessInit.hpp
   
  -// XALAN HEADERS...
  -//	Are included by FileUtility.hpp
   
   // EXTENSION HEADERS...
   #include <XalanExtensions/FunctionDifference.hpp>
  @@ -81,30 +77,34 @@
   #include <XalanExtensions/FunctionIntersection.hpp>
   #include <XalanExtensions/FunctionNodeSet.hpp>
   
  +
  +
  +#include <XalanTransformer/XalanTransformer.hpp>
  +
  +
  +
   // HARNESS HEADERS...
  -#include <XMLFileReporter.hpp>
  -#include <FileUtility.hpp>
  -#include <HarnessInit.hpp>
  +#include <Harness/XMLFileReporter.hpp>
  +#include <Harness/FileUtility.hpp>
  +#include <Harness/HarnessInit.hpp>
  +
   
   
   #if !defined(XALAN_NO_NAMESPACES)
  -	using std::cerr;
   	using std::cout;
   	using std::endl;
   #endif
   
  -// GLOBAL VARIABLES...
  -FileUtility				h;
   
  -const XalanDOMString	currentDir("library");
  -const XalanDOMString	theNamespace("http://xml.apache.org/xalan");
  -const char *resultString = "The specified function is not available: http://xml.apache.org/xalan:nodeset";
  +
  +// GLOBAL VARIABLES...
  +const char* const	resultString = "The specified function is not available: http://xml.apache.org/xalan:nodeset";
   
   
   void
  -setHelp()
  +setHelp(FileUtility&	h)
   {
  -	h.args.help << endl
  +	h.args.getHelpStream() << endl
   		 << "extensions dirname [-out]"
   		 << endl
   		 << endl
  @@ -116,24 +116,28 @@
   
   
   // Generate the various filenames needed for testing.
  -void generateFiles(const XalanDOMString &fileName, 
  -				   XalanDOMString &xml, 
  -				   XalanDOMString &xsl,
  -				   XalanDOMString &out,
  -				   XalanDOMString &gold,
  -				   const char* test)
  +void
  +generateFiles(
  +			const XalanDOMString&	fileName,
  +			const XalanDOMString&	currentDir,
  +			XalanDOMString&			xml, 
  +			XalanDOMString&			xsl,
  +			XalanDOMString&			out,
  +			XalanDOMString&			gold,
  +			const char*				test,
  +			FileUtility&			h)
   {
   	// Set up the input/output files.
   	const XalanDOMString testName(h.generateFileName(fileName,"out"));
   
  -	xsl = h.args.base + currentDir + pathSep + fileName;
  +	xsl = h.args.base + currentDir + FileUtility::s_pathSep + fileName;
   	xml = h.generateFileName(xsl,"xml");
   	h.data.xmlFileURL = xml;
   	h.data.xslFileURL = xsl;
   
  -	out =  h.args.output + currentDir + pathSep + XalanDOMString(test) + testName; 
  +	out =  h.args.output + currentDir + FileUtility::s_pathSep + XalanDOMString(test) + testName; 
   
  -	gold = h.args.gold + currentDir + pathSep + testName;
  +	gold = h.args.gold + currentDir + FileUtility::s_pathSep + testName;
   
   }
   
  @@ -146,12 +150,18 @@
   //		globally. Currently XalanC supports the following extensions; difference, distinct, evaluate, 
   //		hasSameNodes, intersection and nodeset. 
   //		 
  -void TestCase1(XalanTransformer &xalan, const XalanDOMString &fileName, XMLFileReporter &logFile)
  +void
  +TestCase1(
  +			XalanTransformer&		xalan,
  +			const XalanDOMString&	fileName,
  +			const XalanDOMString&	currentDir,
  +			XMLFileReporter&		logFile,
  +			FileUtility&			h)
   {
   	
   	XalanDOMString	xml, xsl, theOutputFile, theGoldFile;
   		
  -	generateFiles(fileName, xml, xsl, theOutputFile, theGoldFile, "tc1-");
  +	generateFiles(fileName, currentDir, xml, xsl, theOutputFile, theGoldFile, "tc1-", h);
   
   	h.data.testOrFile = XalanDOMString("TestCase1: ") + fileName;
   	h.data.xmlFileURL = xml;
  @@ -175,12 +185,19 @@
   //		This test verifies that the 'nodeset' function is properly uninstalled via the api.
   //		Output file should NOT contain data. 
   //
  -void TestCase2(XalanTransformer &xalan, const XalanDOMString &fileName, XMLFileReporter &logFile)
  +void
  +TestCase2(
  +			XalanTransformer&		xalan,
  +			const XalanDOMString&	fileName,
  +			const XalanDOMString&	currentDir,
  +			const XalanDOMString&	theNamespace,
  +			XMLFileReporter&		logFile,
  +			FileUtility&			h)
   {	
   
   	XalanDOMString	xml, xsl, theOutputFile, theGoldFile;
   	
  -	generateFiles(fileName, xml, xsl, theOutputFile, theGoldFile, "tc2-");
  +	generateFiles(fileName, currentDir, xml, xsl, theOutputFile, theGoldFile, "tc2-", h);
   	h.data.testOrFile = XalanDOMString("TestCase2");
   	h.data.xmlFileURL = xml;
   	h.data.xslFileURL = xsl;
  @@ -213,12 +230,19 @@
   //		This tests the installExternalFunction method of XalanTransformer using the nodeset function.
   //		Output file should NOT contain data.
   //
  -void TestCase3(XalanTransformer &xalan, const XalanDOMString &fileName, XMLFileReporter &logFile)
  +void TestCase3(
  +			XalanTransformer&		xalan,
  +			const XalanDOMString&	fileName,
  +			const XalanDOMString&	currentDir,
  +			const XalanDOMString&	theNamespace,
  +			XMLFileReporter&		logFile,
  +			FileUtility&			h)
   {
   	
   	XalanDOMString	xml, xsl, theOutputFile, theGoldFile;
   	
  -	generateFiles(fileName, xml, xsl, theOutputFile, theGoldFile, "tc3-");
  +	generateFiles(fileName, currentDir, xml, xsl, theOutputFile, theGoldFile, "tc3-", h);
  +
   	h.data.testOrFile = XalanDOMString("TestCase3a");
   	h.data.xmlFileURL = xml;
   	h.data.xslFileURL = xsl;
  @@ -275,12 +299,18 @@
   //		This tests uses transformer method installExternalFunctionGlobal to add the nodeset function. 
   //		The output file should contain data.
   //
  -void TestCase4(XalanTransformer &xalan, const XalanDOMString &fileName, XMLFileReporter &logFile)
  +void TestCase4(
  +			XalanTransformer&		xalan,
  +			const XalanDOMString&	fileName,
  +			const XalanDOMString&	currentDir,
  +			const XalanDOMString&	theNamespace,
  +			XMLFileReporter&		logFile,
  +			FileUtility&			h)
   {
   	
   	XalanDOMString	xml, xsl, theOutputFile, theGoldFile;
   
  -	generateFiles(fileName, xml, xsl, theOutputFile, theGoldFile, "tc4-");
  +	generateFiles(fileName, currentDir, xml, xsl, theOutputFile, theGoldFile, "tc4-", h);
   	h.data.testOrFile = XalanDOMString("TestCase4a");
   	h.data.xmlFileURL = xml;
   	h.data.xslFileURL = xsl;
  @@ -308,6 +338,7 @@
   
   }
   
  +
   int
   main(int			argc,
   	 const char*	argv [])
  @@ -318,18 +349,24 @@
   	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
   #endif
   
  +	HarnessInit		xmlPlatformUtils;
  +
  +	FileUtility		h;
  +
   	// Set the program help string,  then get the command line parameters.
   	//
  -	setHelp();	
  +	setHelp(h);	
  +
   	if (h.getParams(argc, argv, "EXTENSION-RESULTS") == true)
   	{
  +		const XalanDOMString	currentDir("library");
   		const XalanDOMString	extDir(h.args.base + currentDir);
   
   		// Check that the base directory is correct.
   		if ( !h.checkDir(extDir) )
   		{
   			cout << "Invalid base directory - " << c_str(TranscodeToLocalCodePage(extDir)) << endl;
  -			cout << h.args.help.str();
  +			cout << h.args.getHelpMessage();
   			return 0;
   		}
   
  @@ -338,7 +375,7 @@
   
   		// Defined basic constants for file manipulation 
   		const XalanDOMString drive(h.getDrive());
  -		const XalanDOMString  resultsFile(drive + h.args.output + currentDir + UniqRunid + XMLSuffix);
  +		const XalanDOMString  resultsFile(drive + h.args.output + currentDir + UniqRunid + FileUtility::s_xmlSuffix);
   		
   		XMLFileReporter	logFile(resultsFile);
   		logFile.logTestFileInit("C++ Extension Testing. ");
  @@ -347,41 +384,46 @@
   		cout << "Performing Extension testing ..." << endl;
   
   		// Call the static initializers...
  -		HarnessInit xmlPlatformUtils;
   		XalanTransformer::initialize();
   
  -		XalanTransformer xalan;				
  -				
  -		// Check that output directory is there.
  -		XalanDOMString		  fileName;
  -				
  -		const XalanDOMString  theOutputDir = h.args.output + currentDir;
  -		h.checkAndCreateDir(theOutputDir);
  +		{
  +			XalanTransformer	xalan;				
  +					
  +			// Check that output directory is there.
  +			XalanDOMString		fileName;
  +					
  +			const XalanDOMString	theOutputDir(h.args.output + currentDir);
  +
  +			h.checkAndCreateDir(theOutputDir);
  +
  +			// Get the files found in the "cextension" directory
  +			const FileNameVectorType	files = h.getTestFileNames(h.args.base, currentDir, true);
  +
  +			// TestCase1 is used to verify correct functioning of the default extension functions
  +			TestCase1(xalan, files[0], currentDir, logFile, h);	// Difference function
  +			TestCase1(xalan, files[1], currentDir, logFile, h);	// Distinct 
  +			TestCase1(xalan, files[2], currentDir, logFile, h);	// Evaluate 
  +			TestCase1(xalan, files[3], currentDir, logFile, h);	// HasSameNodes 
  +			TestCase1(xalan, files[4], currentDir, logFile, h);	// Intersection 
  +			TestCase1(xalan, files[5], currentDir, logFile, h);	// NodeSet01 - basic testing
  +			TestCase1(xalan, files[6], currentDir, logFile, h);	// NodeSet02 - extensive RTF testing. 
  +
  +			const XalanDOMString	theNamespace("http://xml.apache.org/xalan");
  +
  +			// These testcases are used to test the Install/Uninstall Function API's of the transformer.
  +			TestCase2(xalan, files[5], theNamespace, currentDir, logFile, h);
  +			TestCase3(xalan, files[5], theNamespace, currentDir, logFile, h);
  +			TestCase4(xalan, files[5], theNamespace, currentDir, logFile, h);
   
  -		// Get the files found in the "cextension" directory
  -		const FileNameVectorType	files = h.getTestFileNames(h.args.base, currentDir, true);
  +			logFile.logTestCaseClose("Done", "Pass");
  +			h.reportPassFail(logFile, UniqRunid);
  +				
  +			logFile.logTestFileClose("C++ Extension Testing: ", "Done");
  +			logFile.close();
   
  -		// TestCase1 is used to verify correct functioning of the default extension functions
  -		TestCase1(xalan, files[0], logFile);	// Difference function
  -		TestCase1(xalan, files[1], logFile);	// Distinct 
  -		TestCase1(xalan, files[2], logFile);	// Evaluate 
  -		TestCase1(xalan, files[3], logFile);	// HasSameNodes 
  -		TestCase1(xalan, files[4], logFile);	// Intersection 
  -		TestCase1(xalan, files[5], logFile);	// NodeSet01 - basic testing
  -		TestCase1(xalan, files[6], logFile);	// NodeSet02 - extensive RTF testing. 
  -
  -		// These testcases are used to excerise the Install/Uninstall Function API's of the transformer.
  -		TestCase2(xalan, files[5], logFile);
  -		TestCase3(xalan, files[5], logFile);
  -		TestCase4(xalan, files[5], logFile);
  -
  -		logFile.logTestCaseClose("Done", "Pass");
  -		h.reportPassFail(logFile, UniqRunid);
  -			
  -		logFile.logTestFileClose("C++ Extension Testing: ", "Done");
  -		logFile.close();
  +			h.analyzeResults(xalan, resultsFile);
  +		}
   
  -		h.analyzeResults(xalan, resultsFile);
   		XalanTransformer::terminate();
   
   	}
  
  
  
  1.13      +96 -59    xml-xalan/c/Tests/InputSource/inputsource.cpp
  
  Index: inputsource.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/InputSource/inputsource.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- inputsource.cpp	20 Dec 2001 17:56:54 -0000	1.12
  +++ inputsource.cpp	25 Jan 2002 00:34:51 -0000	1.13
  @@ -71,14 +71,25 @@
   //	Are included by HarnessInit.hpp
   #include <parsers/DOMParser.hpp>
   
  +
   // XALAN HEADERS...
  -//	Are included by FileUtility.hpp
  +#include <XPath/XPathExecutionContextDefault.hpp>
  +#include <XPath/XObjectFactoryDefault.hpp>
  +#include <XPath/XPathFactoryDefault.hpp>
  +
  +#include <XSLT/StylesheetConstructionContextDefault.hpp>
  +#include <XSLT/StylesheetExecutionContextDefault.hpp>
  +#include <XSLT/XSLTProcessorEnvSupportDefault.hpp>
  +#include <XSLT/XSLTEngineImpl.hpp>
  +
  +
  +#include <XalanTransformer/XalanTransformer.hpp>
   #include <XalanTransformer/XercesDOMWrapperParsedSource.hpp>
   
   // HARNESS HEADERS...
  -#include <XMLFileReporter.hpp>
  -#include <FileUtility.hpp>
  -#include <HarnessInit.hpp>
  +#include <Harness/XMLFileReporter.hpp>
  +#include <Harness/FileUtility.hpp>
  +#include <Harness/HarnessInit.hpp>
   
   
   #if !defined(XALAN_NO_NAMESPACES)
  @@ -87,12 +98,12 @@
   	using std::endl;
   #endif
   
  -FileUtility		h;
   
  +	
   void
  -setHelp()
  +setHelp(FileUtility&	h)
   {
  -	h.args.help << endl
  +	h.args.getHelpStream() << endl
   				<< "inputsource dirname [-out]"
   				<< endl
   				<< endl
  @@ -106,33 +117,45 @@
   //		- XSLTInputSource(const XMLCh* systemId)
   //		- XSLTInputSource(const XMLCh* systemId,
   //						  const XMLCh* publicId)
  -void testCase1(XalanTransformer &xalan, XMLFileReporter& logFile, 
  -			   const XalanDOMString &xml, const XalanDOMString &xsl, 
  -			   const XalanDOMString outBase, XalanDOMString &theGoldFile)
  +void
  +testCase1(
  +			XalanTransformer&		xalan,
  +			XMLFileReporter&		logFile, 
  +			const XalanDOMString&	xml,
  +			const XalanDOMString&	xsl, 
  +			const XalanDOMString&	outBase,
  +			const XalanDOMString&	theGoldFile,
  +			FileUtility&			h)
   {
  -	const XalanDOMString  publicID("public-smublic");
  +	const XalanDOMString	publicID("public-smublic");
   
   	const XalanDOMString	theOutputFile = outBase + XalanDOMString("\\InputSource-TestCase1.out");
   	const XSLTResultTarget	theResultTarget(theOutputFile);
   
   	h.data.testOrFile = "InputSource-TestCase1";
   
  -	// This code excersized the stated methods of XSLTInputSource
  +	// This code exercised the stated methods of XSLTInputSource
   	const XSLTInputSource	xmlInputSource(c_wstr(xml));
   	const XSLTInputSource	xslInputSource(c_wstr(xsl), c_wstr(publicID));
   
   	// Do the transform and report the results.
   	xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
  +
   	h.checkResults(theOutputFile, theGoldFile, logFile);
  -		
   }
   
  +
   // TestCase2 will use the following methods of XSLTInputSource
   //		- XSLTInputSource(const char* systemId)
   //		- XSLTInputSource(const char* systemId,
   //						  const char* publicId)
  -void testCase2(XalanTransformer &xalan, XMLFileReporter& logFile, 
  -			   const XalanDOMString outBase, XalanDOMString &theGoldFile)
  +void
  +testCase2(
  +			XalanTransformer&		xalan,
  +			XMLFileReporter&		logFile, 
  +			const XalanDOMString&	outBase,
  +			const XalanDOMString&	theGoldFile,
  +			FileUtility&			h)
   
   {
   	const XalanDOMString	theOutputFile = outBase + XalanDOMString("\\InputSource-TestCase2.out");
  @@ -158,12 +181,13 @@
   //		- XSLTInputSource::getNode()
   //		- NOTE:  We can't use the XalanTransformer Class with this test. So we create the processor directly.
   
  -void testCase3(XalanTransformer &xalan, XMLFileReporter &logFile, 
  -			   const XalanDOMString &outBase, const XalanDOMString &theGoldFile)
  -
  +void testCase3(
  +			XMLFileReporter&		logFile, 
  +			const XalanDOMString&	outBase,
  +			const XalanDOMString&	theGoldFile,
  +			FileUtility&			h)
   {
  -	XalanSourceTreeDocument::NodeType	type;		// actual values used for testing.
  -	XalanDOMString						name, value;	
  +	XalanDOMString			name, value;	
   
   	const XalanDOMString	theOutputFile = outBase + XalanDOMString("\\InputSource-TestCase3.out");
   	XSLTResultTarget		theResultTarget3(theOutputFile);
  @@ -209,8 +233,7 @@
   	// Create the XSL Input Source
   	const XSLTInputSource	xslStringSource("\\xml-xalan\\test\\tests\\capi\\smoke\\smoke01.xsl");
   
  -	XalanDocument* domXSL = parserLiaison.createXalanSourceTreeDocument();
  -	domXSL = parserLiaison.parseXMLStream(xslStringSource);
  +	XalanDocument* const	domXSL = parserLiaison.parseXMLStream(xslStringSource);
   
   	// Here is one of the tests. It will be verified when we do the transform.
   	XSLTInputSource	xslXalanNode(domXSL);
  @@ -232,8 +255,7 @@
   	// Create the XML Input Source
   	const XSLTInputSource	xmlStringSource("\\xml-xalan\\test\\tests\\capi\\smoke\\smoke01.xml");
   
  -	XalanDocument* domXML = parserLiaison.createXalanSourceTreeDocument();
  -	domXML = parserLiaison.parseXMLStream(xmlStringSource);
  +	XalanDocument* const	domXML = parserLiaison.parseXMLStream(xmlStringSource);
   
   	// Here is the final test. It too will be verified when we do the transform.
   	XSLTInputSource	xmlXalanNode;
  @@ -256,19 +278,21 @@
   // TestCase4 will use the following API.  Default constructor of XSLTInputSource will take a string.
   //		- XSLTInputSource(const char*)
   //		- XSLTInputSource(const char*)
  -void testCase4(XalanTransformer &xalan, XMLFileReporter& logFile,
  -			   const XalanDOMString outBase, XalanDOMString &goldFile)
  +void testCase4(
  +			XalanTransformer&		xalan,
  +			XMLFileReporter&		logFile, 
  +			const XalanDOMString&	outBase,
  +			const XalanDOMString&	theGoldFile,
  +			FileUtility&			h)
   {
   
   	const XalanDOMString theOutputFile = outBase + XalanDOMString("\\InputSource-TestCase4.out");
  -//	const XalanDOMString theOutputFile("\\xml-xalan\\test\\tests\\INPUTSOURCE-RESULTS\\smoke\\InputSource-TestCase4.out");
  -	const XalanDOMString theGoldFile(goldFile);
   
   	XSLTResultTarget theResultTarget(theOutputFile);
   
   	h.data.testOrFile = "InputSource-TestCase4";
   
  -	// This code excersized the stated methods of XSLTInputSource
  +	// This code exercises the stated methods of XSLTInputSource
   	// Do the transform and report the results.
   	xalan.transform("\\xml-xalan\\test\\tests\\capi\\smoke\\smoke01.xml", 
   					"\\xml-xalan\\test\\tests\\capi\\smoke\\smoke01.xsl",
  @@ -279,9 +303,15 @@
   
   // TestCase5 uses XercesDOMWrapperParsedSource class to wrap a xerces generated dom. 
   //
  -void testCase5(XalanTransformer &xalan, XMLFileReporter& logFile,
  -			   const XalanDOMString &xml, const XalanDOMString &xsl,
  -			   const XalanDOMString outBase, XalanDOMString &theGoldFile)
  +void 
  +testCase5(
  +			XalanTransformer&		xalan,
  +			XMLFileReporter&		logFile,
  +			const XalanDOMString&	xml,
  +			const XalanDOMString&	xsl,
  +			const XalanDOMString&	outBase,
  +			const XalanDOMString&	theGoldFile,
  +			FileUtility&			h)
   {
   	h.data.testOrFile = "InputSource-TestCase5";
   	const XSLTInputSource	xmlInputSource(c_wstr(xml));
  @@ -295,30 +325,28 @@
   	XercesParserLiaison theParserLiaison(theDOMSupport);
   
   	// This is the wrapper class for Xerces DOM. 
  -	const XercesDOMWrapperParsedSource* xmlDocWrapper = 0;
  -	xmlDocWrapper = new XercesDOMWrapperParsedSource(theDOM, 
  -													 theParserLiaison, 
  -													 theDOMSupport, 
  -													 xml);
  -/*	const XercesDOMWrapperParsedSource xmlDocWrapper(theDOM, 
  +	const XercesDOMWrapperParsedSource	xmlDocWrapper(theDOM, 
   													 theParserLiaison, 
   													 theDOMSupport, 
   													 xml);
   
  -*/
   	const XalanDOMString theOutputFile(outBase + XalanDOMString("\\InputSource-TestCase5.out"));
  +
   	const XSLTInputSource	xslInputSource(c_wstr(xsl));
   	const XSLTResultTarget	theResultTarget(theOutputFile);
   
   	// Do the transform and report the results.
  -	xalan.transform(*xmlDocWrapper, xslInputSource, theResultTarget);
  +	xalan.transform(xmlDocWrapper, xslInputSource, theResultTarget);
  +
   	h.checkResults(theOutputFile, theGoldFile, logFile);
  -	delete xmlDocWrapper;
   }
   
  +
  +
   int
  -main(int		  argc,
  -	 const char*  argv [])
  +main(
  +			int				argc,
  +			const char*		argv[])
   {
   #if !defined(NDEBUG) && defined(_MSC_VER)
   	_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
  @@ -326,18 +354,26 @@
   	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
   #endif
   
  +	HarnessInit		xmlPlatformUtils;
  +
  +	FileUtility		h;
  +
   	// Set the program help string,  then get the command line parameters.
   	//
  -	setHelp();
  +	setHelp(h);
  +
   	if (h.getParams(argc, argv, "INPUTSOURCE-RESULTS") == true)
   	{
  +		// Call the static initializers...
  +		XalanTransformer::initialize();
  +
   		// Generate and Initialize Unique result logfile, and get drive designation
   		//
   		const XalanDOMString UniqRunid = h.generateUniqRunid();
   		const XalanDOMString drive(h.getDrive());
   		const XalanDOMString  resultFilePrefix("isource");
  -		const XalanDOMString  resultsFile(drive + h.args.output + resultFilePrefix + UniqRunid + XMLSuffix);
  -		
  +		const XalanDOMString  resultsFile(drive + h.args.output + resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
  +			
   		XMLFileReporter	logFile(resultsFile);
   		logFile.logTestFileInit("XSLTInputSource Testing: Give various types of allowable Inputs. ");
   
  @@ -345,44 +381,45 @@
   		{
   			// Call the static initializers...
   			//
  -			HarnessInit xmlPlatformUtils;
  -			XalanTransformer::initialize();
   			XalanTransformer xalan;
  +
   			{
   				XalanDOMString		fileName;
  -				
  +					
   				// Get testfiles from the capi\smoke directory, create output directory, .
   				//
   				const XalanDOMString  currentDir("smoke");
   				const XalanDOMString  theOutputDir = h.args.output + currentDir;
  +				
   				h.checkAndCreateDir(theOutputDir);
   
   				// Get the single file found in the "smoke" directory, and run tests.
   				//
   				const FileNameVectorType	files = h.getTestFileNames(h.args.base, currentDir, true);
   				logFile.logTestCaseInit(currentDir);
  +
   				for(FileNameVectorType::size_type i = 0; i < files.size(); ++i)
   				{
   					fileName = files[i];
   					h.data.testOrFile = fileName;
   
   					// Set up the input/output files.
  -					const XalanDOMString  theXSLFile= h.args.base + currentDir + pathSep + fileName;
  +					const XalanDOMString  theXSLFile= h.args.base + currentDir + FileUtility::s_pathSep + fileName;
   					const XalanDOMString  theXMLFile = h.generateFileName(theXSLFile,"xml");
   					h.data.xmlFileURL = theXMLFile;
   					h.data.xslFileURL = theXSLFile;
   
   					// Set the gold file.
  -					XalanDOMString  theGoldFile = h.args.gold + currentDir + pathSep + fileName;
  +					XalanDOMString  theGoldFile = h.args.gold + currentDir + FileUtility::s_pathSep + fileName;
   					theGoldFile = h.generateFileName(theGoldFile, "out");
  -					
  +						
   					// Execute the test cases. 
   					//
  -					testCase1(xalan, logFile, theXMLFile, theXSLFile, theOutputDir, theGoldFile);
  -					testCase2(xalan, logFile, theOutputDir, theGoldFile);
  -					testCase3(xalan, logFile, theOutputDir, theGoldFile);
  -					testCase4(xalan, logFile, theOutputDir, theGoldFile);
  -					testCase5(xalan, logFile, theXMLFile, theXSLFile, theOutputDir, theGoldFile);
  +					testCase1(xalan, logFile, theXMLFile, theXSLFile, theOutputDir, theGoldFile, h);
  +					testCase2(xalan, logFile, theOutputDir, theGoldFile, h);
  +					testCase3(logFile, theOutputDir, theGoldFile, h);
  +					testCase4(xalan, logFile, theOutputDir, theGoldFile, h);
  +					testCase5(xalan, logFile, theXMLFile, theXSLFile, theOutputDir, theGoldFile, h);
   				}
   
   				logFile.logTestCaseClose("Done", "Pass");	
  @@ -393,14 +430,14 @@
   			logFile.close();
   
   			h.analyzeResults(xalan, resultsFile);
  -			XalanTransformer::terminate();
   		}
   		catch(...)
   		{
   			cerr << "Exception caught!!!" << endl << endl;
   		}
  +
  +		XalanTransformer::terminate();
   	}
   
   	return 0;
  -
   }
  
  
  
  1.18      +128 -123  xml-xalan/c/Tests/Params/Params.cpp
  
  Index: Params.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Params/Params.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Params.cpp	17 Dec 2001 14:41:33 -0000	1.17
  +++ Params.cpp	25 Jan 2002 00:34:51 -0000	1.18
  @@ -75,9 +75,9 @@
   
   #include <XalanTransformer/XalanTransformer.hpp>
   
  -#include <XMLFileReporter.hpp>
  -#include <FileUtility.hpp>
  -#include <HarnessInit.hpp>
  +#include <Harness/XMLFileReporter.hpp>
  +#include <Harness/FileUtility.hpp>
  +#include <Harness/HarnessInit.hpp>
   
   
   #if !defined(XALAN_NO_NAMESPACES)
  @@ -86,12 +86,12 @@
   	using std::endl;
   #endif
   
  -FileUtility		h;
  +
   
   void
  -setHelp()
  +setHelp(FileUtility&	h)
   {
  -	h.args.help << endl
  +	h.args.getHelpStream() << endl
   		 << "params dirname [-out]"
   		 << endl
   		 << endl
  @@ -125,160 +125,165 @@
   	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
   #endif
   
  +	HarnessInit		xmlPlatformUtils;
  +
  +	FileUtility		h;
  +
   	char testCase[15];
   	XalanDOMString fileName, theGoldFile;
   	const XalanDOMString  currentDir("params");
  -	
   
  -	setHelp();
  +	// Set the program help string,  then get the command line parameters.
  +	//
  +	setHelp(h);
   
   	// Get the command line parameters.
   	//
   	if (h.getParams(argc, argv, "PARAMS-RESULTS") == true)
   	{
  -
   		const XalanDOMString	extDir(h.args.base + currentDir);
   
   		// Check that the base directory is correct.
   		if ( !h.checkDir(extDir) )
   		{
   			cout << "Invalid base directory - " << c_str(TranscodeToLocalCodePage(extDir)) << endl;
  -			cout << h.args.help.str();
  +			cout << h.args.getHelpMessage();
   			return 0;
   		}
   
   		// Call the static initializers...
  -		HarnessInit xmlPlatformUtils;
   		XalanTransformer::initialize();
  -		XalanTransformer	xalan;
  +		{
  +			XalanTransformer	xalan;
   
  -		// Generate Unique Run id. (Only used to name the result logfile.)
  -		const XalanDOMString UniqRunid = h.generateUniqRunid();
  +			// Generate Unique Run id. (Only used to name the result logfile.)
  +			const XalanDOMString UniqRunid = h.generateUniqRunid();
   
  -		// Defined basic constants for file manipulation
  -		const XalanDOMString  drive(h.getDrive());
  -		const XalanDOMString  resultFilePrefix("params");
  -		const XalanDOMString  resultsFile(drive + h.args.output + resultFilePrefix + UniqRunid + XMLSuffix);
  -		
  -		XMLFileReporter	logFile(resultsFile);
  -		logFile.logTestFileInit("Param Testing: Testing ability to pass parameters to stylesheets. ");
  +			// Defined basic constants for file manipulation
  +			const XalanDOMString  drive(h.getDrive());
  +			const XalanDOMString  resultFilePrefix("params");
  +			const XalanDOMString  resultsFile(drive + h.args.output + resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
  +			
  +			XMLFileReporter	logFile(resultsFile);
  +			logFile.logTestFileInit("Param Testing: Testing ability to pass parameters to stylesheets. ");
   
  -		try
  -		{
  -			bool embedFlag =  false;
  -				
  -			// Get the files found in the "params" directory
  -			const XalanDOMString  theOutputDir = h.args.output + currentDir;
  +			try
  +			{
  +				bool embedFlag =  false;
  +					
  +				// Get the files found in the "params" directory
  +				const XalanDOMString  theOutputDir = h.args.output + currentDir;
   
  -			// Check that output directory is there.
  -			h.checkAndCreateDir(theOutputDir);
  +				// Check that output directory is there.
  +				h.checkAndCreateDir(theOutputDir);
   
  -			const FileNameVectorType	files = h.getTestFileNames(h.args.base, currentDir, true);
  -			logFile.logTestCaseInit(currentDir);
  +				const FileNameVectorType	files = h.getTestFileNames(h.args.base, currentDir, true);
  +				logFile.logTestCaseInit(currentDir);
   
  -			for(FileNameVectorType::size_type i = 0; i < files.size(); ++i)
  -			{
  -				fileName = files[i];
  -				sprintf(testCase, "%s%d","TestCase",i+1);
  -				h.data.testOrFile = testCase;
  -
  -				// Set up the input/output files.
  -				const XalanDOMString  theXSLFile= h.args.base + currentDir + pathSep + fileName;
  -				XalanDOMString		  theXMLFile;
  -				
  -				// Neither testcase 7 nor 8 utilize xml source files. Both use fragment identifiers,
  -				// so the generation of xml file is unnecessary.
  -				// Testcase 7 tests: <?xml-stylesheet type="text/xsl" href="#style1-23.34.123456789_345"?>
  -				// Testcase 8 tests: <?xml-stylesheet type="text/xsl" href="foo.xsl"?>
  -				if ( i+1 <= 6 )
  +				for(FileNameVectorType::size_type i = 0; i < files.size(); ++i)
   				{
  -					assign(theXMLFile, h.generateFileName(theXSLFile,"xml"));
  -				}
  -
  -				h.data.xmlFileURL = theXMLFile;
  -				h.data.xslFileURL = theXSLFile;
  +					fileName = files[i];
  +					sprintf(testCase, "%s%d","TestCase",i+1);
  +					h.data.testOrFile = testCase;
  +
  +					// Set up the input/output files.
  +					const XalanDOMString  theXSLFile= h.args.base + currentDir + FileUtility::s_pathSep + fileName;
  +					XalanDOMString		  theXMLFile;
  +					
  +					// Neither testcase 7 nor 8 utilize xml source files. Both use fragment identifiers,
  +					// so the generation of xml file is unnecessary.
  +					// Testcase 7 tests: <?xml-stylesheet type="text/xsl" href="#style1-23.34.123456789_345"?>
  +					// Testcase 8 tests: <?xml-stylesheet type="text/xsl" href="foo.xsl"?>
  +					if ( i+1 <= 6 )
  +					{
  +						assign(theXMLFile, h.generateFileName(theXSLFile,"xml"));
  +					}
  +
  +					h.data.xmlFileURL = theXMLFile;
  +					h.data.xslFileURL = theXSLFile;
  +
  +					const XalanDOMString  theOutput =  h.args.output + currentDir + FileUtility::s_pathSep + fileName; 
  +					const XalanDOMString  theOutputFile = h.generateFileName(theOutput, "out");
  +					theGoldFile = h.args.gold + currentDir + FileUtility::s_pathSep + fileName;
  +					theGoldFile = h.generateFileName(theGoldFile, "out");
  +
  +					XSLTResultTarget		theResultTarget(theOutputFile);
  +					const XSLTInputSource	xslInputSource(c_wstr(theXSLFile));
  +					const XSLTInputSource	xmlInputSource(c_wstr(theXMLFile));
  +							
  +					// Set the desired parameters
  +					switch (getTestNumber(fileName))
  +					{	
  +						case 2:
  +							xalan.setStylesheetParam("in1", "'A '");
  +
  +							xalan.setStylesheetParam("in2", "'B '");
  +
  +							xalan.setStylesheetParam(
  +								XalanDOMString("in3"),
  +								XalanDOMString("'C '"));
  +							xalan.setStylesheetParam(
  +								XalanDOMString("in4"),
  +								XalanDOMString("'D '"));
  +							xalan.setStylesheetParam(
  +								XalanDOMString("in5"),
  +								XalanDOMString("'E '"));
  +							break;
   
  -				const XalanDOMString  theOutput =  h.args.output + currentDir + pathSep + fileName; 
  -				const XalanDOMString  theOutputFile = h.generateFileName(theOutput, "out");
  -				theGoldFile = h.args.gold + currentDir + pathSep + fileName;
  -				theGoldFile = h.generateFileName(theGoldFile, "out");
  -
  -				XSLTResultTarget		theResultTarget(theOutputFile);
  -				const XSLTInputSource	xslInputSource(c_wstr(theXSLFile));
  -				const XSLTInputSource	xmlInputSource(c_wstr(theXMLFile));
  -						
  -				// Set the desired parameters
  -				switch (getTestNumber(fileName))
  -				{	
  -					case 2:
  -						xalan.setStylesheetParam("in1", "'A '");
  -
  -						xalan.setStylesheetParam("in2", "'B '");
  -
  -						xalan.setStylesheetParam(
  -							XalanDOMString("in3"),
  -							XalanDOMString("'C '"));
  -						xalan.setStylesheetParam(
  -							XalanDOMString("in4"),
  -							XalanDOMString("'D '"));
  -						xalan.setStylesheetParam(
  -							XalanDOMString("in5"),
  -							XalanDOMString("'E '"));
  -						break;
  -
  -					case 3:
  -						xalan.setStylesheetParam(
  -							XalanDOMString("'xyz:in1'"),
  -							XalanDOMString("'DATA'"));
  -						break;
  -
  -					case 7:
  -						{
  -							const XSLTInputSource	embed07InputSource(c_wstr(theXSLFile));
  -							xalan.transform(embed07InputSource, theResultTarget);
  -							append(h.data.testOrFile, " (Embed01)" );
  -							embedFlag = true;
  +						case 3:
  +							xalan.setStylesheetParam(
  +								XalanDOMString("'xyz:in1'"),
  +								XalanDOMString("'DATA'"));
   							break;
  -						}
   
  -					case 8:
  -						{
  -							const XSLTInputSource	embed08InputSource(c_wstr(theXSLFile));
  -							xalan.transform(embed08InputSource, theResultTarget);
  -							append(h.data.testOrFile, " (Embed02)" );
  -							embedFlag = true;
  +						case 7:
  +							{
  +								const XSLTInputSource	embed07InputSource(c_wstr(theXSLFile));
  +								xalan.transform(embed07InputSource, theResultTarget);
  +								append(h.data.testOrFile, " (Embed01)" );
  +								embedFlag = true;
  +								break;
  +							}
  +
  +						case 8:
  +							{
  +								const XSLTInputSource	embed08InputSource(c_wstr(theXSLFile));
  +								xalan.transform(embed08InputSource, theResultTarget);
  +								append(h.data.testOrFile, " (Embed02)" );
  +								embedFlag = true;
  +								break;
  +							}
  +						default:
  +							xalan.setStylesheetParam(
  +								XalanDOMString("input"),
  +								XalanDOMString("'testing 1 2 3'"));
   							break;
  -						}
  -					default:
  -						xalan.setStylesheetParam(
  -							XalanDOMString("input"),
  -							XalanDOMString("'testing 1 2 3'"));
  -						break;
  -				}
  +					}
   
  -				// Do a total end to end transform with no pre parsing of either xsl or xml files.
  -				if (!embedFlag)
  -				{
  -					xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
  -				}
  +					// Do a total end to end transform with no pre parsing of either xsl or xml files.
  +					if (!embedFlag)
  +					{
  +						xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
  +					}
   
  -				// Check and report the results.
  -				h.checkResults(theOutputFile, theGoldFile, logFile);
  +					// Check and report the results.
  +					h.checkResults(theOutputFile, theGoldFile, logFile);
  +				}
  +								
  +				logFile.logTestCaseClose("Done", "Pass");
   			}
  -							
  -			logFile.logTestCaseClose("Done", "Pass");
  -		}
   
  -		catch(...)
  -		{
  -			cerr << "Exception caught!!!" << endl << endl;
  -		}
  +			catch(...)
  +			{
  +				cerr << "Exception caught!!!" << endl << endl;
  +			}
   
  -		h.reportPassFail(logFile, UniqRunid);
  -		logFile.logTestFileClose("Param Testing: ", "Done");
  -		logFile.close();
  +			h.reportPassFail(logFile, UniqRunid);
  +			logFile.logTestFileClose("Param Testing: ", "Done");
  +			logFile.close();
   
  -		h.analyzeResults(xalan, resultsFile);
  +			h.analyzeResults(xalan, resultsFile);
  +		}
   
   		XalanTransformer::terminate();
   	}
  
  
  
  1.4       +3 -3      xml-xalan/c/Tests/PerfT/PerfT.dsp
  
  Index: PerfT.dsp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/PerfT/PerfT.dsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PerfT.dsp	7 Jun 2001 16:28:59 -0000	1.3
  +++ PerfT.dsp	25 Jan 2002 00:34:51 -0000	1.4
  @@ -43,7 +43,7 @@
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
   # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
  -# ADD CPP /nologo /MD /W4 /GR /GX /O2 /Ob2 /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src\\" /I "..\harness\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
  +# ADD CPP /nologo /MD /W4 /GR /GX /O2 /Ob2 /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src\\" /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
   # SUBTRACT CPP /YX
   # ADD BASE RSC /l 0x409 /d "NDEBUG"
   # ADD RSC /l 0x409 /d "NDEBUG"
  @@ -68,7 +68,7 @@
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
   # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
  -# ADD CPP /nologo /MDd /W4 /GR /GX /Od /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src\\" /I "..\harness\\" /D "_WINDOWS" /D "_CONSOLE" /D "WIN32" /D "_DEBUG" /D "_MBCS" /YX /FD /GZ /c
  +# ADD CPP /nologo /MDd /W4 /GR /GX /Od /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src\\" /I ".." /D "_WINDOWS" /D "_CONSOLE" /D "WIN32" /D "_DEBUG" /D "_MBCS" /YX /FD /GZ /c
   # ADD BASE RSC /l 0x409 /d "_DEBUG"
   # ADD RSC /l 0x409 /d "_DEBUG"
   BSC32=bscmake.exe
  @@ -93,7 +93,7 @@
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
   # ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src\\" /I "..\harness\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
  -# ADD CPP /nologo /MD /W4 /GR /GX /Zi /O2 /Ob2 /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src\\" /I "..\harness\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
  +# ADD CPP /nologo /MD /W4 /GR /GX /Zi /O2 /Ob2 /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src\\" /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
   # SUBTRACT CPP /YX
   # ADD BASE RSC /l 0x409 /d "NDEBUG"
   # ADD RSC /l 0x409 /d "NDEBUG"
  
  
  
  1.13      +191 -188  xml-xalan/c/Tests/PerfT/perft.cpp
  
  Index: perft.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/PerfT/perft.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- perft.cpp	22 Jan 2002 18:50:55 -0000	1.12
  +++ perft.cpp	25 Jan 2002 00:34:51 -0000	1.13
  @@ -55,6 +55,7 @@
    * <http://www.apache.org/>.
    */
   
  +#include <ctime>
   #include <iostream>
   #include <strstream>
   #include <stdio.h>
  @@ -63,11 +64,7 @@
   #if !defined(XALAN_NO_NAMESPACES)
   	using std::cerr;
   	using std::cout;
  -	using std::cin;
   	using std::endl;
  -	using std::ifstream;
  -	using std::ios_base;
  -	using std::ostrstream;
   #endif
   
   // XALAN HEADERS...
  @@ -76,9 +73,9 @@
   #include <XalanTransformer/XalanTransformer.hpp>
   
   // HARNESS HEADERS...
  -#include <XMLFileReporter.hpp>
  -#include <FileUtility.hpp>
  -#include <HarnessInit.hpp>
  +#include <Harness/XMLFileReporter.hpp>
  +#include <Harness/FileUtility.hpp>
  +#include <Harness/HarnessInit.hpp>
   
   #if defined(XALAN_NO_NAMESPACES)
   	typedef map<XalanDOMString, XalanDOMString, less<XalanDOMString> >	Hashtable;
  @@ -91,7 +88,7 @@
   #include <crtdbg.h>
   #endif
   
  -FileUtility h;
  +
   
   const char* const 	excludeStylesheets[] =
   {
  @@ -134,7 +131,7 @@
   
   
   void
  -setHelp()
  +setHelp(FileUtility&	h)
   {
   	h.args.getHelpStream() << endl
   		 << "Perft dir [-out -sub -i -iter]"
  @@ -162,9 +159,14 @@
   	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
   #endif
   
  +	HarnessInit		xmlPlatformUtils;
  +
  +	FileUtility		h;
  +
   	// Set the program help string,  then get the command line parameters.
   	//
  -	setHelp();
  +	setHelp(h);
  +
   	bool setGold = false;
   	{
   		const XalanDOMString	processorType(XALAN_STATIC_UCODE_STRING("XalanC"));
  @@ -176,227 +178,228 @@
   			//
   			// Call the static initializers for xerces and xalan, and create a transformer
   			//
  -			HarnessInit xmlPlatformUtils;
   			XalanTransformer::initialize();
  -			XalanTransformer xalan;
  -
  -			// Generate Unique Run id and processor info
  -			const XalanDOMString UniqRunid = h.generateUniqRunid();
  -
  -
  -			// Defined basic constants for file manipulation and open results file
  -			const XalanDOMString  resultFilePrefix("cpp");
  -			const XalanDOMString  resultsFile(h.args.output + resultFilePrefix + UniqRunid + XMLSuffix);
  +			{
  +				XalanTransformer xalan;
   
  +				// Generate Unique Run id and processor info
  +				const XalanDOMString UniqRunid = h.generateUniqRunid();
   
  -			XMLFileReporter	logFile(resultsFile);
  -			logFile.logTestFileInit("Performance Testing - Reports various performance metrics using the Transformer");
   
  +				// Defined basic constants for file manipulation and open results file
  +				const XalanDOMString  resultFilePrefix("cpp");
  +				const XalanDOMString  resultsFile(h.args.output + resultFilePrefix + UniqRunid + FileUtility::s_xmlSuffix);
   
  -			// Get the list of sub-directories below "base" and iterate through them
  -			bool foundDir = false;		// Flag indicates directory found. Used in conjunction with -sub cmd-line arg.
  -			const FileNameVectorType dirs = h.getDirectoryNames(h.args.base);
   
  -			for(FileNameVectorType::size_type	j = 0; j < dirs.size(); j++)
  -			{
  -				// Run specific category of files from given directory
  -				if (length(h.args.sub) > 0 && !equals(dirs[j], h.args.sub))
  -				{
  -					continue;
  -				}
  +				XMLFileReporter	logFile(resultsFile);
  +				logFile.logTestFileInit("Performance Testing - Reports various performance metrics using the Transformer");
   
  -				cout << "Processing files in Directory: " << dirs[j] << endl;
   
  -				// Check that output directory is there.
  -				const XalanDOMString  theOutputDir = h.args.output + dirs[j];
  -				h.checkAndCreateDir(theOutputDir);
  +				// Get the list of sub-directories below "base" and iterate through them
  +				bool foundDir = false;		// Flag indicates directory found. Used in conjunction with -sub cmd-line arg.
  +				const FileNameVectorType dirs = h.getDirectoryNames(h.args.base);
   
  -				
  -				// Indicate that directory was processed and get test files from the directory
  -				foundDir = true;
  -				const FileNameVectorType files = h.getTestFileNames(h.args.base, dirs[j], false);
  -				logFile.logTestCaseInit(XalanDOMString("Performance Directory: ") + dirs[j] ); 
  -
  -				for(FileNameVectorType::size_type i = 0; i < files.size(); i++)
  +				for(FileNameVectorType::size_type	j = 0; j < dirs.size(); j++)
   				{
  -					// Define  variables used for timing and reporting ...
  -					clock_t startTime, endTime, accmTime, avgEtoe;
  -					double timeinMilliseconds = 0, theAverage =0;
  -					int transformResult = 0;
  -					Hashtable attrs;
  -
  -					attrs.insert(Hashtable::value_type(XalanDOMString("idref"), files[i]));
  -					attrs.insert(Hashtable::value_type(XalanDOMString("UniqRunid"),UniqRunid));
  -					attrs.insert(Hashtable::value_type(XalanDOMString("processor"),processorType));
  -					logFile.addMetricToAttrs("Iterations",iterCount, attrs);
  -							
  -					if (h.args.skip)
  +					// Run specific category of files from given directory
  +					if (length(h.args.sub) > 0 && !equals(dirs[j], h.args.sub))
   					{
  -						if (checkForExclusion(files[i]))
  -							continue;
  +						continue;
   					}
   
  -					const XalanDOMString  theXSLFile= h.args.base + dirs[j] + pathSep + files[i];
  -					const XalanDOMString  theXMLFile = h.generateFileName(theXSLFile,"xml");
  -
  -					const XalanDOMString  outbase =  h.args.output + dirs[j] + pathSep + files[i]; 
  -					const XalanDOMString  theOutputFile = h.generateFileName(outbase, "out");
  +					cout << "Processing files in Directory: " << dirs[j] << endl;
   
  -					const XSLTInputSource	xslInputSource(c_wstr(theXSLFile));
  -					const XSLTInputSource	xmlInputSource(c_wstr(theXMLFile));
  -					const XSLTResultTarget	theResultTarget(theOutputFile);
  -
  -					attrs.insert(Hashtable::value_type(XalanDOMString("href"), theXSLFile));
  -					cout << endl << files[i] << endl;
  -
  -					// Time the parsing(compile) of the XSL stylesheet and report the results..
  -					//
  -					startTime = clock();
  -					const XalanCompiledStylesheet*	compiledSS = 0;
  -					xalan.compileStylesheet(xslInputSource, compiledSS);
  -					endTime = clock();
  +					// Check that output directory is there.
  +					const XalanDOMString  theOutputDir = h.args.output + dirs[j];
  +					h.checkAndCreateDir(theOutputDir);
  +
  +					
  +					// Indicate that directory was processed and get test files from the directory
  +					foundDir = true;
  +					const FileNameVectorType files = h.getTestFileNames(h.args.base, dirs[j], false);
  +					logFile.logTestCaseInit(XalanDOMString("Performance Directory: ") + dirs[j] ); 
   
  -					if (compiledSS == 0)
  +					for(FileNameVectorType::size_type i = 0; i < files.size(); i++)
   					{
  -						continue;
  -					}
  +						// Define  variables used for timing and reporting ...
  +						clock_t startTime, endTime, accmTime, avgEtoe;
  +						double timeinMilliseconds = 0, theAverage =0;
  +						int transformResult = 0;
  +						Hashtable attrs;
  +
  +						attrs.insert(Hashtable::value_type(XalanDOMString("idref"), files[i]));
  +						attrs.insert(Hashtable::value_type(XalanDOMString("UniqRunid"),UniqRunid));
  +						attrs.insert(Hashtable::value_type(XalanDOMString("processor"),processorType));
  +						logFile.addMetricToAttrs("Iterations",iterCount, attrs);
  +								
  +						if (h.args.skip)
  +						{
  +							if (checkForExclusion(files[i]))
  +								continue;
  +						}
  +
  +						const XalanDOMString  theXSLFile= h.args.base + dirs[j] + FileUtility::s_pathSep + files[i];
  +						const XalanDOMString  theXMLFile = h.generateFileName(theXSLFile,"xml");
  +
  +						const XalanDOMString  outbase =  h.args.output + dirs[j] + FileUtility::s_pathSep + files[i]; 
  +						const XalanDOMString  theOutputFile = h.generateFileName(outbase, "out");
  +
  +						const XSLTInputSource	xslInputSource(c_wstr(theXSLFile));
  +						const XSLTInputSource	xmlInputSource(c_wstr(theXMLFile));
  +						const XSLTResultTarget	theResultTarget(theOutputFile);
   
  -					timeinMilliseconds = calculateElapsedTime(startTime, endTime);
  -					cout << "   XSL: " << timeinMilliseconds << " milliseconds, Parse" << endl;
  -					logFile.addMetricToAttrs("parsexsl",timeinMilliseconds, attrs);	
  -
  -					// Time the parsing of the input XML and report the results..
  -					//
  -					startTime = clock();
  -					const XalanParsedSource*	parsedSource = 0;
  -					xalan.parseSource(xmlInputSource, parsedSource);
  -					endTime = clock();
  +						attrs.insert(Hashtable::value_type(XalanDOMString("href"), theXSLFile));
  +						cout << endl << files[i] << endl;
   
  -					if (parsedSource == 0)
  -					{
  -						continue;
  -					}
  +						// Time the parsing(compile) of the XSL stylesheet and report the results..
  +						//
  +						startTime = clock();
  +						const XalanCompiledStylesheet*	compiledSS = 0;
  +						xalan.compileStylesheet(xslInputSource, compiledSS);
  +						endTime = clock();
   
  -					timeinMilliseconds = calculateElapsedTime(startTime, endTime);
  -					cout << "   XML: " << timeinMilliseconds << " milliseconds, Parse" <<endl;
  -					logFile.addMetricToAttrs("parsexml",timeinMilliseconds, attrs);
  -
  -					// Perform One transform using parsed stylesheet and unparsed xml source, report results...
  -					// 
  -					startTime = clock();
  -						transformResult = xalan.transform(xmlInputSource, compiledSS, theResultTarget);
  -					endTime = clock();
  -					if(!transformResult)
  -					{
  -						timeinMilliseconds = calculateElapsedTime(startTime, endTime);
  -						cout << endl << "   One: " << timeinMilliseconds << " w/Parsed XSL." << endl;
  -						logFile.addMetricToAttrs("single", timeinMilliseconds, attrs);	
  -					}
  -					else
  -					{
  -						cout << xalan.getLastError();
  -						return 0;
  -					}
  +						if (compiledSS == 0)
  +						{
  +							continue;
  +						}
   
  -					// Do One eTOe transform with no pre parsing of either xsl or xml files.
  -					// And output metrics to console and result log
  -					//
  -					startTime = clock();
  -						transformResult = xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
  -					endTime = clock();
  -					if(!transformResult)
  -					{
   						timeinMilliseconds = calculateElapsedTime(startTime, endTime);
  -						cout << "   One: " << timeinMilliseconds << " eTOe." << endl;
  -						logFile.addMetricToAttrs("etoe", timeinMilliseconds, attrs);	
  -					}
  -					else
  -					{
  -						cout << xalan.getLastError();
  -						return 0;
  -					}
  -
  +						cout << "   XSL: " << timeinMilliseconds << " milliseconds, Parse" << endl;
  +						logFile.addMetricToAttrs("parsexsl",timeinMilliseconds, attrs);	
   
  -					// Perform multiple transforms and calculate the average time ..
  -					// These are done 3 different ways.
  -					//
  -					// FIRST: Parsed XSL Stylesheet and Parsed XML Source.
  -					//
  -					iterCount = h.args.iters;
  -					accmTime = 0;
  -					for(int j = 0; j < iterCount; ++j)
  -					{	
  +						// Time the parsing of the input XML and report the results..
  +						//
   						startTime = clock();
  -							transformResult = xalan.transform(*parsedSource, compiledSS, theResultTarget);
  +						const XalanParsedSource*	parsedSource = 0;
  +						xalan.parseSource(xmlInputSource, parsedSource);
   						endTime = clock();
  -				
  -						accmTime += endTime - startTime;
  -					}
   
  -					theAverage = calculateAvgTime(accmTime, iterCount); 
  -					cout << endl << "   Avg: " << theAverage << " for " << iterCount << " iter's w/Parsed files" << endl;
  -					logFile.addMetricToAttrs("avgparsedxml",theAverage, attrs);
  -			
  -
  -					// SECOND: Parsed Stylesheet and UnParsed XML Source.
  -					// This is currently how the XalanJ 2.0 is performing transforms
  -					//
  -					accmTime = 0;
  -					for(int k = 0; k < iterCount; ++k)
  -					{
  +						if (parsedSource == 0)
  +						{
  +							continue;
  +						}
  +
  +						timeinMilliseconds = calculateElapsedTime(startTime, endTime);
  +						cout << "   XML: " << timeinMilliseconds << " milliseconds, Parse" <<endl;
  +						logFile.addMetricToAttrs("parsexml",timeinMilliseconds, attrs);
  +
  +						// Perform One transform using parsed stylesheet and unparsed xml source, report results...
  +						// 
   						startTime = clock();
   							transformResult = xalan.transform(xmlInputSource, compiledSS, theResultTarget);
   						endTime = clock();
  -				
  -						accmTime += endTime - startTime;						
  -					}
  -					theAverage = calculateAvgTime(accmTime, iterCount);
  -					cout << "   Avg: " << theAverage << " for " << iterCount << " iter's w/UnParsed XML" << endl;
  -					logFile.addMetricToAttrs("avgunparsedxml",theAverage, attrs);
  -
  -
  -					// THIRD: Neither Stylesheet nor XML Source are parsed.
  -					// Perform multiple etoe transforms and calculate the average ...
  -					//
  -					avgEtoe = 0;
  -					for(int jj = 0; jj < iterCount; ++jj)
  -					{	
  +						if(!transformResult)
  +						{
  +							timeinMilliseconds = calculateElapsedTime(startTime, endTime);
  +							cout << endl << "   One: " << timeinMilliseconds << " w/Parsed XSL." << endl;
  +							logFile.addMetricToAttrs("single", timeinMilliseconds, attrs);	
  +						}
  +						else
  +						{
  +							cout << xalan.getLastError();
  +							return 0;
  +						}
  +
  +						// Do One eTOe transform with no pre parsing of either xsl or xml files.
  +						// And output metrics to console and result log
  +						//
   						startTime = clock();
   							transformResult = xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
   						endTime = clock();
  +						if(!transformResult)
  +						{
  +							timeinMilliseconds = calculateElapsedTime(startTime, endTime);
  +							cout << "   One: " << timeinMilliseconds << " eTOe." << endl;
  +							logFile.addMetricToAttrs("etoe", timeinMilliseconds, attrs);	
  +						}
  +						else
  +						{
  +							cout << xalan.getLastError();
  +							return 0;
  +						}
  +
  +
  +						// Perform multiple transforms and calculate the average time ..
  +						// These are done 3 different ways.
  +						//
  +						// FIRST: Parsed XSL Stylesheet and Parsed XML Source.
  +						//
  +						iterCount = h.args.iters;
  +						accmTime = 0;
  +						for(int j = 0; j < iterCount; ++j)
  +						{	
  +							startTime = clock();
  +								transformResult = xalan.transform(*parsedSource, compiledSS, theResultTarget);
  +							endTime = clock();
  +					
  +							accmTime += endTime - startTime;
  +						}
  +
  +						theAverage = calculateAvgTime(accmTime, iterCount); 
  +						cout << endl << "   Avg: " << theAverage << " for " << iterCount << " iter's w/Parsed files" << endl;
  +						logFile.addMetricToAttrs("avgparsedxml",theAverage, attrs);
   				
  -						avgEtoe += endTime - startTime;						
  -					}
  -					theAverage = calculateAvgTime(avgEtoe,iterCount);
   
  -					// Output average transform time to console and result log
  -					cout << "   Avg: " << theAverage << " for " << iterCount << " iter's of eToe" << endl;
  -					logFile.addMetricToAttrs("avgetoe",theAverage, attrs);
  +						// SECOND: Parsed Stylesheet and UnParsed XML Source.
  +						// This is currently how the XalanJ 2.0 is performing transforms
  +						//
  +						accmTime = 0;
  +						for(int k = 0; k < iterCount; ++k)
  +						{
  +							startTime = clock();
  +								transformResult = xalan.transform(xmlInputSource, compiledSS, theResultTarget);
  +							endTime = clock();
  +					
  +							accmTime += endTime - startTime;						
  +						}
  +						theAverage = calculateAvgTime(accmTime, iterCount);
  +						cout << "   Avg: " << theAverage << " for " << iterCount << " iter's w/UnParsed XML" << endl;
  +						logFile.addMetricToAttrs("avgunparsedxml",theAverage, attrs);
  +
  +
  +						// THIRD: Neither Stylesheet nor XML Source are parsed.
  +						// Perform multiple etoe transforms and calculate the average ...
  +						//
  +						avgEtoe = 0;
  +						for(int jj = 0; jj < iterCount; ++jj)
  +						{	
  +							startTime = clock();
  +								transformResult = xalan.transform(xmlInputSource, xslInputSource, theResultTarget);
  +							endTime = clock();
  +					
  +							avgEtoe += endTime - startTime;						
  +						}
  +						theAverage = calculateAvgTime(avgEtoe,iterCount);
  +
  +						// Output average transform time to console and result log
  +						cout << "   Avg: " << theAverage << " for " << iterCount << " iter's of eToe" << endl;
  +						logFile.addMetricToAttrs("avgetoe",theAverage, attrs);
  +
  +						logFile.logElementWAttrs(10, "perf", attrs, "xxx");
   
  -					logFile.logElementWAttrs(10, "perf", attrs, "xxx");
  +						xalan.destroyParsedSource(parsedSource);
  +						xalan.destroyStylesheet(compiledSS);
   
  -					xalan.destroyParsedSource(parsedSource);
  -					xalan.destroyStylesheet(compiledSS);
  +					}
   
  +				logFile.logTestCaseClose(XalanDOMString("Performance Directory: ") + dirs[j], XalanDOMString("Done") );
   				}
   
  -			logFile.logTestCaseClose(XalanDOMString("Performance Directory: ") + dirs[j], XalanDOMString("Done") );
  +			// Check to see if -sub cmd-line directory was processed correctly.
  +			if (!foundDir)
  +			{
  +				cout << "Specified test directory: \"" << c_str(TranscodeToLocalCodePage(h.args.sub)) << "\" not found" << endl;
   			}
   
  -		// Check to see if -sub cmd-line directory was processed correctly.
  -		if (!foundDir)
  -		{
  -			cout << "Specified test directory: \"" << c_str(TranscodeToLocalCodePage(h.args.sub)) << "\" not found" << endl;
  -		}
  -
  -		h.reportPassFail(logFile, UniqRunid);
  -		logFile.logTestFileClose("Performance", "Done");
  -		logFile.close();
  +			h.reportPassFail(logFile, UniqRunid);
  +			logFile.logTestFileClose("Performance", "Done");
  +			logFile.close();
   
  +			}
   		}
  +	
  +		XalanTransformer::terminate();
   	}
  -
  -	XalanTransformer::terminate();
   
   	return 0;
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message