Author: faridz Date: Thu Jan 11 09:53:05 2007 New Revision: 495309 URL: http://svn.apache.org/viewvc?view=rev&rev=495309 Log: 2007-01-11 Farid Zaripov * build.wsf: New script file to build specified configuration * configure.wsf (configure): Check if the environment variable exist before removing; use MT DLL runtime instead of ST static runtime in ST DLL solution configurations * devenv_consts.js: Added new constants * generate.wsf: Removed unused BUILDTYPE option from usage text; by default don't generate projects for build and test locales; generate additional solution files (stdlib + examples; stdlib + rwtest + tests; stdlib + utils + locales; stdlib + utils + locale tests; stdlib + utils + run_examples + run_tests); use new build.wsf script in generated build batch file * makelog.wsf (makelog): Updated according to new directory structure * projectdef.js (InitVSObjects): Added freedte parameter, don't free dte object if freedte == false; (projectCreateVCProject): Use MT DLL runtime instead of ST static runtime in ST DLL solution configurations; (projectCreateProjectDefsFromFolder): Add name of subfolder to the OutDir only if shiftOutDir is true; (projectCreateTestLocalesDef): New function to generate project for perform all locale tests in one shot; * projects.js (CreateProjectDefs): Added generation of the 3 projects: .stdcxx_runexamples; .stdcxx_runtests; .stdcxx_testlocales. Now returns array of the sets of projects (configure, stdlib, rwtest, utils, examples, run_examples, tests, run_tests, locales, locale_tests) * run_locale_utils.wsf (Cleanup): New function to remove temporary folder (Exit): New function to exit from script with cleanup (CreateFolder): New function to create directory three (dump_charmap): New function to dump the charmap of a locale (dump_locale): On error exited script with the same non-zero exit status as the locale utility (generate_locale): Used Exit function (test_locale): Called dump_charmap to produce the charmap source from the locale database at each of the three stages. Used this charmap source to create a locale in each subsequent stage. Placed the files created at each stage in separate directories named stage.1 through stage.3. (run_locale_utils): Avoided deleting stage directories when the -n option is set * runall.wsf: Parameter INOUTDIR now is optional; removed unused parameter COPYRWTESTDLL; (readOutFile): check manual and tutorial subfolders when searching example requested output file; (runWithChecks, runNoChecks): Removed as unused; (runAllExamples): Rewritten to use exec utility in packet mode. * summary.js (saveBuildInfoTable): encode symbols in example output before saving them to HTML file (readBuildLog): Added temporary loop to check the run-time error "runall.wsf(59, 6) Microsoft JScript runtime error: Permission denied" * utilities.js (decodeHTML): New function to decode escaped symbols (stripTags): New function to get text from HTML document Added: incubator/stdcxx/trunk/etc/config/windows/build.wsf (with props) Modified: incubator/stdcxx/trunk/etc/config/windows/configure.wsf incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js incubator/stdcxx/trunk/etc/config/windows/generate.wsf incubator/stdcxx/trunk/etc/config/windows/makelog.wsf incubator/stdcxx/trunk/etc/config/windows/projectdef.js incubator/stdcxx/trunk/etc/config/windows/projects.js incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf incubator/stdcxx/trunk/etc/config/windows/runall.wsf incubator/stdcxx/trunk/etc/config/windows/summary.js incubator/stdcxx/trunk/etc/config/windows/utilities.js Added: incubator/stdcxx/trunk/etc/config/windows/build.wsf URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/build.wsf?view=auto&rev=495309 ============================================================================== --- incubator/stdcxx/trunk/etc/config/windows/build.wsf (added) +++ incubator/stdcxx/trunk/etc/config/windows/build.wsf Thu Jan 11 09:53:05 2007 @@ -0,0 +1,341 @@ + + + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + + + + + +Builds specified solution configuration + + + + + + cscript build.wsf /CONFIG:msvc-7.1 /BUILDTYPE:11d + + +Usage: cscript build.wsf /CONFIG:@CONFIG /BUILDDIR:@BUILDDIR /BUILDTYPE:@BUILDTYPE [/BUILDONLY:@BUILDONLY] +where +@CONFIG is the compiler configuration (msvc-7.1, icc-9.0, etc). +@BUILDDIR is the root of the build directory. +@BUILDTYPE is the build type (11d, 11s, etc). +@BUILDONLY is one of { yes, no } - execute or not the tests. + + + + + + + Propchange: incubator/stdcxx/trunk/etc/config/windows/build.wsf ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/stdcxx/trunk/etc/config/windows/build.wsf ------------------------------------------------------------------------------ svn:keywords = Id Modified: incubator/stdcxx/trunk/etc/config/windows/configure.wsf URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/configure.wsf?view=diff&rev=495309&r1=495308&r2=495309 ============================================================================== --- incubator/stdcxx/trunk/etc/config/windows/configure.wsf (original) +++ incubator/stdcxx/trunk/etc/config/windows/configure.wsf Thu Jan 11 09:53:05 2007 @@ -191,10 +191,13 @@ // remove VS_UNICODE_OUTPUT environment variable // http://blogs.msdn.com/freik/archive/2006/04/05/569025.aspx - try { - WshShell.Environment("PROCESS").Remove("VS_UNICODE_OUTPUT"); - } catch (e) {} + var env = WshShell.Environment("PROCESS"); + var name = "VS_UNICODE_OUTPUT"; + var str = env.Item(name); + if ("undefined" != typeof(str) && "" != str) + env.Remove(name); + } getCompilerOpts(WScript.Arguments.Named("SolutionName")); @@ -204,10 +207,10 @@ CPPFLAGS += " /M"; - if (!confInfo.mt) - CPPFLAGS += NOSTCRT ? "T" : "L"; + if (confInfo.dll) + CPPFLAGS += "D"; else - CPPFLAGS += confInfo.dll ? "D" : "T"; + CPPFLAGS += (confInfo.mt || NOSTCRT) ? "T" : "L"; if (confInfo.debug) { Modified: incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js?view=diff&rev=495309&r1=495308&r2=495309 ============================================================================== --- incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js (original) +++ incubator/stdcxx/trunk/etc/config/windows/devenv_consts.js Thu Jan 11 09:53:05 2007 @@ -132,3 +132,7 @@ var runtimeCheckStackFrame = 1; var runtimeCheckUninitVariables = 2; var runtimeBasicCheckAll = 3; + +var vsBuildStateNotStarted = 1; +var vsBuildStateInProgress = 2; +var vsBuildStateDone = 3; Modified: incubator/stdcxx/trunk/etc/config/windows/generate.wsf URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/generate.wsf?view=diff&rev=495309&r1=495308&r2=495309 ============================================================================== --- incubator/stdcxx/trunk/etc/config/windows/generate.wsf (original) +++ incubator/stdcxx/trunk/etc/config/windows/generate.wsf Thu Jan 11 09:53:05 2007 @@ -24,8 +24,8 @@ Generates solution file for a specified environment - + Usage: cscript generate.wsf /CONFIG:@CONFIG -/BUILDDIR:@BUILDDIR [/TOPDIR:@TOPDIR] -[/BUILDTYPE:@BUILDTYPE] [/BUILDONLY:@BUILDONLY] [/COPYDLL:@COPYDLL] +/BUILDDIR:@BUILDDIR [/TOPDIR:@TOPDIR] [/COPYDLL:@COPYDLL] [/LOCALES:@LOCALES] [/LOCALETESTS:@LOCALETESTS] where @CONFIG is the compiler configuration (msvc-7.1, icc-9.0, etc). -@TOPDIR is the root of the stdcxx source tree, -@BUILDDIR is the root of the build directory, -@COPYDLL is one of { yes, no }; when yes, the stdcxx DLL will be copied -into each directory containing an executable program built by the solution -@LOCALES is one of { yes, no } - generate projects for build locales -@LOCALETESTS is one of { yes, no } - generate projects for test locales +@TOPDIR is the root of the stdcxx source tree. +@BUILDDIR is the root of the build directory. +@COPYDLL is one of { yes, no }; when yes, the stdcxx DLL will be copied. +into each directory containing an executable program built by the solution. +@LOCALES is one of { yes, no } - generate projects for build locales. +@LOCALETESTS is one of { yes, no } - generate projects for test locales. @@ -78,8 +77,8 @@ var logStream = null; var currentCfg = ""; var copyDll = false; -var buildLocales = true; -var testLocales = true; +var buildLocales = false; +var testLocales = false; var winconfigDir = "\\etc\\config\\windows"; var description = new generate; // run @@ -118,8 +117,6 @@ PrintVars(logStream); PrintVars(WScript.StdOut); - var solutionName = currentCfg + ".sln"; - LogMessage("Creating projects definitions..."); var projectDefs = CreateProjectsDefs(copyDll, buildLocales, testLocales); @@ -133,7 +130,40 @@ } LogMessage("Writing solution on disk..."); - generateSolution(projectDefs, outDir, solutionName); + var solutionName = currentCfg + ".sln"; + var exsolutionName = currentCfg + "_ex.sln"; + var tstsolutionName = currentCfg + "_tst.sln"; + var locsolutionName = currentCfg + "_loc.sln"; + var tstlocsolutionName = currentCfg + "_tstloc.sln"; + var runsolutionName = currentCfg + "_run.sln"; + + var configureDefs = projectDefs[0]; + var stdlibDefs = projectDefs[1]; + var rwtestDefs = projectDefs[2]; + var utilDefs = projectDefs[3]; + var exampleDefs = projectDefs[4]; + var runexamplesDefs = projectDefs[5]; + var testDefs = projectDefs[6]; + var runtestsDefs = projectDefs[7]; + var localeDefs = projectDefs[8]; + var testlocaleDefs = projectDefs[9]; + + var solution = new Array(); + for (var i = 0; i < projectDefs.length; ++i) + solution = solution.concat(projectDefs[i]); + + var exsolution = configureDefs.concat(stdlibDefs).concat(exampleDefs); + var tstsolution = configureDefs.concat(stdlibDefs).concat(rwtestDefs).concat(testDefs); + var locsolution = configureDefs.concat(stdlibDefs).concat(utilDefs).concat(localeDefs); + var tstlocsolution = configureDefs.concat(stdlibDefs).concat(utilDefs).concat(testlocaleDefs); + var runsolution = configureDefs.concat(stdlibDefs).concat(utilDefs).concat(runexamplesDefs).concat(runtestsDefs); + + generateSolution(solution, outDir, solutionName); + generateSolution(exsolution, outDir, exsolutionName); + generateSolution(tstsolution, outDir, tstsolutionName); + generateSolution(locsolution, outDir, locsolutionName); + generateSolution(tstlocsolution, outDir, tstlocsolutionName); + generateSolution(runsolution, outDir, runsolutionName); projectDefs = null; VCProjectEngine = null; @@ -243,8 +273,8 @@ var option = WScript.Arguments.Named("LOCALES"); option = option.toLowerCase(); - if (option == "no" || option == "n") - buildLocales = false; + if (option != "no" && option != "n") + buildLocales = true; } if (WScript.Arguments.Named.Exists("LOCALETESTS")) @@ -252,8 +282,8 @@ var option = WScript.Arguments.Named("LOCALETESTS"); option = option.toLowerCase(); - if (option == "no" || option == "n") - testLocales = false; + if (option != "no" && option != "n") + testLocales = true; } } @@ -324,9 +354,10 @@ buildBatchFile.WriteLine("set makelog=makelog.wsf"); buildBatchFile.WriteLine("set cfg="); buildBatchFile.WriteLine("set cfgbrief="); + buildBatchFile.WriteLine("set devenv=\"" + DEVENV + "\""); buildBatchFile.WriteLine(""); - buildBatchFile.WriteLine(":cfgloop"); + buildBatchFile.WriteLine(":cfgloop"); buildBatchFile.WriteLine("if \"%1\"==\"\" goto continue"); buildBatchFile.WriteLine(""); @@ -349,12 +380,11 @@ buildBatchFile.WriteLine("goto nextcfg"); buildBatchFile.WriteLine(")"); buildBatchFile.WriteLine(""); - - buildBatchFile.WriteLine("\"" + DEVENV + "\" " + DEVENVFLAGS + - " \"%builddir%\\" + currentCfg + - "\\" + currentCfg + ".sln\" /build \"%cfg%\""); - - buildBatchFile.WriteLine(""); + + buildBatchFile.WriteLine("cscript /nologo " + + "\"%topdir%\\%scriptdir%\\build.wsf\"" + + " /BUILDDIR:\"%builddir%\" /BUILDTYPE:%cfgbrief%" + + " /CONFIG:" + currentCfg); buildBatchFile.WriteLine("cscript /nologo " + "\"%topdir%\\%scriptdir%\\%makelog%\"" + " /BUILDDIR:\"%builddir%\" /BUILDTYPE:%cfgbrief%" Modified: incubator/stdcxx/trunk/etc/config/windows/makelog.wsf URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/makelog.wsf?view=diff&rev=495309&r1=495308&r2=495309 ============================================================================== --- incubator/stdcxx/trunk/etc/config/windows/makelog.wsf (original) +++ incubator/stdcxx/trunk/etc/config/windows/makelog.wsf Thu Jan 11 09:53:05 2007 @@ -125,8 +125,12 @@ saveBuildSummarySingle(fSum, rwtestInfo, hdrTestDriver); // save build summary for examples and tests - saveBuildSummaryMulti(fSum, buildDir + "\\" + buildType + "\\" + examplesBuildDir); - saveBuildSummaryMulti(fSum, buildDir + "\\" + buildType + "\\" + testsBuildDir); + saveBuildSummariesFromFolder(fSum, + buildDir + "\\" + buildType + "\\" + examplesBuildDir, + htmFolderName); + saveBuildSummariesFromFolder(fSum, + buildDir + "\\" + buildType + "\\" + testsBuildDir, + htmFolderName); closeSummaryLog(fSum); @@ -243,9 +247,10 @@ // tempName - name of the folder with temporary files function deleteTempFolders(startDir, tempName) { - var startFolder = fso.GetFolder(startDir); - if (! startFolder) + if (!fso.FolderExists(startDir)) return; + + var startFolder = fso.GetFolder(startDir); var enumHtmSubFolders = new Enumerator(startFolder.SubFolders); for (; !enumHtmSubFolders.atEnd(); enumHtmSubFolders.moveNext()) Modified: incubator/stdcxx/trunk/etc/config/windows/projectdef.js URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/projectdef.js?view=diff&rev=495309&r1=495308&r2=495309 ============================================================================== --- incubator/stdcxx/trunk/etc/config/windows/projectdef.js (original) +++ incubator/stdcxx/trunk/etc/config/windows/projectdef.js Thu Jan 11 09:53:05 2007 @@ -30,6 +30,7 @@ // the timeout for the exec utility var execTimeout = 180; +var dte = null; var VCProjectEngine = null; var ICConvertTool = "ICProjConvert90.exe"; @@ -49,12 +50,11 @@ // init VisualStudio objects using specified configuration // config - name of configuration (e.g. msvc-7.0) -function InitVSObjects(config) +// freedte - if undefined or true then free dte inside function +function InitVSObjects(config, freedte) { getCompilerOpts(config); - var dte = null; - try { dte = WScript.CreateObject("VisualStudio.DTE." + VERSION); @@ -110,7 +110,7 @@ } } - if (null != dte) + if (("undefined" == typeof(freedte) || true == freedte) && (null != dte)) { dte.Quit(); dte = null; @@ -172,6 +172,7 @@ ProjectDef.prototype.createProjectDefsFromFolder = projectCreateProjectDefsFromFolder; ProjectDef.prototype.createLocaleDefs = projectCreateLocaleDefs; ProjectDef.prototype.createTestLocaleDefs = projectCreateTestLocaleDefs; +ProjectDef.prototype.createTestLocalesDef = projectCreateTestLocalesDef; // returns copy of ProjectDef object function projectCloneDef() @@ -426,29 +427,26 @@ compiler.ExceptionHandling = cppExceptionHandlingYes; compiler.RuntimeTypeInfo = this.RTTI; - - if (confInfo.mt) + + if (confInfo.dll) { - if (confInfo.dll) - compiler.RuntimeLibrary = confInfo.debug ? - rtMultiThreadedDebugDLL : rtMultiThreadedDLL; - else - compiler.RuntimeLibrary = confInfo.debug ? - rtMultiThreadedDebug : rtMultiThreaded; + // the singlethreaded dll runtimes are not present + // always use the multithreaded dll runtime + compiler.RuntimeLibrary = confInfo.debug ? + rtMultiThreadedDebugDLL : rtMultiThreadedDLL; } else { - if (!NOSTCRT) - // use singlethreaded runtimes + if (confInfo.mt || NOSTCRT) + // use multithreaded runtimes compiler.RuntimeLibrary = confInfo.debug ? - rtSingleThreadedDebug : rtSingleThreaded; + rtMultiThreadedDebug : rtMultiThreaded; else - // the singlethreaded runtimes are not present - // use the multithreaded instead + // use singlethreaded runtimes compiler.RuntimeLibrary = confInfo.debug ? - rtMultiThreadedDebug : rtMultiThreaded; + rtSingleThreadedDebug : rtSingleThreaded; } - + compiler.UsePrecompiledHeader = pchNone; } @@ -557,7 +555,9 @@ // inclFiles - regular expression to define include files // exclDirs - regular expression to define exclude folder // exclFiles - regular expression to define exclude files -function projectCreateProjectDefsFromFolder(startDir, inclFiles, exclDirs, exclFiles) +// shiftOutDir - if true then add subfolder name to the OutDir path +function projectCreateProjectDefsFromFolder(startDir, + inclFiles, exclDirs, exclFiles, shiftOutDir) { var projectDefs = new Array(); @@ -573,11 +573,14 @@ continue; } - var newDefs = this.createProjectDefsFromFolder( - subFolder.Path, inclFiles, exclDirs, exclFiles); + var newDefs = this.createProjectDefsFromFolder(subFolder.Path, + inclFiles, exclDirs, exclFiles, shiftOutDir); - for (var i = 0; i < newDefs.length; ++i) - newDefs[i].OutDir += "\\" + subFolder.Name; + if (shiftOutDir) + { + for (var i = 0; i < newDefs.length; ++i) + newDefs[i].OutDir += "\\" + subFolder.Name; + } projectDefs = projectDefs.concat(newDefs); } @@ -822,4 +825,72 @@ } return projectDefs; +} + +// create ProjectDef object for test all locales +// nlsDir - folder containing locale source files +function projectCreateTestLocalesDef(nlsDir) +{ + nlsDir = ReplaceMacros(nlsDir, cmnMacros); + + if (typeof(this.arrLocales) == "undefined") + ProjectDef.prototype.arrLocales = initLocalesList(nlsDir); + + var srcdir = "%SRCDIR%\\etc\\config\\windows"; + var bindir = "$(SolutionDir)%CONFIG%\\bin"; + var test = "sanity_test"; + + // create test_locale_sanity project + var projectDef = this.clone(); + if (null == projectDef.PreBuildCmd) + projectDef.PreBuildCmd = ""; + else + projectDef.PreBuildCmd += "\r\n"; + projectDef.PreBuildCmd += + "echo cscript /nologo \"" + srcdir + "\\run_locale_utils.wsf\"" + + " /s /b:\"" + bindir + "\" > \"" + bindir + "\\" + test + ".bat\""; + projectDef.CustomBuildCmd = "cd \"" + bindir + "\"\r\n" + + "exec.exe -t " + execTimeout + " " + test + ".bat"; + projectDef.CustomBuildOut = bindir + "\\" + test + ".out"; + + for (var i = 0; i < this.arrLocales.length; ++i) + { + var locale = this.arrLocales[i]; + srcFileName = nlsDir + "\\src\\" + locale.srcName; + cmFileName = nlsDir + "\\charmaps\\" + locale.cmName; + + var cmFile; + var srcFile; + + try + { + cmFile = fso.GetFile(cmFileName); + } + catch (e) + { + WScript.StdErr.WriteLine("Generate: Fatal error: File " + + cmFileName + " not found"); + WScript.Quit(3); + } + + try + { + srcFile = fso.GetFile(srcFileName); + } + catch (e) + { + WScript.StdErr.WriteLine("Generate: Fatal error: File " + + srcFileName + " not found"); + WScript.Quit(3); + } + + projectDef.PreBuildCmd += "\r\n" + + "echo cscript /nologo \"" + srcdir + "\\run_locale_utils.wsf\"" + + " /f /b:\"" + bindir + "\" /i:\"" + nlsDir + "\"" + + " /l:" + locale.Name + " > \"" + bindir + "\\" + locale.Name + ".bat\""; + projectDef.CustomBuildCmd += " " + locale.Name + ".bat"; + projectDef.CustomBuildOut += ";" + bindir + "\\" + locale.Name + ".out"; + } + + return projectDef; } Modified: incubator/stdcxx/trunk/etc/config/windows/projects.js URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/projects.js?view=diff&rev=495309&r1=495308&r2=495309 ============================================================================== --- incubator/stdcxx/trunk/etc/config/windows/projects.js (original) +++ incubator/stdcxx/trunk/etc/config/windows/projects.js Thu Jan 11 09:53:05 2007 @@ -47,7 +47,7 @@ { var projectDefs = new Array(); - /////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// var configureDef = new ProjectDef(".configure", typeGeneric); configureDef.VCProjDir = ProjectsDir; configureDef.FilterDefs.push( @@ -74,9 +74,9 @@ configureDef.CustomBuildOut = "$(OutDir)\\config.h"; configureDef.CustomBuildDeps = "%FILES%"; - projectDefs.push(configureDef); + projectDefs.push(new Array(configureDef)); -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// var stdlibDef = new ProjectDef(".stdlib", typeLibrary); stdlibDef.VCProjDir = ProjectsDir; stdlibDef.FilterDefs.push( @@ -95,9 +95,9 @@ stdlibDef.OutFile = "$(OutDir)\\stdlib%CONFIG%%EXT%"; stdlibDef.PrjDeps.push(configureDef); - projectDefs.push(stdlibDef); + projectDefs.push(new Array(stdlibDef)); -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// var rwtestDef = new ProjectDef(".rwtest", typeLibrary); rwtestDef.VCProjDir = ProjectsDir; rwtestDef.FilterDefs.push( @@ -115,9 +115,11 @@ rwtestDef.Libs = commonLibs; rwtestDef.PrjRefs.push(stdlibDef); - projectDefs.push(rwtestDef); + projectDefs.push(new Array(rwtestDef)); + +/////////////////////////////////////////////////////////////////////////////// + var utilsArray = new Array(); -/////////////////////////////////////////////////////////////////////////////// var execDef = new ProjectDef("util_exec", typeApplication); execDef.VCProjDir = ProjectsDir + "\\util"; execDef.FilterDefs.push( @@ -135,9 +137,9 @@ execDef.OutFile = "$(OutDir)\\exec.exe"; execDef.PrjDeps.push(configureDef); - projectDefs.push(execDef); + utilsArray.push(execDef); -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// var localedefDef = new ProjectDef("util_localedef", typeApplication); localedefDef.VCProjDir = ProjectsDir + "\\util"; localedefDef.FilterDefs.push( @@ -160,9 +162,9 @@ localedefDef.OutFile = "$(OutDir)\\localedef.exe"; localedefDef.PrjRefs.push(stdlibDef); - projectDefs.push(localedefDef); + utilsArray.push(localedefDef); -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// var localeDef = new ProjectDef("util_locale", typeApplication); localeDef.VCProjDir = ProjectsDir + "\\util"; localeDef.FilterDefs.push( @@ -185,10 +187,10 @@ localeDef.OutFile = "$(OutDir)\\locale.exe"; localeDef.PrjRefs.push(stdlibDef); - projectDefs.push(localeDef); + utilsArray.push(localeDef); -/////////////////////////////////////////////////////////////////////////////// - var utilsDef = new ProjectDef(".stdlib_utils", typeGeneric); +/////////////////////////////////////////////////////////////////////////////// + var utilsDef = new ProjectDef(".stdcxx_utils", typeGeneric); utilsDef.VCProjDir = ProjectsDir + "\\util"; utilsDef.OutDir = "$(SolutionDir)%CONFIG%\\bin"; utilsDef.IntDir = utilsDef.OutDir; @@ -196,9 +198,13 @@ utilsDef.PrjDeps.push(localedefDef); utilsDef.PrjDeps.push(localeDef); - projectDefs.push(utilsDef); + utilsArray.push(utilsDef); + + projectDefs.push(utilsArray); + +/////////////////////////////////////////////////////////////////////////////// + var exampleArray = new Array(); -/////////////////////////////////////////////////////////////////////////////// var exampleTplDef = new ProjectDef(null, typeApplication); exampleTplDef.VCProjDir = ProjectsDir + "\\examples"; exampleTplDef.Defines = commonDefines; @@ -211,12 +217,23 @@ "%SRCDIR%\\examples", new RegExp("^.+\\.(?:cpp)$", "i"), new RegExp("^(?:\\.svn|Release.*|Debug.*|in|out|CVS)$", "i"), - new RegExp("^(?:rwstdmessages.cpp)$", "i")); + new RegExp("^(?:rwstdmessages.cpp)$", "i"), false); - projectDefs = projectDefs.concat(exampleDefs); + exampleArray = exampleArray.concat(exampleDefs); -/////////////////////////////////////////////////////////////////////////////// - var runexamplesDef = new ProjectDef(".stdlib_examples", typeGeneric); +/////////////////////////////////////////////////////////////////////////////// + var allexamplesDef = new ProjectDef(".stdcxx_examples", typeGeneric); + allexamplesDef.VCProjDir = ProjectsDir + "\\examples"; + allexamplesDef.OutDir = "$(SolutionDir)%CONFIG%\\examples"; + allexamplesDef.IntDir = allexamplesDef.OutDir; + allexamplesDef.PrjDeps = exampleDefs; + + exampleArray.push(allexamplesDef); + + projectDefs.push(exampleArray); + +/////////////////////////////////////////////////////////////////////////////// + var runexamplesDef = new ProjectDef(".stdcxx_runexamples", typeGeneric); runexamplesDef.VCProjDir = ProjectsDir + "\\examples"; runexamplesDef.FilterDefs.push( new FilterDef("Script Files", null, ".js;.wsf", eFileTypeScript, false). @@ -239,12 +256,14 @@ " /LIBDIR:\"$(SolutionDir)lib\""; runexamplesDef.CustomBuildOut = "$(OutDir)\\runexamples.log"; runexamplesDef.CustomBuildDeps = "%FILES%"; - runexamplesDef.PrjDeps = exampleDefs; + //runexamplesDef.PrjDeps.push(allexamplesDef); runexamplesDef.PrjDeps.push(execDef); - projectDefs.push(runexamplesDef); + projectDefs.push(new Array(runexamplesDef)); + +/////////////////////////////////////////////////////////////////////////////// + var testArray = new Array(); -/////////////////////////////////////////////////////////////////////////////// var testTplDef = new ProjectDef(null, typeApplication); testTplDef.VCProjDir = ProjectsDir + "\\tests"; testTplDef.Defines = commonDefines; @@ -258,12 +277,23 @@ "%SRCDIR%\\tests", new RegExp("^.+\\.(?:cpp)$", "i"), new RegExp("^(?:\\.svn|Release.*|Debug.*|in|out|CVS|src|include)$","i"), - new RegExp("^(?:rwstdmessages.cpp)$","i")); + new RegExp("^(?:rwstdmessages.cpp)$","i"), false); - projectDefs = projectDefs.concat(testDefs); + testArray = testArray.concat(testDefs); -/////////////////////////////////////////////////////////////////////////////// - var runtestsDef = new ProjectDef(".stdlib_tests", typeGeneric); +/////////////////////////////////////////////////////////////////////////////// + var alltestsDef = new ProjectDef(".stdcxx_tests", typeGeneric); + alltestsDef.VCProjDir = ProjectsDir + "\\tests"; + alltestsDef.OutDir = "$(SolutionDir)%CONFIG%\\tests"; + alltestsDef.IntDir = alltestsDef.OutDir; + alltestsDef.PrjDeps = testDefs; + + testArray.push(alltestsDef); + + projectDefs.push(testArray); + +/////////////////////////////////////////////////////////////////////////////// + var runtestsDef = new ProjectDef(".stdcxx_runtests", typeGeneric); runtestsDef.VCProjDir = ProjectsDir + "\\tests"; runtestsDef.FilterDefs.push( new FilterDef("Script Files", null, ".js;.wsf", eFileTypeScript, false). @@ -277,22 +307,22 @@ "if exist \"$(OutDir)\\runtests.log\" del \"$(OutDir)\\runtests.log\""; runtestsDef.CustomBuildFile = "runall.wsf"; runtestsDef.CustomBuildCmd = "cscript /nologo \"%CUSTOMFILE%\"" + - " /INOUTDIR:\"%SRCDIR%\\tests\"" + " /EXEDIR:\"$(OutDir)\"" + " /BUILDTYPE:\"%CONFIG%\"" + " /CONFIG:\"%SOLUTION%\"" + " /LOGFILE:\"runtests.log\"" + " /COPYDLL:" + (copyDll ? "false" : "true") + - " /COPYRWTESTDLL:" + (copyDll ? "false" : "true") + " /LIBDIR:\"$(SolutionDir)lib\""; runtestsDef.CustomBuildOut = "$(OutDir)\\runtests.log"; runtestsDef.CustomBuildDeps = "%FILES%"; - runtestsDef.PrjDeps = testDefs; + //runtestsDef.PrjDeps.push(alltestsDef); runtestsDef.PrjDeps.push(execDef); - projectDefs.push(runtestsDef); + projectDefs.push(new Array(runtestsDef)); + +/////////////////////////////////////////////////////////////////////////////// + var localeArray = new Array(); -/////////////////////////////////////////////////////////////////////////////// if (buildLocales) { var localeTplDef = new ProjectDef(null, typeGeneric); @@ -320,61 +350,62 @@ } var localeDefs = localeTplDef.createLocaleDefs("%SRCDIR%\\etc\\nls"); + + localeArray = localeArray.concat(localeDefs); - projectDefs = projectDefs.concat(localeDefs); - - var localesDef = new ProjectDef(".stdlib_locales", typeGeneric); + var localesDef = new ProjectDef(".stdcxx_locales", typeGeneric); localesDef.VCProjDir = ProjectsDir + "\\locales"; localesDef.OutDir = "$(SolutionDir)nls"; localesDef.IntDir = localesDef.OutDir; localesDef.PrjDeps = localeDefs; - - projectDefs.push(localesDef); + + localeArray.push(localesDef); } + projectDefs.push(localeArray); + /////////////////////////////////////////////////////////////////////////////// + var testlocaleArray = new Array(); + + var testlocaleTplDef = new ProjectDef(".stdcxx_testlocales", typeGeneric); + testlocaleTplDef.VCProjDir = ProjectsDir + "\\locales"; + testlocaleTplDef.FilterDefs.push( + new FilterDef("Script Files", null, "js;wsf", eFileTypeScript, false). + addFiles("%SRCDIR%\\etc\\config\\windows", + new Array("run_locale_utils.wsf"))); + testlocaleTplDef.OutDir = "$(SolutionDir)%CONFIG%\\bin"; + testlocaleTplDef.IntDir = testlocaleTplDef.OutDir; + testlocaleTplDef.CustomBuildFile = "run_locale_utils.wsf"; + testlocaleTplDef.CustomBuildDeps = "%FILES%"; + testlocaleTplDef.PrjDeps.push(execDef); + testlocaleTplDef.PrjDeps.push(localeDef); + testlocaleTplDef.PrjDeps.push(localedefDef); + if (!copyDll) + { + // copy stdlibxxx.dll to the bin directory + // before executing run_locale_utils.wsf script + // and finally delete the copied file + var libname = "stdlib%CONFIG%.dll"; + var src = "\"$(SolutionDir)lib\\" + libname + "\""; + var dst = "\"$(SolutionDir)%CONFIG%\\bin\\" + libname + "\""; + testlocaleTplDef.PreBuildCmd = "if exist " + src + " if not exist " + dst + + " copy /Y " + src + " " + dst; + testlocaleTplDef.PostBuildCmd = "if exist " + dst + " del " + dst; + } + if (testLocales) { - var testlocaleTplDef = new ProjectDef(null, typeGeneric); - testlocaleTplDef.VCProjDir = ProjectsDir + "\\locales"; - testlocaleTplDef.FilterDefs.push( - new FilterDef("Script Files", null, "js;wsf", eFileTypeScript, false). - addFiles("%SRCDIR%\\etc\\config\\windows", - new Array("run_locale_utils.wsf"))); - testlocaleTplDef.OutDir = "$(SolutionDir)%CONFIG%\\bin"; - testlocaleTplDef.IntDir = testlocaleTplDef.OutDir + "\\$(ProjectName)"; - testlocaleTplDef.CustomBuildFile = "run_locale_utils.wsf"; - testlocaleTplDef.CustomBuildDeps = "%FILES%"; - testlocaleTplDef.PrjDeps.push(execDef); - testlocaleTplDef.PrjDeps.push(localeDef); - testlocaleTplDef.PrjDeps.push(localedefDef); - if (!copyDll) - { - // copy stdlibxxx.dll to the bin directory - // before executing run_locale_utils.wsf script - // and finally delete the copied file - var libname = "stdlib%CONFIG%.dll"; - var src = "\"$(SolutionDir)lib\\" + libname + "\""; - var dst = "\"$(SolutionDir)%CONFIG%\\bin\\" + libname + "\""; - testlocaleTplDef.PreBuildCmd = "if exist " + src + " if not exist " + dst + - " copy /Y " + src + " " + dst; - testlocaleTplDef.PostBuildCmd = "if exist " + dst + " del " + dst; - } - var testlocaleDefs = testlocaleTplDef.createTestLocaleDefs("%SRCDIR%\\etc\\nls"); - projectDefs = projectDefs.concat(testlocaleDefs); - - var testlocalesDef = new ProjectDef(".stdlib_testlocales", typeGeneric); - testlocalesDef.VCProjDir = ProjectsDir + "\\locales"; - testlocalesDef.OutDir = "$(SolutionDir)bin"; - testlocalesDef.IntDir = testlocalesDef.OutDir; - testlocalesDef.PrjDeps = testlocaleDefs; - - projectDefs.push(testlocalesDef); + testlocaleArray = testlocaleArray.concat(testlocaleDefs); } -/////////////////////////////////////////////////////////////////////////////// + var testlocalesDef = testlocaleTplDef.createTestLocalesDef("%SRCDIR%\\etc\\nls"); + testlocaleArray.push(testlocalesDef); + + projectDefs.push(testlocaleArray); + +/////////////////////////////////////////////////////////////////////////////// if (copyDll) { // if project type is application and @@ -384,48 +415,53 @@ // copy rwtest.dll to project output directory for (var i = 0; i < projectDefs.length; ++i) { - var projectDef = projectDefs[i]; - - if (projectDef.Type != typeApplication) - continue; + var projectArray = projectDefs[i]; - var arrDeps = projectDef.PrjRefs.concat(projectDef.PrjDeps); - var command = ""; - - if (0 <= arrayIndexOf(arrDeps, stdlibDef)) + for (var j = 0; j < projectArray.length; ++j) { - var libname = "stdlib%CONFIG%.dll"; - var src = "\"$(SolutionDir)lib\\" + libname + "\""; - var dst = "\"$(OutDir)\\" + libname + "\""; - var cmd = "if exist " + src + " (\r\n" + - "del " + dst + "\r\n" + - "copy /Y " + src + " " + dst + "\r\n" + - ")"; - if (0 == command.length) - command = cmd; - else - command += "\r\n" + cmd; - } + var projectDef = projectArray[j]; - if (0 <= arrayIndexOf(arrDeps, rwtestDef)) - { - var libname = "rwtest.dll"; - var src = "\"$(SolutionDir)%CONFIG%\\tests\\" + libname + "\""; - var dst = "\"$(OutDir)\\" + libname + "\""; - var cmd = "if exist " + src + " (\r\n" + - "del " + dst + "\r\n" + - "copy /Y " + src + " " + dst + "\r\n" + - ")"; - if (0 == command.length) - command = cmd; + if (projectDef.Type != typeApplication) + continue; + + var arrDeps = projectDef.PrjRefs.concat(projectDef.PrjDeps); + var command = ""; + + if (0 <= arrayIndexOf(arrDeps, stdlibDef)) + { + var libname = "stdlib%CONFIG%.dll"; + var src = "\"$(SolutionDir)lib\\" + libname + "\""; + var dst = "\"$(OutDir)\\" + libname + "\""; + var cmd = "if exist " + src + " (\r\n" + + "del " + dst + "\r\n" + + "copy /Y " + src + " " + dst + "\r\n" + + ")"; + if (0 == command.length) + command = cmd; + else + command += "\r\n" + cmd; + } + + if (0 <= arrayIndexOf(arrDeps, rwtestDef)) + { + var libname = "rwtest.dll"; + var src = "\"$(SolutionDir)%CONFIG%\\tests\\" + libname + "\""; + var dst = "\"$(OutDir)\\" + libname + "\""; + var cmd = "if exist " + src + " (\r\n" + + "del " + dst + "\r\n" + + "copy /Y " + src + " " + dst + "\r\n" + + ")"; + if (0 == command.length) + command = cmd; + else + command += "\r\n" + cmd; + } + + if (null == projectDef.PostBuildCmd || "" == projectDef.PostBuildCmd) + projectDef.PostBuildCmd = command; else - command += "\r\n" + cmd; + projectDef.PostBuildCmd = command + "\r\n" + projectDef.PostBuildCmd; } - - if (null == projectDef.PostBuildCmd || "" == projectDef.PostBuildCmd) - projectDef.PostBuildCmd = command; - else - projectDef.PostBuildCmd = command + "\r\n" + projectDef.PostBuildCmd; } } @@ -439,13 +475,18 @@ { for (var i = 0; i < projectDefs.length; ++i) { - var projectDef = projectDefs[i]; + var projectArray = projectDefs[i]; - // turn on RTTI support if project in RTTIProjects array - if (0 <= arrayIndexOf(RTTIProjects, projectDef.Name)) - projectDef.RTTI = true; - - projectDef.createVCProject(VCProjectEngine, report); + for (var j = 0; j < projectArray.length; ++j) + { + var projectDef = projectArray[j]; + + // turn on RTTI support if project in RTTIProjects array + if (0 <= arrayIndexOf(RTTIProjects, projectDef.Name)) + projectDef.RTTI = true; + + projectDef.createVCProject(VCProjectEngine, report); + } } } @@ -456,39 +497,45 @@ { for (var i = 0; i < projectDefs.length; ++i) { - var projectDef = projectDefs[i]; - var VCProject = projectDef.VSProject; + var projectArray = projectDefs[i]; - var prjrefs = projectDef.PrjRefs; - if (0 == prjrefs.length) - continue; - - var file = fso.OpenTextFile(VCProject.ProjectFile, 1, false); - var text = file.ReadAll(); - file.Close(); - var refs = ""; - for (var j = 0; j < prjrefs.length; ++j) - { - refs += "\t\t"); - if (0 > pos) + for (var j = 0; j < projectArray.length; ++j) { - var str = "\t"; - pos = text.indexOf(str); - if (0 <= pos) + var projectDef = projectArray[j]; + + var VCProject = projectDef.VSProject; + + var prjrefs = projectDef.PrjRefs; + if (0 == prjrefs.length) + continue; + + var file = fso.OpenTextFile(VCProject.ProjectFile, 1, false); + var text = file.ReadAll(); + file.Close(); + var refs = ""; + for (var k = 0; k < prjrefs.length; ++k) + { + refs += "\t\t"); + if (0 > pos) { - refs = "\n\t\n" + refs + "\t"; - pos += str.length; + var str = "\t"; + pos = text.indexOf(str); + if (0 <= pos) + { + refs = "\n\t\n" + refs + "\t"; + pos += str.length; + } } + text = text.substr(0, pos) + refs + text.substr(pos); + text.replace("\t", refs); + file = fso.CreateTextFile(VCProject.ProjectFile, true, false); + file.Write(text); + file.Close(); } - text = text.substr(0, pos) + refs + text.substr(pos); - text.replace("\t", refs); - file = fso.CreateTextFile(VCProject.ProjectFile, true, false); - file.Write(text); - file.Close(); } } Modified: incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf?view=diff&rev=495309&r1=495308&r2=495309 ============================================================================== --- incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf (original) +++ incubator/stdcxx/trunk/etc/config/windows/run_locale_utils.wsf Thu Jan 11 09:53:05 2007 @@ -37,9 +37,10 @@ cscript run_locale_utils.wsf /s /b:..\..\..\bin\11s" -Usage: cscript run_locale_utils.wsf [/d] [/s] [/f [/i:@NlsDir /l:@LocaleName]] [/b:@BinDir] [/O:@Out], +Usage: cscript run_locale_utils.wsf [/d] [/n] [/s] [/f [/i:@NlsDir /l:@LocaleName]] [/b:@BinDir] [/O:@Out], where - "/d" debug; +- "/n" no cleanup; - "/s" tests location, output; - "/f" tests functionality; is followed by: - "/i:@NlsDir>" @@ -63,10 +64,14 @@ var locale_db = ""; var bindir = ""; var outstrm = WScript.StdOut; +var no_clean = false; var locale = "locale.exe"; var localedef = "localedef.exe"; +var TemporaryFolder = 2; +var tmpdir = fso.GetSpecialFolder(TemporaryFolder) + "\\" + fso.GetTempName(); + // assertions var assertions = 0; var failedassertions = 0; @@ -109,6 +114,18 @@ return exec; } +function Cleanup() +{ + if (!no_clean && fso.FolderExists(tmpdir)) + fso.DeleteFolder(tmpdir, true); +} + +function Exit(code) +{ + Cleanup(); + WScript.Quit(code); +} + // convert number num to string with specified width function FormatNumber(num, width) { @@ -119,6 +136,33 @@ return s; } +// create folder with intermediate folders, if needed +function CreateFolder(path) +{ + var res = true; + + if (!fso.FolderExists(path)) + { + var parent = fso.GetParentFolderName(path); + if (0 == parent.length) + return false; + res = CreateFolder(parent); + if (res) + { + try + { + fso.CreateFolder(path); + } + catch (e) + { + res = false; + } + } + } + + return res; +} + var description = new run_locale_utils; // run ////////////////////////////////////////////////////////////////////////////// @@ -303,19 +347,19 @@ if (charmap == "") { outstrm.WriteLine(err + "character maps file not specified."); - WScript.Quit(1); + Exit(1); } if (src == "") { outstrm.WriteLine(err + "source input file not specified."); - WScript.Quit(1); + Exit(1); } if (locname == "") { outstrm.WriteLine(err + "output locale name not specified."); - WScript.Quit(1); + Exit(1); } ++assertions; @@ -325,37 +369,86 @@ + " -i " + src + " " + locname; DebugOutLine(cmd); - var retcode = Run(cmd).ExitCode; + var exec = Run(cmd); + DebugOut(run_stdout); + + var retcode = exec.ExitCode; if (retcode) { - outstrm.WriteLine("Error - localedef returned code: " + retcode); - ++failedassertions; + // exit with the same status as the tool + Exit(retcode); + } +} + +// +// +// +function dump_charmap(locname, outfile) +{ + err="Cannot create characater set description file - " + + // locname: LC_ALL value + // outfile: output file name + + if (outfile == "") + { + outstrm.WriteLine(err + " - no output file specified."); + Exit(1); + } + + ++assertions; + + // dumping charmap + var cmd = locale + " --charmap -l"; + DebugOutLine("LC_ALL=" + locname + " " + cmd + " > " + outfile); + + WEnv("LC_ALL") = locname; + var exec = Run(cmd); + + DebugOut(run_stderr); + + var dmpfile = fso.CreateTextFile(outfile, true); + if (dmpfile) + { + dmpfile.Write(run_stdout); + dmpfile.Close(); + } + + var retcode = exec.ExitCode; + if (retcode) + { + // exit with the same status as the tool + Exit(retcode); } } // // Dumps one locale database // -function dump_locale(dumpfile) +function dump_locale(locname, dumpfile) { var err = "Cannot dump locale database - "; - // dumpfile - current locale dump file + // locname: LC_ALL value + // dumpfile: current locale dump file if (dumpfile == "") { outstrm.WriteLine(err + " - no output file specified."); - WScript.Quit(1); + Exit(1); } ++assertions; // Dumping locale database - var cmd = locale + " -ck -h LC_ALL > " + dumpfile; - DebugOutLine(cmd); + var cmd = locale + " -ck -h -l LC_ALL"; + DebugOutLine("LC_ALL=" + locname + " " + cmd + " > " + dumpfile); + WEnv("LC_ALL") = locname; var exec = Run(cmd); + DebugOut(run_stderr); + var dmpfile = fso.CreateTextFile(dumpfile, true); if (dmpfile) { @@ -366,127 +459,179 @@ var retcode = exec.ExitCode; if (retcode) { - outstrm.WriteLine("Error - locale returned code: " + retcode); - ++failedassertions; + // exit with the same status as the tool + Exit(retcode); } } // // Test one locale // -function test_locale(nlsdir, testdir, locname) +function test_locale(nlsdir, tmpdir, fname) { var err = "Cannot test locale - "; - // nlsdir - nlsdir - // testdir - test directory + // nlsdir - nls subdirectory of the source directory tree + // tmpdir - the test (sandbox) directory // locname - name of the locale database if (nlsdir == "") { outstrm.WriteLine(err+ " - nls directory not specified."); - WScript.Quit(1); + Exit(1); } - if (testdir == "") + if (tmpdir == "") { - outstrm.WriteLine(err + " - test directory not specified."); - WScript.Quit(1); + outstrm.WriteLine(err + " - temporary directory not specified."); + Exit(1); } - if (locname == "") + if (fname == "") { outstrm.WriteLine(err+ " - locale database name not specified."); - WScript.Quit(1); + Exit(1); } // get locale's name and encoding - var locale_src = locname.replace( - new RegExp("\([^.]*\)\.\([^>@]*\)\(.*\)"), "$1$3") - .replace("@", "."); - - var locale_encoding = locname.replace( - new RegExp("\([^.]*\)\.\([^>@]*\)\(.*\)"), "$2") - .replace("@", "."); - - DebugOutLine("locale_src = " + locale_src); - DebugOutLine("locale_encoding = " + locale_encoding); - - var charmap = nlsdir + "\\charmaps\\" + locale_encoding; - var src = nlsdir + "\\src\\" + locale_src; - var locdir = testdir + "\\" + locname; + var rx = new RegExp("\([^.]*\)\.\([^@]*\)\(.*\)"); + var source = fname.replace(rx, "$1$3").replace("@", "."); + var charmap = fname.replace(rx, "$2"); + + var src_path = nlsdir + "\\src\\" + source; + var cm_path = nlsdir + "\\charmaps\\" + charmap; + + var stage_1 = tmpdir + "\\stage.1"; + var stage_2 = tmpdir + "\\stage.2"; + var stage_3 = tmpdir + "\\stage.3"; + + source += ".src"; + + // point locale at the original source directory + DebugOutLine("RWSTD_SRC_ROOT=" + nlsdir); + WEnv("RWSTD_SRC_ROOT") = nlsdir; + + // create a directory for stage 1 charmap source files + var cm_dir1 = stage_1 + "\\charmaps"; + DebugOutLine("mkdir " + cm_dir1); + CreateFolder(cm_dir1); - // generate the first locale database - generate_locale(charmap, src, locdir); + ++assertions; - // set necessary environment variables - DebugOutLine("LC_ALL=" + locname); - WEnv("LC_ALL") = locname; - DebugOutLine("LANG=" + locname); - WEnv("LANG") = locname; + var locname1 = stage_1 + "\\" + fname; + var cm_path1 = cm_dir1 + "\\" + charmap; + var src_path1 = stage_1 + "\\" + source; - // adjust the locale root - DebugOutLine("RWSTD_LOCALE_ROOT=" + testdir); - WEnv("RWSTD_LOCALE_ROOT") = testdir; - - var test1 = testdir + "\\out.1"; - - // dump the locale database content to temporary location - dump_locale(test1); - DebugOutLine(""); - - // remove stage one database - if (fso.FolderExists(locdir)) - fso.DeleteFolder(locdir, true); - - // generate stage two database - generate_locale(charmap, test1, locdir); + // generate stage 1 locale database from the orignal sources + generate_locale(cm_path, src_path, locname1); - var test2 = testdir + "\\out.2"; + ++assertions; - // dump stage two database to file - dump_locale(test2); + // dump the charmap and the locale data from the database + // to a pair of charmap and locale source files + dump_charmap(locname1, cm_path1); + dump_locale(locname1, src_path1); + + // create a directory for stage 2 charmap source files + var cm_dir2 = stage_2 + "\\charmaps"; + DebugOutLine("mkdir " + cm_dir2); + CreateFolder(cm_dir2); - // remove stage two database - if (fso.FolderExists(locdir)) - fso.DeleteFolder(locdir, true); + ++assertions; - // generate stage three database - generate_locale(charmap, test2, locdir); + var locname2 = stage_2 + "\\" + fname; + var cm_path2 = cm_dir2 + "\\" + charmap; + var src_path2 = stage_2 + "\\" + source; + + // generate stage 2 locale database from the charmap and locale + // source files produced by locale from the stage 1 database + generate_locale(cm_path1, src_path1, locname2); + + // point locale at the stage 1 directory + DebugOutLine("RWSTD_SRC_ROOT=" + stage_1); + WEnv("RWSTD_SRC_ROOT") = stage_1; - var test3 = testdir + "\\out.3"; + ++assertions; - // and finally dump it to file - dump_locale(test3); + // dump the charmap and the locale data from the database + //to a pair of charmap and locale source files + dump_charmap(locname2, cm_path2); + dump_locale(locname2, src_path2); ++assertions; - // compare + // create a directory for stage 2 charmap source files + var cm_dir3 = stage_3 + "\\charmaps"; + DebugOutLine("mkdir " + cm_dir3); + CreateFolder(cm_dir3); + + ++assertions; - var params = test2 +" " + test3; - var cmd = "fc.exe " + params; + var locname3 = stage_3 + "\\" + fname; + var cm_path3 = cm_dir3 + "\\" + charmap; + var src_path3 = stage_3 + "\\" + source; + + // generate stage 3 locale database from the charmap and locale + // source files produced by locale from the stage 2 database + generate_locale(cm_path2, src_path2, locname3); + + // point locale at the stage 2 directory + DebugOutLine("RWSTD_SRC_ROOT=" + stage_2); + WEnv("RWSTD_SRC_ROOT") = stage_2; + + ++assertions; + + // dump the charmap and the locale data from the database + // to a pair of charmap and locale source files + dump_charmap(locname3, cm_path3); + dump_locale(locname3, src_path3); + + ++assertions; + + // verify that stage 1 and stage 2 charmaps are the same + var cmd = "fc " + cm_path1 + " " + cm_path2; + DebugOutLine(cmd); + var retcode = Run(cmd).ExitCode; + if (retcode) + { + DebugOutLine("## AssertionFailed: " + cm_path1 + + " and " + cm_path2 + " differ."); + ++failedassertions; + } + + // verify that stage 2 and stage 3 charmaps are the same + var cmd = "fc " + cm_path2 + " " + cm_path3; + DebugOutLine(cmd); + var retcode = Run(cmd).ExitCode; + if (retcode) + { + DebugOutLine("## AssertionFailed: " + cm_path2 + + " and " + cm_path3 + " differ."); + ++failedassertions; + } + + // verify that stage 2 and stage 3 locale sources are the same + var cmd = "fc " + src_path2 + " " + src_path3; + DebugOutLine(cmd); var retcode = Run(cmd).ExitCode; if (retcode) { - DebugOutLine("ERROR: " + params +" differ."); + DebugOutLine("## AssertionFailed: " + src_path2 + + " and " + src_path3 + " differ."); ++failedassertions; } - // and remove database - if (fso.FolderExists(locdir)) - fso.DeleteFolder(locdir); - - // remove dump files - if (fso.FileExists(test1)) - fso.DeleteFile(test1); - if (fso.FileExists(test2)) - fso.DeleteFile(test2); - if (fso.FileExists(test3)) - fso.DeleteFile(test3); - - // and finally remove the tmp directory - if (fso.FolderExists(testdir)) - fso.DeleteFolder(testdir); + if (!no_clean) + { + // clean up + DebugOutLine("rm -rf " + stage_1 + " " + stage_2 + " " + stage_3); + if (fso.FolderExists(stage_1)) + fso.DeleteFolder(stage_1, true); + if (fso.FolderExists(stage_2)) + fso.DeleteFolder(stage_2, true); + if (fso.FolderExists(stage_3)) + fso.DeleteFolder(stage_3, true); + } } ////////////////////////////////////////////////////////////////////////////// @@ -510,6 +655,9 @@ if (WScript.Arguments.Named.Exists("l")) locale_db = WScript.Arguments.Named("l"); + if (WScript.Arguments.Named.Exists("n")) + no_clean = true; + if (WScript.Arguments.Named.Exists("b")) { bindir = WScript.Arguments.Named("b"); @@ -540,29 +688,17 @@ } else if (chk_func) { - // set the temp dir - var TemporaryFolder = 2; - var tmpdir = fso.GetSpecialFolder(TemporaryFolder) - + "\\" + fso.GetTempName(); - - if (!fso.CreateFolder(tmpdir)) + // create the temp dir + if (!CreateFolder(tmpdir)) { - WScript.StdErr.WriteLine("Unable to create " + tmpdir - + ", aborting"); + WScript.StdErr.WriteLine("Unable to create " + tmpdir + ", aborting"); WScript.Quit(1); } - // checking locale functionality - DebugOutLine("RWSTD_SRC_ROOT=" + nlsdir); - WEnv("RWSTD_SRC_ROOT") = nlsdir; - DebugOutLine("RWSTD_LOCALE_ROOT=" + tmpdir); - WEnv("RWSTD_LOCALE_ROOT") = tmpdir; - // test only one locale test_locale(nlsdir, tmpdir, locale_db); - if (fso.FolderExists(tmpdir)) - fso.DeleteFolder(tmpdir, true); + Cleanup(); } else { @@ -586,8 +722,6 @@ outstrm.WriteLine("## Assertions = " + assertions); outstrm.WriteLine("## FailedAssertions = " + failedassertions); outstrm.WriteLine(); - - WScript.Quit(failedassertions); } ]]> Modified: incubator/stdcxx/trunk/etc/config/windows/runall.wsf URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/runall.wsf?view=diff&rev=495309&r1=495308&r2=495309 ============================================================================== --- incubator/stdcxx/trunk/etc/config/windows/runall.wsf (original) +++ incubator/stdcxx/trunk/etc/config/windows/runall.wsf Thu Jan 11 09:53:05 2007 @@ -27,16 +27,14 @@ + name="INOUTDIR" required="false" type="string"/> - - @@ -45,10 +43,9 @@ /INOUTDIR:"C:\stdcxx\build" /BUILDTYPE:11d /CONFIG:msvc-7.1 -Usage: cscript runexamples.wsf /EXEDIR:@EXEDIR /INOUTDIR:@INOUTDIR +Usage: cscript runexamples.wsf /EXEDIR:@EXEDIR [/INOUTDIR:@INOUTDIR] /BUILDTYPE:@BUILDTYPE /CONFIG:@CONFIG [/LOGFILE:@LOGFILE] [/COPYDLL:@COPYDLL] [/LIBDIR:@LIBDIR] -[/COPYRWTESTDLL:@COPYRWTESTDLL] where @EXEDIR is the root directory with executables ro be run and checked, @TOPDIR is the root directory with .in and .out files @@ -56,9 +53,8 @@ @BUILDTYPE is the build type (11d, 11s, etc). @CONFIG is the compiler configuration (msvc-7.1, icc-9.0, etc). @LOGFILE is the log file name. -@COPYDLL is the option for copy dll to executables +@COPYDLL is the option for copy stdlibxx.dll to executables @LIBDIR is the library dll folder (specify when COPYDLL is true) -@COPYRWTESTDLL is the option for copy rwtest.dll to executables @@ -66,7 +62,7 @@