uhd/.ci/templates/job-uhd-usrp-tests.yml

235 lines
10 KiB
YAML

parameters:
- name: suiteName
type: string
- name: uhdArtifactSource
type: string
- name: uhdFpgaArtifactSource
type: string
- name: fpga_imgs_source
type: string
- name: dutMatrix
type: object
- name: 'toolset'
type: string
values:
- fedora_rpm
- make
- msbuild
- ubuntu_deb
- name: 'installer'
type: string
values:
- rpm # fedora_rpm
- tar # make
- nsis # msbuild
- deb # ubuntu_deb
- name: buildOSName
type: string
jobs:
- job: uhd_usrp_examples_${{ parameters.suiteName }}
displayName: UHD USRP examples ${{ parameters.suiteName }}
timeoutInMinutes: 30
pool:
name: de-dre-lab
demands:
- agent.os -equals Windows_NT
- suiteName -equals ${{ parameters.suiteName }}
- device -equals $(dutName)
strategy:
matrix: ${{ parameters.dutMatrix }}
steps:
- checkout: self
clean: true
- checkout: ettus-rts
clean: true
- checkout: labview-usrp-examples
clean: true
- download: ${{ parameters.uhdFpgaArtifactSource }}
patterns: |
usrp_$(dutModel)*.bit
usrp_$(dutModel)*.dts
displayName: Download FPGA artifacts
- script: |
if "${{ parameters.uhdArtifactSource }}" == "current" (
echo ##vso[task.setvariable variable=uhd_artifact_directory]%Agent_BuildDirectory%
) else (
echo ##vso[task.setvariable variable=uhd_artifact_directory]%Agent_BuildDirectory%\${{ parameters.uhdArtifactSource }}
)
displayName: Set uhddev pipeline artifact location
- script: |
if "${{ parameters.uhdFpgaArtifactSource }}" == "current" (
echo ##vso[task.setvariable variable=uhd_fpga_artifact_directory]%Agent_BuildDirectory%
echo uhd_fpga_artifact_directory=%Agent_BuildDirectory%
) else (
echo ##vso[task.setvariable variable=uhd_fpga_artifact_directory]%Agent_BuildDirectory%\${{ parameters.uhdFpgaArtifactSource }}
echo uhd_fpga_artifact_directory=%Agent_BuildDirectory%\${{ parameters.uhdFpgaArtifactSource }}
)
displayName: Set uhddev FPGA pipeline artifact location
- download: ${{ parameters.uhdArtifactSource }}
artifact: uhddev-${{ parameters.buildOSName }}-${{ parameters.toolset }}-${{ parameters.installer }}-installer
displayName: Download uhddev-${{ parameters.buildOSName }}-${{ parameters.toolset }}-${{ parameters.installer }}-installer artifact
- script: |
echo ##vso[task.setvariable variable=uhd_installer_dir]%uhd_artifact_directory%\uhddev-${{ parameters.buildOSName }}-${{ parameters.toolset }}-${{ parameters.installer }}-installer
displayName: Set UHD installer directory location
- script: |
echo ##vso[task.setvariable variable=uhd_installation_dir]%Agent_BuildDirectory%\uhddev_installed
displayName: Set UHD installation directory location
- script: |
echo "Installing UHD from ${{ parameters.uhdArtifactSource }} uhddev artifact"
echo "UHD installer directory %uhd_installer_dir%"
dir %uhd_installer_dir%
if exist "%uhd_installation_dir%\Uninstall.exe" (
echo "Found existing UHD installed. Uninstalling using %uhd_installation_dir%\Uninstall.exe"
"%uhd_installation_dir%\Uninstall.exe" /S
) else (
echo "No UHD installed"
)
echo "Creating UHD target installation directory %uhd_installation_dir%"
mkdir %uhd_installation_dir%
for %%f in ("%uhd_installer_dir%\uhd_*.exe") do (set uhd_installer_exe_path=%%f)
echo "Installing UHD from %uhd_installer_exe_path%"
%uhd_installer_exe_path% /S /D=%uhd_installation_dir%
echo ##vso[task.setvariable variable=UHD_PKG_PATH]%uhd_installation_dir%
displayName: Install UHD from uhddev artifact
- task: DeleteFiles@1
inputs:
SourceFolder: '$(uhd_artifact_directory)\$(dutEmbeddedImagesArtifact)'
Contents: '*'
RemoveSourceFolder: yes
TreatMissingSourceFolderAsSuccess: true
displayName: Cleanup from prior runs
condition: and(succeeded(), eq(variables.dutType, 'x4xx'))
- download: ${{ parameters.uhdArtifactSource }}
artifact: $(dutEmbeddedImagesArtifact)
displayName: Download $(dutEmbeddedImagesArtifact)
condition: and(succeeded(), eq(variables.dutType, 'x4xx'))
- 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.dutType, 'x4xx'))
- script: |
set USRP_EMB_TARGET_NAME=ni-$(dutType)-$(dutSerial)
ssh-keygen -f %userprofile%\.ssh\known_hosts -R %USRP_EMB_TARGET_NAME%
dir %uhd_artifact_directory%\%dutEmbeddedImagesArtifact%
scp -o StrictHostKeyChecking=no %uhd_artifact_directory%\%dutEmbeddedImagesArtifact%\*.mender root@%USRP_EMB_TARGET_NAME%:~/.
if errorlevel 1 exit /b %ERRORLEVEL%
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "mender install ~/*mender.mender"
if errorlevel 1 exit /b %ERRORLEVEL%
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "rm -f ~/*mender.mender"
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "reboot"
echo waiting 2 minutes for target to reboot...
ping 127.0.0.1 -n 120 > nul
ipconfig /flushdns
ssh-keygen -f %userprofile%\.ssh\known_hosts -R %USRP_EMB_TARGET_NAME%
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "mender commit"
if errorlevel 1 exit /b %ERRORLEVEL%
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "mender show-artifact"
displayName: Copy + install mender file to target
condition: and(succeeded(), eq(variables.dutType, 'x4xx'))
- script: |
set USRP_EMB_TARGET_NAME=ni-$(dutType)-$(dutSerial)
ssh-keygen -f %userprofile%\.ssh\known_hosts -R %USRP_EMB_TARGET_NAME%
scp -o StrictHostKeyChecking=no $(uhd_fpga_artifact_directory)/*/usrp_$(dutModel)_* root@%USRP_EMB_TARGET_NAME%:/usr/share/uhd/images/
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "md5sum /usr/share/uhd/images/usrp_$(dutModel)_fpga_$(dutFPGA).bit > /usr/share/uhd/images/usrp_$(dutModel)_fpga_$(dutFPGA).bit.md5"
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "md5sum /usr/share/uhd/images/usrp_$(dutModel)_fpga_$(dutFPGA).dts > /usr/share/uhd/images/usrp_$(dutModel)_fpga_$(dutFPGA).dts.md5"
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "rm /lib/firmware/x4*.* && systemctl stop usrp-hwd.service"
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "umount /mnt/db*_flash || true && systemctl start usrp-hwd.service"
displayName: Copy FPGA pipeline images to device
condition: and(succeeded(), and(contains('${{ parameters.fpga_imgs_source }}', 'Pipeline'), ne(variables.dutType, 'b200')))
- script: |
set USRP_EMB_TARGET_NAME=ni-$(dutType)-$(dutSerial)
ssh-keygen -f %userprofile%\.ssh\known_hosts -R %USRP_EMB_TARGET_NAME%
ssh -o StrictHostKeyChecking=no -tt root@%USRP_EMB_TARGET_NAME% "uhd_image_loader --args addr=localhost,type=$(dutType),fpga=$(dutFPGA)"
displayName: Flash FPGA $(dutFPGA)
condition: and(succeeded(), and(contains('${{ parameters.fpga_imgs_source }}', 'Pipeline'), ne(variables.dutType, 'b200')))
- script: |
%uhd_installation_dir%\bin\uhd_usrp_probe --args type=$(dutType),addr=$(dutAddr)
displayName: Probe device
# TODO make this work for all python versions we support (3.10 + 3.12)
# UHD Python package must be installed into System Python because the LV-example opens a normal
# Python process, not a virtual environment one.
- script: |
cd $(Build.SourcesDirectory)
echo "Upgrading required Python packages"
py -3.10 -m pip install --upgrade pip setuptools virtualenv wheel
echo "Removing and reinstalling uhd Python package"
py -3.10 -m pip uninstall -y uhd
for %%f in ("%uhd_installer_dir%\uhd-*.whl") do (set uhd_python_pkg_path=%%f)
echo "Using wheel: %uhd_python_pkg_path%"
py -3.10 -m pip install "%uhd_python_pkg_path%"
echo "Creating virtual environment"
py -3.10 -m venv lvtest_venv
call lvtest_venv\Scripts\activate.bat
echo "Installing required Python packages into the virtual environment"
python -m pip install --upgrade pip
pip install lvtest
displayName: Prepare venv (Python 3.10)
- script: |
set
cd $(Build.SourcesDirectory)
call lvtest_venv\Scripts\activate.bat
set UHD_PKG_PATH=%UHD_PKG_PATH%
mkdir -p $(Common.TestResultsDirectory)\uhdlvtest
set LVTEST_OUTPUT=$(Common.TestResultsDirectory)\uhdlvtest\lvtest_output.txt
set LVTEST_FAILED=$(Common.TestResultsDirectory)\uhdlvtest\lvtest_failed.txt
cd ettus-rts\config\remote\python_tests\lvtest
echo "Running lvtest for LabVIEW USRP Examples in %cd%"
lvtest -f %cd%\lv_usrp_tests -o %cd%\ats_configs\dre-ec62-dut1\options.yaml > %LVTEST_OUTPUT% 2>&1
set lvtest_exit_code=%errorlevel%
if %lvtest_exit_code% neq 0 (
echo "lvtest did not run successfully, exit code: %lvtest_exit_code%"
exit %lvtest_exit_code%
)
echo "Evaluate lvtest output for LabVIEW USRP Examples:"
type %LVTEST_OUTPUT%
findstr "FAILED" %LVTEST_OUTPUT% > %LVTEST_FAILED%
set findstr_exit_code=%errorlevel%
if %findstr_exit_code% equ 0 (
echo "--- LV TEST FAILED WITH: ---"
type %LVTEST_FAILED%
echo "--- LV TEST json outputs for all tests: ---"
type lv_usrp_tests\*.json
exit 1
)
displayName: Run lvtest for LabVIEW USRP Examples
- publish: $(Common.TestResultsDirectory)\uhdlvtest
artifact: test-logs-uhdlvtest-$(dutName)-run$(System.JobAttempt)
displayName: Upload Test Logs
condition: always()
# UHD Python package must be uninstalled to cleanup the System Python
- script: |
echo "Removing uhd Python package"
py -3.10 -m pip uninstall -y uhd
displayName: Remove uhd from Python 3.10
condition: always()
workspace:
clean: all