From f798a04137895f826bf0332fa3ebdbcc9180b2f5 Mon Sep 17 00:00:00 2001 From: Grant Meyerhoff Date: Sun, 18 Feb 2024 14:06:10 -0600 Subject: ci: make changes for test_selector change in ATS --- .ci/templates/job-uhd-rf-tests.yml | 3 ++- .ci/templates/stages-uhd-pipeline.yml | 2 +- .../tests/templates/job-uhd-x4xx-hardware-tests.yml | 7 ++++--- .ci/uhd-hardware-test-dev.yml | 2 +- .ci/utils/mutex_hardware.py | 12 ++++++++++-- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.ci/templates/job-uhd-rf-tests.yml b/.ci/templates/job-uhd-rf-tests.yml index cd1dedf91..b7e2cf0ba 100644 --- a/.ci/templates/job-uhd-rf-tests.yml +++ b/.ci/templates/job-uhd-rf-tests.yml @@ -127,9 +127,10 @@ jobs: --sdimage_sdmux $(devType),$(devModel),$(uhd_artifact_directory)/$(devType)-images/$(devSDImage),${{ parameters.uhdSrcDir }}/$(devLabgridConfig),$(devHostname) \ --fpgas $(devFpga) \ --sfp_addrs $(sfpAddrs) \ + --working_dir "$(Build.SourcesDirectory)/ettus-rts/config/remote/python_tests/pytests/" \ ${{ parameters.redisHost }} $(devName) \ "uhd_usrp_probe --args addr=$(devAddr)" \ - "python3 $(Build.SourcesDirectory)/ettus-rts/config/remote/python_tests/automated_main.py --ats_config $(pytestAtsConfig) --dut $(pytestDUT) \ + "python3 ../automated_main.py --ats_config $(pytestAtsConfig) --dut $(pytestDUT) \ --results_path $(Common.TestResultsDirectory)/pytest/{fpga} ${{ parameters.extra_rf_test_args }}" continueOnError: true condition: and(succeeded(), eq(variables.devType, 'n3xx'), eq(variables.devBus, 'ip')) diff --git a/.ci/templates/stages-uhd-pipeline.yml b/.ci/templates/stages-uhd-pipeline.yml index 77d908be7..ce907726f 100644 --- a/.ci/templates/stages-uhd-pipeline.yml +++ b/.ci/templates/stages-uhd-pipeline.yml @@ -446,7 +446,7 @@ stages: - template: tests/job-uhd-x440-hardware-tests-saison.yml parameters: testOS: ubuntu2204 - extra_rf_test_args: --test_selector pytests/test_rx_phase_coherence.py pytests/test_tx_phase_coherence.py + extra_rf_test_args: --test_selector test_rx_phase_coherence.py test_tx_phase_coherence.py testLength: ${{ parameters.testLength }} - stage: test_uhd_rf_test_stage diff --git a/.ci/templates/tests/templates/job-uhd-x4xx-hardware-tests.yml b/.ci/templates/tests/templates/job-uhd-x4xx-hardware-tests.yml index dab01e652..a55ede196 100644 --- a/.ci/templates/tests/templates/job-uhd-x4xx-hardware-tests.yml +++ b/.ci/templates/tests/templates/job-uhd-x4xx-hardware-tests.yml @@ -261,13 +261,13 @@ jobs: export PYTHONPATH=$GNURADIO_GRETTUS_INSTALL_PATH/lib/python3/dist-packages:$PYTHONPATH fi - cd $(Build.SourcesDirectory)/ettus-rts/config/remote/python_tests + cd $(Build.SourcesDirectory)/ettus-rts/config/remote/python_tests/pytests if [ ${{ parameters.warmUpAfterBoot }} > 0 ]; then echo 'sleeping ${{ parameters.warmUpAfterBoot }} seconds before testing...' sleep ${{ parameters.warmUpAfterBoot }} fi uhd_find_devices --args type=$(dutType) - python3 automated_main.py --ats_config $(pytestAtsConfig) --dut $(pytestDUT) --results_path '$(Common.TestResultsDirectory)/pytest/host' --test_length ${{ parameters.testLength }} ${{ parameters.extra_rf_test_args }} + python3 ../automated_main.py --ats_config $(pytestAtsConfig) --dut $(pytestDUT) --results_path '$(Common.TestResultsDirectory)/pytest/host' --test_length ${{ parameters.testLength }} ${{ parameters.extra_rf_test_args }} displayName: Run pytest on host continueOnError: true condition: and(succeeded(), ${{ parameters.runPyTest }}) @@ -279,7 +279,8 @@ jobs: ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "pip3 install --upgrade pytest pytest-helpers-namespace pytest-tempdir pytest-salt" ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "rm -rf ~/usrp_pytest && mkdir -p ~/usrp_pytest" scp -o StrictHostKeyChecking=no -r $(Build.SourcesDirectory)/ettus-rts/config/remote/ root@$USRP_EMB_TARGET_IP:~/usrp_pytest - ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "cd ~/usrp_pytest/remote/python_tests && python3 automated_main.py --ats_config $(pytestAtsConfig) --dut $(pytestDUT) --test_selector pytests/test_gnuradio_sanity.py --run_embedded" + ssh -o StrictHostKeyChecking=no -tt root@$USRP_EMB_TARGET_IP "cd ~/usrp_pytest/remote/python_tests/pytests && \ + python3 ../automated_main.py --ats_config $(pytestAtsConfig) --dut $(pytestDUT) --test_selector test_gnuradio_sanity.py --run_embedded" EXITCODE=$? scp -o StrictHostKeyChecking=no -r root@$USRP_EMB_TARGET_IP:~/usrp_pytest . exit $EXITCODE diff --git a/.ci/uhd-hardware-test-dev.yml b/.ci/uhd-hardware-test-dev.yml index 8dc1d49cc..7976bade5 100644 --- a/.ci/uhd-hardware-test-dev.yml +++ b/.ci/uhd-hardware-test-dev.yml @@ -180,5 +180,5 @@ stages: ${{ if contains(parameters['extra_rf_test_args'], 'test_selector') }}: extra_rf_test_args: ${{ parameters.extra_rf_test_args }} ${{ else }}: - extra_rf_test_args: ${{ parameters.extra_rf_test_args }} --test_selector pytests/test_rx_phase_coherence.py pytests/test_tx_phase_coherence.py + extra_rf_test_args: ${{ parameters.extra_rf_test_args }} --test_selector test_rx_phase_coherence.py test_tx_phase_coherence.py testLength: ${{ parameters.testLength }} diff --git a/.ci/utils/mutex_hardware.py b/.ci/utils/mutex_hardware.py index bda4726c9..be4deced6 100644 --- a/.ci/utils/mutex_hardware.py +++ b/.ci/utils/mutex_hardware.py @@ -243,13 +243,19 @@ def main(args): set_sfp_addrs(mgmt_addr, sfp_addrs) for command in args.test_commands: - result = subprocess.run(shlex.split(command.format(fpga=fpga))) + if args.working_dir: + result = subprocess.run(shlex.split(command.format(fpga=fpga)), cwd=args.working_dir) + else: + result = subprocess.run(shlex.split(command.format(fpga=fpga))) if(return_code == 0): return_code = result.returncode sys.exit(return_code) else: for command in args.test_commands: - result = subprocess.run(shlex.split(command)) + if args.working_dir: + result = subprocess.run(shlex.split(command), cwd=args.working_dir) + else: + result = subprocess.run(shlex.split(command)) if(result.returncode != 0): sys.exit(result.returncode) sys.exit(0) @@ -273,6 +279,8 @@ if __name__ == "__main__": help="Comma delimited list of FPGAs to test") parser.add_argument("--dut_timeout", type=int, default=60, help="Dut mutex timeout in minutes") + parser.add_argument("--working_dir", type=str, + help="Change working directory for commands to be run") parser.add_argument("redis_server", type=str, help="Redis server for mutex") parser.add_argument("dut_name", type=str, -- cgit v1.2.3-59-g8ed1b