Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1395)

Unified Diff: visual_studio/NativeClientVSAddIn/UnitTests/CompileTest.cs

Issue 12248006: [VS Addin] Fix parallel building. (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: visual_studio/NativeClientVSAddIn/UnitTests/CompileTest.cs
diff --git a/visual_studio/NativeClientVSAddIn/UnitTests/CompileTest.cs b/visual_studio/NativeClientVSAddIn/UnitTests/CompileTest.cs
index cb313d8da2d1f1a702cf909d5fc1d9045dbfc2b1..c7218678d1902b1834503fc94636199843a9b1a2 100644
--- a/visual_studio/NativeClientVSAddIn/UnitTests/CompileTest.cs
+++ b/visual_studio/NativeClientVSAddIn/UnitTests/CompileTest.cs
@@ -14,40 +14,14 @@ using NativeClientVSAddIn;
namespace UnitTests
{
[TestClass]
- public class CompileTest
+ public class ComileTest : BaseCompileTest
{
- /// <summary>
- /// The main visual studio object.
- /// </summary>
- private DTE2 dte_;
-
- /// <summary>
- /// The path to a NaCl solution used in compile tests.
- /// </summary>
- private static string SolutionName_;
+ private static string SolutionBaseName_ = "CompileTest";
- /// <summary>
- /// This is run one time before any test methods are called. Here we set-up test-copies of
- /// new NaCl solutions for use in the tests.
- /// </summary>
- /// <param name="testContext">Holds information about the current test run</param>
[ClassInitialize]
- public static void ClassSetUp(TestContext testContext)
+ public new static void ClassSetUp(TestContext testContext)
{
- DTE2 dte = TestUtilities.StartVisualStudioInstance();
- try
- {
- SolutionName_ = TestUtilities.CreateBlankValidNaClSolution(
- dte,
- "CompileTest",
- Strings.PepperPlatformName,
- Strings.NaCl64PlatformName,
- testContext);
- }
- finally
- {
- TestUtilities.CleanUpVisualStudioInstance(dte);
- }
+ BaseCompileTest.ClassSetUp(testContext, SolutionBaseName_);
}
/// <summary>
@@ -60,77 +34,6 @@ namespace UnitTests
}
/// <summary>
- /// This is run before each test to create test resources.
- /// </summary>
- [TestInitialize]
- public void TestSetup()
- {
- dte_ = TestUtilities.StartVisualStudioInstance();
- try
- {
- TestUtilities.AssertAddinLoaded(dte_, Strings.AddInName);
- }
- catch
- {
- TestUtilities.CleanUpVisualStudioInstance(dte_);
- throw;
- }
- }
-
- /// <summary>
- /// Helper function which opens the given solution, sets the configuration and platform and
- /// tries to compile, failing the test if the build does not succeed.
- /// </summary>
- /// <param name="solutionPath">Path to the solution to open.</param>
- /// <param name="configName">Solution Configuration name (Debug or Release).</param>
- /// <param name="platformName">Platform name.</param>
- private void TryCompile(string configName, string platformName)
- {
- string failFormat = "Project compile failed for {0} platform {1} config."
- + "Build output: {2}";
- string cygwinWarningFormat = "Did not pass cygwin nodosfilewarning environment var to"
- + " tools Platform: {0}, configuration: {1}";
- StringComparison ignoreCase = StringComparison.InvariantCultureIgnoreCase;
-
- // Open Debug configuration and build.
- dte_.Solution.Open(SolutionName_);
- TestUtilities.SetSolutionConfiguration(
- dte_, TestUtilities.NaClProjectUniqueName, configName, platformName);
- dte_.Solution.SolutionBuild.Build(true);
-
- string compileOutput = TestUtilities.GetPaneText(
- dte_.ToolWindows.OutputWindow.OutputWindowPanes.Item("Build"));
- Assert.IsTrue(
- compileOutput.Contains("Build succeeded.", ignoreCase),
- string.Format(failFormat, platformName, configName, compileOutput));
- Assert.IsFalse(
- compileOutput.Contains("MS-DOS style path detected", ignoreCase),
- string.Format(cygwinWarningFormat, platformName, configName));
-
- dte_.Solution.Close(true);
- }
-
- /// <summary>
- /// Set the type of the project: Executable, DynamicLibrary, StaticLibrary
- /// </summary>
- private void SetProjectType(string projectType, string platformName)
- {
- dte_.Solution.Open(SolutionName_);
- Project project = dte_.Solution.Projects.Item(TestUtilities.NaClProjectUniqueName);
- VCConfiguration config;
- IVCRulePropertyStorage rule;
-
- config = TestUtilities.GetVCConfiguration(project, "Debug", platformName);
- rule = config.Rules.Item("ConfigurationGeneral");
- rule.SetPropertyValue("ConfigurationType", projectType);
-
- config = TestUtilities.GetVCConfiguration(project, "Release", platformName);
- rule = config.Rules.Item("ConfigurationGeneral");
- rule.SetPropertyValue("ConfigurationType", projectType);
- dte_.Solution.Close(true);
- }
-
- /// <summary>
/// Test method to check that the NaCl platform compiles a test project.
/// </summary>
[TestMethod]
@@ -176,20 +79,5 @@ namespace UnitTests
CheckCompile(Strings.PNaClPlatformName, false);
}
- private void CheckCompile(string platform, bool dll)
- {
- SetProjectType("Executable", platform);
- TryCompile("Debug", platform);
- TryCompile("Release", platform);
- SetProjectType("StaticLibrary", platform);
- TryCompile("Debug", platform);
- TryCompile("Release", platform);
- if (dll)
- {
- SetProjectType("DynamicLibrary", platform);
- TryCompile("Debug", platform);
- TryCompile("Release", platform);
- }
- }
}
}

Powered by Google App Engine
This is Rietveld 408576698