summaryrefslogtreecommitdiff
path: root/eng/test-job.yml
blob: 11294ec6bb4435b20401fc4c3e59e1b921fc1441 (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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
parameters:
  buildConfig: ''
  archType: ''
  osGroup: ''
  osIdentifier: ''
  testGroup: ''
  readyToRun: false
  helixQueues: ''
  crossrootfsDir: ''

### Test job

### Each test job depends on a corresponding build job with the same
### buildConfig and archType.

jobs:
- template: xplat-job.yml
  parameters:
    buildConfig: ${{ parameters.buildConfig }}
    archType: ${{ parameters.archType }}
    osGroup: ${{ parameters.osGroup }}
    osIdentifier: ${{ parameters.osIdentifier }}

    # Compute job name from template parameters
    ${{ if and(eq(parameters.testGroup, 'innerloop'), eq(parameters.readyToRun, false)) }}:
      name: ${{ format('testbuild_pri0_{0}_{1}_{2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
      displayName: ${{ format('Test Pri0 {0} {1} {2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
    ${{ if and(eq(parameters.testGroup, 'innerloop'), eq(parameters.readyToRun, true)) }}:
      name: ${{ format('testbuild_pri0_r2r_{0}_{1}_{2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
      displayName: ${{ format('Test Pri0 R2R {0} {1} {2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}

    ${{ if and(ne(parameters.testGroup, 'innerloop'), eq(parameters.readyToRun, false)) }}:
      name: ${{ format('testbuild_pri1_{0}_{1}_{2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
      displayName: ${{ format('Test Pri1 {0} {1} {2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
    ${{ if and(ne(parameters.testGroup, 'innerloop'), eq(parameters.readyToRun, true)) }}:
      name: ${{ format('testbuild_pri1_r2r_{0}_{1}_{2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
      displayName: ${{ format('Test Pri1 R2R {0} {1} {2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}

    crossrootfsDir: ${{ parameters.crossrootfsDir }}

    variables:
    - group: DotNet-HelixApi-Access
    # Map template parameters to command line arguments
    - name: priorityArg
      value: ''
    - ${{ if ne(parameters.testGroup, 'innerloop') }}:
      - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
        - name: priorityArg
          value: 'priority1'
      - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
        - name: priorityArg
          value: '-priority=1'

    - name: crossgenArg
      value: ''
    - ${{ if eq(parameters.readyToRun, true) }}:
      - name: crossgenArg
        value: 'crossgen'

    - name: clangArg
      value: ''
    # Our FreeBSD doesn't yet detect available clang versions, so pass it explicitly.
    - ${{ if eq(parameters.osGroup, 'FreeBSD') }}:
      - name: clangArg
        value: '-clang6.0'
    - ${{ if and(eq(parameters.osIdentifier, 'Linux_musl'), eq(parameters.archType, 'arm64')) }}:
      - name: clangArg
        value: '-clang5.0'

    # TODO: Enable crossgen in build-test.sh. It currently doesn't
    # accept a crossgen arg, so disable the macos/linux crossgen test
    # build jobs.
    ${{ if and(eq(parameters.readyToRun, true), in(parameters.osGroup, 'Linux', 'OSX')) }}:
      condition: false

    # FreeBSD test jobs are disabled since we don't have any FreeBSD helix queues.
    ${{ if eq(parameters.osGroup, 'FreeBSD') }}:
      condition: false

    # Test job depends on the corresponding build job
    dependsOn: ${{ format('build_{0}_{1}_{2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}

    # Run all steps in the container.
    # Note that the containers are resources defined in azure-pipelines.yml
    containerName: ${{ parameters.containerName }}

    # "Total" means building tests, waiting for a queue in Helix to become available, and running the tests.
    # In case test-job.yml gets split into two separate jobs (e.g. build-test-job.yml and run-test.yml)
    # this number should be adjusted accordingly.
    ${{ if eq(parameters.testGroup, 'innerloop') }}:
      timeoutInMinutes: 240
    ${{ if eq(parameters.testGroup, 'outerloop') }}:
      timeoutInMinutes: 360
    ${{ if in(parameters.testGroup, 'outerloop-jitminopts-jitstress1-jitstress2', 'outerloop-jitstressregs', 'outerloop-jitstress2-jitstressregs', 'outerloop-gcstress0x3-gcstress0xc') }}:
      timeoutInMinutes: 480

    steps:

    # Install test build dependencies
    - ${{ if eq(parameters.osGroup, 'OSX') }}:
      - script: sh eng/install-native-dependencies.sh $(osGroup)
        displayName: Install native dependencies


    # Download product build from pipeline artifact storage
    - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
      - task: DownloadPipelineArtifact@0
        displayName: Download product build pipeline artifact
        inputs:
          artifactName: ${{ format('{0}_{1}_{2}_build', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
          targetPath: $(Build.SourcesDirectory)/bin/Product/$(osGroup).$(archType).$(buildConfigUpper)
    - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
      - task: DownloadPipelineArtifact@0
        displayName: Download product build pipeline artifact
        inputs:
          artifactName: ${{ format('{0}_{1}_{2}_build', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
          targetPath: $(Build.SourcesDirectory)\bin\Product\Windows_NT.$(archType).$(buildConfigUpper)


    # Build tests
    # TODO: enable crossgen in build-test.sh
    - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
      - script: ./build-test.sh $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(crossgenArg) $(clangArg)
        displayName: Build tests
    - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
      - script: build-test.cmd $(buildConfig) $(archType) $(priorityArg) $(crossgenArg)
        displayName: Build tests


    # Send tests to Helix
    - template: /eng/send-to-helix-step.yml
      parameters:
        displayName: Send tests to Helix
        buildConfig: ${{ parameters.buildConfig }}
        archType: ${{ parameters.archType }}
        osGroup: ${{ parameters.osGroup }}

        ${{ if eq(variables['System.TeamProject'], 'public') }}:
          creator: $(Build.DefinitionName)

        helixBuild: $(Build.BuildNumber)

        ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
          helixSource: official/dotnet/coreclr/$(Build.SourceBranch)
        ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
          helixSource: pr/dotnet/coreclr/$(Build.SourceBranch)
        ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
          helixSource: ci/dotnet/coreclr/$(Build.SourceBranch)

        ${{ if eq(parameters.readyToRun, false) }}:
          helixType: 'test/functional/cli/'
        ${{ if eq(parameters.readyToRun, true) }}:
          helixType: 'test/functional/r2r/cli/'

        helixQueues: ${{ parameters.helixQueues }}

        ${{ if eq(parameters.helixQueues.asString, '') }}:
          condition: false

        publishTestResults: true

        ${{ if eq(parameters.testGroup, 'innerloop') }}:
          # "PerCollection" is time needed for the "biggest" xUnit test collection to complete.
          # In case xUnit test wrappers get refactored this number should also be adjusted.
          timeoutPerTestCollectionInMinutes: 30
          # "PerTest" corresponds to individual test running time (i.e. __TestTimeout).
          timeoutPerTestInMinutes: 10
        ${{ if eq(parameters.testGroup, 'outerloop') }}:
          timeoutPerTestCollectionInMinutes: 60
          timeoutPerTestInMinutes: 10
        ${{ if in(parameters.testGroup, 'outerloop-jitminopts-jitstress1-jitstress2', 'outerloop-jitstressregs', 'outerloop-jitstress2-jitstressregs', 'outerloop-gcstress0x3-gcstress0xc') }}:
          timeoutPerTestCollectionInMinutes: 120
          timeoutPerTestInMinutes: 30

        runCrossGen: ${{ parameters.readyToRun }}

        ${{ if eq(variables['System.TeamProject'], 'internal') }}:
          # Access token variable for internal project from the
          # DotNet-HelixApi-Access variable group
          helixAccessToken: $(HelixApiAccessToken)

        ${{ if in(parameters.testGroup, 'innerloop', 'outerloop') }}:
          scenarios:
            asString: 'normal,no_tiered_compilation'
            asArray:
            - normal
            - no_tiered_compilation
        ${{ if eq(parameters.testGroup, 'outerloop-jitminopts-jitstress1-jitstress2') }}:
          scenarios:
            asString: 'jitminopts,jitstress1,jitstress1_tiered,jitstress2,jitstress2_tiered'
            asArray:
            - jitminopts
            - jitstress1
            - jitstress1_tiered
            - jitstress2
            - jitstress2_tiered
        ${{ if eq(parameters.testGroup, 'outerloop-jitstressregs') }}:
          scenarios:
            asString: 'jitstressregs1,jitstressregs2,jitstressregs3,jitstressregs4,jitstressregs8,jitstressregs0x10,jitstressregs0x80,jitstressregs0x1000'
            asArray:
            - jitstressregs1
            - jitstressregs2
            - jitstressregs3
            - jitstressregs4
            - jitstressregs8
            - jitstressregs0x10
            - jitstressregs0x80
            - jitstressregs0x1000
        ${{ if eq(parameters.testGroup, 'outerloop-jitstress2-jitstressregs') }}:
          scenarios:
            asString: 'jitstress2_jitstressregs1,jitstress2_jitstressregs2,jitstress2_jitstressregs3,jitstress2_jitstressregs4,jitstress2_jitstressregs8,jitstress2_jitstressregs0x10,jitstress2_jitstressregs0x80,jitstress2_jitstressregs0x1000'
            asArray:
            - jitstress2_jitstressregs1
            - jitstress2_jitstressregs2
            - jitstress2_jitstressregs3
            - jitstress2_jitstressregs4
            - jitstress2_jitstressregs8
            - jitstress2_jitstressregs0x10
            - jitstress2_jitstressregs0x80
            - jitstress2_jitstressregs0x1000
        ${{ if eq(parameters.testGroup, 'outerloop-gcstress0x3-gcstress0xc') }}:
          scenarios:
            asString: 'gcstress0x3,gcstress0xc'
            asArray:
            - gcstress0x3
            - gcstress0xc

    # Publish Logs
    - task: PublishPipelineArtifact@0
      displayName: Publish Logs
      inputs:
        ${{ if eq(parameters.readyToRun, false) }}:
          artifactName: ${{ format('testbuild_{0}_{1}_{2}_{3}_Logs', parameters.osIdentifier, parameters.archType, parameters.buildConfig, parameters.testGroup) }}
        ${{ if  eq(parameters.readyToRun, true) }}:
          artifactName: ${{ format('testbuild_{0}_{1}_{2}_{3}_r2r_Logs', parameters.osIdentifier, parameters.archType, parameters.buildConfig, parameters.testGroup) }}
        targetPath: $(Build.SourcesDirectory)/bin/Logs
      continueOnError: true
      condition: always()