Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Wicher <kwicher@microsoft.com>2016-07-28 23:16:52 +0300
committerKrzysztof Wicher <kwicher@microsoft.com>2016-07-28 23:16:52 +0300
commit65cca50e20ad60f96527648db31ec03b9cc361aa (patch)
tree598c1bf73b66019d4d502657606897e28851eeb9 /src/System.Private.Xml/tests/Xslt/XsltCompiler
parent2583be64b949ce1633ba88c8fe56f96a9e3cb2d2 (diff)
rename System.Xml to System.Private.Xml (no csproj changes)
Diffstat (limited to 'src/System.Private.Xml/tests/Xslt/XsltCompiler')
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/ApiTests/XsltcApiTest.cs121
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestBasicFunctionality.cs150
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCaseBase.cs354
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestClassname.cs107
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCompile.cs48
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestFile.cs77
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestOut.cs118
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestPlatform.cs118
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestSettings.cs112
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/Identity.xslt12
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/IdentityTransform.dllbin0 -> 4608 bytes
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/IdentityTransform.xslt12
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/Program.cs26
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/TestStylesheet.dllbin0 -> 4096 bytes
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/TestStylesheet.xslt14
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCommon.cs648
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCompiler.Tests.csproj64
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltcModule.cs55
-rw-r--r--src/System.Private.Xml/tests/Xslt/XsltCompiler/project.json33
19 files changed, 2069 insertions, 0 deletions
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/ApiTests/XsltcApiTest.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/ApiTests/XsltcApiTest.cs
new file mode 100644
index 0000000000..554c591ad8
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/ApiTests/XsltcApiTest.cs
@@ -0,0 +1,121 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using Xunit.Abstractions;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Xml;
+using System.Xml.Xsl;
+using OLEDB.Test.ModuleCore;
+
+namespace System.Xml.Tests
+{
+ //[TestCase(Name = "Load(Type) API Functional Tests", Desc = "This testcase exercises the API tests for the Load(Type) overload")]
+ public class XsltcAPITest : XsltcTestCaseBase
+ {
+ private ITestOutputHelper _output;
+ public XsltcAPITest(ITestOutputHelper output) : base(output)
+ {
+ _output = output;
+ }
+
+ //[Variation("1", Desc = "Pass null, Load((Type) null)", Pri = 0)]
+ [InlineData()]
+ [Theory]
+ public void Var1()
+ {
+ try
+ {
+ new XslCompiledTransform().Load((Type)null);
+ }
+ catch (ArgumentNullException)
+ {
+ return;
+ }
+
+ throw new CTestFailedException("Did not throw ArgumentException");
+ }
+
+ //[Variation("2", Desc = "Pass types that are not generated by xsltc.exe, Load(typeof(Object))", Pri = 1)]
+ [InlineData()]
+ [Theory]
+ public void Var2()
+ {
+ try
+ {
+ new XslCompiledTransform().Load(typeof(Object));
+ }
+ catch (ArgumentException)
+ {
+ return;
+ }
+
+ throw new CTestFailedException("Did not throw ArgumentException");
+ }
+
+ /*//[Variation("3", Desc = "Exercise loading from the same class within different threads", Pri = 1)]
+ [InlineData()]
+ [Theory]
+ public void Var3()
+ {
+ var xsltList = new SynchronizedCollection<XslCompiledTransform>();
+ var rThreads = new CThreads(_output);
+
+ for (int i = 0; i < 10; i++)
+ {
+ rThreads.Add(o =>
+ {
+ var xslt = new XslCompiledTransform();
+ xsltList.Add(xslt);
+ XsltcUtil.LoadFromAssembly(ref xslt, "IdentityTransform");
+ return;
+ }, i.ToString(CultureInfo.InvariantCulture));
+ }
+
+ //Wait until they are complete
+ rThreads.Start();
+ rThreads.Wait();
+
+ return Verify(xsltList);
+ }*/
+
+ //[Variation("4", Desc = "XSLCompiledTransform Load(Type) changes the static data of the Type to XmlILCommand", Pri = 1)]
+ [InlineData()]
+ //[Theory] //Disabled as it tries to load an assembly which does not exist on CoreFX anymore
+ public void Var4()
+ {
+ var xslt = new XslCompiledTransform();
+
+ Type t = Assembly.Load(new AssemblyName("TestStylesheet")).GetType("TestStylesheet");
+ BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Static;
+
+ Type beforeLoad = t.GetTypeInfo().GetField("staticData", bindingFlags).GetValue(null).GetType();
+ xslt.Load(t);
+ Type afterLoad = t.GetTypeInfo().GetField("staticData", bindingFlags).GetValue(null).GetType();
+ CError.Compare(beforeLoad, afterLoad, "Mismatch in type, before and after load");
+ return;
+ }
+
+ public void Verify(IList<XslCompiledTransform> xsltList)
+ {
+ var inputXml = new XmlDocument();
+ inputXml.LoadXml("<foo><bar>Hello, world!</bar></foo>");
+
+ foreach (XslCompiledTransform xslt in xsltList)
+ {
+ using (var actualStream = new MemoryStream())
+ using (var sw = new StreamWriter(actualStream) { AutoFlush = true })
+ {
+ xslt.Transform(inputXml, null, sw);
+
+ CompareOutput("<?xml version=\"1.0\" encoding=\"utf-8\"?><foo><bar>Hello, world!</bar></foo>", actualStream);
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestBasicFunctionality.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestBasicFunctionality.cs
new file mode 100644
index 0000000000..9b2c646948
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestBasicFunctionality.cs
@@ -0,0 +1,150 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using Xunit.Abstractions;
+using System;
+using System.IO;
+
+namespace System.Xml.Tests
+{
+ //[TestCase(Name = "Basic Functionality", Desc = "This Testcase maps to test variations described in 'Basic Functional Tests'")]
+ public class XsltcTestBasicFunctionality : XsltcTestCaseBase
+ {
+ private ITestOutputHelper _output;
+ public XsltcTestBasicFunctionality(ITestOutputHelper output) : base(output)
+ {
+ _output = output;
+ }
+
+ //[Variation("1", Desc = "Exercise the basic use case, no options", Pri = 1, Params = new object[] { "bft1.xsl", "bft1", "bft1.txt" })]
+ //[InlineData("bft1.xsl", "bft1", "bft1.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("2", Desc = "Exercise the basic use case, no options, fully qualified path", Pri = 1, Params = new object[] { @"$(CurrentWorkingDirectory)\bft2.xsl", "bft2", "bft2.txt" })]
+ //[InlineData(@"$(CurrentWorkingDirectory)\bft2.xsl", "bft2", "bft2.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("10", Desc = "Exercise the basic use case, 2 stylesheets, 2 classes", Pri = 1, Params = new object[] { "/class:bft10a bft10a.xsl /class:bft10b bft10b.xsl", "bft10a", "bft10.txt" })]
+ //[InlineData("/class:bft10a bft10a.xsl /class:bft10b bft10b.xsl", "bft10a", "bft10.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("11", Desc = "Exercise the basic use case, 3 stylesheets, 2 classes", Pri = 2, Params = new object[] { "/class:bft11a bft11a.xsl /class:bft11b bft11b.xsl bft11c.xsl", "bft11a", "bft11.txt" })]
+ //[InlineData("/class:bft11a bft11a.xsl /class:bft11b bft11b.xsl bft11c.xsl", "bft11a", "bft11.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("12", Desc = "Exercise the basic use case, many stylesheets 1 class", Pri = 2, Params = new object[] { "/class:bft12az /out:bft12az.dll bft12a.xsl bft12b.xsl bft12c.xsl bft12d.xsl bft12e.xsl bft12f.xsl bft12g.xsl bft12h.xsl bft12i.xsl bft12j.xsl bft12k.xsl bft12l.xsl bft12m.xsl bft12n.xsl bft12o.xsl bft12p.xsl bft12q.xsl bft12r.xsl bft12s.xsl bft12t.xsl bft12u.xsl bft12v.xsl bft12w.xsl bft12x.xsl bft12y.xsl bft12z.xsl", "bft12az", "bft12.txt" })]
+ //[InlineData("/class:bft12az /out:bft12az.dll bft12a.xsl bft12b.xsl bft12c.xsl bft12d.xsl bft12e.xsl bft12f.xsl bft12g.xsl bft12h.xsl bft12i.xsl bft12j.xsl bft12k.xsl bft12l.xsl bft12m.xsl bft12n.xsl bft12o.xsl bft12p.xsl bft12q.xsl bft12r.xsl bft12s.xsl bft12t.xsl bft12u.xsl bft12v.xsl bft12w.xsl bft12x.xsl bft12y.xsl bft12z.xsl", "bft12az", "bft12.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("13", Desc = "Exercise the basic use case, same stylesheet twice", Pri = 2, Params = new object[] { "bft13.xsl bft13.xsl", "bft13", "bft13.txt" })]
+ //[InlineData("bft13.xsl bft13.xsl", "bft13", "bft13.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("14", Desc = "Exercise the basic use case, same stylesheet twice with 2 different classnames", Pri = 2, Params = new object[] { "/class:bft14a bft14a.xsl /class:bft14b bft14a.xsl", "bft14a", "bft14.txt" })]
+ //[InlineData("/class:bft14a bft14a.xsl /class:bft14b bft14a.xsl", "bft14a", "bft14.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("17", Desc = "Exercise a very long stylesheetname with default classname and default assembly name", Pri = 2, Params = new object[] { "bft17012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.xsl", "bft17012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", "bft17.txt" })]
+ //[InlineData("bft17012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.xsl", "bft17012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", "bft17.txt")]
+ //[Variation("19", Desc = "Exercise relative URIs for imported documents", Pri = 1, Params = new object[] { @"bft19.xsl", "bft19", "bft19.txt" })]
+ //[InlineData(@"bft19.xsl", "bft19", "bft19.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("20", Desc = "Exercise relative URIs for included documents", Pri = 1, Params = new object[] { @"bft20.xsl", "bft20", "bft20.txt" })]
+ //[InlineData(@"bft20.xsl", "bft20", "bft20.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("21", Desc = "Exercise relative URIs for document function", Pri = 1, Params = new object[] { @"/settings:document+ bft21.xsl", "bft21", "bft21.txt" })]
+ //[InlineData(@"/settings:document+ bft21.xsl", "bft21", "bft21.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("22", Desc = "Exercise the basic use case, no options, relative path", Pri = 1, Params = new object[] { @".\bft22.xsl", "bft22", "bft22.txt" })]
+ //[InlineData(@".\bft22.xsl", "bft22", "bft22.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("23", Desc = "Exercise the basic use case, no options, relative path with fwd slashes", Pri = 1, Params = new object[] { @"./bft23.xsl", "bft23", "bft23.txt" })]
+ //[InlineData(@"./bft23.xsl", "bft23", "bft23.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("25", Desc = "Exercise a stylesheet with space in its name", Pri = 1, Params = new object[] { "\"bft 25.xsl\"", "bft 25", "bft25.txt" })]
+ //[InlineData("\"bft 25.xsl\"", "bft 25", "bft25.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("26", Desc = "Exercise Cyrillic e in filename", Pri = 1, Params = new object[] { "bft26.xsl", "bft26", "bft26.txt" })]
+ //[InlineData("bft26.xsl", "bft26", "bft26.txt")] /*sd problems \u0400\u0400\u0400\u0400bft26.xsl, coverage addded to other test cases*/ //Skipping this, it tries to load System.dll
+ //[Variation("31", Desc = "Exercise options with “-“", Pri = 1, Params = new object[] { "-out:bft31.dll /class:bft31 -debug- bft31.xsl", "bft31", "bft31.txt" })]
+ //[InlineData("-out:bft31.dll /class:bft31 -debug- bft31.xsl", "bft31", "bft31.txt")] //Skipping this, it tries to load System.dll
+ [Theory]
+ public void Var1(object param0, object param1, object param2)
+ {
+ try
+ {
+ // Verify xsltc.exe is available
+ XmlCoreTest.Common.XsltVerificationLibrary.SearchPath("xsltc.exe");
+ }
+ catch (FileNotFoundException)
+ {
+ _output.WriteLine("Could not find 'xsltc.exe'. Make sure that the .NET SDK is installed");
+ Assert.True(false);
+ }
+
+ String cmdLine = ReplaceCurrentWorkingDirectory(param0.ToString());
+ String asmName = param1 + ".dll";
+ String typeName = param1.ToString();
+ String pdbName = param1 + ".pdb";
+ String baselineFile = param2.ToString();
+
+ VerifyTest(cmdLine, asmName, true, typeName, pdbName, false, baselineFile, _createFromInputFile);
+ }
+
+ // All variations that are Invalid are run by Var2()
+ //[Variation("6", Desc = "Exercise the basic use case, invalid input", Pri = 1, Params = new object[] { "/thisisinvalid foo", "bft6.txt" })]
+ //[InlineData("/thisisinvalid foo", "bft6.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("7", Desc = "Exercise the basic use case, invalid input", Pri = 1, Params = new object[] { "mystylesheet", "bft7.txt" })]
+ //[InlineData("mystylesheet", "bft7.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("8", Desc = "Exercise the basic use case, invalid input", Pri = 1, Params = new object[] { "mystylesheet,xsl", "bft8.txt" })]
+ //[InlineData("mystylesheet,xsl", "bft8.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("9", Desc = "Exercise the basic use case, wildcarded stylesheet group", Pri = 1, Params = new object[] { "*.xsl", "bft9.txt", "EnglishOnly" })]
+ //[InlineData("*.xsl", "bft9.txt"/*, "EnglishOnly"*/)] //Skipping this, it tries to load System.dll
+ //[Variation("15", Desc = "Exercise what would be a circular reference, a primary stylesheet that includes another, followed by the include itself", Pri = 2, Params = new object[] { "bft15a.xsl bft15b.xsl", "bft15.txt", "EnglishOnly" })]
+ [InlineData("bft15a.xsl bft15b.xsl", "bft15.txt"/*, "EnglishOnly"*/)]
+ //[Variation("16", Desc = "Exercise the basic use case, 2 stylesheets with different extensions", Pri = 2, Params = new object[] { "bft16.xsl bft16.xslt", "bft16.txt" })]
+ //[InlineData("bft16.xsl bft16.xslt", "bft16.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("18", Desc = "Exercise what would be a circular reference, a primary stylesheet that imports another, followed by the import itself", Pri = 1, Params = new object[] { "bft18a.xsl bft18b.xsl", "bft18.txt", "EnglishOnly" })]
+ //[InlineData("bft18a.xsl bft18b.xsl", "bft18.txt"/*, "EnglishOnly"*/)] //Skipping this, it tries to load System.dll
+ //[Variation("24", Desc = "Exercise what would be a circular reference, a primary stylesheet that imports another, followed by the include itself", Pri = 1, Params = new object[] { "bft24a.xsl bft24b.xsl", "bft24.txt", "EnglishOnly" })]
+ //[InlineData("bft24a.xsl bft24b.xsl", "bft24.txt"/*, "EnglishOnly"*/)] //Skipping this, it tries to load System.dll
+ //[Variation("27", Desc = "Exercise whitespace before flag values", Pri = 1, Params = new object[] { "/ out:bft27.dll bft27.xsl", "bft27.txt" })]
+ [InlineData("/ out:bft27.dll bft27.xsl", "bft27.txt")]
+ //[Variation("28", Desc = "Exercise whitespace after flag values", Pri = 1, Params = new object[] { "/out: bft28.dll bft28.xsl", "bft28.txt" })]
+ //[InlineData("/out: bft28.dll bft28.xsl", "bft28.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("29", Desc = "Exercise help", Pri = 1, Params = new object[] { "/?", "help.txt" })]
+ //[InlineData("/?", "help.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("30", Desc = "Exercise help with option values", Pri = 1, Params = new object[] { "bft2.xsl /? bft2.xsl", "help.txt" })]
+ [InlineData("bft2.xsl /? bft2.xsl", "help.txt")]
+ //[Variation("33", Desc = "Exercise nologo", Pri = 1, Params = new object[] { "/nologo /foo", "bft33.txt" })]
+ //[InlineData("/nologo /foo", "bft33.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("34", Desc = "Stylesheet path containing device name", Pri = 1, Params = new object[] { "nul/bft34.xsl", "bft34.txt" })]
+ //[InlineData("nul/bft34.xsl", "bft34.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("35", Desc = "Device name as stylesheetname", Pri = 1, Params = new object[] { "nul.xsl", "bft35.txt" })]
+ [InlineData("nul.xsl", "bft35.txt")]
+ //[Variation("36", Desc = "Stylesheet path without name", Pri = 1, Params = new object[] { "..\\", "bft36.txt" })]
+ //[InlineData("..\\", "bft36.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("37", Desc = "No input source", Pri = 1, Params = new object[] { "/debug+", "bft37.txt" })]
+ [InlineData("/debug+", "bft37.txt")]
+ //[Variation("38", Desc = "Empty string in arguments", Pri = 1, Params = new object[] { "\"\"", "bft38.txt" })]
+ [InlineData("\"\"", "bft38.txt")]
+ [Theory]
+ public void Var2(object param0, object param1)
+ {
+ try
+ {
+ // Verify xsltc.exe is available
+ XmlCoreTest.Common.XsltVerificationLibrary.SearchPath("xsltc.exe");
+ }
+ catch (FileNotFoundException)
+ {
+ _output.WriteLine("Could not find 'xsltc.exe'. Make sure that the .NET SDK is installed");
+ Assert.True(false);
+ }
+
+ if (ShouldSkip(new object[] { param0, param1 }))
+ {
+ return;// TEST_SKIPPED;
+ }
+ String cmdLine = param0.ToString();
+ String baselineFile = param1.ToString();
+
+ VerifyTest(cmdLine, baselineFile, _createFromInputFile);
+ }
+
+ //[Variation("5", Desc = "Exercise the basic use case, no input", Pri = 1, Params = new object[] { " ", "bft5.txt" })]
+ //[InlineData(" ", "bft5.txt")] //Skipping this, it tries to load System.dll
+ //[Theory]
+ public void Var3(object param0, object param1)
+ {
+ String cmdLine = param0.ToString();
+ String baselineFile = _createFromInputFile
+ ? param1.ToString()
+ : "help.txt";
+
+ VerifyTest(cmdLine, baselineFile, _createFromInputFile);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCaseBase.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCaseBase.cs
new file mode 100644
index 0000000000..16699426e3
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCaseBase.cs
@@ -0,0 +1,354 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using Xunit.Abstractions;
+using System;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Xml;
+using System.Xml.Xsl;
+using XmlCoreTest.Common;
+using OLEDB.Test.ModuleCore;
+using System.Runtime.Loader;
+
+namespace System.Xml.Tests
+{
+ public class XsltcTestCaseBase : CTestCase
+ {
+ // Generic data for all derived test cases
+ public String szDefaultNS = "urn:my-object";
+
+ public String szEmpty = "";
+ public String szInvalid = "*?%(){}[]&!@#$";
+ public String szLongNS = "http://www.microsoft.com/this/is/a/very/long/namespace/uri/to/do/the/api/testing/for/xslt/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/";
+ public String szLongString = "ThisIsAVeryLongStringToBeStoredAsAVariableToDetermineHowLargeThisBufferForAVariableNameCanBeAndStillFunctionAsExpected";
+ public String szSimple = "myArg";
+ public String[] szWhiteSpace = { " ", "\n", "\t", "\r", "\t\n \r\t" };
+ public String szXslNS = "http://www.w3.org/1999/XSL/Transform";
+
+ // Other global variables
+ protected bool _createFromInputFile = false; // This is intiialized from a parameter passed from LTM as a dimension, that dictates whether the variation is to be created using an input file.
+
+ protected bool _isInProc; // Is the current test run in proc or /Host None?
+
+ private static ITestOutputHelper s_output;
+ public XsltcTestCaseBase(ITestOutputHelper output)
+ {
+ s_output = output;
+ }
+
+ public override int Init(object objParam)
+ {
+ // initialize whether this run is in proc or not
+
+ string executionMode = "File";
+
+ _createFromInputFile = executionMode.Equals("File");
+
+ return 1;
+ }
+
+ protected static void CompareOutput(string expected, Stream actualStream)
+ {
+ using (var expectedStream = new MemoryStream(Encoding.UTF8.GetBytes(expected)))
+ {
+ CompareOutput(expectedStream, actualStream);
+ }
+ }
+
+ protected static void CompareOutput(Stream expectedStream, Stream actualStream, int count = 0)
+ {
+ actualStream.Seek(0, SeekOrigin.Begin);
+
+ using (var expectedReader = new StreamReader(expectedStream))
+ using (var actualReader = new StreamReader(actualStream))
+ {
+ for (int i = 0; i < count; i++)
+ {
+ actualReader.ReadLine();
+ expectedReader.ReadLine();
+ }
+
+ string actual = actualReader.ReadToEnd();
+ string expected = expectedReader.ReadToEnd();
+
+ if (actual.Equals(expected))
+ {
+ return;
+ }
+
+ throw new CTestFailedException("Output was not as expected.", actual, expected, null);
+ }
+ }
+
+ protected bool LoadPersistedTransformAssembly(string asmName, string typeName, string baselineFile, bool pdb)
+ {
+ var other = (AssemblyLoader)Activator.CreateInstance(typeof(AssemblyLoader), typeof(AssemblyLoader).FullName);
+
+ bool result = other.Verify(asmName, typeName, baselineFile, pdb);
+
+ return result;
+ }
+
+ protected string ReplaceCurrentWorkingDirectory(string commandLine)
+ {
+ return commandLine.Replace(@"$(CurrentWorkingDirectory)", XsltcModule.TargetDirectory);
+ }
+
+ protected bool ShouldSkip(object[] varParams)
+ {
+ // some test only applicable in English environment, so skip them if current cultral is not english
+ bool isCultralEnglish = CultureInfo.CurrentCulture.TwoLetterISOLanguageName.ToLower() == "en";
+ if (isCultralEnglish)
+ {
+ return false;
+ }
+
+ // look up key word "EnglishOnly", if hit return true, otherwise false
+ return varParams != null && varParams.Any(o => o.ToString() == "EnglishOnly");
+ }
+
+ protected void VerifyTest(String cmdLine, String baselineFile, bool loadFromFile)
+ {
+ VerifyTest(cmdLine, String.Empty, false, String.Empty, baselineFile, loadFromFile);
+ }
+
+ protected void VerifyTest(String cmdLine, String asmName, bool asmCreated, String typeName, String baselineFile, bool loadFromFile)
+ {
+ VerifyTest(cmdLine, asmName, asmCreated, typeName, String.Empty, false, baselineFile, loadFromFile);
+ }
+
+ protected void VerifyTest(String cmdLine, String asmName, bool asmCreated, String typeName, String pdbName, bool pdbCreated, String baselineFile, bool loadFromFile)
+ {
+ VerifyTest(cmdLine, asmName, asmCreated, typeName, pdbName, pdbCreated, baselineFile, true, loadFromFile);
+ }
+
+ protected void VerifyTest(String cmdLine, String asmName, bool asmCreated, String typeName, String pdbName, bool pdbCreated, String baselineFile, bool runAssemblyVerification, bool loadFromFile)
+ {
+ string targetDirectory = XsltcModule.TargetDirectory;
+
+ string output = asmCreated ? TryCreatePersistedTransformAssembly(cmdLine, _createFromInputFile, true, targetDirectory) : TryCreatePersistedTransformAssembly(cmdLine, _createFromInputFile, false, targetDirectory);
+
+ //verify assembly file existence
+ if (asmName != null && String.CompareOrdinal(String.Empty, asmName) != 0)
+ {
+ if (File.Exists(GetPath(asmName)) != asmCreated)
+ {
+ throw new CTestFailedException("Assembly File Creation Check: FAILED");
+ }
+ }
+
+ //verify pdb existence
+ if (pdbName != null && String.CompareOrdinal(String.Empty, pdbName) != 0)
+ {
+ if (File.Exists(GetPath(pdbName)) != pdbCreated)
+ {
+ throw new CTestFailedException("PDB File Creation Check: FAILED");
+ }
+ }
+
+ if (asmCreated && !String.IsNullOrEmpty(typeName))
+ {
+ if (!LoadPersistedTransformAssembly(GetPath(asmName), typeName, baselineFile, pdbCreated))
+ {
+ throw new CTestFailedException("Assembly loaded failed");
+ }
+ }
+ else
+ {
+ using (var ms = new MemoryStream())
+ using (var sw = new StreamWriter(ms) { AutoFlush = true })
+ using (var expected = new FileStream(GetPath(baselineFile), FileMode.Open, FileAccess.Read))
+ {
+ sw.Write(output);
+ CompareOutput(expected, ms, 4);
+ }
+ }
+
+ SafeDeleteFile(GetPath(pdbName));
+ SafeDeleteFile(GetPath(asmName));
+
+ return;
+ }
+
+ private static void SafeDeleteFile(string fileName)
+ {
+ try
+ {
+ var fileInfo = new FileInfo(fileName);
+
+ if (fileInfo.Directory != null && !fileInfo.Directory.Exists)
+ {
+ fileInfo.Directory.Create();
+ }
+
+ if (fileInfo.Exists)
+ {
+ fileInfo.Delete();
+ }
+ }
+ catch (ArgumentException)
+ {
+ }
+ catch (PathTooLongException)
+ {
+ }
+ catch (Exception e)
+ {
+ s_output.WriteLine(e.Message);
+ }
+ }
+
+ // Used to generate a unique name for an input file, and write that file, based on a specified command line.
+ private string CreateInputFile(string commandLine)
+ {
+ string fileName = Path.Combine(XsltcModule.TargetDirectory, Guid.NewGuid() + ".ipf");
+
+ File.WriteAllText(fileName, commandLine);
+
+ return fileName;
+ }
+
+ private string GetPath(string fileName)
+ {
+ return XsltcModule.TargetDirectory + Path.DirectorySeparatorChar + fileName;
+ }
+
+ /// <summary>
+ /// Currently this method supports only 1 input file. For variations that require more than one input file to test
+ /// @file
+ /// functionality, custom-craft and write those input files in the body of the variation method, then pass an
+ /// appropriate
+ /// commandline such as @file1 @file2 @file3, along with createFromInputFile = false.
+ /// </summary>
+ /// <param name="commandLine"></param>
+ /// <param name="createFromInputFile"></param>
+ /// <param name="expectedToSucceed"></param>
+ /// <param name="targetDirectory"></param>
+ /// <returns></returns>
+ private string TryCreatePersistedTransformAssembly(string commandLine, bool createFromInputFile, bool expectedToSucceed, string targetDirectory)
+ {
+ // If createFromInputFile is specified, create an input file now that the compiler can consume.
+ string processArguments = createFromInputFile ? "@" + CreateInputFile(commandLine) : commandLine;
+
+ var processStartInfo = new ProcessStartInfo
+ {
+ FileName = XsltVerificationLibrary.SearchPath("xsltc.exe"),
+ Arguments = processArguments,
+ //WindowStyle = ProcessWindowStyle.Hidden,
+ CreateNoWindow = true,
+ UseShellExecute = false,
+ RedirectStandardOutput = true,
+ WorkingDirectory = targetDirectory
+ };
+
+ // Call xsltc to create persistant assembly.
+ var compilerProcess = new Process
+ {
+ StartInfo = processStartInfo
+ };
+
+ compilerProcess.Start();
+ string output = compilerProcess.StandardOutput.ReadToEnd();
+ compilerProcess.WaitForExit();
+
+ if (createFromInputFile)
+ {
+ SafeDeleteFile(processArguments.Substring(1));
+ }
+
+ if (expectedToSucceed)
+ {
+ // The Assembly was created successfully
+ if (compilerProcess.ExitCode == 0)
+ {
+ return output;
+ }
+
+ throw new CTestFailedException("Failed to create assembly: " + output);
+ }
+
+ return output;
+ }
+
+ public class AssemblyLoader //: MarshalByRefObject
+ {
+ public AssemblyLoader(string asmName)
+ {
+ }
+
+ public bool Verify(string asmName, string typeName, string baselineFile, bool pdb)
+ {
+ try
+ {
+ var xslt = new XslCompiledTransform();
+ Assembly xsltasm = AssemblyLoadContext.Default.LoadFromAssemblyPath(Path.GetFullPath(asmName));
+
+ if (xsltasm == null)
+ {
+ //_output.WriteLine("Could not load file");
+ return false;
+ }
+
+ Type t = xsltasm.GetType(typeName);
+
+ if (t == null)
+ {
+ //_output.WriteLine("No type loaded");
+ return false;
+ }
+
+ xslt.Load(t);
+
+ var inputXml = new XmlDocument();
+
+ using (var stream = new MemoryStream())
+ using (var sw = new StreamWriter(stream) { AutoFlush = true })
+ {
+ inputXml.LoadXml("<foo><bar>Hello, world!</bar></foo>");
+ xslt.Transform(inputXml, null, sw);
+
+ if (!XsltVerificationLibrary.CompareXml(Path.Combine(XsltcModule.TargetDirectory, baselineFile), stream))
+ {
+ //_output.WriteLine("Baseline file comparison failed");
+ return false;
+ }
+ }
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ s_output.WriteLine(e.Message);
+ return false;
+ }
+ // Turning this off as this causes noise on different platforms like IA64.
+ // Also since we verify the assembly by loading there is not really a need for this verification.
+ // if (succeeded && runAssemblyVerification) {
+ // String peOutput = String.Empty;
+ // succeeded = XsltVerificationLibrary.VerifyAssemblyUsingPEVerify(
+ // asmName,
+ // logger,
+ // ref peOutput);
+ // logger.LogMessage("Assembly Verification Result: " + peOutput);
+ //}
+ }
+
+ private static byte[] loadFile(string filename)
+ {
+ using (var fs = new FileStream(filename, FileMode.Open))
+ {
+ var buffer = new byte[(int)fs.Length];
+ fs.Read(buffer, 0, buffer.Length);
+ return buffer;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestClassname.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestClassname.cs
new file mode 100644
index 0000000000..ab4abad633
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestClassname.cs
@@ -0,0 +1,107 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using Xunit.Abstractions;
+using System;
+using System.IO;
+
+namespace System.Xml.Tests
+{
+ // Note: Skipping these tests as they try to load a dll which references System.dll
+ ////[TestCase(Name = "Classname Tests", Desc = "This Testcase maps to test variations described in 'Classname Functional Tests'")]
+ //public class XsltcTestClassname : XsltcTestCaseBase
+ //{
+ // private ITestOutputHelper _output;
+ // public XsltcTestClassname(ITestOutputHelper output) : base(output)
+ // {
+ // _output = output;
+ // }
+
+ // //[Variation("1", Desc = "Exercise the basic use case, a simple valid classname", Pri = 1, Params = new object[] { "/class:MyClass cnt1.xsl", "MyClass", "cnt1.dll", "cnt1.txt" })]
+ // [InlineData("/class:MyClass cnt1.xsl", "MyClass", "cnt1.dll", "cnt1.txt")]
+ // //[Variation("2", Desc = "Exercise the basic use case, a fully qualified classname", Pri = 1, Params = new object[] { "/class:XmlCoreTest.MyClass cnt2.xsl", "XmlCoreTest.MyClass", "cnt2.dll", "cnt2.txt" })]
+ // [InlineData("/class:XmlCoreTest.MyClass cnt2.xsl", "XmlCoreTest.MyClass", "cnt2.dll", "cnt2.txt")]
+ // //[Variation("4", Desc = "Exercise a C# reserved keyword", Pri = 1, Params = new object[] { "/class:class cnt4.xsl", "class", "cnt4.dll", "cnt4.txt" })]
+ // [InlineData("/class:class cnt4.xsl", "class", "cnt4.dll", "cnt4.txt")]
+ // //[Variation("5", Desc = "Exercise an MSIL reserved keyword", Pri = 1, Params = new object[] { "/class:hidebysig cnt5.xsl", "hidebysig", "cnt5.dll", "cnt5.txt" })]
+ // [InlineData("/class:hidebysig cnt5.xsl", "hidebysig", "cnt5.dll", "cnt5.txt")]
+ // //[Variation("6", Desc = "Exercise case sensitivity", Pri = 1, Params = new object[] { "/class:MyStyleSheEt cnt6.xsl", "MyStyleSheEt", "cnt6.dll", "cnt6.txt" })]
+ // [InlineData("/class:MyStyleSheEt cnt6.xsl", "MyStyleSheEt", "cnt6.dll", "cnt6.txt")]
+ // //[Variation("7", Desc = "Exercise wildcards", Pri = 1, Params = new object[] { "/class:AB? cnt7.xsl", "AB?", "cnt7.dll", "cnt7.txt" })]
+ // [InlineData("/class:AB? cnt7.xsl", "AB?", "cnt7.dll", "cnt7.txt")]
+ // //[Variation("8", Desc = "Exercise same classname, one in defautl NS, one in fully-qualified NS", Pri = 1, Params = new object[] { "/class:myclass cnt8a.xsl /class:myns.myclass cnt8b.xsl", "myclass", "cnt8a.dll", "cnt8.txt" })]
+ // [InlineData("/class:myclass cnt8a.xsl /class:myns.myclass cnt8b.xsl", "myclass", "cnt8a.dll", "cnt8.txt")]
+ // //[Variation("9", Desc = "Exercise same classname, different namespaces", Pri = 1, Params = new object[] { "/class:ns1.myclass cnt9a.xsl /class:ns2.myclass cnt9b.xsl", "ns1.myclass", "cnt9a.dll", "cnt9.txt" })]
+ // [InlineData("/class:ns1.myclass cnt9a.xsl /class:ns2.myclass cnt9b.xsl", "ns1.myclass", "cnt9a.dll", "cnt9.txt")]
+ // //[Variation("10", Desc = "Exercise same namespace, different classnames", Pri = 1, Params = new object[] { "/class:ns.myclass1 cnt10a.xsl /class:ns.myclass2 cnt10b.xsl", "ns.myclass2", "cnt10a.dll", "cnt10.txt" })]
+ // [InlineData("/class:ns.myclass1 cnt10a.xsl /class:ns.myclass2 cnt10b.xsl", "ns.myclass2", "cnt10a.dll", "cnt10.txt")]
+ // //[Variation("11", Desc = "Exercise inner class classname", Pri = 2, Params = new object[] { "/class:myclass1 cnt11a.xsl /class:myclass1.myclass2 cnt11b.xsl", "myclass1", "cnt11a.dll", "cnt11.txt" })]
+ // [InlineData("/class:myclass1 cnt11a.xsl /class:myclass1.myclass2 cnt11b.xsl", "myclass1", "cnt11a.dll", "cnt11.txt")]
+ // //[Variation("12", Desc = "Exercise inner class classname ordered", Pri = 1, Params = new object[] { "/class:myclass1.myclass2 cnt12b.xsl /class:myclass1 cnt12a.xsl ", "myclass1", "cnt12b.dll", "cnt12.txt" })]
+ // [InlineData("/class:myclass1.myclass2 cnt12b.xsl /class:myclass1 cnt12a.xsl ", "myclass1", "cnt12b.dll", "cnt12.txt")]
+ // //[Variation("14", Desc = "Exercise case sensitivity-2", Pri = 1, Params = new object[] { "/class:MyStyleSheEt cnt14.xsl /class:MystylesheeT cnt14b.xsl", "MyStyleSheEt", "cnt14.dll", "cnt14.txt" })]
+ // [InlineData("/class:MyStyleSheEt cnt14.xsl /class:MystylesheeT cnt14b.xsl", "MyStyleSheEt", "cnt14.dll", "cnt14.txt")]
+ // //[Variation("16", Desc = "Exercise stylesheet name with multiple dots for default classname ", Pri = 2, Params = new object[] { "ns1.ns2.cnt16.xsl", "ns1.ns2.cnt16", "ns1.ns2.cnt16.dll", "cnt16.txt" })]
+ // [InlineData("ns1.ns2.cnt16.xsl", "ns1.ns2.cnt16", "ns1.ns2.cnt16.dll", "cnt16.txt")]
+ // //[Variation("17", Desc = "Exercise stylesheet name with multiple adjacent dots for default classname", Pri = 2, Params = new object[] { "ns1..cnt17.xsl", "ns1..cnt17", "ns1..cnt17.dll", "cnt17.txt" })]
+ // [InlineData("ns1..cnt17.xsl", "ns1..cnt17", "ns1..cnt17.dll", "cnt17.txt")]
+ // //[Variation("19", Desc = "Exercise a stylesheet with invalid c# classname", Pri = 1, Params = new object[] { "2-(1)cnt19.xsl", "2-(1)cnt19", "2-(1)cnt19.dll", "cnt19.txt" })]
+ // [InlineData("2-(1)cnt19.xsl", "2-(1)cnt19", "2-(1)cnt19.dll", "cnt19.txt")]
+ // //[Variation("21", Desc = "Exercise keyword case sensitivity", Pri = 1, Params = new object[] { "/CLasS:cnt21 cnt21.xsl", "cnt21", "cnt21.dll", "cnt21.txt" })]
+ // [InlineData("/CLasS:cnt21 cnt21.xsl", "cnt21", "cnt21.dll", "cnt21.txt")]
+ // //[Variation("22", Desc = "Exercise a space containing classname", Pri = 2, Params = new object[] { "/class:\"cn t22\" cnt22.xsl", "cn t22", "cnt22.dll", "cnt22.txt" })]
+ // [InlineData("/class:\"cn t22\" cnt22.xsl", "cn t22", "cnt22.dll", "cnt22.txt")]
+ // //[Variation("23", Desc = "Exercise short form", Pri = 1, Params = new object[] { "-c:myclass cnt23.xsl", "myclass", "cnt23.dll", "cnt23.txt" })]
+ // [InlineData("-c:myclass cnt23.xsl", "myclass", "cnt23.dll", "cnt23.txt")]
+ // //[Variation("25", Desc = "Exercise two classnames differentiated only by Cyrillic E", Pri = 1, Params = new object[] { "/class:\u0400cnt25\u0400 cnt25a.xsl /class:cnt25 cnt25b.xsl", "\u0400cnt25\u0400", "cnt25a.dll", "cnt25.txt" })]
+ // [InlineData("/class:\u0400cnt25\u0400 cnt25a.xsl /class:cnt25 cnt25b.xsl", "\u0400cnt25\u0400", "cnt25a.dll", "cnt25.txt")]
+ // //[Variation("26", Desc = "Exercise two classnames differentiated only by zero width non breaking space and zero width non joiner", Pri = 1, Params = new object[] { "/class:\uFEFFcnt26\u200B cnt26a.xsl /class:cnt26 cnt26b.xsl", "\uFEFFcnt26\u200B", "cnt26a.dll", "cnt26.txt" })]
+ // [InlineData("/class:\uFEFFcnt26\u200B cnt26a.xsl /class:cnt26 cnt26b.xsl", "\uFEFFcnt26\u200B", "cnt26a.dll", "cnt26.txt")]
+ // //[Variation("27", Desc = "Exercise two classnames differentiated only by latin a combined with ring above and \u00e5", Pri = 1, Params = new object[] { "/class:\u0061\u030acnt27 cnt27a.xsl /class:\u00e5cnt27 cnt27b.xsl", "\u0061\u030acnt27", "cnt27a.dll", "cnt27.txt" })]
+ // [InlineData("/class:\u0061\u030acnt27 cnt27a.xsl /class:\u00e5cnt27 cnt27b.xsl", "\u0061\u030acnt27", "cnt27a.dll", "cnt27.txt")]
+ // //[Variation("28", Desc = "Exercise two classnames differentiated only by latin small y and IPA block phoenetic y with load", Pri = 1, Params = new object[] { "/class:\u0079cnt28 cnt28a.xsl /class:\u028Fcnt28 cnt28b.xsl", "\u0079cnt28", "cnt28a.dll", "cnt28.txt" })]
+ // [InlineData("/class:\u0079cnt28 cnt28a.xsl /class:\u028Fcnt28 cnt28b.xsl", "\u0079cnt28", "cnt28a.dll", "cnt28.txt")]
+ // //[Variation("29", Desc = "Exercise classnames containing (0x03C2), (0x03A3) and (0x03C3), where 2 lower case characters have the same upper case character", Pri = 1, Params = new object[] { "/class:\u03C2\u03A3\u03C3cnt29 cnt29a.xsl /class:\u03A3\u03C2\u03C3cnt29 cnt29b.xsl", "\u03C2\u03A3\u03C3cnt29", "cnt29a.dll", "cnt29.txt" })]
+ // [InlineData("/class:\u03C2\u03A3\u03C3cnt29 cnt29a.xsl /class:\u03A3\u03C2\u03C3cnt29 cnt29b.xsl", "\u03C2\u03A3\u03C3cnt29", "cnt29a.dll", "cnt29.txt")]
+ // [Theory]
+ // public void Var1(object param0, object param1, object param2, object param3)
+ // {
+ // String cmdLine = param0.ToString();
+ // String asmName = param2.ToString();
+ // bool asmCreated = true;
+ // String typeName = param1.ToString();
+ // String pdbName = Path.ChangeExtension(param2.ToString(), ".pdb");
+ // bool pdbCreated = false;
+ // String baselineFile = param3.ToString();
+
+ // VerifyTest(cmdLine, asmName, asmCreated, typeName, pdbName, pdbCreated, baselineFile, _createFromInputFile);
+ // }
+
+ // //[Variation("3", Desc = "Exercise an invalid case, empty/no argument", Pri = 1, Params = new object[] { "/class: cnt3.xsl", "cnt3.txt" })]
+ // [InlineData("/class: cnt3.xsl", "cnt3.txt")]
+ // //[Variation("13", Desc = "Exercise an invalid case, class specified without colon", Pri = 1, Params = new object[] { "/class cnt13.xsl", "cnt13.txt" })]
+ // [InlineData("/class cnt13.xsl", "cnt13.txt")]
+ // //[Variation("15", Desc = "Exercise classname conflict, 2 stylesheets one with default classname and one specifying the same", Pri = 2, Params = new object[] { "cnt15a.xsl /class:cnt15a cnt15b.xsl", "cnt15.txt" })]
+ // [InlineData("cnt15a.xsl /class:cnt15a cnt15b.xsl", "cnt15.txt")]
+ // //[Variation("18", Desc = "Exercise the basic use case, 2 stylesheets with different extensions", Pri = 2, Params = new object[] { "cnt18.xsl cnt18.xslt", "cnt18.txt" })]
+ // [InlineData("cnt18.xsl cnt18.xslt", "cnt18.txt")]
+ // //[Variation("20", Desc = "Exercise a very long classname", Pri = 2, Params = new object[] { "/class:cnt2001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 cnt20.xsl", "cnt20.txt", "EnglishOnly" })]
+ // //[InlineData("/class:cnt2001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 cnt20.xsl", "cnt20.txt"/*, "EnglishOnly"*/)]
+ // //[Variation("24", Desc = "Exercise multiple /class flags for one stylesheet", Pri = 1, Params = new object[] { "/class:A /class:B cnt24.xsl", "cnt24.txt" })]
+ // [InlineData("/class:A /class:B cnt24.xsl", "cnt24.txt")]
+ // [Theory]
+ // public void Var2(object param0, object param1)
+ // {
+ // if (ShouldSkip(new object[] { param0, param1 }))
+ // {
+ // return; //TEST_SKIPPED;
+ // }
+ // String cmdLine = param0.ToString();
+ // String baselineFile = param1.ToString();
+
+ // VerifyTest(cmdLine, baselineFile, _createFromInputFile);
+ // }
+ //}
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCompile.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCompile.cs
new file mode 100644
index 0000000000..b838861c6e
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestCompile.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+//using Xunit;
+//using Xunit.Abstractions;
+//using System.IO;
+//using System.Xml;
+//using System.Xml.Xsl;
+
+// BinCompat TODO: Disabling this for now, as this is loading a dll with no strong name
+//namespace System.Xml.Tests
+//{
+// //[TestCase(Name = "Compile Time Tests", Desc = "This Testcase maps to test variations described in 'CompileTime Variations Functional Tests'")]
+// public class XsltcTestCompile : XsltcTestCaseBase
+// {
+// private ITestOutputHelper _output;
+// public XsltcTestCompile(ITestOutputHelper output) : base(output)
+// {
+// _output = output;
+// }
+
+// //[Variation("1", Desc = "Test calling XslCompiledTransform(typeof()) instead of using reflection to load the assembly.", Pri = 1)]
+// [InlineData()]
+// [Theory]
+// public void Var1()
+// {
+// var inputXml = new XmlDocument();
+// inputXml.LoadXml("<foo><bar>Hello, world!</bar></foo>");
+
+// var xslt = new XslCompiledTransform();
+// xslt.Load(typeof(TestStylesheet));
+
+// using (var actualStream = new MemoryStream())
+// using (var sw = new StreamWriter(actualStream)
+// {
+// AutoFlush = true
+// })
+// {
+// xslt.Transform(inputXml, null, sw);
+
+// CompareOutput("<?xml version=\"1.0\" encoding=\"utf-8\"?>Hello foo!", actualStream);
+
+// return;
+// }
+// }
+// }
+//} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestFile.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestFile.cs
new file mode 100644
index 0000000000..339e8fa57f
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestFile.cs
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using Xunit.Abstractions;
+using System;
+
+namespace System.Xml.Tests
+{
+ //[TestCase(Name = "File Option Tests", Desc = "This Testcase maps to test variations described in '@file Functional Tests'")]
+ public class XsltcTestFile : XsltcTestCaseBase
+ {
+ private ITestOutputHelper _output;
+ public XsltcTestFile(ITestOutputHelper output) : base(output)
+ {
+ _output = output;
+ }
+
+ //[Variation("2", Desc = "Create a file that is Unicode encoded and send to xsltc.exe", Pri = 1, Params = new object[] { "@infft2.txt", "fft2.dll", "yes", "fft2", "fft2.pdb", "no", "fft2.txt" })]
+ //[InlineData("@infft2.txt", "fft2.dll", "yes", "fft2", "fft2.pdb", "no", "fft2.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("3", Desc = "Create a file that is UTF-8 encoded and send to xsltc.exe", Pri = 1, Params = new object[] { "@infft3.txt", "fft3.dll", "yes", "fft3", "fft3.pdb", "no", "fft3.txt" })]
+ //[InlineData("@infft3.txt", "fft3.dll", "yes", "fft3", "fft3.pdb", "no", "fft3.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("4", Desc = "Write specific @files with different quote sets to test quote processing", Pri = 1, Params = new object[] { "@infft4.txt", "fft4.dll", "yes", "fft4", "fft4.pdb", "yes", "fft4.txt" })]
+ //[InlineData("@infft4.txt", "fft4.dll", "yes", "fft4", "fft4.pdb", "yes", "fft4.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("5", Desc = "Write specific @file with unsupported format, to see how Xsltc handles invalid format input files.", Pri = 1, Params = new object[] { "@infft5.txt", "fft5.dll", "no", "fft5", "fft5.pdb", "no", "fft5.txt" })]
+ //[InlineData("@infft5.txt", "fft5.dll", "no", "fft5", "fft5.pdb", "no", "fft5.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("6", Desc = "Write specific @file with line thats almost the same as a specified command line, see which takes precedence", Pri = 1, Params = new object[] { "/out:fft.dll @infft6.txt", "fft6.dll", "yes", "fft6", "fft6.pdb", "no", "fft6.txt" })]
+ //[InlineData("/out:fft.dll @infft6.txt", "fft6.dll", "yes", "fft6", "fft6.pdb", "no", "fft6.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("7", Desc = "Test multiple config files, command line, 2 config files", Pri = 1, Params = new object[] { "@infft7a.txt /out:fft7.dll @infft7b.txt", "fft7.dll", "yes", "fft7a", "fft7a.pdb", "no", "fft7.txt" })]
+ //[InlineData("@infft7a.txt /out:fft7.dll @infft7b.txt", "fft7.dll", "yes", "fft7a", "fft7a.pdb", "no", "fft7.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("8", Desc = "Test multiple config files, command line, config, command line, config", Pri = 1, Params = new object[] { "@infft8a.txt /out:fft8.dll @infft8b.txt /class:fft8d fft8d.xsl /debug+ @infft8c.txt", "fft8.dll", "yes", "fft8888b", "fft8.pdb", "yes", "fft8.txt" })]
+ //[InlineData("@infft8a.txt /out:fft8.dll @infft8b.txt /class:fft8d fft8d.xsl /debug+ @infft8c.txt", "fft8.dll", "yes", "fft8888b", "fft8.pdb", "yes", "fft8.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("9", Desc = "Test a config file that includes itself", Pri = 1, Params = new object[] { "@infft9.txt", "fft9.dll", "no", "fft9", "fft9.pdb", "no", "fft9.txt" })]
+ //[InlineData("@infft9.txt", "fft9.dll", "no", "fft9", "fft9.pdb", "no", "fft9.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("10", Desc = "Test multiple config files with circular reference", Pri = 1, Params = new object[] { "@infft10.txt", "fft10.dll", "no", "fft10", "fft10.pdb", "no", "fft10.txt" })]
+ //[InlineData("@infft10.txt", "fft10.dll", "no", "fft10", "fft10.pdb", "no", "fft10.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("11", Desc = "Test multiple config files with relative paths inside the files and command line", Pri = 1, Params = new object[] { @"@.\infft11.txt", "fft11.dll", "yes", "fft11", "fft11.pdb", "no", "fft11.txt" })]
+ //[InlineData(@"@.\infft11.txt", "fft11.dll", "yes", "fft11", "fft11.pdb", "no", "fft11.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("12", Desc = "Test multiple config files with circular reference and relative paths", Pri = 1, Params = new object[] { "@infft12.txt", "fft12.dll", "no", "fft12", "fft12.pdb", "no", "fft12.txt" })]
+ //[InlineData("@infft12.txt", "fft12.dll", "no", "fft12", "fft12.pdb", "no", "fft12.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("13", Desc = "Test multiple config files with fully qualified path inside the files and command line", Pri = 1, Params = new object[] { @"@$(CurrentWorkingDirectory)\infft13.txt", "fft13.dll", "yes", "fft13", "fft13.pdb", "no", "fft13.txt" })]
+ //[InlineData(@"@$(CurrentWorkingDirectory)\infft13.txt", "fft13.dll", "yes", "fft13", "fft13.pdb", "no", "fft13.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("14", Desc = "Test multiple config files with circular reference and fully qualified path inside the files", Pri = 1, Params = new object[] { "@infft14.txt", "fft14.dll", "no", "fft14", "fft14.pdb", "no", "fft14.txt" })]
+ [InlineData("@infft14.txt", "fft14.dll", "no", "fft14", "fft14.pdb", "no", "fft14.txt")]
+ //[Variation("15", Desc = "Test multiple config files with circular reference and case sensitive file names specified", Pri = 1, Params = new object[] { "@infft15.txt", "fft15.dll", "no", "fft15", "fft15.pdb", "no", "fft15.txt" })]
+ //[InlineData("@infft15.txt", "fft15.dll", "no", "fft15", "fft15.pdb", "no", "fft15.txt")] //Skipping this, it tries to load System.dll
+ //TODO: [Variation("16", Desc = "Test GB18030 encoded config file", Pri = 1, Params = new object[] { "@infft16.txt", "fft16.dll", "yes", "fft16", "fft16.pdb", "no", "fft16.txt" })]
+ //[Variation("17", Desc = "Exercise comments(‘#’) within file", Pri = 1, Params = new object[] { "@infft17.txt", "fft17.dll", "yes", "fft17", "fft17.pdb", "no", "fft17.txt" })]
+ //[InlineData("@infft17.txt", "fft17.dll", "yes", "fft17", "fft17.pdb", "no", "fft17.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("18", Desc = "When loading from a file exercise commands and filenames with ‘#” in them", Pri = 1, Params = new object[] { "@infft18.txt", "fft18.dll", "yes", "AB#CD", "fft18.pdb", "no", "fft18.txt" })]
+ //[InlineData("@infft18.txt", "fft18.dll", "yes", "AB#CD", "fft18.pdb", "no", "fft18.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("19", Desc = "Exercise wildcards with @", Pri = 1, Params = new object[] { "@*.txt", "fft19.dll", "no", "fft19", "fft19.pdb", "no", "fft19.txt", "EnglishOnly" })]
+ [InlineData("@*.txt", "fft19.dll", "no", "fft19", "fft19.pdb", "no", "fft19.txt"/*, "EnglishOnly"*/)]
+ //[Variation("20", Desc = "Exercise @ without filename", Pri = 1, Params = new object[] { "@", "fft20.dll", "no", "fft20", "fft20.pdb", "no", "fft20.txt" })]
+ [InlineData("@", "fft20.dll", "no", "fft20", "fft20.pdb", "no", "fft20.txt")]
+ //[Variation("21", Desc = "Exercise @ with not existing filename", Pri = 1, Params = new object[] { "@IDontExist", "fft21.dll", "no", "fft21", "fft21.pdb", "no", "fft21.txt" })]
+ [InlineData("@IDontExist", "fft21.dll", "no", "fft21", "fft21.pdb", "no", "fft21.txt")]
+ [Theory]
+ public void Var1(object param0, object param1, object param2, object param3, object param4, object param5, object param6)
+ {
+ if (ShouldSkip(new object[] { param0, param1, param2, param3, param4, param5, param6 }))
+ {
+ return; //TEST_SKIPPED;
+ }
+ String cmdLine = ReplaceCurrentWorkingDirectory(param0.ToString());
+ String asmName = param1.ToString();
+ bool asmCreated = String.Compare(param2.ToString(), "yes", true) == 0;
+ String typeName = param3.ToString();
+ String pdbName = param4.ToString();
+ bool pdbCreated = String.Compare(param5.ToString(), "yes", true) == 0;
+ String baselineFile = param6.ToString();
+
+ VerifyTest(cmdLine, asmName, asmCreated, typeName, pdbName, pdbCreated, baselineFile, _createFromInputFile);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestOut.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestOut.cs
new file mode 100644
index 0000000000..2d25120f44
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestOut.cs
@@ -0,0 +1,118 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using Xunit.Abstractions;
+using System;
+
+namespace System.Xml.Tests
+{
+ // Note: Skipping these tests as they try to load a dll which references System.dll
+ ////[TestCase(Name = "Out Option Tests", Desc = "This Testcase maps to test variations described in 'Out Functional Tests'")]
+ //public class XsltcTestOut : XsltcTestCaseBase
+ //{
+ // private ITestOutputHelper _output;
+ // public XsltcTestOut(ITestOutputHelper output) : base(output)
+ // {
+ // _output = output;
+ // }
+
+ // //[Variation("1", Desc = "Exercise basic use case, no option specified", Pri = 1, Params = new object[] { "oft1.xsl", "oft1.dll", "yes", "oft1", "oft1.txt" })]
+ // [InlineData("oft1.xsl", "oft1.dll", "yes", "oft1", "oft1.txt")]
+ // //[Variation("2", Desc = "Exercise basic use case, no option value", Pri = 1, Params = new object[] { "/out: oft2.xsl", "oft2.dll", "no", "oft2", "oft2.txt" })]
+ // [InlineData("/out: oft2.xsl", "oft2.dll", "no", "oft2", "oft2.txt")]
+ // //[Variation("3", Desc = "Exercise basic use case, assembly name different from stylesheet", Pri = 1, Params = new object[] { "/out:MyFoo.dll oft3.xsl", "MyFoo.dll", "yes", "oft3", "oft3.txt" })]
+ // [InlineData("/out:MyFoo.dll oft3.xsl", "MyFoo.dll", "yes", "oft3", "oft3.txt")]
+ // //[Variation("4", Desc = "Exercise basic use case, multiple stylesheets, no option specified", Pri = 1, Params = new object[] { "oft4a.xsl oft4b.xsl", "oft4a.dll", "yes", "oft4a", "oft4.txt" })]
+ // [InlineData("oft4a.xsl oft4b.xsl", "oft4a.dll", "yes", "oft4a", "oft4.txt")]
+ // //[Variation("5", Desc = "Exercise basic use case, multiple stylesheets, no option specified-2", Pri = 1, Params = new object[] { "oft5b.xsl oft5a.xsl", "oft5b.dll", "yes", "oft5a", "oft5.txt" })]
+ // [InlineData("oft5b.xsl oft5a.xsl", "oft5b.dll", "yes", "oft5a", "oft5.txt")]
+ // //[Variation("6", Desc = "Exercise basic use case, multiple stylesheets in one assembly", Pri = 1, Params = new object[] { "/out:oft6.dll oft6a.xsl oft6b.xsl", "oft6.dll", "yes", "oft6a", "oft6.txt" })]
+ // [InlineData("/out:oft6.dll oft6a.xsl oft6b.xsl", "oft6.dll", "yes", "oft6a", "oft6.txt")]
+ // //[Variation("7", Desc = "Exercise use case where assembly extension is specified, exe", Pri = 1, Params = new object[] { "/out:oft7.exe oft7.xsl", "oft7.exe", "yes", "oft7", "oft7.txt" })]
+ // [InlineData("/out:oft7.exe oft7.xsl", "oft7.exe", "yes", "oft7", "oft7.txt")]
+ // //[Variation("8", Desc = "Exercise use case where assembly extension is specified but different", Pri = 1, Params = new object[] { "/out:myfoo.doc oft8.xsl", "myfoo.doc", "yes", "oft8", "oft8.txt" })]
+ // [InlineData("/out:myfoo.doc oft8.xsl", "myfoo.doc", "yes", "oft8", "oft8.txt")]
+ // //[Variation("9", Desc = "Exercise use case, assembly extension is shorter than 3 chars", Pri = 1, Params = new object[] { "/out:oft9.xy oft9.xsl", "oft9.xy", "yes", "oft9", "oft9.txt" })]
+ // [InlineData("/out:oft9.xy oft9.xsl", "oft9.xy", "yes", "oft9", "oft9.txt")]
+ // //[Variation("10", Desc = "Exercise use case, assembly extension is longer than 3 chars", Pri = 1, Params = new object[] { "/out:oft10.xyzt oft10.xsl", "oft10.xyzt", "yes", "oft10", "oft10.txt" })]
+ // [InlineData("/out:oft10.xyzt oft10.xsl", "oft10.xyzt", "yes", "oft10", "oft10.txt")]
+ // //[Variation("11", Desc = "Exercise a very long assembly name", Pri = 1, Params = new object[] { "/out:oft1101234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.dll oft11.xsl", "oft1101234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.dll", "no", "oft11", "oft11.txt", "EnglishOnly" })]
+ // //[InlineData("/out:oft1101234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.dll oft11.xsl", "oft1101234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.dll", "no", "oft11", "oft11.txt"/*, "EnglishOnly"*/)]
+ // //[Variation("12", Desc = "Exercise a case where the output assembly name contains whitespace", Pri = 1, Params = new object[] { "/out:\"oft 12.dll\" oft12.xsl", "oft 12.dll", "yes", "oft12", "oft12.txt" })]
+ // [InlineData("/out:\"oft 12.dll\" oft12.xsl", "oft 12.dll", "yes", "oft12", "oft12.txt")]
+ // //[Variation("13", Desc = "Exercise keyword case sensitivity", Pri = 1, Params = new object[] { "/OUt:oft13.dll oft13.xsl", "oft13.dll", "yes", "oft13", "oft13.txt" })]
+ // [InlineData("/OUt:oft13.dll oft13.xsl", "oft13.dll", "yes", "oft13", "oft13.txt")]
+ // //[Variation("14", Desc = "Exercise fully qualified output path", Pri = 1, Params = new object[] { @"/out:$(CurrentWorkingDirectory)\oft14.dll oft14.xsl", "oft14.dll", "yes", "oft14", "oft14.txt" })]
+ // [InlineData(@"/out:$(CurrentWorkingDirectory)\oft14.dll oft14.xsl", "oft14.dll", "yes", "oft14", "oft14.txt")]
+ // //[Variation("15", Desc = "Exercise relative output path", Pri = 1, Params = new object[] { @"/out:.\oft15.dll oft15.xsl", "oft15.dll", "yes", "oft15", "oft15.txt" })]
+ // [InlineData(@"/out:.\oft15.dll oft15.xsl", "oft15.dll", "yes", "oft15", "oft15.txt")]
+ // //[Variation("16", Desc = "Exercise relative output path with forward slash", Pri = 1, Params = new object[] { @"/out:./oft16.dll oft16.xsl", "oft16.dll", "yes", "oft16", "oft16.txt" })]
+ // [InlineData(@"/out:./oft16.dll oft16.xsl", "oft16.dll", "yes", "oft16", "oft16.txt")]
+ // //[Variation("18", Desc = "Exercise output to device", Pri = 1, Params = new object[] { "/out:a:\\oft18.dll oft18.xsl", "oft18.dll", "no", "oft18", "oft18.txt", "EnglishOnly" })]
+ // [InlineData("/out:a:\\oft18.dll oft18.xsl", "oft18.dll", "no", "oft18", "oft18.txt"/*, "EnglishOnly"*/)]
+ // //[Variation("19", Desc = "Exercise output to null device", Pri = 1, Params = new object[] { "/out:nul.dll oft19.xsl", "nul.dll", "no", "oft19", "oft19.txt" })]
+ // [InlineData("/out:nul.dll oft19.xsl", "nul.dll", "no", "oft19", "oft19.txt")]
+ // //[Variation("20", Desc = "Exercise assembly name with invalid chars", Pri = 1, Params = new object[] { "/out:\"oft|20.dll\" oft20.xsl", "oft|20.dll", "no", "oft20", "oft20.txt", "EnglishOnly" })]
+ // [InlineData("/out:\"oft|20.dll\" oft20.xsl", "oft|20.dll", "no", "oft20", "oft20.txt"/*, "EnglishOnly"*/)]
+ // //[Variation("21", Desc = "Exercise reserved device name as assembly name", Pri = 1, Params = new object[] { "/out:\"COM1.dll\" oft21.xsl", "COM1.dll", "no", "oft21", "oft21.txt" })]
+ // [InlineData("/out:\"COM1.dll\" oft21.xsl", "COM1.dll", "no", "oft21", "oft21.txt")]
+ // //[Variation("23", Desc = "Exercise assembly named ..a", Pri = 1, Params = new object[] { "/out:..oft23 oft23.xsl", "..oft23", "yes", "oft23", "oft23.txt" })]
+ // [InlineData("/out:..oft23 oft23.xsl", "..oft23", "yes", "oft23", "oft23.txt")]
+ // //[Variation("24", Desc = "Exercise file path with . in it", Pri = 1, Params = new object[] { "/out:MyFoo.dll oft3.xsl", "MyFoo.dll", "yes", "oft3", "oft3.txt" })]
+ // //[Variation("25", Desc = "Exercise space containing assembly extension", Pri = 1, Params = new object[] { "/out:\"oft25.d l\" oft25.xsl", "oft25.d l", "yes", "oft25", "oft25.txt" })]
+ // [InlineData("/out:\"oft25.d l\" oft25.xsl", "oft25.d l", "yes", "oft25", "oft25.txt")]
+ // //[Variation("26", Desc = "Exercise space containing assembly path", Pri = 1, Params = new object[] { "/out:MyFoo.dll oft3.xsl", "MyFoo.dll", "yes", "oft3", "oft3.txt" })]
+ // //[Variation("27", Desc = "Exercise multiple /out: flags", Pri = 1, Params = new object[] { "/out:oft27A.dll /out:oft27B.dll oft27.xsl", "oft27B.dll", "yes", "oft27", "oft27.txt" })]
+ // [InlineData("/out:oft27A.dll /out:oft27B.dll oft27.xsl", "oft27B.dll", "yes", "oft27", "oft27.txt")]
+ // //[Variation("29", Desc = "Exercise device name containing path", Pri = 1, Params = new object[] { "/out:d:/nul/oft29.dll oft29.xsl", "oft29.dll", "no", "oft29", "oft29.txt", "EnglishOnly" })]
+ // [InlineData("/out:d:/nul/oft29.dll oft29.xsl", "oft29.dll", "no", "oft29", "oft29.txt"/*, "EnglishOnly"*/)]
+ // //[Variation("30", Desc = "No directory with intranet path", Pri = 1, Params = new object[] { @"/out:\\foo\bar.dll oft30.xsl", "oft30.dll", "no", "oft30", "oft30.txt" })]
+ // [InlineData(@"/out:\\foo\bar.dll oft30.xsl", "oft30.dll", "no", "oft30", "oft30.txt")]
+ // //[Variation("31", Desc = "Invalid intranet path", Pri = 1, Params = new object[] { @"/out:\\foo\foo\bar.dll oft31.xsl", "oft31.dll", "no", "oft31", "oft31.txt", "EnglishOnly" })]
+ // [InlineData(@"/out:\\foo\foo\bar.dll oft31.xsl", "oft31.dll", "no", "oft31", "oft31.txt"/*, "EnglishOnly"*/)]
+ // [Theory]
+ // public virtual void Var1(object param0, object param1, object param2, object param3, object param4)
+ // {
+ // if (ShouldSkip(new object[] { param0, param1, param2, param3, param4}))
+ // {
+ // return; //TEST_SKIPPED;
+ // }
+ // String cmdLine,
+ // asmName,
+ // typeName,
+ // baselineFile;
+ // bool asmCreated;
+
+ // VarParse(param0, param1, param2, param3, param4, out cmdLine, out asmName, out asmCreated, out typeName, out baselineFile);
+
+ // VerifyTest(cmdLine, asmName, asmCreated, typeName, baselineFile, _createFromInputFile);
+ // }
+
+ // //[Variation("28", Desc = "Exercise an assembly name composed of zero width chars and Cyrillic E", Pri = 1, Params = new object[] { "/out:\u0400\uFEFF\u200B.\u0400\uFEFF\u200B\u0400 oft28.xsl", "\u0400\uFEFF\u200B.\u0400\uFEFF\u200B\u0400", "yes", "oft28", "oft28.txt" })]
+ // [InlineData("/out:\u0400\uFEFF\u200B.\u0400\uFEFF\u200B\u0400 oft28.xsl", "\u0400\uFEFF\u200B.\u0400\uFEFF\u200B\u0400", "yes", "oft28", "oft28.txt")]
+ // [Theory]
+ // public virtual void Var2(object param0, object param1, object param2, object param3, object param4)
+ // {
+ // String cmdLine,
+ // asmName,
+ // typeName,
+ // baselineFile;
+ // bool asmCreated;
+
+ // VarParse(param0, param1, param2, param3, param4, out cmdLine, out asmName, out asmCreated, out typeName, out baselineFile);
+
+ // VerifyTest(cmdLine, asmName, asmCreated, typeName, String.Empty, false, baselineFile, false, _createFromInputFile);
+ // }
+
+ // public virtual void VarParse(object param0, object param1, object param2, object param3, object param4, out String cmdLine, out String asmName, out bool asmCreated, out String typeName, out String baselineFile)
+ // {
+ // cmdLine = ReplaceCurrentWorkingDirectory(param0.ToString());
+ // asmName = param1.ToString();
+ // asmCreated = String.Compare(param2.ToString(), "yes", true) == 0;
+ // typeName = param3.ToString();
+ // baselineFile = param4.ToString();
+ // }
+ //}
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestPlatform.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestPlatform.cs
new file mode 100644
index 0000000000..d39312cbb0
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestPlatform.cs
@@ -0,0 +1,118 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using Xunit.Abstractions;
+using System;
+using System.Globalization;
+using System.IO;
+
+namespace System.Xml.Tests
+{
+ //[TestCase(Name = "Platform Option Tests", Desc = "This Testcase maps to test variations described in 'Platform Functional Tests'")]
+ public class XsltcTestPlatform : XsltcTestCaseBase
+ {
+ private ITestOutputHelper _output;
+ public XsltcTestPlatform(ITestOutputHelper output) : base(output)
+ {
+ _output = output;
+ }
+
+ //[Variation("1", Desc = "Exercise basic use case, no option specified", Pri = 1, Params = new object[] { "pft1.xsl", "pft1", "pft1.dll", "pft1.txt" })]
+ //[InlineData("pft1.xsl", "pft1", "pft1.dll", "pft1.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("3", Desc = "Exercise basic use case, a supported option val", Pri = 1, Params = new object[] { "/platform:x64 pft3.xsl", "", "pft3.dll", "pft3.txt" })]
+ [InlineData("/platform:x64 pft3.xsl", "", "pft3.dll", "pft3.txt")]
+ //[Variation("7", Desc = "Exercise keyword case sensitivity -1 ", Pri = 1, Params = new object[] { "/PLAtforM:X86 pft7.xsl", "", "pft7.dll", "pft7.txt" })]
+ //[InlineData("/PLAtforM:X86 pft7.xsl", "", "pft7.dll", "pft7.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("8", Desc = "Exercise keyword case sensitivity -2", Pri = 1, Params = new object[] { "/PLAtforM:ItaNiuM pft8.xsl", "", "pft8.dll", "pft8.txt" })]
+ [InlineData("/PLAtforM:ItaNiuM pft8.xsl", "", "pft8.dll", "pft8.txt")]
+ //[Variation("9", Desc = "Exercise keyword case sensitivity -3", Pri = 1, Params = new object[] { "/PLAtforM:X64 pft9.xsl", "", "pft9.dll", "pft9.txt" })]
+ //[InlineData("/PLAtforM:X64 pft9.xsl", "", "pft9.dll", "pft9.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("10", Desc = "Exercise keyword case sensitivity -4", Pri = 1, Params = new object[] { "/PLAtforM:AnyCpU pft10.xsl", "", "pft10.dll", "pft10.txt" })]
+ [InlineData("/PLAtforM:AnyCpU pft10.xsl", "", "pft10.dll", "pft10.txt")]
+ //[Variation("17", Desc = "Compile an assembly for anycpu and load", Pri = 1, Params = new object[] { "/platform:anycpu pft17.xsl", "pft17", "pft17.dll", "pft17.txt" })]
+ //[InlineData("/platform:anycpu pft17.xsl", "pft17", "pft17.dll", "pft17.txt")] //Skipping this, it tries to load System.dll
+ [Theory]
+ public void Var1(object param0, object param1, object param2, object param3)
+ {
+ String cmdLine = param0.ToString();
+ String asmName = param2.ToString();
+ bool asmCreated = true;
+ String typeName = param1.ToString();
+ String pdbName = Path.ChangeExtension(param2.ToString(), ".pdb");
+ bool pdbCreated = false;
+ String baselineFile = param3.ToString();
+
+ VerifyTest(cmdLine, asmName, asmCreated, typeName, pdbName, pdbCreated, baselineFile, _createFromInputFile);
+ }
+
+ //[Variation("2", Desc = "Exercise basic use case, no option value", Pri = 1, Params = new object[] { "/platform: pft2.xsl", "pft2.txt" })]
+ [InlineData("/platform: pft2.xsl", "pft2.txt")]
+ //[Variation("4", Desc = "Exercise basic use case, an unsupported option value", Pri = 1, Params = new object[] { "/platform:foo pft4.xsl", "pft4.txt" })]
+ [InlineData("/platform:foo pft4.xsl", "pft4.txt")]
+ //[Variation("11", Desc = "Exercise basic use case, an unsupported option value -1", Pri = 1, Params = new object[] { "/platform pft11.xsl", "pft11.txt" })]
+ //[InlineData("/platform pft11.xsl", "pft11.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("12", Desc = "Exercise basic use case, an unsupported option value -2", Pri = 1, Params = new object[] { "/platform: pft12.xsl", "pft12.txt" })]
+ [InlineData("/platform: pft12.xsl", "pft12.txt")]
+ //[Variation("13", Desc = "Exercise basic use case, an unsupported option value -3", Pri = 1, Params = new object[] { "/platform:* pft13.xsl", "pft13.txt" })]
+ //[InlineData("/platform:* pft13.xsl", "pft13.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("14", Desc = "Exercise basic use case, an unsupported option value -4", Pri = 1, Params = new object[] { "/platform:x86x64 pft14.xsl", "pft14.txt" })]
+ //[InlineData("/platform:x86x64 pft14.xsl", "pft14.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("15", Desc = "Exercise basic use case, an unsupported option value -5", Pri = 1, Params = new object[] { "/platform:x86,x64 pft15.xsl", "pft15.txt" })]
+ //[InlineData("/platform:x86,x64 pft15.xsl", "pft15.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("16", Desc = "Exercise basic use case, an unsupported option value -6", Pri = 1, Params = new object[] { "/platform:x86;x64 pft16.xsl", "pft16.txt" })]
+ [InlineData("/platform:x86;x64 pft16.xsl", "pft16.txt")]
+ [Theory]
+ public void Var2(object param0, object param1)
+ {
+ String cmdLine = param0.ToString();
+ String baselineFile = param1.ToString();
+
+ VerifyTest(cmdLine, baselineFile, _createFromInputFile);
+ }
+
+ //[Variation("18", Desc = "Compile an assembly for machine's platform and load", Pri = 1, Params = new object[] { "pft18.xsl", "pft18.dll", "yes", "pft18", "pft18.pdb", "no", "pft18.txt", "yes" })]
+ //[InlineData("pft18.xsl", "pft18.dll", "yes", "pft18", "pft18.pdb", "no", "pft18.txt", "yes")] //Skipping this, it tries to load System.dll
+ //[Variation("19", Desc = "Compile an assembly for different platform and load", Pri = 1, Params = new object[] { "pft19.xsl", "pft19.dll", "yes", "", "pft19.pdb", "no", "pft19.txt", "no" })]
+ [InlineData("pft19.xsl", "pft19.dll", "yes", "", "pft19.pdb", "no", "pft19.txt", "no")]
+ //[Variation("20", Desc = "Exercise multiple /platform: flags", Pri = 1, Params = new object[] { "/platform:X64 pft20.xsl" /*+ " /platform:<current>*/, "pft20.dll", "yes", "pft20", "pft20.pdb", "no", "pft20.txt", "yes" })]
+ //[InlineData("/platform:X64 pft20.xsl" /*+ " /platform:<current>*/, "pft20.dll", "yes", "pft20", "pft20.pdb", "no", "pft20.txt", "yes")] //Skipping this, it tries to load System.dll
+ [Theory]
+ public void Var3(object param0, object param1, object param2, object param3, object param4, object param5, object param6, object param7)
+ {
+ String platform = "X86"; //CModInfo.Options["Arc"] as String;
+ bool isSameMachine = String.Compare(param7.ToString(), "yes", true) == 0;
+
+ string[] platforms = { "x86", "x64", "Itanium" };
+ int index;
+
+ if (platform == null)
+ {
+ Assert.True(false);
+ }
+ if (String.Compare("AMD64", platform, true) == 0)
+ {
+ index = 1;
+ }
+ else
+ {
+ index = 0;
+ }
+
+ platform = platforms[(index + (isSameMachine
+ ? 0
+ : 1)) % platforms.Length];
+
+ String cmdLine = param0 + " " + "/platform:" + platform;
+ String asmName = param1.ToString();
+ bool asmCreated = String.Compare(param2.ToString(), "yes", true) == 0;
+ String typeName = param3.ToString();
+ String pdbName = param4.ToString();
+ bool pdbCreated = String.Compare(param5.ToString(), "yes", true) == 0;
+ String baselineFile = param6.ToString();
+
+ VerifyTest(cmdLine, asmName, asmCreated, typeName, pdbName, pdbCreated, baselineFile, _createFromInputFile);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestSettings.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestSettings.cs
new file mode 100644
index 0000000000..d95b195607
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/CommonScenarios/XsltcTestSettings.cs
@@ -0,0 +1,112 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using Xunit.Abstractions;
+using System;
+
+namespace System.Xml.Tests
+{
+ //[TestCase(Name = "Settings Tests", Desc = "This Testcase maps to test variations described in 'Settings Functional Tests'")]
+ public class XsltcTestSettings : XsltcTestCaseBase
+ {
+ private ITestOutputHelper _output;
+ public XsltcTestSettings(ITestOutputHelper output) : base(output)
+ {
+ _output = output;
+ }
+
+ //[Variation("1", Desc = "Basic /settings test cases, stylesheet has DTD, where DTD+", Pri = 0, Params = new object[] { "/settings:DTD+ sft1.xsl", "sft1.dll", "yes", "sft1", "sft1.pdb", "no", "sft1.txt" })]
+ //[InlineData("/settings:DTD+ sft1.xsl", "sft1.dll", "yes", "sft1", "sft1.pdb", "no", "sft1.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("2", Desc = "Basic /settings test cases, stylesheet has DTD, where DTD-", Pri = 0, Params = new object[] { "/settings:DTD- sft2.xsl", "sft2.dll", "no", "sft2", "sft2.pdb", "no", "sft2.txt" })]
+ //[InlineData("/settings:DTD- sft2.xsl", "sft2.dll", "no", "sft2", "sft2.pdb", "no", "sft2.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("3", Desc = "Basic /settings test cases, stylesheet has script, where script+", Pri = 0, Params = new object[] { "/settings:script+ sft3.xsl", "sft3.dll", "yes", "sft3", "sft3.pdb", "no", "sft3.txt" })]
+ //[InlineData("/settings:script+ sft3.xsl", "sft3.dll", "yes", "sft3", "sft3.pdb", "no", "sft3.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("4", Desc = "Basic /settings test cases, stylesheet has script, where script-", Pri = 0, Params = new object[] { "/settings:script- sft4.xsl", "sft4hack.dll", "no", "sft4", "sft4.pdb", "no", "sft4.txt" })]
+ [InlineData("/settings:script- sft4.xsl", "sft4hack.dll", "no", "sft4", "sft4.pdb", "no", "sft4.txt")]
+ //[Variation("5", Desc = "Basic /settings test cases, stylesheet has document(), where document+", Pri = 0, Params = new object[] { "/settings:document+ sft5.xsl", "sft5.dll", "yes", "sft5", "sft5.pdb", "no", "sft5.txt" })]
+ //[InlineData("/settings:document+ sft5.xsl", "sft5.dll", "yes", "sft5", "sft5.pdb", "no", "sft5.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("6", Desc = "Basic /settings test cases, stylesheet has document(), where document-", Pri = 0, Params = new object[] { "/settings:document- sft6.xsl", "sft6hack.dll", "no", "sft6", "sft6.pdb", "no", "sft6.txt" })]
+ [InlineData("/settings:document- sft6.xsl", "sft6hack.dll", "no", "sft6", "sft6.pdb", "no", "sft6.txt")]
+ //[Variation("7", Desc = "Exercise settings with no colon", Pri = 0, Params = new object[] { "/settingsDTD+ sft7.xsl", "sft7.dll", "no", "sft7", "sft7.pdb", "no", "sft7.txt" })]
+ [InlineData("/settingsDTD+ sft7.xsl", "sft7.dll", "no", "sft7", "sft7.pdb", "no", "sft7.txt")]
+ //[Variation("8", Desc = "Exercise settings with no option value", Pri = 0, Params = new object[] { "/settings: sft8.xsl", "sft8.dll", "yes", "sft8", "sft8.pdb", "no", "sft8.txt" })]
+ //[InlineData("/settings: sft8.xsl", "sft8.dll", "yes", "sft8", "sft8.pdb", "no", "sft8.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("9", Desc = "Exercise DTD switch without +/-, stylesheet has DTD", Pri = 0, Params = new object[] { "/settings:DTD sft9.xsl", "sft9.dll", "yes", "sft9", "sft9.pdb", "no", "sft9.txt" })]
+ //[InlineData("/settings:DTD sft9.xsl", "sft9.dll", "yes", "sft9", "sft9.pdb", "no", "sft9.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("10", Desc = "Exercise script switch without +/-, stylesheet has script block", Pri = 0, Params = new object[] { "/settings:script sft10.xsl", "sft10.dll", "yes", "sft10", "sft10.pdb", "no", "sft10.txt" })]
+ //[InlineData("/settings:script sft10.xsl", "sft10.dll", "yes", "sft10", "sft10.pdb", "no", "sft10.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("11", Desc = "Exercise document switch without +/-, stylesheet has document() function", Pri = 0, Params = new object[] { "/settings:document sft11.xsl", "sft11.dll", "yes", "sft11", "sft11.pdb", "no", "sft11.txt" })]
+ //[InlineData("/settings:document sft11.xsl", "sft11.dll", "yes", "sft11", "sft11.pdb", "no", "sft11.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("13", Desc = "Exercise keyword case sensitivity", Pri = 0, Params = new object[] { "/SeTTings:DOCument+ sft13.xsl", "sft13.dll", "yes", "sft13", "sft13.pdb", "no", "sft13.txt" })]
+ //[InlineData("/SeTTings:DOCument+ sft13.xsl", "sft13.dll", "yes", "sft13", "sft13.pdb", "no", "sft13.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("14", Desc = "Exercise Turkish I problem", Pri = 0, Params = new object[] { "/SETTÄ°NGS:SCRÄ°PT+ sft14.xsl", "sft14.dll", "no", "sft14", "sft14.pdb", "no", "sft14.txt", "EnglishOnly" })]
+ [InlineData("/SETT\u0130NGS:SCR\u0130PT+ sft14.xsl", "sft14.dll", "no", "sft14", "sft14.pdb", "no", "sft14.txt"/*, "EnglishOnly"*/)]
+ //[Variation("15", Desc = "Exercise conflicting +, - symbols", Pri = 0, Params = new object[] { "/settings:script+- sft15.xsl", "sft15.dll", "no", "sft15", "sft15.pdb", "no", "sft15.txt" })]
+ [InlineData("/settings:script+- sft15.xsl", "sft15.dll", "no", "sft15", "sft15.pdb", "no", "sft15.txt")]
+ //[Variation("27", Desc = "Basic /settings test cases, imported stylesheet has DTD, where DTD+", Pri = 0, Params = new object[] { "/settings:DTD+ sft27.xsl", "sft27.dll", "yes", "sft27", "sft27.pdb", "no", "sft27.txt" })]
+ //[InlineData("/settings:DTD+ sft27.xsl", "sft27.dll", "yes", "sft27", "sft27.pdb", "no", "sft27.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("28", Desc = "Basic /settings test cases, imported stylesheet has DTD, where DTD-", Pri = 0, Params = new object[] { "/settings:DTD- sft28.xsl", "sft28.dll", "no", "sft28", "sft28.pdb", "no", "sft28.txt" })]
+ [InlineData("/settings:DTD- sft28.xsl", "sft28.dll", "no", "sft28", "sft28.pdb", "no", "sft28.txt")]
+ //[Variation("29", Desc = "Basic /settings test cases, imported stylesheet has script, where script+", Pri = 0, Params = new object[] { "/settings:script+ sft29.xsl", "sft29.dll", "yes", "sft29", "sft29.pdb", "no", "sft29.txt" })]
+ //[InlineData("/settings:script+ sft29.xsl", "sft29.dll", "yes", "sft29", "sft29.pdb", "no", "sft29.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("30", Desc = "Basic /settings test cases, imported stylesheet has script, where script-", Pri = 0, Params = new object[] { "/settings:script- sft30.xsl", "sft30hack.dll", "no", "sft30", "sft30.pdb", "no", "sft30.txt" })]
+ [InlineData("/settings:script- sft30.xsl", "sft30hack.dll", "no", "sft30", "sft30.pdb", "no", "sft30.txt")]
+ //[Variation("31", Desc = "Basic /settings test cases, imported stylesheet has document(), where document+", Pri = 0, Params = new object[] { "/settings:document+ sft31.xsl", "sft31.dll", "yes", "sft31", "sft31.pdb", "no", "sft31.txt" })]
+ //[InlineData("/settings:document+ sft31.xsl", "sft31.dll", "yes", "sft31", "sft31.pdb", "no", "sft31.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("32", Desc = "Basic /settings test cases, imported stylesheet has document(), where document-", Pri = 0, Params = new object[] { "/settings:document- sft32.xsl", "sft32hack.dll", "no", "sft32", "sft32.pdb", "no", "sft32.txt" })]
+ //[InlineData("/settings:document- sft32.xsl", "sft32hack.dll", "no", "sft32", "sft32.pdb", "no", "sft32.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("33", Desc = "Basic /settings test cases, included stylesheet has DTD, where DTD+", Pri = 0, Params = new object[] { "/settings:DTD+ sft33.xsl", "sft33.dll", "yes", "sft33", "sft33.pdb", "no", "sft33.txt" })]
+ //[InlineData("/settings:DTD+ sft33.xsl", "sft33.dll", "yes", "sft33", "sft33.pdb", "no", "sft33.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("34", Desc = "Basic /settings test cases, included stylesheet has DTD, where DTD-", Pri = 0, Params = new object[] { "/settings:DTD- sft34.xsl", "sft34.dll", "no", "sft34", "sft34.pdb", "no", "sft34.txt" })]
+ //[InlineData("/settings:DTD- sft34.xsl", "sft34.dll", "no", "sft34", "sft34.pdb", "no", "sft34.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("35", Desc = "Basic /settings test cases, included stylesheet has script, where script+", Pri = 0, Params = new object[] { "/settings:script+ sft35.xsl", "sft35.dll", "yes", "sft35", "sft35.pdb", "no", "sft35.txt" })]
+ //[InlineData("/settings:script+ sft35.xsl", "sft35.dll", "yes", "sft35", "sft35.pdb", "no", "sft35.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("36", Desc = "Basic /settings test cases, included stylesheet has script, where script-", Pri = 0, Params = new object[] { "/settings:script- sft36.xsl", "sft36hack.dll", "no", "sft36", "sft36.pdb", "no", "sft36.txt" })]
+ [InlineData("/settings:script- sft36.xsl", "sft36hack.dll", "no", "sft36", "sft36.pdb", "no", "sft36.txt")]
+ //[Variation("37", Desc = "Basic /settings test cases, included stylesheet has document(), where document+", Pri = 0, Params = new object[] { "/settings:document+ sft37.xsl", "sft37.dll", "yes", "sft37", "sft37.pdb", "no", "sft37.txt" })]
+ //[InlineData("/settings:document+ sft37.xsl", "sft37.dll", "yes", "sft37", "sft37.pdb", "no", "sft37.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("38", Desc = "Basic /settings test cases, included stylesheet has document(), where document-", Pri = 0, Params = new object[] { "/settings:document- sft38.xsl", "sft38hack.dll", "no", "sft38", "sft38.pdb", "no", "sft38.txt" })]
+ [InlineData("/settings:document- sft38.xsl", "sft38hack.dll", "no", "sft38", "sft38.pdb", "no", "sft38.txt")]
+ //[Variation("41", Desc = "Exercise basic use case invalid option specified", Pri = 0, Params = new object[] { "/settings:DTD~ sft41.xsl", "sft41.dll", "no", "sft41", "sft41.pdb", "no", "sft41.txt" })]
+ [InlineData("/settings:DTD~ sft41.xsl", "sft41.dll", "no", "sft41", "sft41.pdb", "no", "sft41.txt")]
+ //[Variation("42", Desc = "Exercise basic use case invalid option specified", Pri = 0, Params = new object[] { "/settings:script* sft42.xsl", "sft42.dll", "no", "sft42", "sft42.pdb", "no", "sft42.txt" })]
+ [InlineData("/settings:script* sft42.xsl", "sft42.dll", "no", "sft42", "sft42.pdb", "no", "sft42.txt")]
+ //[Variation("43", Desc = "Exercise basic use case invalid option specified", Pri = 0, Params = new object[] { "/settings:document% sft43.xsl", "sft43.dll", "no", "sft43", "sft43.pdb", "no", "sft43.txt" })]
+ //[InlineData("/settings:document% sft43.xsl", "sft43.dll", "no", "sft43", "sft43.pdb", "no", "sft43.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("44", Desc = "Exercise basic use case multiple options specified", Pri = 0, Params = new object[] { "/settings:script+document- sft44.xsl", "sft44.dll", "no", "sft44", "sft44.pdb", "no", "sft44.txt" })]
+ [InlineData("/settings:script+document- sft44.xsl", "sft44.dll", "no", "sft44", "sft44.pdb", "no", "sft44.txt")]
+ //[Variation("45", Desc = "Exercise basic use case invalid option specified", Pri = 0, Params = new object[] { "/script sft45.xsl", "sft45.dll", "no", "sft45", "sft45.pdb", "no", "sft45.txt" })]
+ //[InlineData("/script sft45.xsl", "sft45.dll", "no", "sft45", "sft45.pdb", "no", "sft45.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("46", Desc = "Exercise basic use case invalid option specified", Pri = 0, Params = new object[] { "/script+ sft46.xsl", "sft46.dll", "no", "sft46", "sft46.pdb", "no", "sft46.txt" })]
+ [InlineData("/script+ sft46.xsl", "sft46.dll", "no", "sft46", "sft46.pdb", "no", "sft46.txt")]
+ //[Variation("47", Desc = "Exercise basic use case invalid option specified", Pri = 0, Params = new object[] { "/DTD sft47.xsl", "sft47.dll", "no", "sft47", "sft47.pdb", "no", "sft47.txt" })]
+ //[InlineData("/DTD sft47.xsl", "sft47.dll", "no", "sft47", "sft47.pdb", "no", "sft47.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("48", Desc = "Exercise basic use case invalid option specified", Pri = 0, Params = new object[] { "/DTD- sft48.xsl", "sft48.dll", "no", "sft48", "sft48.pdb", "no", "sft48.txt" })]
+ [InlineData("/DTD- sft48.xsl", "sft48.dll", "no", "sft48", "sft48.pdb", "no", "sft48.txt")]
+ //[Variation("49", Desc = "Exercise basic use case invalid option specified", Pri = 0, Params = new object[] { "/document sft49.xsl", "sft49.dll", "no", "sft49", "sft49.pdb", "no", "sft49.txt" })]
+ [InlineData("/document sft49.xsl", "sft49.dll", "no", "sft49", "sft49.pdb", "no", "sft49.txt")]
+ //[Variation("50", Desc = "Exercise basic use case invalid option specified", Pri = 0, Params = new object[] { "/document- sft50.xsl", "sft50.dll", "no", "sft50", "sft50.pdb", "no", "sft50.txt" })]
+ //[InlineData("/document- sft50.xsl", "sft50.dll", "no", "sft50", "sft50.pdb", "no", "sft50.txt")] //Skipping this, it tries to load System.dll
+ //[Variation("51", Desc = "Regression: Basic /settings test cases, two stylesheet with the same script block", Pri = 0, Params = new object[] { "/settings:script+ sft3.xsl sft4.xsl", "sft3.dll", "yes", "", "sft3.pdb", "no", "sft3.txt" })]
+ [InlineData("/settings:script+ sft3.xsl sft4.xsl", "sft3.dll", "yes", "", "sft3.pdb", "no", "sft3.txt")]
+ [Theory]
+ public void Var1(object param0, object param1, object param2, object param3, object param4, object param5, object param6)
+ {
+ String cmdLine = param0.ToString();
+ String asmName = param1.ToString();
+ bool asmCreated = String.Compare(param2.ToString(), "yes", true) == 0;
+ String typeName = param3.ToString();
+ String pdbName = param4.ToString();
+ bool pdbCreated = String.Compare(param5.ToString(), "yes", true) == 0;
+ String baselineFile = param6.ToString();
+ if (ShouldSkip(new object[] { param0, param1, param2, param3, param4, param5, param6 }))
+ {
+ return; //TEST_SKIPPED;
+ }
+
+ VerifyTest(cmdLine, asmName, asmCreated, typeName, pdbName, pdbCreated, baselineFile, _createFromInputFile);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/Identity.xslt b/src/System.Private.Xml/tests/Xslt/XsltCompiler/Identity.xslt
new file mode 100644
index 0000000000..005048ba12
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/Identity.xslt
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
+ <xsl:output method="xml" indent="no" />
+
+ <xsl:template match="@* | node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@* | node()" />
+ </xsl:copy>
+ </xsl:template>
+</xsl:stylesheet> \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/IdentityTransform.dll b/src/System.Private.Xml/tests/Xslt/XsltCompiler/IdentityTransform.dll
new file mode 100644
index 0000000000..2ae4db78e8
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/IdentityTransform.dll
Binary files differ
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/IdentityTransform.xslt b/src/System.Private.Xml/tests/Xslt/XsltCompiler/IdentityTransform.xslt
new file mode 100644
index 0000000000..005048ba12
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/IdentityTransform.xslt
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
+ <xsl:output method="xml" indent="no" />
+
+ <xsl:template match="@* | node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@* | node()" />
+ </xsl:copy>
+ </xsl:template>
+</xsl:stylesheet> \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/Program.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/Program.cs
new file mode 100644
index 0000000000..ad95ecb35a
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/Program.cs
@@ -0,0 +1,26 @@
+using ModuleCore;
+using System;
+using System.IO;
+
+namespace XsltCompilerTests
+{
+ internal class Program
+ {
+ public static int Main()
+ {
+ try
+ {
+ // Verify xsltc.exe is available
+ XmlCoreTest.Common.XsltVerificationLibrary.SearchPath("xsltc.exe");
+ }
+ catch (FileNotFoundException)
+ {
+ Console.WriteLine("Could not find 'xsltc.exe'. Make sure that the .NET SDK is installed");
+ return 99;
+ }
+
+ string args = @"ExecutionMode:File Host:None SDKInstalled:NotInstalled";
+ return 100 + TestRunner.Execute(args);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/TestStylesheet.dll b/src/System.Private.Xml/tests/Xslt/XsltCompiler/TestStylesheet.dll
new file mode 100644
index 0000000000..3797d8c4a5
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/TestStylesheet.dll
Binary files differ
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/TestStylesheet.xslt b/src/System.Private.Xml/tests/Xslt/XsltCompiler/TestStylesheet.xslt
new file mode 100644
index 0000000000..c6207f4423
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/TestStylesheet.xslt
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
+ <xsl:output method="xml" indent="yes" />
+
+ <xsl:template match="node()">
+ <xsl:for-each select="/*">
+ <xsl:text>Hello </xsl:text>
+ <xsl:value-of select="local-name()" />
+ <xsl:text>!</xsl:text>
+ </xsl:for-each>
+ </xsl:template>
+</xsl:stylesheet> \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCommon.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCommon.cs
new file mode 100644
index 0000000000..221ac200ef
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCommon.cs
@@ -0,0 +1,648 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using OLEDB.Test.ModuleCore;
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Xml;
+using System.Xml.XmlDiff;
+using System.Xml.Xsl;
+
+namespace XmlCoreTest.Common
+{
+ /*************************************************
+ author alexkr
+ date 12/14/2005
+
+ This class contains common static methods used to verify the results of an XSLT data-driven test.
+ It contains the following methods:
+ CompareXml - used to compare two XML outputs, captured as files, using XmlDiff.
+ CompareChecksum - used to compare two non-XML outputs, captured as files, using a Checksum calculation.
+ CompareException - used to compare two Exceptions, or the meta-data of two Exceptions, using an Exception wrapper class.
+
+ ************************************************/
+
+ public class XsltVerificationLibrary
+ {
+ public static string winSDKPath = string.Empty;
+
+ /*************************************************
+ XMLDiff compare for XSLTV2 data driven tests.
+ It supports custom data-driven xmldiff options passed from the command line,
+ It might support an optional helperObject that can perform delayed logging, but does not yet.
+ ************************************************/
+
+ public static bool CompareXml(string baselineFile, string actualFile, string xmldiffoptionvalue)
+ {
+ return CompareXml(baselineFile, actualFile, xmldiffoptionvalue, null);
+ }
+
+ public static bool CompareXml(string baselineFile, string actualFile, string xmldiffoptionvalue, DelayedWriteLogger logger)
+ {
+ using (var fsActual = new FileStream(actualFile, FileMode.Open, FileAccess.Read))
+ using (var fsExpected = new FileStream(baselineFile, FileMode.Open, FileAccess.Read))
+ {
+ return CompareXml(fsActual, fsExpected, xmldiffoptionvalue, logger);
+ }
+ }
+
+ public static bool CompareXml(string baselineFile, Stream actualStream)
+ {
+ actualStream.Seek(0, SeekOrigin.Begin);
+
+ using (var expectedStream = new FileStream(baselineFile, FileMode.Open, FileAccess.Read))
+ return CompareXml(expectedStream, actualStream, String.Empty, null);
+ }
+
+ public static bool CompareXml(Stream expectedStream, Stream actualStream, string xmldiffoptionvalue, DelayedWriteLogger logger)
+ {
+ bool bResult = false;
+
+ // Default Diff options used by XSLT V2 driver.
+ int defaultXmlDiffOptions = (int)(XmlDiffOption.InfosetComparison | XmlDiffOption.IgnoreEmptyElement | XmlDiffOption.IgnoreAttributeOrder);
+ XmlDiff diff = new XmlDiff();
+
+ if (xmldiffoptionvalue == null || xmldiffoptionvalue.Equals(string.Empty))
+ diff.Option = (XmlDiffOption)defaultXmlDiffOptions;
+ else
+ {
+ if (logger != null) logger.LogMessage("Custom XmlDiffOptions used. Value passed is " + xmldiffoptionvalue);
+ diff.Option = (XmlDiffOption)Int32.Parse(xmldiffoptionvalue);
+ }
+
+ XmlParserContext context = new XmlParserContext(new NameTable(), null, "", XmlSpace.None);
+
+ try
+ {
+ bResult =
+ diff.Compare(new XmlTextReader(actualStream, XmlNodeType.Element, context),
+ new XmlTextReader(expectedStream, XmlNodeType.Element, context));
+ }
+ catch (Exception e)
+ {
+ bResult = false;
+ if (logger != null)
+ {
+ logger.LogMessage("Exception thrown in XmlDiff compare!");
+ logger.LogXml(e.ToString());
+ throw;
+ }
+ }
+
+ if (bResult)
+ return true;
+
+ if (logger != null)
+ {
+ logger.LogMessage("Mismatch in XmlDiff");
+ logger.LogMessage("Actual result: ");
+ }
+
+ return false;
+ }
+
+ /*************************************************
+ Checksum calculation. Legacy.
+ ************************************************/
+
+ public static bool CompareChecksum(string Baseline, string OutFile, int driverVersion)
+ {
+ return CompareChecksum(Baseline, OutFile, driverVersion, null);
+ }
+
+ public static bool CompareChecksum(string Baseline, string OutFile, int driverVersion, DelayedWriteLogger logger)
+ {
+ return CompareChecksum(
+ Baseline,
+ 1, //start from the first line in the baseline file
+ OutFile,
+ 1, //start from the first line in the output file
+ driverVersion,
+ logger);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="Baseline"></param>
+ /// <param name="baselineStartLine">The line to start comparison in the baseline file</param>
+ /// <param name="OutFile"></param>
+ /// <param name="outFileStartLine">The line to start comparion in the output file</param>
+ /// <param name="driverVersion"></param>
+ /// <param name="logger"></param>
+ /// <returns></returns>
+ public static bool CompareChecksum(string Baseline, int baselineStartLine, string OutFile, int outFileStartLine, int driverVersion, DelayedWriteLogger logger)
+ {
+ // Keep people honest.
+ if (driverVersion == 2)
+ {
+ if (logger != null) logger.LogMessage("Calculating checksum for baseline output {0}...", Baseline);
+
+ string expectedCheckSum = CalcChecksum(Baseline, baselineStartLine, logger);
+ string actualChecksum = CalcChecksum(OutFile, outFileStartLine, logger);
+
+ if (expectedCheckSum.Equals(actualChecksum))
+ return true;
+ else
+ {
+ if (logger != null)
+ {
+ logger.LogMessage("Actual checksum: {0}, Expected checksum: {1}", actualChecksum, expectedCheckSum);
+ logger.LogMessage("Actual result: ");
+ logger.WriteOutputFileToLog(OutFile);
+ }
+ return false;
+ }
+ }
+ else throw new NotSupportedException("Not a supported driver version");
+ }
+
+ private static string CalcChecksum(string fileName, DelayedWriteLogger logger)
+ {
+ return CalcChecksum(fileName, 1, logger);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="fileName"></param>
+ /// <param name="startFromLine">The line to start calculating the checksum. Any text before this line is ignored. First line is 1.</param>
+ /// <param name="logger"></param>
+ /// <returns></returns>
+ private static string CalcChecksum(string fileName, int startFromLine, DelayedWriteLogger logger)
+ {
+ const int BUFFERSIZE = 4096;
+ Decimal dResult = 0; // Numerical value of the checksum
+ int i = 0; // Generic counter
+ int cBytesRead = 1; // # of bytes read at one time
+ int cTotalRead = 0; // Total # of bytes read so far
+ Decimal dEndBuffer = 0; // Buffer to remove from the end (This is necessary because
+ // notepad adds CR/LF onto the end of every file)
+ Char[] rgBuffer = new Char[BUFFERSIZE];
+
+ string xml = "";
+
+ StreamReader fs = null;
+
+ try
+ {
+ fs = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read));
+
+ //switch to the line to start from, lines start from 1
+ for (int j = 1; j < startFromLine; j++)
+ {
+ fs.ReadLine();
+ }
+
+ cBytesRead = fs.Read(rgBuffer, 0, BUFFERSIZE);
+
+ while (cBytesRead > 0)
+ {
+ // Keep XML property up to date
+ xml = String.Concat(xml, new String(rgBuffer, 0, cBytesRead));
+
+ // Calculate the checksum
+ for (i = 0; i < cBytesRead; i++)
+ {
+ dResult += Math.Round((Decimal)(rgBuffer[i] / (cTotalRead + i + 1.0)), 10);
+ }
+
+ cTotalRead += cBytesRead;
+ dEndBuffer = 0;
+
+ // Keep reading (in case file is bigger than 4K)
+ cBytesRead = fs.Read(rgBuffer, 0, BUFFERSIZE);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (logger != null) logger.LogXml(ex.ToString());
+ return "";
+ }
+ finally
+ {
+ if (fs != null) fs.Dispose();
+ }
+ return Convert.ToString(dResult - dEndBuffer, NumberFormatInfo.InvariantInfo);
+ }
+
+ // Is this really all there is to it?
+ public static bool DetectEmittedPDB(string fileName)
+ {
+ if (File.Exists(fileName)) return true;
+ else return File.Exists(fileName + ".pdb");
+ }
+
+ // Call PEVerify on the Assembly name, parse the output,
+ // and return true if the output is PASS and false if the output is FAIL.
+ public static bool VerifyAssemblyUsingPEVerify(string asmName, bool isValidCase, DelayedWriteLogger logger, ref string output)
+ {
+ Debug.Assert(asmName != null);
+ Debug.Assert(asmName != String.Empty);
+
+ if (!asmName.Contains(".dll") || !asmName.Contains(".DLL"))
+ asmName = asmName + ".dll";
+
+ if (File.Exists(asmName))
+ {
+ return VerifyAssemblyUsingPEVerify(asmName, logger, ref output);
+ }
+ else
+ {
+ if (isValidCase)
+ {
+ string message = "PEVerify could not be run, no assembly present: " + asmName;
+ if (logger != null)
+ logger.LogMessage(message);
+ output = message;
+ return false;
+ }
+ else return true;
+ }
+ }
+
+ public static bool VerifySingleAssemblyUsingPEVerify(string asmName, DelayedWriteLogger logger, ref string output)
+ {
+ Debug.Assert(asmName != null);
+ Debug.Assert(asmName != String.Empty);
+
+ bool result = false;
+
+ if (File.Exists(asmName))
+ {
+ //add double quotes for names with whitespace in them
+ string processArguments = " /quiet " + "\"" + asmName + "\"";
+
+ // Call PEVerify to verify persistant assembly.
+ Process peVerifyProcess = new Process();
+ peVerifyProcess.StartInfo.FileName = SearchPath("peverify.exe");
+ peVerifyProcess.StartInfo.Arguments = " " + processArguments;
+ //peVerifyProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
+ peVerifyProcess.StartInfo.CreateNoWindow = true;
+ peVerifyProcess.StartInfo.UseShellExecute = false;
+ peVerifyProcess.StartInfo.RedirectStandardOutput = true;
+
+ peVerifyProcess.Start();
+ output = peVerifyProcess.StandardOutput.ReadToEnd();
+ peVerifyProcess.WaitForExit();
+
+ // Check the output for the Assembly name, and the word "PASS"
+ // For example:
+ // C:>peverify /quiet 4AC8BD29F3CB888FAD76F7C08FD57AD3.dll
+ // 4AC8BD29F3CB888FAD76F7C08FD57AD3.dll PASS
+ if (peVerifyProcess.ExitCode == 0 && output.Contains(asmName) && output.Contains("PASS"))
+ result = true;
+ else
+ {
+ if (logger != null)
+ logger.LogMessage("PEVerify could not be run or FAILED : {0}", asmName + " " + output);
+ result = false;
+ }
+ }
+ else
+ {
+ if (logger != null)
+ logger.LogMessage("Assembly file could not be found : {0}", asmName);
+ result = false;
+ }
+
+ return result;
+ }
+
+ public static bool VerifyAssemblyUsingPEVerify(string asmName, DelayedWriteLogger logger, ref string output)
+ {
+ String scriptAsmNameFormat = Path.ChangeExtension(asmName, null) + "_Script{0}.dll";
+ int scriptCounter = 0;
+ String testAsm = asmName;
+ bool result = false;
+
+ do
+ {
+ result = VerifySingleAssemblyUsingPEVerify(testAsm, logger, ref output);
+ testAsm = String.Format(scriptAsmNameFormat, ++scriptCounter);
+ }
+ while (result && File.Exists(testAsm));
+
+ return result;
+ }
+
+ public static string SearchPath(String fileName)
+ {
+ const string ToolsDirectorySuffix = @"bin\NETFX 4.5.1 Tools";
+
+ var tools64 = new DirectoryInfo(@"C:\program Files (x86)\Microsoft SDKs\Windows");
+ var tools32 = new DirectoryInfo(@"C:\program Files\Microsoft SDKs\Windows");
+
+ var directories64 = tools64.Exists ? tools64.EnumerateDirectories() : Enumerable.Empty<DirectoryInfo>();
+ var directories32 = tools32.Exists ? tools32.EnumerateDirectories() : Enumerable.Empty<DirectoryInfo>();
+
+ var toolPath = directories64.Concat(directories32)
+ .Select(dir => Path.Combine(dir.FullName, ToolsDirectorySuffix, fileName))
+ .SingleOrDefault(File.Exists);
+
+ if (toolPath == null)
+ throw new FileNotFoundException(fileName);
+
+ return toolPath;
+ }
+ }
+
+ /*************************************************
+ This class is a delayed-write message logger, similar to CError.WriteLine etc. It is
+ instantiated by your XsltDriver and used to record messages that you would normally write
+ with CError.WriteLine, CError.WriteLineIgnore, or CError.WriteXml, in a buffered manner.
+ The messages can be written to the final log file using WriteOutputFileToLog() by your driver code
+ if there is a variation failure, or just discarded when a test passes to keep results.log files
+ within a managable size on disk.
+
+ As an example, using this method reduced the size of the XSLT V2 log file from 3MB per run to around 300k.
+ ************************************************/
+
+ public class DelayedWriteLogger
+ {
+ private ArrayList _messageLog;
+
+ public DelayedWriteLogger()
+ {
+ _messageLog = new ArrayList();
+ }
+
+ // Writes the buffer of messages to the results.log file.
+ public void WriteOutputFileToLog(string fileName)
+ {
+ StreamReader fs = null;
+ try
+ {
+ Char[] rgBuffer = new Char[4096];
+
+ fs = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read));
+
+ int cBytesRead = fs.Read(rgBuffer, 0, 4096);
+ while (cBytesRead > 0)
+ {
+ this.Log(new string(rgBuffer, 0, cBytesRead));
+ cBytesRead = fs.Read(rgBuffer, 0, 4096);
+ }
+ }
+ finally
+ {
+ if (fs != null) fs.Dispose();
+ this.LogMessage(String.Empty);
+ }
+ }
+
+ public void Log(string msg)
+ {
+ LogMessage(MessageType.Write, msg, null);
+ }
+
+ public void LogMessage(string msg)
+ {
+ LogMessage(MessageType.WriteLine, msg, null);
+ }
+
+ public void LogMessage(string msg, params object[] args)
+ {
+ LogMessage(MessageType.WriteLineParams, msg, args);
+ }
+
+ public void LogMessageIgnore(string msg)
+ {
+ LogMessage(MessageType.WriteLineIgnore, msg, null);
+ }
+
+ public void LogXml(string msg)
+ {
+ LogMessage(MessageType.Xml, msg, null);
+ }
+
+ private void LogMessage(MessageType msgtype, string msg, params object[] args)
+ {
+ LogMessage message = new LogMessage(msgtype, msg, args);
+ _messageLog.Add(message);
+ }
+
+ public void WriteLoggedMessages()
+ {
+ foreach (LogMessage mg in _messageLog)
+ {
+ switch (mg.type)
+ {
+ case MessageType.Write:
+ CError.Write(mg.msg);
+ break;
+
+ case MessageType.WriteLine:
+ CError.WriteLine(mg.msg);
+ break;
+
+ case MessageType.WriteLineIgnore:
+ CError.WriteLineIgnore(mg.msg);
+ break;
+
+ case MessageType.WriteLineParams:
+ CError.WriteLine(mg.msg, mg.args);
+ break;
+
+ case MessageType.Xml:
+ CError.WriteXml(mg.msg);
+ break;
+ }
+ }
+ }
+ }
+
+ // used by DelayedWriteLogger
+ internal enum MessageType
+ {
+ Write,
+ WriteLine,
+ WriteLineParams,
+ WriteLineIgnore,
+ Xml
+ }
+
+ // used by DelayedWriteLogger
+ internal class LogMessage
+ {
+ public LogMessage(MessageType t, string m, object[] o)
+ {
+ type = t;
+ msg = m;
+ args = o;
+ }
+
+ internal MessageType type;
+ public string msg;
+ public object[] args;
+ }
+
+ /*************************************************
+ author alexkr
+ date 12/12/2005
+
+ This class is used to compare expected exceptions with actual exceptions in the CompareException
+ method, used by the XSLT V2 data driven driver.
+
+ Its use is somewhat subtle, so please read all comments, understand the Equals method, and ask for
+ introduction before you use it in any new code, or modify existing code. Why? There are many
+ assumptions made when using this class. Here are some...
+
+ Non-Xml Exceptions are always compared by type, and must never have ExceptionResourceId or ExceptionMessage attributes in a control file.
+ Xml Exceptions can be either ExceptionId only, ExceptionId and ExceptionMessage for all Xml_UserException exceptions, or ExceptionId and ExceptionResourceId for all non-Xml_UserExceptions
+ Never have both ExceptionResourceId AND ExceptionMessage attributes set for the same Exception meta-data. The behavior is undefined.
+ Xml Exceptions that are Xml_UserExceptions and include a MessageFragment will only be compared in ENU runs. Globalized runs resort to Type comparison (ExceptionId) only.
+ Xml Exceptions that are non-Xml_UserExceptions and include an ExceptionResourceId will be compared for all runs.
+
+ **************************************************/
+
+ public class XsltRuntimeException
+ {
+ public static string XMLUSEREX = "Xml_UserException";
+
+ private XsltRuntimeException()
+ {
+ } // no op, do not call
+
+ public XsltRuntimeException(string a, bool d)
+ : this(a, XMLUSEREX, String.Empty, d)
+ {
+ }
+
+ public XsltRuntimeException(string a, string b, string c, bool d)
+ {
+ ExceptionId = a;
+ ResourceId = b;
+ MessageFragment = c;
+ _examineMessages = d;
+ }
+
+ public string ExceptionId;
+ public string ResourceId;
+ public string MessageFragment;
+ private bool _examineMessages;
+
+ public override string ToString()
+ {
+ return ExceptionId + "\n" + ResourceId + "\n" + MessageFragment;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ // The Equals method must always be used this way
+ // ExpectedException.Equals( ActualException )?
+ // Please note that if ExamineMessages is true, we are in a non-localized build and we can safely examine exception messages. If false, we fall back to type comparison exclusively.
+ public override bool Equals(object o)
+ {
+ XsltRuntimeException objectToCompareTo = o as XsltRuntimeException;
+
+ Debug.Assert(objectToCompareTo != null);
+ Debug.Assert(objectToCompareTo.ExceptionId != null, "ExceptionId must be initialized to a valid fully qualified type name");
+ Debug.Assert(objectToCompareTo.ResourceId != null, "ResourceId must be initialized to String.Empty, in which case MessageFragment is used, or a legal resource Id");
+ Debug.Assert(objectToCompareTo.MessageFragment != null, "MessageFragment must be intialized to String.Empty, in which case ResourceId is used, or a string that represents a specific exception message.");
+ Debug.Assert(this.ExceptionId != null, "ExceptionId must be initialized to a valid fully qualified type name");
+ Debug.Assert(this.ResourceId != null, "ResourceId must be initialized to String.Empty, in which case MessageFragment is used, or a legal resource Id");
+ Debug.Assert(this.MessageFragment != null, "MessageFragment must be intialized to String.Empty, in which case ResourceId is used, or a string that represents a specific exception message.");
+
+ // Inside this block, we have two properly initialized XsltRuntimeExceptions to compare.
+
+ /////
+ // There are several basic comparisons, each with its own degree of certainty.
+ //
+ // The first comparison is the original used by the driver, which we no longer use: if there is any
+ // exception at all for an expected "Invalid" case, we match.
+ //
+ // The second comparison is the initial revision to the driver: an Exception type comparison. This is the least certain.
+ // type matches should no longer exist once this exception work is complete. These will be flagged by failing the test.
+ //
+ // The third comparison is for Xml_UserExceptions. In this case we try to compare the Exception Type and Exception Message.
+ // If the Exception type does not match, but the message does, we count that as a match. Note that this match is NOT
+ // immue to the effects of globalized resource strings, and hence is less certain.
+ //
+ // The fourth comparison is for NON Xml_UserExceptions. In this case we try to compare the Exception Type and ResourceId.
+ // If the Exception type does not match, but the resource id does, we count that a match. Note that this match is
+ // immune to the effects of globalized resource strings. It is the most certain match we can make.
+ //
+ /////
+ if (!IsXmlException(this.ExceptionId))
+ {
+ // Aye, here's the dillema. If its not an XML exception we can't look up its resource ID.
+ // So in these cases (very rare anyway) we revert to the old simple days of comparing type to type.
+ return objectToCompareTo.ExceptionId.Equals(this.ExceptionId);
+ }
+ else
+ {
+ if (!objectToCompareTo.ResourceId.Equals(String.Empty) && !objectToCompareTo.ResourceId.Equals(XMLUSEREX) &&
+ objectToCompareTo.ResourceId.Equals(this.ResourceId))
+ {
+ //**** The highest degree of certainty we have. ****//
+
+ if (objectToCompareTo.ExceptionId.Equals(this.ExceptionId))
+ return true;
+ // ResourceIds match, but Exception types dont.
+ else
+ {
+ CError.WriteLine("match?\n {0} \ncompare to \n {1} \n pls investigate why this resource id is being thrown in 2 differet exceptions", objectToCompareTo.ToString(), this.ToString());
+ return true;
+ }
+ }
+ // ResourceId is Empty or Xml_UserException, or they dont match
+ else if (!this.MessageFragment.Equals(String.Empty) && _examineMessages)
+ {
+ if (objectToCompareTo.ResourceId.Equals(this.ResourceId) &&
+ objectToCompareTo.MessageFragment.Contains(this.MessageFragment))
+ {
+ //**** Very high certainty equivalence ****//
+
+ if (objectToCompareTo.ExceptionId.Equals(this.ExceptionId))
+ return true;
+
+ // Messages match, but Exception types dont.
+ else
+ {
+ CError.WriteLine("match?(message matches but exact typename doesn't)\n {0} \ncompare to \n {1} ", objectToCompareTo.ToString(), this.ToString());
+ return false; // for now.
+ }
+ }
+ }
+ // ResourceId is Empty or Xml_UserException or they dont match, Message is Empty or they dont match
+ else
+ {
+ //**** Lower degree of certainty ****//
+ // This is an exception that has not yet been updated in the control file with complete information.
+ // Use the older, less flexible comparison logic.
+ CError.WriteLine("old comparison:{0} \ncompare to \n {1} ", objectToCompareTo.ToString(), this.ToString());
+ return objectToCompareTo.ExceptionId.Equals(this.ExceptionId);
+ }
+ }
+ return false;
+ }
+
+ public static ArrayList XmlExceptionList = new ArrayList(5);
+
+ private static void setXmlExceptionList()
+ {
+ XmlExceptionList.Add("System.Xml.Xsl.XPath.XPathCompileException");
+ XmlExceptionList.Add("System.Xml.Xsl.XslLoadException");
+ XmlExceptionList.Add("System.Xml.Xsl.XslTransformException");
+ XmlExceptionList.Add("System.Xml.Xsl.XsltException");
+ XmlExceptionList.Add("System.Xml.XmlException");
+ }
+
+ public static bool IsXmlException(string typeName)
+ {
+ setXmlExceptionList();
+ return XmlExceptionList.Contains(typeName);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCompiler.Tests.csproj b/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCompiler.Tests.csproj
new file mode 100644
index 0000000000..1ff2923788
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCompiler.Tests.csproj
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{B01E2AE1-1B52-4518-B32E-016070356A7F}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AssemblyName>XsltCompiler.Tests</AssemblyName>
+ <RootNamespace>System.Xml.Tests</RootNamespace>
+ <NuGetTargetMoniker>.NETStandard,Version=v1.5</NuGetTargetMoniker>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>$(OutputPath)\$(RootNamespace)\$(AssemblyName)</OutputPath>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>$(OutputPath)\$(RootNamespace)\$(AssemblyName)</OutputPath>
+ </PropertyGroup>
+ <ItemGroup>
+ <!--<Reference Include="TestStylesheet">
+ <HintPath>.\TestStylesheet.dll</HintPath>
+ </Reference>-->
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CommonScenarios\XsltcTestBasicFunctionality.cs" />
+ <Compile Include="CommonScenarios\XsltcTestCaseBase.cs" />
+ <Compile Include="CommonScenarios\XsltcTestClassname.cs" />
+ <Compile Include="CommonScenarios\XsltcTestCompile.cs" />
+ <Compile Include="CommonScenarios\XsltcTestFile.cs" />
+ <Compile Include="CommonScenarios\XsltcTestOut.cs" />
+ <Compile Include="CommonScenarios\XsltcTestPlatform.cs" />
+ <Compile Include="CommonScenarios\XsltcTestSettings.cs" />
+ <Compile Include="XsltcModule.cs" />
+ <Compile Include="XsltCommon.cs" />
+ <Compile Include="ApiTests\XsltcApiTest.cs" />
+ <Content Include="..\TestFiles\**\*.*">
+ <Link>TestFiles\%(RecursiveDir)%(Filename)%(Extension)</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(CommonTestPath)\System\Xml\ModuleCore\ModuleCore.csproj" />
+ <ProjectReference Include="$(CommonTestPath)\System\Xml\XmlCoreTest\XmlCoreTest.csproj" />
+ <ProjectReference Include="$(CommonTestPath)\System\Xml\xmlDiff\XmlDiff.csproj" />
+ <ProjectReference Include="..\..\..\src\System.Xml.csproj" />
+ <ProjectReference Include="..\..\..\..\System.Xml.ReaderWriter\src\System.Xml.ReaderWriter.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Identity.xslt" />
+ <Content Include="IdentityTransform.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="IdentityTransform.xslt">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <SubType>Designer</SubType>
+ </Content>
+ <Content Include="TestStylesheet.xslt" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltcModule.cs b/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltcModule.cs
new file mode 100644
index 0000000000..bbf7e6be63
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltcModule.cs
@@ -0,0 +1,55 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Xunit;
+using Xunit.Abstractions;
+using System;
+using System.IO;
+using XmlCoreTest.Common;
+using OLEDB.Test.ModuleCore;
+
+namespace System.Xml.Tests
+{
+ //[TestModule(Name = "Xsltc", Desc = "Xsltc Compiler Tests", Pri = 1)]
+ public class XsltcModule : CTestModule
+ {
+ public static string TargetDirectory = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"xsltc\baseline");
+
+ public void CopyDataFiles(string sourcePath, string targetDir)
+ {
+ if (!Directory.Exists(targetDir))
+ {
+ Directory.CreateDirectory(targetDir);
+ }
+
+ foreach (String file in Directory.GetFiles(sourcePath))
+ {
+ string fileName = Path.GetFileName(file);
+ if (!File.Exists(Path.Combine(targetDir, fileName)))
+ {
+ File.Copy(file, Path.Combine(targetDir, fileName), true);
+ }
+ }
+ }
+
+ public override int Init(object objParam)
+ {
+ int ret = base.Init(objParam);
+
+ // copy all the data files to working folder
+ CopyDataFiles(Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), "xsltc"), TargetDirectory);
+ CopyDataFiles(Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), "xsltc", "precompiled"), TargetDirectory);
+ CopyDataFiles(Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), "xsltc", "baseline"), TargetDirectory);
+
+ return ret;
+ }
+
+ private static string GetDirectory()
+ {
+ string current = Directory.GetCurrentDirectory();
+
+ return current.Contains(" ") ? "C:\\xml" : current;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Xml/tests/Xslt/XsltCompiler/project.json b/src/System.Private.Xml/tests/Xslt/XsltCompiler/project.json
new file mode 100644
index 0000000000..84555070a0
--- /dev/null
+++ b/src/System.Private.Xml/tests/Xslt/XsltCompiler/project.json
@@ -0,0 +1,33 @@
+{
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "1.0.2-beta-24322-03",
+ "System.Collections.NonGeneric": "4.0.2-beta-24322-03",
+ "System.Collections.Specialized": "4.0.2-beta-24322-03",
+ "System.Diagnostics.Process": "4.1.1-beta-24322-03",
+ "System.IO": "4.1.1-beta-24322-03",
+ "System.IO.FileSystem": "4.0.2-beta-24322-03",
+ "System.IO.FileSystem.Primitives": "4.0.2-beta-24322-03",
+ "System.Linq": "4.1.1-beta-24322-03",
+ "System.Linq.Expressions": "4.1.1-beta-24322-03",
+ "System.ObjectModel": "4.0.13-beta-24322-03",
+ "System.Resources.Reader": "4.0.1-beta-24322-03",
+ "System.Runtime": "4.1.1-beta-24322-03",
+ "System.Runtime.Extensions": "4.1.1-beta-24322-03",
+ "System.Runtime.Loader": "4.0.1-beta-24322-03",
+ "System.Threading": "4.0.12-beta-24322-03",
+ "System.Threading.Thread": "4.0.1-beta-24322-03",
+ "System.Threading.Tasks": "4.0.12-beta-24322-03",
+ "test-runtime": {
+ "target": "project",
+ "exclude": "compile"
+ },
+ "Microsoft.xunit.netcore.extensions": "1.0.0-prerelease-00508-01",
+ "Microsoft.DotNet.BuildTools.TestSuite": "1.0.0-prerelease-00520-02"
+ },
+ "frameworks": {
+ "netstandard1.5": {}
+ },
+ "supports": {
+ "coreFx.Test.netcoreapp1.0": {}
+ }
+}