Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// CodeContracts
// CodeContracts
//
// Copyright (c) Microsoft Corporation
//
Expand All @@ -19,6 +19,7 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("ClousotCacheTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
Expand All @@ -31,9 +32,11 @@
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.

[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid("acbc5b6f-02d0-45b1-8d8d-9f54a9610cc4")]

// Version information for an assembly consists of the following four values:
Expand All @@ -45,5 +48,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
289 changes: 142 additions & 147 deletions Microsoft.Research/RegressionTest/ClousotCacheTests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,158 +13,153 @@
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using System;

using ClousotTests;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Tests
{
/// <summary>
/// Summary description for RewriterTests
/// </summary>
[TestClass]
public class ClousotCacheTests
{
public ClousotCacheTests()
{
//
// TODO: Add constructor logic here
//
}

private TestContext testContextInstance;

/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}

#region Additional test attributes
//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext) { }
//
// Use ClassCleanup to run code after all tests in a class have run
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// Use TestInitialize to run code before running each test
// [TestInitialize()]
// public void MyTestInitialize() { }
//
//Use TestCleanup to run code after each test has run
[TestCleanup()]
public void MyTestCleanup()
{
if (TestContext.CurrentTestOutcome != UnitTestOutcome.Passed && CurrentGroupInfo != null && !System.Diagnostics.Debugger.IsAttached)
{
// record failing case
CurrentGroupInfo.WriteFailure();
}
}
#endregion

[TestCategory("StaticChecker"), TestCategory("Clousot1")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze1FromSourcesV35Cache()
{
var options = GrabTestOptions("Analyze1FromSourcesV35Cache");
options.BuildFramework = @"v3.5";
options.ContractFramework = @"v3.5";
if (!options.Skip)
TestDriver.BuildAndAnalyze(options);
}

[TestCategory("StaticChecker"), TestCategory("Clousot2"), TestCategory("Cache")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze2FromSourcesV35Cache()
{
var options = GrabTestOptions("Analyze2FromSourcesV35Cache");
options.BuildFramework = @"v3.5";
options.ContractFramework = @"v3.5";
if (!options.Skip)
TestDriver.BuildAndAnalyze2(options);
}

[TestCategory("StaticChecker"), TestCategory("Clousot1"), TestCategory("Cache")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze1FromSourcesV40Cache()
/// Summary description for RewriterTests
/// </summary>
[TestClass]
public class ClousotCacheTests
{
var options = GrabTestOptions("Analyze1FromSourcesV40Cache");
options.BuildFramework = @".NETFramework\v4.0";
options.ContractFramework = @".NETFramework\v4.0";
if (!options.Skip)
TestDriver.BuildAndAnalyze(options);
private TestContext testContextInstance;

/// <summary>
/// Gets or sets the test context which provides
/// information about and functionality for the current test run.
/// </summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}

#region Additional test attributes

//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext) { }
//
// Use ClassCleanup to run code after all tests in a class have run
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// Use TestInitialize to run code before running each test
// [TestInitialize()]
// public void MyTestInitialize() { }
//
//Use TestCleanup to run code after each test has run
[TestCleanup]
public void MyTestCleanup()
{
if (TestContext.CurrentTestOutcome != UnitTestOutcome.Passed && CurrentGroupInfo != null && !System.Diagnostics.Debugger.IsAttached)
{
// record failing case
CurrentGroupInfo.WriteFailure();
}
}

#endregion

[TestCategory("StaticChecker"), TestCategory("Clousot1")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze1FromSourcesV35Cache()
{
var options = GrabTestOptions("Analyze1FromSourcesV35Cache");
options.BuildFramework = @"v3.5";
options.ContractFramework = @"v3.5";
if (!options.Skip)
TestDriver.BuildAndAnalyze(options);
}

[TestCategory("StaticChecker"), TestCategory("Clousot2"), TestCategory("Cache")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze2FromSourcesV35Cache()
{
var options = GrabTestOptions("Analyze2FromSourcesV35Cache");
options.BuildFramework = @"v3.5";
options.ContractFramework = @"v3.5";
if (!options.Skip)
TestDriver.BuildAndAnalyze2(options);
}

[TestCategory("StaticChecker"), TestCategory("Clousot1"), TestCategory("Cache")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze1FromSourcesV40Cache()
{
var options = GrabTestOptions("Analyze1FromSourcesV40Cache");
options.BuildFramework = @".NETFramework\v4.0";
options.ContractFramework = @".NETFramework\v4.0";
if (!options.Skip)
TestDriver.BuildAndAnalyze(options);
}

[TestCategory("StaticChecker"), TestCategory("Clousot1"), TestCategory("Cache")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze1FromSourcesV40AgainstV35ContractsCache()
{
var options = GrabTestOptions("Analyze1FromSourcesV40AgainstV35ContractsCache");
options.BuildFramework = @".NETFramework\v4.0";
options.ContractFramework = @"v3.5";
if (!options.Skip)
TestDriver.BuildAndAnalyze(options);
}

[TestCategory("StaticChecker"), TestCategory("Clousot2"), TestCategory("Service"), TestCategory("Cache")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze2ServiceSequentialFromSourcesV40Cache()
{
var options = GrabTestOptions("Analyze2ServiceSequentialFromSourcesV40Cache");
options.BuildFramework = @".NETFramework\v4.0";
options.ContractFramework = @".NETFramework\v4.0";
if (!options.Skip)
TestDriver.BuildAndAnalyze2S(options);
}

[TestCategory("StaticChecker"), TestCategory("Clousot2"), TestCategory("Service"), TestCategory("Cache"), TestCategory("Short")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze2FastSequentialFromSourcesV40Cache()
{
var options = GrabTestOptions("Analyze2FastSequentialFromSourcesV40Cache");
options.BuildFramework = @".NETFramework\v4.0";
options.ContractFramework = @".NETFramework\v4.0";
options.Fast = true;
if (!options.Skip)
TestDriver.BuildAndAnalyze2(options);
}

[AssemblyCleanup] // Automatically called at the end of ClousotCacheTests
public static void AssemblyCleanup()
{
TestDriver.Cleanup();
}

private Options GrabTestOptions(string testGroupName)
{
var options = new Options(testGroupName, TestContext);
CurrentGroupInfo = options.Group;
return options;
}

private static GroupInfo CurrentGroupInfo;
}

[TestCategory("StaticChecker"), TestCategory("Clousot1"), TestCategory("Cache")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze1FromSourcesV40AgainstV35ContractsCache()
{
var options = GrabTestOptions("Analyze1FromSourcesV40AgainstV35ContractsCache");
options.BuildFramework = @".NETFramework\v4.0";
options.ContractFramework = @"v3.5";
if (!options.Skip)
TestDriver.BuildAndAnalyze(options);
}

[TestCategory("StaticChecker"), TestCategory("Clousot2"), TestCategory("Service"), TestCategory("Cache")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze2ServiceSequentialFromSourcesV40Cache()
{
var options = GrabTestOptions("Analyze2ServiceSequentialFromSourcesV40Cache");
options.BuildFramework = @".NETFramework\v4.0";
options.ContractFramework = @".NETFramework\v4.0";
if (!options.Skip)
TestDriver.BuildAndAnalyze2S(options);
}

[TestCategory("StaticChecker"), TestCategory("Clousot2"), TestCategory("Service"), TestCategory("Cache"), TestCategory("Short")]
[DeploymentItem(@"Microsoft.Research\RegressionTest\ClousotCacheTests\ClousotCacheTestInputs.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\ClousotCacheTestInputs.xml", "TestRun", DataAccessMethod.Sequential)]
[TestMethod]
public void Analyze2FastSequentialFromSourcesV40Cache()
{
var options = GrabTestOptions("Analyze2FastSequentialFromSourcesV40Cache");
options.BuildFramework = @".NETFramework\v4.0";
options.ContractFramework = @".NETFramework\v4.0";
options.Fast = true;
if (!options.Skip)
TestDriver.BuildAndAnalyze2(options);
}

[AssemblyCleanup] // Automatically called at the end of ClousotCacheTests
public static void AssemblyCleanup()
{
TestDriver.Cleanup();
}

private Options GrabTestOptions(string testGroupName)
{
var options = new Options(testGroupName, TestContext);
CurrentGroupInfo = options.Group;
return options;
}

static GroupInfo CurrentGroupInfo;

}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// CodeContracts
// CodeContracts
//
// Copyright (c) Microsoft Corporation
//
Expand All @@ -19,6 +19,7 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("ClousotTestHarness")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
Expand All @@ -31,9 +32,11 @@
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.

[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid("7ed696dc-0dae-41ae-a9cc-0d4e990ab16a")]

// Version information for an assembly consists of the following four values:
Expand All @@ -46,5 +49,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading