ci: Automatically run rfnoc_modtool tests

- When the Linux builds pass, take the Linux build output, and put it
  onto an RFMI builder. This is because we require access to Vivado
  tools.
  - There is a builtin assumption that RFMI builder agents are running
    a recent-ish version of Ubuntu.
  - This requires the addition of hwtools to the repository list.
- This only happens if examples/rfnoc-gain or test_modtool.py are
  modified (changeset testlist)
This commit is contained in:
Martin Braun 2025-01-17 10:29:29 +01:00 committed by Jörg Hofrichter
parent 21c4c591a5
commit 0a6d5fc934
5 changed files with 184 additions and 0 deletions

View File

@ -0,0 +1,36 @@
parameters:
- name: checkoutSteps
type: stepList
default:
# Checkout the repository under test
- checkout: self
clean: true
fetchDepth: 1
persistCredentials: true
# Checkout hwtools repo
- checkout: hwtools
fetchDepth: '1'
fetchTags: false
path: s/hwtools/head
persistCredentials: true
- name: demands_default
type: object
default:
pool:
name: Drivers-NIBuildFarm-RFMIBUILD
demands:
- Agent.OS -equals Linux
hwhookVersion: 2
steps:
- template: build/pipelines/helpers/setup_steps.yml@hwtools
parameters:
caller: setup_steps.yml
pool: Drivers-NIBuildFarm-RFMIBUILD
checkoutSteps: ${{ parameters.checkoutSteps }}
demands: ${{ parameters.demands_default }}
repoBase: $(Build.SourcesDirectory)
directory: uhddev
name: FPGA build

View File

