summaryrefslogtreecommitdiff
path: root/tests/testenvironment.proj
blob: f99209ba03fbd3135b9a6fe0783b7c400dd2595d (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
<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_EnableIncompleteISAClass;
      COMPlus_EnableLZCNT;
      COMPlus_EnablePCLMULQDQ;
      COMPlus_EnablePOPCNT;
      COMPlus_EnableSSE;
      COMPlus_EnableSSE2;
      COMPlus_EnableSSE3;
      COMPlus_EnableSSE3_4;
      COMPlus_EnableSSSE3;
      COMPlus_EnableSSE41;
      COMPlus_EnableSSE42;
      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="minopts" 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="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="jitsse2only" EnableAVX="0" EnableSSE3_4="0" />
    <TestEnvironment Include="jitnosimd" FeatureSIMD="0" />
    <TestEnvironment Include="jitincompletehwintrinsic" EnableIncompleteISAClass="1" />
    <!-- testing the legacy SSE encoding -->
    <TestEnvironment Include="jitx86hwintrinsicnoavx" EnableIncompleteISAClass="1" EnableAVX="0" />
    <!-- testing SNB/IVB -->
    <TestEnvironment Include="jitx86hwintrinsicnoavx2" EnableIncompleteISAClass="1" EnableAVX2="0" />
    <!-- match "jitnosimd", may need to remove after decoupling HW intrinsic from FeatureSIMD -->
    <TestEnvironment Include="jitx86hwintrinsicnosimd" EnableIncompleteISAClass="1" FeatureSIMD="0" />
    <TestEnvironment Include="jitnox86hwintrinsic" EnableIncompleteISAClass="1" EnableSSE="0" EnableSSE2="0" EnableSSE3="0" EnableSSSE3="0" EnableSSE41="0" EnableSSE42="0" EnableAVX="0" EnableAVX2="0" EnableAES="0" EnableBMI1="0" EnableBMI2="0" EnableFMA="0" EnableLZCNT="0" EnablePCLMULQDQ="0" EnablePOPCNT="0" />
    <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_minopts_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="@echo off" />
      <_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>