summaryrefslogtreecommitdiff
path: root/tests/testenvironment.proj
blob: 7a0aa632727f2926ced1d6216fa282aa908f310d (plain)
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
<Project DefaultTargets="CreateTestEnvFile">
  <!-- This project creates a .cmd or .sh file that sets the environment variables corresponding to the specified Scenario property.
       For example, to create SetStressModes.cmd file for scenario "jitstress1" you can use the following command:

       dotnet msbuild testenvironment.proj /p:TestEnvFileName=SetStressModes.cmd /p:Scenario=jitstress1 /p:TargetsWindows=true
  -->


  <!-- COMPlus_* variables that can be specified for a test scenario -->
  <PropertyGroup>
    <COMPlusVariables>
      COMPlus_TieredCompilation;
      COMPlus_EnableAES;
      COMPlus_EnableAVX;
      COMPlus_EnableAVX2;
      COMPlus_EnableBMI1;
      COMPlus_EnableBMI2;
      COMPlus_EnableFMA;
      COMPlus_EnableHWIntrinsic;
      COMPlus_EnableIncompleteISAClass;
      COMPlus_EnableLZCNT;
      COMPlus_EnablePCLMULQDQ;
      COMPlus_EnablePOPCNT;
      COMPlus_EnableSSE;
      COMPlus_EnableSSE2;
      COMPlus_EnableSSE3;
      COMPlus_EnableSSE3_4;
      COMPlus_EnableSSE41;
      COMPlus_EnableSSE42;
      COMPlus_EnableSSSE3;
      COMPlus_FeatureSIMD;
      COMPlus_ForceRelocs;
      COMPlus_GCStress;
      COMPlus_HeapVerify;
      COMPlus_JITMinOpts;
      COMPlus_JitStress;
      COMPlus_JitStressRegs;
      COMPlus_TailcallStress;
      COMPlus_ReadyToRun;
      COMPlus_ZapDisable
    </COMPlusVariables>
  </PropertyGroup>
  <ItemGroup>
    <COMPlusVariable Include="$(COMPlusVariables)" />
  </ItemGroup>

  <!-- Default values for some COMPlus_* variables -->
  <ItemDefinitionGroup>
    <TestEnvironment>
      <TieredCompilation>0</TieredCompilation>
    </TestEnvironment>
  </ItemDefinitionGroup>

  <!-- TestEnvironment is a mapping between Scenario and COMPlus_* environment variable values that are written to __TestEnv file -->
  <ItemGroup>
    <!-- "normal" scenario doesn't define any COMPlus_* variables and uses the coreclr runtime default values
         while other scenarios use the default values of COMPlus_* variables defined in ItemDefinitionGroup above -->
    <TestEnvironment Include="normal" TieredCompilation="" />
    <TestEnvironment Include="jitminopts" JITMinOpts="1" />
    <TestEnvironment Include="no_tiered_compilation" TieredCompilation="0" />
    <TestEnvironment Include="forcerelocs" ForceRelocs="1" />
    <TestEnvironment Include="jitstress1" JitStress="1" />
    <TestEnvironment Include="jitstress2" JitStress="2" />
    <TestEnvironment Include="jitstress1_tiered" JitStress="1" TieredCompilation="1" />
    <TestEnvironment Include="jitstress2_tiered" JitStress="2" TieredCompilation="1" />
    <TestEnvironment Include="jitstress_isas_incompletehwintrinsic" EnableIncompleteISAClass="1"  />
    <TestEnvironment Include="jitstress_isas_nohwintrinsic" EnableHWIntrinsic="0" />
    <TestEnvironment Include="jitstress_isas_nohwintrinsic_nosimd" EnableHWIntrinsic="0" FeatureSIMD="0" />
    <TestEnvironment Include="jitstress_isas_nosimd" FeatureSIMD="0" />
    <TestEnvironment Include="jitstress_isas_x86_noaes" EnableAES="0" /> <!-- Depends on SSE2 -->
    <TestEnvironment Include="jitstress_isas_x86_noavx" EnableAVX="0" /> <!-- Depends on SSE42 -->
    <TestEnvironment Include="jitstress_isas_x86_noavx2" EnableAVX2="0" /> <!-- Depends on AVX -->
    <TestEnvironment Include="jitstress_isas_x86_nobmi1" EnableBMI1="0" /> <!-- No dependencies -->
    <TestEnvironment Include="jitstress_isas_x86_nobmi2" EnableBMI2="0" /> <!-- No dependencies -->
    <TestEnvironment Include="jitstress_isas_x86_nofma" EnableFMA="0" /> <!-- Depends on AVX -->
    <TestEnvironment Include="jitstress_isas_x86_nohwintrinsic" EnableBMI1="0" EnableBMI2="0" EnableLZCNT="0" EnableSSE="0" />
    <TestEnvironment Include="jitstress_isas_x86_nolzcnt" EnableLZCNT="0" /> <!-- No dependencies -->
    <TestEnvironment Include="jitstress_isas_x86_nopclmulqdq" EnablePCLMULQDQ="0" /> <!-- Depends on SSE2 -->
    <TestEnvironment Include="jitstress_isas_x86_nopopcnt" EnablePOPCNT="0" /> <!-- Depends on SSE42 -->
    <TestEnvironment Include="jitstress_isas_x86_nosse" EnableSSE="0" /> <!-- No dependencies -->
    <TestEnvironment Include="jitstress_isas_x86_nosse2" EnableSSE2="0" /> <!-- Depends on SSE -->
    <TestEnvironment Include="jitstress_isas_x86_nosse3" EnableSSE3="0" /> <!-- Depends on SSE2 -->
    <TestEnvironment Include="jitstress_isas_x86_nosse3_4" EnableSSE3_4="0" /> <!-- Depends on SSE2 -->
    <TestEnvironment Include="jitstress_isas_x86_nosse41" EnableSSE41="0" /> <!-- Depends on SSSE3 and SSE3_4 -->
    <TestEnvironment Include="jitstress_isas_x86_nosse42" EnableSSE42="0" /> <!-- Depends on SSE41 -->
    <TestEnvironment Include="jitstress_isas_x86_nossse3" EnableSSSE3="0" /> <!-- Depends on SSE3 -->
    <TestEnvironment Include="jitstressregs1_x86_noavx" JitStressRegs="1" EnableAVX="0" />
    <TestEnvironment Include="jitstressregs2_x86_noavx" JitStressRegs="2" EnableAVX="0" />
    <TestEnvironment Include="jitstressregs3_x86_noavx" JitStressRegs="3" EnableAVX="0" />
    <TestEnvironment Include="jitstressregs4_x86_noavx" JitStressRegs="4" EnableAVX="0" />
    <TestEnvironment Include="jitstressregs8_x86_noavx" JitStressRegs="8" EnableAVX="0" />
    <TestEnvironment Include="jitstressregs0x10_x86_noavx" JitStressRegs="0x10" EnableAVX="0" />
    <TestEnvironment Include="jitstressregs0x80_x86_noavx" JitStressRegs="0x80" EnableAVX="0" />
    <TestEnvironment Include="jitstressregs0x1000_x86_noavx" JitStressRegs="0x1000" EnableAVX="0" />
    <TestEnvironment Include="jitstressregs1" JitStressRegs="1" />
    <TestEnvironment Include="jitstressregs2" JitStressRegs="2" />
    <TestEnvironment Include="jitstressregs3" JitStressRegs="3" />
    <TestEnvironment Include="jitstressregs4" JitStressRegs="4" />
    <TestEnvironment Include="jitstressregs8" JitStressRegs="8" />
    <TestEnvironment Include="jitstressregs0x10" JitStressRegs="0x10" />
    <TestEnvironment Include="jitstressregs0x80" JitStressRegs="0x80" />
    <TestEnvironment Include="jitstressregs0x1000" JitStressRegs="0x1000" />
    <TestEnvironment Include="jitstress2_jitstressregs1" JitStress="2" JitStressRegs="1" />
    <TestEnvironment Include="jitstress2_jitstressregs2" JitStress="2" JitStressRegs="2" />
    <TestEnvironment Include="jitstress2_jitstressregs3" JitStress="2" JitStressRegs="3" />
    <TestEnvironment Include="jitstress2_jitstressregs4" JitStress="2" JitStressRegs="4" />
    <TestEnvironment Include="jitstress2_jitstressregs8" JitStress="2" JitStressRegs="8" />
    <TestEnvironment Include="jitstress2_jitstressregs0x10" JitStress="2" JitStressRegs="0x10" />
    <TestEnvironment Include="jitstress2_jitstressregs0x80" JitStress="2" JitStressRegs="0x80" />
    <TestEnvironment Include="jitstress2_jitstressregs0x1000" JitStress="2" JitStressRegs="0x1000" />
    <TestEnvironment Include="tailcallstress" TailcallStress="1" />
    <TestEnvironment Include="gcstress0x3" GCStress="0x3" />
    <TestEnvironment Include="gcstress0xc" GCStress="0xC" />
    <TestEnvironment Include="zapdisable" ZapDisable="1" ReadyToRun="0" />
    <TestEnvironment Include="heapverify1" HeapVerify="1" />
    <TestEnvironment Include="gcstress0xc_zapdisable" GCStress="0xC" ZapDisable="1" ReadyToRun="0" />
    <TestEnvironment Include="gcstress0xc_zapdisable_jitstress2" GCStress="0xC" ZapDisable="1" ReadyToRun="0" JitStress="2" />
    <TestEnvironment Include="gcstress0xc_zapdisable_heapverify1" GCStress="0xC" ZapDisable="1" ReadyToRun="0" HeapVerify="1" />
    <TestEnvironment Include="gcstress0xc_jitstress1" GCStress="0xC" JitStress="1" />
    <TestEnvironment Include="gcstress0xc_jitstress2" GCStress="0xC" JitStress="2" />
    <TestEnvironment Include="gcstress0xc_jitminopts_heapverify1" GCStress="0xC" JITMinOpts="1" HeapVerify="1" />
  </ItemGroup>

  <!-- We use target batching on the COMPlusVariable items to iterate over the all COMPlus_* environment variables
       that can be specified by a test scenario. -->
  <Target Name="OutputCOMPlusVariables" Inputs="@(COMPlusVariable)" Outputs="%(COMPlusVariable.Identity)">
    <PropertyGroup>
      <_COMPlusVariable>%(COMPlusVariable.Identity)</_COMPlusVariable>
      <_COMPlusVariableMetadataName>$(_COMPlusVariable.Replace('COMPlus_', ''))</_COMPlusVariableMetadataName>
    </PropertyGroup>

    <ItemGroup>
      <_TestEnvironment Include="@(TestEnvironment)" Condition="'%(Identity)' == '$(Scenario)'" />
      <_TestEnvironmentWithMetadata Include="@(_TestEnvironment->HasMetadata($(_COMPlusVariableMetadataName)))" />

      <!-- _TestEnvironmentWithMetadata can be either empty or contain one item:

       1) If _TestEnvironmentWithMetadata is empty, then this suggests that the test scenario with identity $(Scenario)
          doesn't define COMPlus_* environment variable with name $(_COMPlusVariable);

       2) Otherwise, the test scenario defines such COMPlus_* environment variable and the specified value
          of this variable can be extracted by using Metadata() item function.
      -->

      <_COMPlusVariable Include="$(_COMPlusVariable)" Condition="@(_TestEnvironmentWithMetadata->Count()) == 1">
        <Value>@(_TestEnvironmentWithMetadata->Metadata($(_COMPlusVariableMetadataName)))</Value>
      </_COMPlusVariable>
    </ItemGroup>

    <!-- Conceptually, this target creates a collection of _COMPlusVariable items that corresponds to
         COMPlus_* environment variables specified for the test scenario with identity $(Scenario) -->

  </Target>

  <Target Name="CreateTestEnvFile" DependsOnTargets="OutputCOMPlusVariables">
    <ItemGroup Condition="'$(TargetsWindows)' == 'true'">
      <_TestEnvFileLine Include="@(_COMPlusVariable->'set %(Identity)=%(Value)')"  />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetsWindows)' != 'true'">
      <_TestEnvFileLine Include="#!/usr/bin/env bash" />
      <_TestEnvFileLine Include="@(_COMPlusVariable->'export %(Identity)=%(Value)')"  />
    </ItemGroup>

    <WriteLinesToFile File="$(TestEnvFileName)" Lines="@(_TestEnvFileLine)" Overwrite="true" />
  </Target>

</Project>