Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/p-org/PSharp
Browse files Browse the repository at this point in the history
  • Loading branch information
akashlal committed Aug 16, 2018
2 parents cdcdb92 + f7beb82 commit ea64445
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 21 deletions.
32 changes: 19 additions & 13 deletions Scripts/NuGet/PSharp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,31 @@
<tags>asynchrony testing .NET programming actors state-machines</tags>
</metadata>
<files>
<!-- .NET Standard 2.0 -->
<file src="..\..\bin\netstandard2.0\*.dll" target="lib\netstandard2.0" />
<file src="..\..\bin\netstandard1.1\*.dll" target="lib\netstandard1.1" />
<file src="..\..\bin\netcoreapp2.1\*.dll" target="lib\netcoreapp2.1" />
<file src="..\..\bin\net46\*.dll" target="lib\net46" />
<file src="..\..\bin\net45\*.dll" target="lib\net45" />
<file src="..\..\bin\netstandard2.0\*.mdb" target="lib\netstandard2.0" />
<file src="..\..\bin\netstandard1.1\*.mdb" target="lib\netstandard1.1" />
<file src="..\..\bin\netcoreapp2.1\*.mdb" target="lib\netcoreapp2.1" />
<file src="..\..\bin\net46\*.mdb" target="lib\net46" />
<file src="..\..\bin\net45\*.mdb" target="lib\net45" />
<file src="..\..\bin\netstandard2.0\*.xml" target="lib\netstandard2.0" />
<!-- .NET Standard 1.1 -->
<file src="..\..\bin\netstandard1.1\*.dll" target="lib\netstandard1.1" />
<file src="..\..\bin\netstandard1.1\*.mdb" target="lib\netstandard1.1" />
<file src="..\..\bin\netstandard1.1\*.xml" target="lib\netstandard1.1" />
<!-- .NET Core 2.1 -->
<file src="..\..\bin\netcoreapp2.1\*.dll" target="lib\netcoreapp2.1" />
<file src="..\..\bin\netcoreapp2.1\*.mdb" target="lib\netcoreapp2.1" />
<file src="..\..\bin\netcoreapp2.1\*.xml" target="lib\netcoreapp2.1" />
<file src="..\..\bin\netcoreapp2.1\*.runtimeconfig.json" target="lib\netcoreapp2.1" />
<!-- .NET Framework 4.6 -->
<file src="..\..\bin\net46\*.dll" target="lib\net46" />
<file src="..\..\bin\net46\*.mdb" target="lib\net46" />
<file src="..\..\bin\net46\*.xml" target="lib\net46" />
<file src="..\..\bin\net46\*.exe" target="lib\net46" />
<file src="..\..\bin\net46\*.exe.config" target="lib\net46" />
<file src="..\..\bin\net46\*.targets" target="lib\net46" />
<!-- .NET Framework 4.5 -->
<file src="..\..\bin\net45\*.dll" target="lib\net45" />
<file src="..\..\bin\net45\*.mdb" target="lib\net45" />
<file src="..\..\bin\net45\*.xml" target="lib\net45" />
<file src="..\..\bin\netstandard2.0\*" target="tools\netstandard2.0" />
<file src="..\..\bin\netstandard1.1\*" target="tools\netstandard1.1" />
<file src="..\..\bin\netcoreapp2.1\*" target="tools\netcoreapp2.1" />
<file src="..\..\bin\net46\*" target="tools\net46" />
<file src="..\..\bin\net45\*" target="tools\net45" />
<file src="..\..\bin\net45\*.exe" target="lib\net45" />
<file src="..\..\bin\net45\*.exe.config" target="lib\net45" />
</files>
</package>
9 changes: 8 additions & 1 deletion Tools/Testing/Tester/Interfaces/ITestingProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,37 @@
// </copyright>
//-----------------------------------------------------------------------

#if NET46 || NET45
using System.ServiceModel;

#endif
using Microsoft.PSharp.TestingServices.Coverage;

namespace Microsoft.PSharp.TestingServices
{
/// <summary>
/// Interface for a remote P# testing process.
/// </summary>
#if NET46 || NET45
[ServiceContract(Namespace = "Microsoft.PSharp")]
[ServiceKnownType("GetKnownTypes", typeof(KnownTypesProvider))]
#endif
internal interface ITestingProcess
{
/// <summary>
/// Returns the test report.
/// </summary>
/// <returns>TestReport</returns>
#if NET46 || NET45
[OperationContract]
#endif
TestReport GetTestReport();

/// <summary>
/// Stops testing.
/// </summary>
#if NET46 || NET45
[OperationContract]
#endif
void Stop();
}
}
2 changes: 2 additions & 0 deletions Tools/Testing/Tester/Interfaces/ITestingProcessScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// </copyright>
//-----------------------------------------------------------------------

#if NET46 || NET45
using System.ServiceModel;

namespace Microsoft.PSharp.TestingServices
Expand Down Expand Up @@ -41,3 +42,4 @@ internal interface ITestingProcessScheduler
void SetTestReport(TestReport testReport, uint processId);
}
}
#endif
2 changes: 2 additions & 0 deletions Tools/Testing/Tester/Interfaces/KnownTypesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// </copyright>
//-----------------------------------------------------------------------

