aboutsummaryrefslogtreecommitdiffstats
path: root/.ci/templates/job-uhd-devtest.yml
blob: 3e095c5f3192010c9165544fb56649bdc80eca5b (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
parameters:
- name: suiteName
  type: string
- name: testOS
  type: string
  values:
    - ubuntu2004
- name: knownHost
  type: string
- name: toolset
  type: string
  values:
    - make
- name: uhdSrcDir
  type: string
- name: uhdArtifactSource
  type: string
- name: redisHost
  type: string
- name: dutMatrix
  type: object

jobs:
- job: uhd_devtest_${{ parameters.suiteName }}_${{ parameters.testOS }}
  displayName:  uhd devtest ${{ parameters.suiteName }} ${{ parameters.testOS }}
  timeoutInMinutes: 90
  pool:
    name: de-dre-lab
    demands:
    - suiteName -equals ${{ parameters.suiteName }}
    - testOS -equals ${{ parameters.testOS }}
    - device -equals $(devAgent)
  variables:
  - group: sdr-pipeline-vars
  strategy:
    matrix: ${{ parameters.dutMatrix }}
  workspace:
    clean: outputs

  steps:
  - checkout: self
    clean: true

  - task: InstallSSHKey@0
    displayName: 'Install Ettus SSH key'
    inputs:
      knownHostsEntry: '${{ parameters.knownHost }}'
      sshPublicKey: '$(ettus_ssh_pubkey)'
      sshKeySecureFile: 'id_rsa.ettus'

  - script: |
      if [ "${{ parameters.uhdArtifactSource }}" = "current" ]; then
        echo '##vso[task.setvariable variable=uhd_artifact_directory]'$(Agent.BuildDirectory)
      else
        echo '##vso[task.setvariable variable=uhd_artifact_directory]'$(Agent.BuildDirectory)/${{ parameters.uhdArtifactSource }}
      fi
    displayName: Set uhddev pipeline artifact location

  - download: ${{ parameters.uhdArtifactSource }}
    artifact: uhddev-${{ parameters.testOS }}-${{ parameters.toolset }}
    displayName: Download uhddev-${{ parameters.testOS }}-${{ parameters.toolset }} artifact

  - task: ExtractFiles@1
    inputs:
      archiveFilePatterns: $(uhd_artifact_directory)/uhddev-${{ parameters.testOS }}-${{ parameters.toolset }}/uhddev-${{ parameters.testOS }}-${{ parameters.toolset }}.tar.gz
      destinationFolder: $(Build.BinariesDirectory)
      cleanDestinationFolder: true

  - download: ${{ parameters.uhdArtifactSource }}
    artifact: n3xx-images
    # Only sync the bz2 sdimg since the bmap
    # is incompatible with mender
    patterns: |
      **/*.bz2
      fitImage-manufacturing
    displayName: Download $(devType)-images artifact
    condition: and(succeeded(), eq(variables.devType, 'n3xx'))

  - download: ${{ parameters.uhdArtifactSource }}
    artifact: e320-images
    # Only sync the bz2 sdimg since the bmap
    # is incompatible with mender
    patterns: |
      **/*.bz2
      fitImage-manufacturing
    displayName: Download $(devType)-images artifact
    condition: and(succeeded(), eq(variables.devModel, 'e320'))

  - script: |
      cd $(Build.BinariesDirectory)/uhddev/build
      mkdir -p fpga_images
      rm -rf fpga_images/*
      python3 utils/uhd_images_downloader.py -t $(devModel)_fpga -i fpga_images \
        -b $(sdr-fileserver)
      if [ "$(devType)" = "b200" ]; then
        python3 utils/uhd_images_downloader.py -t b2xx_common -i fpga_images \
          -b $(sdr-fileserver)
      fi
    displayName: Download FPGA Images

  - script: |
      mkdir -p $(Common.TestResultsDirectory)/devtest
      cd $(Common.TestResultsDirectory)/devtest
      export PATH=$(Build.BinariesDirectory)/uhddev/build/utils:$(Build.BinariesDirectory)/uhddev/build/examples:$PATH
      export LD_LIBRARY_PATH=$(Build.BinariesDirectory)/uhddev/build/lib:$LD_LIBRARY_PATH
      export UHD_IMAGES_DIR=$(Build.BinariesDirectory)/uhddev/build/fpga_images
      python3 ${{ parameters.uhdSrcDir }}/.ci/utils/mutex_hardware.py \
        --sdimage_sdmux $(devType),$(devModel),$(uhd_artifact_directory)/$(devType)-images/$(devSDImage),${{ parameters.uhdSrcDir }}/$(devLabgridConfig),$(devHostname) \
        --fpgas $(devFpga) \
        --sfp_addrs $(sfpAddrs) \
        ${{ parameters.redisHost }} $(devName) \
        "$(Build.BinariesDirectory)/uhddev/build/utils/uhd_usrp_probe --args addr=$(devAddr)" \
        "python3 ${{ parameters.uhdSrcDir }}/host/tests/devtest/run_testsuite.py \
          --src-dir ${{ parameters.uhdSrcDir }}/host/tests/devtest \
          --devtest-pattern $(devtestPattern) --args addr=$(devAddr),type=$(devType) \
          --build-type Release --build-dir $(Build.BinariesDirectory)/uhddev/build \
          --python-interp python3 --xml"
    continueOnError: true
    condition: and(succeeded(), eq(variables.devType, 'n3xx'), eq(variables.devBus, 'ip'))
    displayName: Run n3xx devtest on $(devName)

  - script: |
      mkdir -p $(Common.TestResultsDirectory)/devtest
      cd $(Common.TestResultsDirectory)/devtest
      export PATH=$(Build.BinariesDirectory)/uhddev/build/utils:$(Build.BinariesDirectory)/uhddev/build/examples:$PATH
      export LD_LIBRARY_PATH=$(Build.BinariesDirectory)/uhddev/build/lib:$LD_LIBRARY_PATH
      export UHD_IMAGES_DIR=$(Build.BinariesDirectory)/uhddev/build/fpga_images
      python3 ${{ parameters.uhdSrcDir }}/.ci/utils/mutex_hardware.py \
        --sdimage_tftp $(devType),$(devModel),$(uhd_artifact_directory)/e320-images/$(devSDImage),$(uhd_artifact_directory)/e320-images/$(devInitramfsImage),${{ parameters.uhdSrcDir }}/$(devLabgridConfig) \
        --fpgas $(devFpga) \
        --sfp_addrs $(sfpAddrs) \
        ${{ parameters.redisHost }} $(devName) \
        "$(Build.BinariesDirectory)/uhddev/build/utils/uhd_usrp_probe --args addr=$(devAddr)" \
        "python3 ${{ parameters.uhdSrcDir }}/host/tests/devtest/run_testsuite.py \
          --src-dir ${{ parameters.uhdSrcDir }}/host/tests/devtest \
          --devtest-pattern $(devtestPattern) --args addr=$(devAddr),type=$(devType) \
          --build-type Release --build-dir $(Build.BinariesDirectory)/uhddev/build \
          --python-interp python3 --xml"
    continueOnError: true
    condition: and(succeeded(), eq(variables.devModel, 'e320'), eq(variables.devBus, 'ip'))
    displayName: Run e320 devtest on $(devName)

  - script: |
      mkdir -p $(Common.TestResultsDirectory)/devtest
      cd $(Common.TestResultsDirectory)/devtest
      export PATH=$(Build.BinariesDirectory)/uhddev/build/utils:$(Build.BinariesDirectory)/uhddev/build/examples:$PATH
      export LD_LIBRARY_PATH=$(Build.BinariesDirectory)/uhddev/build/lib:$LD_LIBRARY_PATH
      export UHD_IMAGES_DIR=$(Build.BinariesDirectory)/uhddev/build/fpga_images
      python3 ${{ parameters.uhdSrcDir }}/.ci/utils/mutex_hardware.py \
        ${{ parameters.redisHost }} $(devName) \
        "$(Build.BinariesDirectory)/uhddev/build/utils/uhd_usrp_probe --args serial=$(devSerial)" \
        "$(Build.BinariesDirectory)/uhddev/build/utils/uhd_image_loader --args serial=$(devSerial),type=$(devType)" \
        "python3 ${{ parameters.uhdSrcDir }}/host/tests/devtest/run_testsuite.py \
          --src-dir ${{ parameters.uhdSrcDir }}/host/tests/devtest \
          --devtest-pattern $(devtestPattern) --args serial=$(devSerial),type=$(devType) \
          --build-type Release --build-dir $(Build.BinariesDirectory)/uhddev/build \
          --python-interp python3 --xml"
    continueOnError: true
    condition: and(succeeded(), eq(variables.devType, 'b200'), eq(variables.devBus, 'usb'))
    displayName: Run b2xx devtest on $(devName)

  - script: |
      mkdir -p $(Common.TestResultsDirectory)/devtest
      cd $(Common.TestResultsDirectory)/devtest
      export PATH=$(Build.BinariesDirectory)/uhddev/build/utils:$(Build.BinariesDirectory)/uhddev/build/examples:$PATH
      export LD_LIBRARY_PATH=$(Build.BinariesDirectory)/uhddev/build/lib:$LD_LIBRARY_PATH
      python3 ${{ parameters.uhdSrcDir }}/.ci/utils/mutex_hardware.py \
        --jtag_x3xx $(devType),$(devModel),$(jtagServer),$(jtagSerial),$(Build.BinariesDirectory)/uhddev/build/fpga_images/ \
        --fpgas $(devFpga) \
        ${{ parameters.redisHost }} $(devName) \
        "$(Build.BinariesDirectory)/uhddev/build/utils/uhd_usrp_probe --args addr=$(devAddr)" \
        "python3 ${{ parameters.uhdSrcDir }}/host/tests/devtest/run_testsuite.py \
          --src-dir ${{ parameters.uhdSrcDir }}/host/tests/devtest \
          --devtest-pattern $(devtestPattern) --args addr=$(devAddr),type=$(devType) \
          --build-type Release --build-dir $(Build.BinariesDirectory)/uhddev/build \
          --python-interp python3 --xml"
    continueOnError: true
    condition: and(succeeded(), eq(variables.devType, 'x300'), eq(variables.devBus, 'ip'))
    displayName: Run x3xx devtest on $(devName) $(devFpga)

  - script: |
      cat $(Common.TestResultsDirectory)/devtest/log*.log
      echo ""
    displayName: cat devtest log
    condition: always()

  - script: |
      cd $(Common.TestResultsDirectory)/devtest
      python3 ${{ parameters.uhdSrcDir }}/.ci/utils/format_devtest_junitxml.py \
        $(Common.TestResultsDirectory)/devtest \
        $(Common.TestResultsDirectory)/devtest/devtestresults.xml
    continueOnError: true
    displayName: Format devtest xml
    condition: and(always(), eq(variables.devType, 'b200'))

  - script: |
      cd $(Common.TestResultsDirectory)/devtest
      python3 ${{ parameters.uhdSrcDir }}/.ci/utils/format_devtest_junitxml.py \
        --fpgas $(devFpga) \
        $(Common.TestResultsDirectory)/devtest \
        $(Common.TestResultsDirectory)/devtest/devtestresults.xml
    continueOnError: true
    displayName: Format devtest xml
    condition: and(always(), ne(variables.devType, 'b200'))

  - publish: $(Common.TestResultsDirectory)
    artifact: test-logs-devtest-$(devName)-$(devFpga)-run$(System.JobAttempt)
    displayName: Upload Test Logs
    condition: always()

  - task: PublishTestResults@2
    inputs:
      testResultsFormat: 'JUnit'
      testResultsFiles: '$(Common.TestResultsDirectory)/devtest/devtestresults.xml'
      testRunTitle: $(devName) devtest
      buildConfiguration: 'Release'
      mergeTestResults: true
      failTaskOnFailedTests: true
    displayName: Upload devtest results
    condition: always()

  - script: |
      echo "A previous step failed. See steps with warnings."
      echo "Marking the overall build status as a failure."
      exit 1
    condition: in(variables['Agent.JobStatus'],  'SucceededWithIssues')
    displayName: Mark build as failure