forked from LeeSanderson/Concurrency
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConcurrency.build
More file actions
172 lines (131 loc) · 7.7 KB
/
Concurrency.build
File metadata and controls
172 lines (131 loc) · 7.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?xml version="1.0"?>
<project name="Concurrency" default="all" basedir=".">
<!-- ============================================================
Build script for the Concurrency solution.
============================================================ -->
<target name="all" depends="init, build, test, chess"/>
<!-- ============================================================
Target to initialise properties used by all targets
============================================================ -->
<target name="init">
<property name="config" value="debug" overwrite="false"/>
<!--
Project specific properties
If using this file as a template for other build scripts then modifying these properties
should be sufficient to get the build working.
-->
<property name="solutionFile" value="Concurrency.sln"/>
<property name="outputDir" value=".\Concurrency\bin\${config}"/>
<property name="outputAssemblyName" value="Concurrency.dll"/>
<property name="outputAssembly" value="${outputDir}\${outputAssemblyName}"/>
<property name="testOutputDir" value=".\Concurrency.Tests\bin\${config}"/>
<property name="testOutputAssemblyName" value="Concurrency.Tests.dll"/>
<property name="testOutputAssembly" value="${testOutputDir}\${testOutputAssemblyName}"/>
<property name="chessTestOutputDir" value="${path::get-full-path('.\Concurrency.Chess\bin\' + config)}"/>
<property name="chessTestOutputAssemblyName" value="Concurrency.Chess.dll"/>
<property name="chessTestOutputAssembly" value="${chessTestOutputDir}\${chessTestOutputAssemblyName}"/>
<property name="deploymentPackageName" value="Concurrency"/>
<!--
Relative path to tools directory
-->
<property name="toolsHome" value=".\packages"/>
<property name="coverageFilter" value="+[Concurrency]*"/> <!-- Opencover filter to specify code to be analysed -->
<property name="test.MinimumCoverage" value ="100"/> <!-- Opencover minimum coverage (default 100%) -->
<!-- Common properties -->
<property name="testResultsDir" value=".\TestResults"/>
<property name="coverageResultsDir" value="${testResultsDir}\CoverageReports"/>
<property name="deployDir" value=".\Deploy"/>
<property name="msbuildCmd" value="${framework::get-framework-directory('net-4.0')}/msbuild.exe"/>
<property name="opencoverCmd" value="${toolsHome}\OpenCover.4.6.519\tools\OpenCover.Console.exe"/>
<property name="nunitCmd" value="${toolsHome}\NUnit.ConsoleRunner.3.4.1\tools\nunit3-console.exe"/>
<property name="reportGeneratorCmd" value="${toolsHome}\ReportGenerator.2.4.4.0\tools\ReportGenerator.exe"/>
<property name="chessHome" value="${path::get-full-path(toolsHome + '\Chess.1.0.1\tools')}"/>
<property name="mcutCmd" value="${chessHome}\mcut.exe"/>
<property name="expectedChessCLRProfilerPath" value="${chessHome}\Microsoft.ExtendedReflection.ClrMonitor.X86.dll"/>
<!--
Check Chess CLR profiler is installed
-->
<readregistry property="actualChessCLRProfilerPath" key="SOFTWARE\WOW6432Node\Classes\CLSID\{56F9B43A-2FDE-475F-A4B6-839903483980}\InprocServer32\" failonerror="false"/>
<fail unless="${property::exists('actualChessCLRProfilerPath')}">
Unable to find CHESS CLR profiler (Microsoft.ExtendedReflection.ClrMonitor.X86.dll) in the registry.
Please check that the profiler is installed and if necessary run the regClrMonitor.bat command from the
${chessHome} directory (from an administrative command prompt).
</fail>
<fail if="${expectedChessCLRProfilerPath != actualChessCLRProfilerPath}">
Unexpected path for CHESS CLR profiler (Microsoft.ExtendedReflection.ClrMonitor.X86.dll) in the registry.
Expected: ${expectedChessCLRProfilerPath}
Actual: ${actualChessCLRProfilerPath}
Please check that the profiler is installed and if necessary run the regClrMonitor.bat command from the
${chessHome} directory (from an administrative command prompt).
</fail>
</target>
<!-- ============================================================
Target to build the components
============================================================ -->
<target name="build" depends="init">
<exec program="${msbuildCmd}" >
<arg value="${solutionFile}" />
<arg value="/p:configuration=${config}" />
<arg value="/t:Rebuild" />
<!-- Ensure code analysis conditional symbol is defined so that [SuppressMessage] attribute are included in output -->
<arg value='/p:DefineConstants="TRACE;DEBUG;CODE_ANALYSIS"'/>
</exec>
</target>
<!-- ============================================================
Target to run tests and generate coverage reports.
============================================================ -->
<target name="test" depends="build">
<mkdir dir="${testResultsDir}" unless="${directory::exists(testResultsDir)}"/>
<mkdir dir="${coverageResultsDir}" unless="${directory::exists(coverageResultsDir)}"/>
<!-- Run coverage tool -->
<exec program="${opencoverCmd}">
<arg value="-target:${nunitCmd}"/>
<arg value='-targetargs:"${testOutputAssemblyName}"'/>
<arg value='-targetdir:"${testOutputDir}"'/>
<arg value="-log:All"/>
<arg value="-register:user"/>
<arg value='-filter:"${coverageFilter}"'/>
<arg value="-output:${testResultsDir}\CoverageResults.xml"/>
</exec>
<!-- Generate coverage reports -->
<exec program="${reportGeneratorCmd}">
<arg value="-reports:${testResultsDir}\CoverageResults.xml"/>
<arg value="-reporttypes:Html;HtmlSummary"/>
<arg value="-targetdir:${coverageResultsDir}"/>
</exec>
<!-- Check for any test failures -->
<xmlpeek file="${testOutputDir}\TestResult.xml"
xpath="//test-run/@failed"
property="test.NumFailures" />
<fail if="${int::parse(test.NumFailures) > 0}" message="${test.NumFailures} unit tests failed!!!"/>
<!-- Check for sufficient code coverage -->
<xmlpeek file="${testResultsDir}\CoverageResults.xml"
xpath="count(//SequencePoint)"
property="test.SequencePoints" />
<xmlpeek file="${testResultsDir}\CoverageResults.xml"
xpath="count(//SequencePoint[@vc!='0'])"
property="test.CoveredSequencePoints" />
<property name="test.Coverage" value="${double::parse(test.CoveredSequencePoints) / double::parse(test.SequencePoints) * 100}" />
<fail if="${double::parse(test.Coverage) < double::parse(test.MinimumCoverage)}"
message="The solution currently has ${math::round(double::parse(test.Coverage))}% coverage, less than the required ${math::round(double::parse(test.MinimumCoverage))}%" />
</target>
<!-- ============================================================
Target to run concurrency tests using CHESS.
============================================================ -->
<target name="chess" depends="build">
<mkdir dir="${testResultsDir}" unless="${directory::exists(testResultsDir)}"/>
<!-- Tidy up prior to run -->
<property name="chessSessionTemp" value=".\session.tmp"/>
<property name="chessResults" value=".\allResults.xml"/>
<delete file="${chessResults}" if="${file::exists(chessResults)}"/>
<delete dir="${chessSessionTemp}" includeemptydirs="true" if="${directory::exists(chessSessionTemp)}"/>
<!-- Run concurrency test tool -->
<exec program="${mcutCmd}">
<arg value="runAllTests"/>
<arg value="${chessTestOutputAssembly}"/>
</exec>
<!-- Tidy up if successful-->
<move todir="${testResultsDir}" file="allResults.xml" />
<delete dir="${chessSessionTemp}" includeemptydirs="true" if="${directory::exists(chessSessionTemp)}"/>
</target>
</project>