OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 using System; | 4 using System; |
5 using System.Text; | 5 using System.Text; |
6 using System.Collections.Generic; | 6 using System.Collections.Generic; |
7 using EnvDTE; | 7 using EnvDTE; |
8 using EnvDTE80; | 8 using EnvDTE80; |
9 using Microsoft.VisualStudio.TestTools.UnitTesting; | 9 using Microsoft.VisualStudio.TestTools.UnitTesting; |
10 using Microsoft.VisualStudio.VCProjectEngine; | 10 using Microsoft.VisualStudio.VCProjectEngine; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 /// <summary> | 70 /// <summary> |
71 /// Helper function which opens the given solution, sets the configurati
on and platform and | 71 /// Helper function which opens the given solution, sets the configurati
on and platform and |
72 /// tries to compile, failing the test if the build does not succeed. | 72 /// tries to compile, failing the test if the build does not succeed. |
73 /// </summary> | 73 /// </summary> |
74 /// <param name="solutionPath">Path to the solution to open.</param> | 74 /// <param name="solutionPath">Path to the solution to open.</param> |
75 /// <param name="configName">Solution Configuration name (Debug or Relea
se).</param> | 75 /// <param name="configName">Solution Configuration name (Debug or Relea
se).</param> |
76 /// <param name="platformName">Platform name.</param> | 76 /// <param name="platformName">Platform name.</param> |
77 private void TryCompile(string configName, string platformName) | 77 private void TryCompile(string configName, string platformName) |
78 { | 78 { |
79 string failFormat = "Project compile failed for {0} platform {1} con
fig." | 79 string failFormat = "Project compile failed for {0} platform {1} con
fig.\n" |
| 80 + "If this test fails it could be because the buil
d output" |
| 81 + "is set to Minimal or below.\n" |
80 + "Build output: {2}"; | 82 + "Build output: {2}"; |
81 string cygwinWarningFormat = "Did not pass cygwin nodosfilewarning e
nvironment var to" | 83 string cygwinWarningFormat = "Did not pass cygwin nodosfilewarning e
nvironment var to" |
82 + " tools Platform: {0}, configuration: {
1}"; | 84 + " tools Platform: {0}, configuration: {
1}"; |
83 StringComparison ignoreCase = StringComparison.InvariantCultureIgnor
eCase; | 85 StringComparison ignoreCase = StringComparison.InvariantCultureIgnor
eCase; |
84 | 86 |
85 // Open Debug configuration and build. | 87 // Open Debug configuration and build. |
86 TestUtilities.SetSolutionConfiguration( | 88 TestUtilities.SetSolutionConfiguration( |
87 dte_, TestUtilities.NaClProjectUniqueName, configName, platformN
ame); | 89 dte_, TestUtilities.NaClProjectUniqueName, configName, platformN
ame); |
88 dte_.Solution.SolutionBuild.Build(true); | 90 dte_.Solution.SolutionBuild.Build(true); |
89 | 91 |
90 string compileOutput = TestUtilities.GetPaneText( | 92 string compileOutput = TestUtilities.GetPaneText( |
91 dte_.ToolWindows.OutputWindow.OutputWindowPanes.Item("Build")); | 93 dte_.ToolWindows.OutputWindow.OutputWindowPanes.Item("Build")); |
| 94 |
| 95 // Check for "Build succeeded" in the output pane. This only works i
f |
| 96 // the visual studio output verbosity is set to Normal or above. |
| 97 // TODO(sbc): find some other way to verify success or at least veri
fy |
| 98 // that the build verbosity is set to Normal or above. |
92 Assert.IsTrue( | 99 Assert.IsTrue( |
93 compileOutput.Contains("Build succeeded.", ignoreCase), | 100 compileOutput.Contains("Build succeeded.", ignoreCase), |
94 string.Format(failFormat, platformName, configName, compileOutpu
t)); | 101 string.Format(failFormat, platformName, configName, compileOutpu
t)); |
95 Assert.IsFalse( | 102 Assert.IsFalse( |
96 compileOutput.Contains("MS-DOS style path detected", ignoreCase)
, | 103 compileOutput.Contains("MS-DOS style path detected", ignoreCase)
, |
97 string.Format(cygwinWarningFormat, platformName, configName)); | 104 string.Format(cygwinWarningFormat, platformName, configName)); |
98 } | 105 } |
99 | 106 |
100 /// <summary> | 107 /// <summary> |
101 /// Set the type of the project: Executable, DynamicLibrary, StaticLibra
ry | 108 /// Set the type of the project: Executable, DynamicLibrary, StaticLibra
ry |
(...skipping 21 matching lines...) Expand all Loading... |
123 if (ppapi) | 130 if (ppapi) |
124 { | 131 { |
125 SetProjectType("DynamicLibrary", platform); | 132 SetProjectType("DynamicLibrary", platform); |
126 TryCompile("Debug", platform); | 133 TryCompile("Debug", platform); |
127 TryCompile("Release", platform); | 134 TryCompile("Release", platform); |
128 } | 135 } |
129 dte_.Solution.Close(true); | 136 dte_.Solution.Close(true); |
130 } | 137 } |
131 } | 138 } |
132 } | 139 } |
OLD | NEW |