@ -0,0 +1,75 @@
jobs:
- job: uhd_rfnoc_modtool_test_sw
displayName: rfnoc_modtool test software
dependsOn: get_latest_uhd_docker
timeoutInMinutes: 20
variables:
# Docker vars from job-get-latest-uhd-docker.yml
dockerBuildNumber: $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.dockerBuildNumber'] ]
dockerImagePrefix: $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.dockerImagePrefix'] ]
uhd_artifact_name: uhddev-ubuntu2404-make
uhd_builder_name: uhd-builder-ubuntu2404
pool:
name: Drivers-NIBuildFarm-RFMIBUILD
demands:
- Agent.OS -equals Linux
- docker
workspace:
clean: outputs
container:
image: $(dockerImagePrefix)$(uhd_builder_name):$(dockerBuildNumber)
${{ if or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/heads/UHD-')) }}:
endpoint: rnd-docker-niartifacts-ci-readonly
${{ else }}:
endpoint: rnd-docker-niartifacts-pre-readonly
steps:
- checkout: self
clean: true
fetchDepth: 1
- bash: |
echo '##vso[task.setvariable variable=uhd_artifact_name]uhddev-ubuntu'`lsb_release -s -r | tr -d .`-make
displayName: Set uhddev pipeline artifact information
- download: current
artifact: $(uhd_artifact_name)
displayName: Download $(uhd_artifact_name) artifact
- task: ExtractFiles@1
inputs:
archiveFilePatterns: $(Agent.BuildDirectory)/$(uhd_artifact_name)/$(uhd_artifact_name).tar.gz
destinationFolder: $(Build.BinariesDirectory)
cleanDestinationFolder: true
# Test SW only firsts
- bash: |
ls -l $(Build.SourcesDirectory)
export LD_LIBRARY_PATH=$(Build.BinariesDirectory)/uhddev/build/lib:$LD_LIBRARY_PATH
export PATH=$(Build.BinariesDirectory)/uhddev/build-installed/bin:$PATH
export PYTHONPATH=`find $(Build.BinariesDirectory)/uhddev/build-installed/lib -name site-packages`:$PYTHONPATH
export UHD_DIR=$(Build.BinariesDirectory)/uhddev/build-installed
export UHD_PKG_DATA_PATH=$UHD_DIR/share/uhd
mkdir -p $(Agent.TempDirectory)/rfnoc_modtool
ls -l $(Build.SourcesDirectory)/host/tests/
python3 $(Build.SourcesDirectory)/host/tests/test_modtool.py \
--base-dir $(Agent.TempDirectory)/rfnoc_modtool \
--rfnoc-oot-name test \
--uhd-repo-dir $(Build.SourcesDirectory) \
--skip-testbenches
ls -lR $(Agent.TempDirectory)/rfnoc_modtool
displayName: Run rfnoc_modtool SW test
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Agent.TempDirectory)/rfnoc_modtool
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/rfnoc_test_oot.tar.gz'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'rfnoc_test_oot'
displayName: Upload rfnoc_test_oot build artifacts

View File

@ -0,0 +1,53 @@
jobs:
- job: uhd_rfnoc_modtool_test_tb
displayName: rfnoc_modtool test testbenches
dependsOn: uhd_rfnoc_modtool_test_sw
timeoutInMinutes: 20
variables:
uhd_artifact_name: uhddev-ubuntu2404-make
rfnocOotDirectory: $(Build.BinariesDirectory)/rfnoc_test_oot
pool:
name: Drivers-NIBuildFarm-RFMIBUILD
demands:
- Agent.OS -equals Linux
workspace:
clean: outputs
steps:
- checkout: self
clean: true
fetchDepth: 1
- task: DownloadPipelineArtifact@2
inputs:
artifact: rfnoc_test_oot
targetPath: $(Agent.TempDirectory)
displayName: Download rfnoc_test_oot artifact
- bash: mkdir -p $(rfnocOotDirectory)
displayName: Create rfnoc_test_oot directory
- task: ExtractFiles@1
inputs:
archiveFilePatterns: $(Agent.TempDirectory)/rfnoc_test_oot.tar.gz
destinationFolder: $(rfnocOotDirectory)
cleanDestinationFolder: true
- bash: ls -lR $(rfnocOotDirectory)
displayName: List rfnoc_test_oot directory
# Initialize Vivado toolchain
- template: fpga_setup_steps.yml
- bash: |
set -x
# Init toolchain
source $(Build.SourcesDirectory)/uhddev/fpga/.ci/scripts/run_setup.sh $(Build.SourcesDirectory)/uhddev/fpga/usrp3/top/x300
pushd $(Build.SourcesDirectory)/uhddev/fpga/usrp3/tools/utils
pip3 install -r requirements.txt
popd
# Now run the test.
make -C $(rfnocOotDirectory)/rfnoc-test/fpga/test/rfnoc_block_mytestblock/ \
xsim UHD_FPGA_DIR=$(Build.SourcesDirectory)/uhddev/fpga/
displayName: Run rfnoc_modtool testbenches

View File

@ -159,6 +159,22 @@ stages:
toolset: make_custom_boost_version
custom_boost_version_url: ${{ parameters.custom_boost_version_url }}
- stage: build_rfnoc_modtool_stage_linux
displayName: Build and Test RFNoC Modtool
dependsOn:
- build_uhd_stage_linux
- analyze_changeset
variables:
UhdTestList: $[stageDependencies.analyze_changeset.analyze.outputs['gen_testlist.UhdTestList']]
condition: >
and(succeeded(),
contains(dependencies.analyze_changeset.outputs['analyze.gen_testlist.UhdTestList'], 'uhd.rfnoc_modtool.')
)
jobs:
- template: job-get-latest-uhd-docker.yml
- template: job-rfnoc_modtool-test-sw.yml
- template: job-rfnoc_modtool-test-testbenches.yml
- stage: build_uhd_stage_mac
displayName: Build UHD macOS
dependsOn: analyze_changeset

View File

@ -16,6 +16,10 @@
###############################################################################
# HOST CHANGES (UHD)
###############################################################################
- re: host/examples/rfnoc-gain|host/tests/test_modtool.py
add:
- uhd.build.linux
- uhd.rfnoc_modtool.all
# If only a unit test changed, then we need to re-run unit tests, but no HW tests
- re: ^host/tests/[^/]+(cpp|py)$|^host/tests/CMakeLists.txt
add: