public void TestSuiteConfig() { SuiteConfig suite = new SuiteConfig(".\\ProjectSuite1.pjs.tcLS"); Assert.AreEqual(".\\Log", suite.LogDir); Assert.AreEqual("ProjectSuite1", suite.Name); Guid projectGuid = new Guid("{0761baf0-d3e3-4b83-8e0d-f29c7b82ef42}"); ProjectConfig project = suite.GetProject(projectGuid); Assert.AreEqual(".\\Log", project.LogDir); Assert.AreEqual("Project1", project.Name); }
public static void GenTrees(string name, TestAppConfig appConfig, SuiteConfig suiteConfig, genFunc f1) { SupportedType[] tinyTypes = SupportedType.GetSupportedTypes(typeof(string)); SupportedType[] smallTypes = SupportedType.GetSupportedTypes(typeof(string), typeof(string)); SupportedType[] mediumTypes = SupportedType.GetSupportedTypes(typeof(string), typeof(string), typeof(int), typeof(int)); Gen1(name, appConfig, suiteConfig, "T", tinyTypes, f1, true); Gen1(name, appConfig, suiteConfig, "T", tinyTypes, f1, false); #if longbuild Gen1(name, appConfig, suiteConfig, "S", smallTypes, f1, true); Gen1(name, appConfig, suiteConfig, "S", smallTypes, f1, false); Gen1(name, appConfig, suiteConfig, "M", mediumTypes, f1, true); Gen1(name, appConfig, suiteConfig, "M", mediumTypes, f1, false); Gen1(name, appConfig, suiteConfig, "B", SupportedType.All, f1, true); Gen1(name, appConfig, suiteConfig, "B", SupportedType.All, f1, false); #endif }
public static void Gen1(string name, TestAppConfig appConfig, SuiteConfig suiteConfig, string typeName, SupportedType[] types, genFunc func, bool isLibrary) { string ending = isLibrary?"L":"E"; GenSample(name + "E1" + typeName + "F_" + ending, appConfig, suiteConfig, func(name + "E1" + typeName + "F_" + ending, types, null, true, false), isLibrary); GenSample(name + "E1" + typeName + "_P" + ending, appConfig, suiteConfig, func(name + "E1" + typeName + "_P" + ending, null, types, true, false), isLibrary); GenSample(name + "E1" + typeName + "FP" + ending, appConfig, suiteConfig, func(name + "E1" + typeName + "FP" + ending, types, types, true, false), isLibrary); GenSample(name + "E2" + typeName + "F_" + ending, appConfig, suiteConfig, func(name + "E2" + typeName + "F_" + ending, types, null, true, true), isLibrary); GenSample(name + "E2" + typeName + "_P" + ending, appConfig, suiteConfig, func(name + "E2" + typeName + "_P" + ending, null, types, true, true), isLibrary); GenSample(name + "E2" + typeName + "FP" + ending, appConfig, suiteConfig, func(name + "E2" + typeName + "FP" + ending, types, types, true, true), isLibrary); GenSample(name + "I1" + typeName + "F_" + ending, appConfig, suiteConfig, func(name + "I1" + typeName + "F_" + ending, types, null, false, false), isLibrary); GenSample(name + "I1" + typeName + "_P" + ending, appConfig, suiteConfig, func(name + "I1" + typeName + "_P" + ending, null, types, false, false), isLibrary); GenSample(name + "I1" + typeName + "FP" + ending, appConfig, suiteConfig, func(name + "I1" + typeName + "FP" + ending, types, types, false, false), isLibrary); GenSample(name + "I2" + typeName + "F_" + ending, appConfig, suiteConfig, func(name + "I2" + typeName + "F_" + ending, types, null, false, true), isLibrary); GenSample(name + "I2" + typeName + "_P" + ending, appConfig, suiteConfig, func(name + "I2" + typeName + "_P" + ending, null, types, false, true), isLibrary); GenSample(name + "I2" + typeName + "FP" + ending, appConfig, suiteConfig, func(name + "I2" + typeName + "FP" + ending, types, types, false, true), isLibrary); }
public static void GenSamples(TestAppConfig appConfig, SuiteConfig suiteConfig) { string name = appConfig.provider.FileExtension; GenSample(name + "99L", appConfig, suiteConfig, GenAllIntrumentedTypeDefs(name + "99L"), true); GenSample(name + "99E", appConfig, suiteConfig, GenAllIntrumentedTypeDefs(name + "99E"), false); #if longbuild GenTrees(name + "10", appConfig, suiteConfig, new genFunc(GenerateLeaf)); GenTrees(name + "21", appConfig, suiteConfig, new genFunc(GenerateSmallTree)); GenTrees(name + "22", appConfig, suiteConfig, new genFunc(GenerateMedTree)); GenTrees(name + "23", appConfig, suiteConfig, new genFunc(GenerateLongTree)); #endif GenTrees(name + "29", appConfig, suiteConfig, new genFunc(GenerateTree)); // GenSample(name+"20", appConfig, suiteConfig, GenerateTree(name+"20", tinyTypes, null, true, false)); }
static void Main(string[] args) { Test(); return; TestAppConfig[] appConfigs = new TestAppConfig[] { new TestAppConfig(new CSharpCodeProvider(), new CodeGeneratorOptions()), new TestAppConfig(new VBCodeProvider(), new CodeGeneratorOptions()), new TestAppConfig(new JScriptCodeProvider(), new CodeGeneratorOptions()) }; SuiteConfig suiteConfig = new SuiteConfig(); suiteConfig.commands1.Add("@echo off"); string dir = Path.Combine(Environment.CurrentDirectory, "TestApps"); Directory.CreateDirectory(dir); Environment.CurrentDirectory = dir; foreach (TestAppConfig appConfig in appConfigs) { GenSamples(appConfig, suiteConfig); } Environment.CurrentDirectory = dir; using (StreamWriter writer = new StreamWriter("makeall.bat", false, Encoding.ASCII)) { foreach (string command in suiteConfig.commands1) { writer.WriteLine(command); } foreach (string command in suiteConfig.commands2) { writer.WriteLine(command); } foreach (string command in suiteConfig.commands3) { writer.WriteLine(command); } } }
static void GenSample(string name, TestAppConfig appConfig, SuiteConfig suiteConfig, CodeTypeDeclarationCollection instrumentedTypes, bool isLibrary) { CodeDomProvider provider = appConfig.provider; CodeGeneratorOptions options = appConfig.options; CodeStatementCollection testStatements = GenTestCases(instrumentedTypes); CodeTypeDeclaration mainClass = AssemblyGenerator.GenMainClass(testStatements); mainClass.Name = name + "App"; CodeNamespace codeNamespace = AssemblyGenerator.GenNamespaceForInstrumentation(name + "App", provider is VBCodeProvider); codeNamespace.Types.Add(SupportedType.jscriptHackType); codeNamespace.Types.AddRange(instrumentedTypes); codeNamespace.Types.Add(mainClass); CodeCompileUnit unit = AssemblyGenerator.GenInstrumentedAssembly("root\\TestAppZ"); unit.Namespaces.Add(codeNamespace); // CodeCompileUnit unitMod = AssemblyGenerator.GenInstrumentedModule(); string fileName = name + "." + provider.FileExtension; string assemblyName = name + "." + (isLibrary?"dll":"exe"); string target = (isLibrary?" /target:library":""); #if SUBDIRSFORLANG string subDir = Path.Combine(Environment.CurrentDirectory, provider.FileExtension); Directory.CreateDirectory(subDir); string oldDir = Environment.CurrentDirectory; Environment.CurrentDirectory = subDir; #endif Console.WriteLine("Generating " + fileName); using (StreamWriter writer = new StreamWriter(fileName, false, Encoding.ASCII)) { provider.CreateGenerator().GenerateCodeFromCompileUnit(unit, writer, options); } #if xxx string fileNameMod = name + "Mod." + provider.FileExtension; string moduleName = name + "Mod." + "mod"; using (StreamWriter writer = new StreamWriter(fileNameMod, false, Encoding.ASCII)) { provider.CreateGenerator().GenerateCodeFromCompileUnit(unitMod, writer, options); } #endif #if SUBDIRSFORLANG Environment.CurrentDirectory = oldDir; #endif #if SUBDIRSFORLANG suiteConfig.commands1.Add("cd " + provider.FileExtension); #endif suiteConfig.commands1.Add("echo Building " + fileName); suiteConfig.commands1.Add(appConfig.GetComplerCommand(unit) + target + " /out:" + assemblyName + " " + fileName); // suiteConfig.commands1.Add(appConfig.GetComplerCommand(unit) + " /target:module /out:" + moduleName + " " + fileNameMod); #if SUBDIRSFORLANG suiteConfig.commands1.Add("cd .."); #endif #if SUBDIRSFORLANG suiteConfig.commands2.Add("cd " + provider.FileExtension); #endif suiteConfig.commands2.Add("echo InstallUtil " + assemblyName); suiteConfig.commands2.Add("InstallUtil /LogToConsole=false " + assemblyName); #if SUBDIRSFORLANG suiteConfig.commands2.Add("cd .."); #endif }