#
# Copyright 2022 Ettus Research, a National Instruments Brand
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# Description:
#
#   This template is used to run all the testbenches using ModelSim.
#


jobs:
- job:
  displayName: "ModelSim Simulation"
  timeoutInMinutes: 360
  pool:
    name: Drivers-NIBuildFarm-RFMIBUILD
    demands:
    - Agent.OS -equals Linux
  variables:
  - group: sdr-pipeline-vars
  steps:
    - template: setup_steps.yml

    - bash: |
        source $(Build.SourcesDirectory)/uhddev/.ci/fpga/scripts/run_setup.sh ./top/x300

        echo "---- Run testbenches ----"
        pushd ./tools/utils
        pip3 install -r requirements.txt
        python3 ./run_testbenches.py --logged --simulator modelsim --excludes=modelsim.excludes -j4 --report $(Build.ArtifactStagingDirectory)/junit.xml run
        popd
      workingDirectory: uhddev/fpga/usrp3
      displayName: "Run Testbenches"

    - task: PublishTestResults@2
      inputs:
        testResultsFormat: 'JUnit'
        testResultsFiles: 'junit.xml'
        searchFolder: $(Build.ArtifactStagingDirectory)
        failTaskOnFailedTests: True
      condition: succeededOrFailed()