#if NET46 || NET45
using System;
using System.Collections.Generic;
using System.Reflection;
Expand Down Expand Up @@ -40,3 +41,4 @@ public static IEnumerable<Type> GetKnownTypes(ICustomAttributeProvider provider)
}
}
}
#endif
25 changes: 21 additions & 4 deletions Tools/Testing/Tester/Scheduling/TestingProcessScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
#if NET46 || NET45
using System.ServiceModel;
using System.ServiceModel.Description;
#endif

using Microsoft.PSharp.IO;
using Microsoft.PSharp.Utilities;
Expand All @@ -30,7 +32,10 @@ namespace Microsoft.PSharp.TestingServices
#if NET46 || NET45
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
#endif
internal sealed class TestingProcessScheduler : ITestingProcessScheduler
internal sealed class TestingProcessScheduler
#if NET46 || NET45
: ITestingProcessScheduler
#endif
{
/// <summary>
/// Configuration.
Expand All @@ -42,12 +47,12 @@ internal sealed class TestingProcessScheduler : ITestingProcessScheduler
/// The notification listening service.
/// </summary>
private ServiceHost NotificationService;
#endif

/// <summary>
/// Map from testing process ids to testing processes.
/// </summary>
private Dictionary<uint, Process> TestingProcesses;
#endif

/// <summary>
/// Map from testing process ids to testing process channels.
Expand Down Expand Up @@ -75,11 +80,13 @@ internal sealed class TestingProcessScheduler : ITestingProcessScheduler
/// </summary>
private object SchedulerLock;

#if NET46 || NET45
/// <summary>
/// The process id of the process that
/// discovered a bug, else null.
/// </summary>
private uint? BugFoundByProcess;
#endif

/// <summary>
/// Set if ctrl-c or ctrl-break occurred.
Expand All @@ -99,15 +106,17 @@ internal sealed class TestingProcessScheduler : ITestingProcessScheduler
/// <param name="configuration">Configuration</param>
private TestingProcessScheduler(Configuration configuration)
{
#if NET46 || NET45
this.TestingProcesses = new Dictionary<uint, Process>();
#endif
this.TestingProcessChannels = new Dictionary<uint, ITestingProcess>();
this.TestReports = new ConcurrentDictionary<uint, TestReport>();
this.GlobalTestReport = new TestReport(configuration);
this.Profiler = new Profiler();
this.SchedulerLock = new object();
#if NET46 || NET45
this.BugFoundByProcess = null;

#if NET46 || NET45
// Code coverage should be run out-of-process; otherwise VSPerfMon won't shutdown correctly
// because an instrumented process (this one) is still running.
this.runOutOfProcess = configuration.ParallelBugFindingTasks > 1 || configuration.ReportCodeCoverage;
Expand All @@ -124,6 +133,7 @@ private TestingProcessScheduler(Configuration configuration)
this.Configuration = configuration;
}

#if NET46 || NET45
/// <summary>
/// Notifies the testing process scheduler
/// that a bug was found.
Expand Down Expand Up @@ -179,6 +189,7 @@ void ITestingProcessScheduler.SetTestReport(TestReport testReport, uint processI
this.MergeTestReport(testReport, processId);
}
}
#endif

/// <summary>
/// Creates a new P# testing process scheduler.
Expand Down Expand Up @@ -379,7 +390,6 @@ private ITestingProcess CreateTestingProcessChannel(uint processId)

return ChannelFactory<ITestingProcess>.CreateChannel(binding, endpoint);
}
#endif

/// <summary>
/// Stops the testing process.
Expand All @@ -398,6 +408,7 @@ private void StopTestingProcess(uint processId)
IO.Debug.WriteLine(ex.ToString());
}
}
#endif

/// <summary>
/// Gets the test report from the specified testing process.
Expand All @@ -408,16 +419,20 @@ private TestReport GetTestReport(uint processId)
{
TestReport testReport = null;

#if NET46 || NET45
try
{
#endif
testReport = this.TestingProcessChannels[processId].GetTestReport();
#if NET46 || NET45
}
catch (CommunicationException ex)
{
IO.Debug.WriteLine("... Unable to communicate with testing task " +
$"'{processId}'. Task has already terminated.");
IO.Debug.WriteLine(ex.ToString());
}
#endif

return testReport;
}
Expand Down Expand Up @@ -448,13 +463,15 @@ private void MergeTestReport(TestReport testReport, uint processId)
private void EmitTestReport()
{
var testReports = new List<TestReport>(this.TestReports.Values);
#if NET46 || NET45
foreach (var process in this.TestingProcesses)
{
if (!this.TestReports.ContainsKey(process.Key))
{
Output.WriteLine($"... Task {process.Key} failed due to an internal error.");
}
}
#endif

if (this.TestReports.Count == 0)
{
Expand Down
3 changes: 0 additions & 3 deletions Tools/Testing/Tester/Tester.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\Source\TestingServices\TestingServices.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.1'">
<PackageReference Include="System.ServiceModel.Primitives" Version="4.5.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net46'">
<Reference Include="System.Configuration" />
<Reference Include="System.ServiceModel" />
Expand Down
2 changes: 2 additions & 0 deletions Tools/Testing/Tester/Testing/TestingProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
#if NET46 || NET45
using System.ServiceModel;
using System.ServiceModel.Description;
#endif
using System.Timers;

using Microsoft.PSharp.IO;
Expand Down

0 comments on commit ea64445

Please sign in to comment.