aboutsummaryrefslogtreecommitdiffstats
path: root/.ci/templates/job-uhd-streaming-tests.yml
blob: f30d55b2eadf1ac97493ab8f2139d3fcbeba9339 (plain) (blame)
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
parameters:
- name: suiteName
  type: string
- name: testOS
  type: string
  values:
    - ubuntu2004
    - ubuntu2204
- name: toolset
  type: string
  values:
    - make
- name: uhdSrcDir
  type: string
- name: dutMatrix
  type: object
- name: testLength
  type: string
  values:
    - 'smoke'
    - 'full'
    - 'stress'
- name: nicType
  type: string
  default: '10gbe'
- name: uhdArtifactSource
  type: string
  default: current
- name: uhdFpgaArtifactSource
  type: string
- name: fpga_imgs_source
  type: string
- name: xilinxLocation
  type: string

jobs:
- job: uhd_streaming_tests_${{ parameters.suiteName }}
  displayName:  uhd streaming tests ${{ parameters.suiteName }}
  timeoutInMinutes: 300
  pool:
    name: de-dre-lab
    demands:
    - suiteName -equals ${{ parameters.suiteName }}
  strategy:
    matrix: ${{ parameters.dutMatrix }}
  workspace:
    clean: outputs
  steps:
  - checkout: self
    clean: true

  - checkout: meta-ettus
    clean: true

  - 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

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

  - script: |
      rm -rf $(uhd_artifact_directory)/$(dutEmbeddedImagesArtifact)
      rm -rf $(uhd_artifact_directory)/uhddev-${{ parameters.testOS }}-${{ parameters.toolset }}
    displayName: Cleanup from prior run
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'))

  - script: |
      if [ ! -z "${{ parameters.uhdFpgaArtifactSource }}" ]; then
        rm -rf $(Agent.BuildDirectory)/${{ parameters.uhdFpgaArtifactSource }}
      fi
    displayName: Cleanup from prior run
    condition: eq('${{ parameters.fpga_imgs_source }}', 'FPGA Pipeline')

  - download: ${{ parameters.uhdArtifactSource }}
    artifact: $(dutEmbeddedImagesArtifact)
    displayName: Download $(dutEmbeddedImagesArtifact)
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'))

  - download: ${{ parameters.uhdFpgaArtifactSource }}
    patterns: |
      usrp_$(dutType)*.bit
      usrp_$(dutType)*.dts
      usrp_$(dutType)*.rpt
    displayName: Download FPGA artifacts
    condition: eq('${{ parameters.fpga_imgs_source }}', 'FPGA Pipeline')

  - task: ExtractFiles@1
    inputs:
      archiveFilePatterns: $(uhd_artifact_directory)/$(dutEmbeddedImagesArtifact)/u-boot-jtag-files.zip
      destinationFolder: $(uhd_artifact_directory)/$(dutEmbeddedImagesArtifact)
      cleanDestinationFolder: false
      overwriteExistingFiles: true
    displayName: Extract JTAG artifact
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'))

  - 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
    displayName: Extract uhddev-${{ parameters.testOS }}-${{ parameters.toolset }} artifact

  - script: |
      cd $(Agent.TempDirectory)
      python3 -m venv venv
      source venv/bin/activate
      echo '##vso[task.setvariable variable=USRP_EMB_VENV]'$(realpath venv)
      echo '##vso[task.setvariable variable=USRP_EMB_IMAGE_PATH]'$(uhd_artifact_directory)/$(dutEmbeddedImagesArtifact)
      echo '##vso[task.setvariable variable=USRP_EMB_FTDI_SERIAL]'$(uartSerial)
      python3 -m pip install -U pip
      pip3 install wheel
      pip3 install --upgrade $(Build.SourcesDirectory)/meta-ettus-dev/contrib/test/usrp_emb
    displayName: Create usrp_emb venv
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'))

  - script: |
      source ${{ parameters.xilinxLocation }}/settings64.sh
      source $USRP_EMB_VENV/bin/activate
      usrp_emb_x4xx_mender_update
    displayName: Update device using Mender
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'))

  - script: |
      source $USRP_EMB_VENV/bin/activate
      USRP_EMB_TARGET_IP=$(usrp_emb_x4xx_boot_linux)
      echo Target IP is $USRP_EMB_TARGET_IP
      echo '##vso[task.setvariable variable=USRP_EMB_TARGET_IP]'$USRP_EMB_TARGET_IP
    displayName: Boot target, get mgmt IP
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'))

  # Setting the timezone on the embedded device is
  # required to make the test runtimes to look sane.
  - script: |
      export HOST_TIME_ZONE=$(cat /etc/timezone)
      ssh-keygen -f ~/.ssh/known_hosts -R $USRP_EMB_TARGET_IP
      ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "timedatectl set-timezone $HOST_TIME_ZONE"
    displayName: Set timezone to Host
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'))

  - script: |
        sleep 60
    displayName: Wait for device to finish booting
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'))

  - script: |
        ssh-keygen -f ~/.ssh/known_hosts -R $USRP_EMB_TARGET_IP
        scp -o StrictHostKeyChecking=no $(uhd_fpga_artifact_directory)/*/usrp_$(dutType)_* root@$USRP_EMB_TARGET_IP:/usr/share/uhd/images/
        ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "md5sum /usr/share/uhd/images/usrp_$(dutType)_fpga_$(dutFPGA).bit > /usr/share/uhd/images/usrp_$(dutType)_fpga_$(dutFPGA).bit.md5"
        ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "md5sum /usr/share/uhd/images/usrp_$(dutType)_fpga_$(dutFPGA).dts > /usr/share/uhd/images/usrp_$(dutType)_fpga_$(dutFPGA).dts.md5"
    displayName: Copy FPGA pipeline images to device
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'), eq('${{ parameters.fpga_imgs_source }}', 'FPGA Pipeline'))

  - script: |
        ssh-keygen -f ~/.ssh/known_hosts -R $USRP_EMB_TARGET_IP
        ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "uhd_image_loader --args addr=localhost,type=$(dutFamily),fpga=$(dutFPGA)"
        EXITCODE=$?
        sleep 60
        exit $EXITCODE
    displayName: Flash FPGA $(dutFPGA)
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'))

  - script: |
      export UHD_IMAGES_DIR=$(Build.BinariesDirectory)/uhddev/build-installed/share/uhd/images
      $(Build.BinariesDirectory)/uhddev/build-installed/bin/uhd_images_downloader -t b2xx -t fw
      $(Build.BinariesDirectory)/uhddev/build-installed/bin/uhd_images_downloader -t b210 -t fpga
    displayName: Download B210 images
    condition: and(succeeded(), eq(variables.dutType, 'B210'))

  - script: |
      export UHD_IMAGES_DIR=$(Build.BinariesDirectory)/uhddev/build-installed/share/uhd/images
      if [ "${{ parameters.fpga_imgs_source }}" = "FPGA Pipeline" ]; then
        cp $(uhd_fpga_artifact_directory)/*/* $(Build.BinariesDirectory)/uhddev/build-installed/share/uhd/images/
      else
        $(Build.BinariesDirectory)/uhddev/build-installed/bin/uhd_images_downloader -t x310
      fi
      openFPGALoader -c digilent --ftdi-serial $(jtagSerial) --ftdi-channel 0 $UHD_IMAGES_DIR/usrp_x310_fpga_$(dutFPGA).bit
      EXITCODE=$?
      echo "Waiting for device to boot"
      sleep 30
      exit $EXITCODE
    displayName: Download and update X310 fpga
    condition: and(succeeded(), eq(variables.dutType, 'X310'))

  - script: |
      ssh-keygen -f ~/.ssh/known_hosts -R $USRP_EMB_TARGET_IP
      ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "ethtool -A sfp0 tx on"
    displayName: Enable Tx Pause Frames on sfp0
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'), in(variables.dutFPGA, 'CG_400', 'CG_1600'))

  - script: |
      ssh-keygen -f ~/.ssh/known_hosts -R $USRP_EMB_TARGET_IP
      ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "ethtool -A sfp1 tx on"
    displayName: Enable Tx Pause Frames on sfp1
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'), in(variables.dutFPGA, 'CG_400', 'UC_200', 'CG_1600'))

  - script: |
      ssh-keygen -f ~/.ssh/known_hosts -R $USRP_EMB_TARGET_IP
      ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "ip addr add $(dutAddr)/24 dev sfp0"
      ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "ip addr del 192.168.10.2/24 dev sfp0"
    displayName: Setup IP addresses on sfp0
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'), in(variables.dutFPGA, 'CG_400', 'CG_1600'))

  - script: |
      ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "ip addr add $(dutSecondAddr)/24 dev sfp1"
      ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "ip addr del 192.168.20.2/24 dev sfp1"
    displayName: Setup IP addresses on sfp1
    condition: and(succeeded(), eq(variables.dutFamily, 'x4xx'), in(variables.dutFPGA, 'CG_400', 'UC_200', 'CG_1600'))

  - script: |
      cd ${{ parameters.uhdSrcDir }}/host/tests/streaming_performance
      if [ "${{ parameters.nicType }}" = "100gbe" ]; then
        sudo ./setup100gbe.sh --auto
      else
        sudo ./setup10gbe.sh --auto
      fi
      EXITCODE=$?
      sleep 5
      exit $EXITCODE
    displayName: setup interfaces for use without DPDK

  - script: |
      echo "##[group]Printing Environment"
      printenv
      echo "##[endgroup]"
      set -x
      cd ${{ parameters.uhdSrcDir }}/host/tests/pytests
      # Disable creation of __pycache__ files using -B to avoid errors on clean up during next run
      # as using sudo below creates them with root priveleges.
      sudo -E LD_LIBRARY_PATH=$LD_LIBRARY_PATH PYTHONPATH=$PYTHONPATH python3 -B -m pytest -s test_streaming.py -m "not dpdk" \
        --dut_type $(dutType) --test_length ${{ parameters.testLength }} \
        --uhd_build_dir $(Build.BinariesDirectory)/uhddev/build --junitxml $(Common.TestResultsDirectory)/TEST-$(dutName).xml \
        --addr $(dutAddr) --second_addr $(dutSecondAddr) --mgmt_addr $(dutMgmtAddr) --name $(dutNameId) \
        --num_recv_frames $(dutNumRecvFrames) --num_send_frames $(dutNumSendFrames)
    env:
      UHD_CONFIG_FILE: $(config_file)
      PYTHONPATH: ${{ parameters.uhdSrcDir }}/host/tests/streaming_performance
      LD_LIBRARY_PATH: $(Build.BinariesDirectory)/uhddev/build-installed/lib
      UHD_IMAGES_DIR: $(Build.BinariesDirectory)/uhddev/build-installed/share/uhd/images
    continueOnError: true
    displayName: Run streaming tests on $(dutName)
    condition: and(succeeded(), not(eq(variables.dutFamily, 'x4xx')))

  - script: |
      cd ${{ parameters.uhdSrcDir }}/host/tests/streaming_performance
      if [ "${{ parameters.nicType }}" = "100gbe" ]; then
        sudo ./setup100gbe.sh --ramdisk
      else
        sudo ./setup10gbe.sh --ramdisk
      fi
      sleep 5
    displayName: setup interfaces for use raw udp streaming

  - script: |
      export PYTHON_VERSION=$(python3 -c "import sys; print('python'+str(sys.version_info.major) + '.' + str(sys.version_info.minor))")
      export PYTHONPATH=$(Build.BinariesDirectory)/uhddev/build-installed/lib/$PYTHON_VERSION/site-packages:${{ parameters.uhdSrcDir }}/host/tests/streaming_performance
      echo "##[group]Printing Environment"
      printenv
      echo "##[endgroup]"
      set -x
      cd ${{ parameters.uhdSrcDir }}/host/tests/pytests
      # Disable creation of __pycache__ files using -B to avoid errors on clean up during next run
      # as using sudo below creates them with root priveleges.
      sudo -E LD_LIBRARY_PATH=$LD_LIBRARY_PATH PYTHONPATH=$PYTHONPATH python3 -B -m pytest -s test_raw_udp_streaming.py \
        --dut_type $(dutType) --dut_fpga $(dutFPGA) --test_length ${{ parameters.testLength }} \
        --uhd_build_dir $(Build.BinariesDirectory)/uhddev/build-installed/lib/uhd --junitxml $(Common.TestResultsDirectory)/TEST-$(dutName).xml \
        --addr $(dutAddr) --second_addr $(dutSecondAddr) --mgmt_addr $(dutMgmtAddr) --name $(dutNameId) \
        --num_recv_frames $(dutNumRecvFrames) --num_send_frames $(dutNumSendFrames) --sfp_int0 $(sfpInt0) --sfp_int1 $(sfpInt1)
    env:
      UHD_CONFIG_FILE: $(config_file)
      LD_LIBRARY_PATH: $(Build.BinariesDirectory)/uhddev/build-installed/lib
      UHD_IMAGES_DIR: $(Build.BinariesDirectory)/uhddev/build-installed/share/uhd/images
    continueOnError: true
    displayName: Run raw udp streaming tests on $(dutName)
    condition: and(succeeded(), or(eq(variables.dutFamily, 'x4xx'), eq(variables.dutType, 'X310')))

  - script: |
      cd ${{ parameters.uhdSrcDir }}/host/tests/streaming_performance
      if [ "${{ parameters.nicType }}" = "100gbe" ]; then
        sudo ./setup100gbe.sh --auto --dpdk
      else
        sudo ./setup10gbe.sh --auto --dpdk
      fi
      EXITCODE=$?
      sleep 5
      exit $EXITCODE
    displayName: setup interfaces for use with DPDK
    condition: and(succeeded(), not(eq(variables.dutType, 'B210')))

  # This step is needed because the agent used to build UHD that gets installed may have a slightly different dpdk setup.
  # For example, if the streaming system uses a Mellanox NIC and thus needs Mellanox drivers installed but the agent used to build UHD doesn't
  # then you can get an access violation when using that version of UHD with dpdk on the streaming system
  - script: |
      mkdir ${{ parameters.uhdSrcDir }}/host/build
      cd ${{ parameters.uhdSrcDir }}/host/build
      cmake -DCMAKE_INSTALL_PREFIX=$(Build.BinariesDirectory)/uhddev/build-installed ..
      make -j8 install
    displayName: build UHD for dpdk installed on test machine
    condition: succeeded()

  - script: |
      if [ "$(dutType)" = "x440" ]; then
        echo "##vso[task.setvariable variable=config_file]${{ parameters.uhdSrcDir }}/host/tests/pytests/uhd_configs/uhd_dpdk_100GbE_x440.conf"
        echo "Using x440 100 GbE UHD Config File"
      elif [ "$(dutFPGA)" = "CG_400" ]; then
        echo "##vso[task.setvariable variable=config_file]${{ parameters.uhdSrcDir }}/host/tests/pytests/uhd_configs/uhd_dpdk_100GbE.conf"
        echo "Using 100 GbE UHD Config File"
      elif [ "$(dutFPGA)" = "UC_200" ]; then
        echo "##vso[task.setvariable variable=config_file]${{ parameters.uhdSrcDir }}/host/tests/pytests/uhd_configs/uhd_dpdk_100GbE_SFP1.conf"
        echo "Using 100 GbE SFP1 UHD Config File"
      else
        echo "##vso[task.setvariable variable=config_file]${{ parameters.uhdSrcDir }}/host/tests/pytests/uhd_configs/uhd_dpdk_10GbE.conf"
        echo "Using 10 GbE UHD Config File"
      fi
    displayName: select UHD config file for DPDK

  - script: |
      echo "##[group]Printing Environment"
      printenv
      echo "##[endgroup]"
      set -x
      cd ${{ parameters.uhdSrcDir }}/host/tests/pytests
      # Disable creation of __pycache__ files using -B to avoid errors on clean up during next run
      # as using sudo below creates them with root priveleges.
      sudo -E LD_LIBRARY_PATH=$LD_LIBRARY_PATH PYTHONPATH=$PYTHONPATH python3 -B -m pytest -s test_streaming.py -m "dpdk" \
        --dut_type $(dutType) --dut_fpga $(dutFPGA) --test_length ${{ parameters.testLength }} \
        --uhd_build_dir $(Build.BinariesDirectory)/uhddev/build --junitxml $(Common.TestResultsDirectory)/TEST-$(dutName)-dpdk.xml \
        --addr $(dutAddr) --second_addr $(dutSecondAddr) --mgmt_addr $(dutMgmtAddr) --name $(dutNameId)
    env:
      UHD_CONFIG_FILE: $(config_file)
      PYTHONPATH: ${{ parameters.uhdSrcDir }}/host/tests/streaming_performance
      LD_LIBRARY_PATH: $(Build.BinariesDirectory)/uhddev/build-installed/lib
      UHD_IMAGES_DIR: $(Build.BinariesDirectory)/uhddev/build-installed/share/uhd/images
    continueOnError: true
    displayName: Run streaming tests with DPDK on $(dutName)
    condition: and(succeeded(), not(eq(variables.dutType, 'B210')))

  - task: PublishTestResults@2
    inputs:
      testResultsFormat: 'JUnit'
      testResultsFiles: '$(Common.TestResultsDirectory)/TEST-*.xml'
      testRunTitle: $(dutName) streaming tests
      buildConfiguration: 'Release'
      mergeTestResults: true
      failTaskOnFailedTests: false
    displayName: Upload streaming test results

  - 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