From 72c878e8e810703aaf4e233afce490c6d410966e Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 21 Oct 2026 00:00:08 -0700 Subject: [PATCH] ble - fixing test_driver after cleanup --- api/Jenkinsfile.ble_test | 15 ++++++++------- api/ble.py | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/api/Jenkinsfile.ble_test b/api/Jenkinsfile.ble_test index 78e8f96..666e264 100644 --- a/api/Jenkinsfile.ble_test +++ b/api/Jenkinsfile.ble_test @@ -38,8 +38,8 @@ pipeline { sh """ cd /tmp - echo Test Hash - ${env.TEST_HASH} - echo Disabling MOTD... + echo ==MC== Test Hash - ${env.TEST_HASH} + echo ==MC== Disabling MOTD... touch .hushlogin scp .hushlogin root@${params.host_ip}:/root/.hushlogin @@ -57,9 +57,9 @@ pipeline { sshagent([env.SSH_CREDENTIALS_ID]) { sh """ ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF - echo Checking for screen application... + echo ==MC== Checking for screen application... if ! command -v screen > /dev/null; then - echo "screen not found - installing" + echo ==MC== "screen not found - installing" apt-get update && apt-get install -y screen fi """ @@ -75,9 +75,9 @@ pipeline { sshagent([env.SSH_CREDENTIALS_ID]) { sh """ ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF - echo Initiating BLE test in Screen session ble_test_${env.TEST_HASH} + echo ==MC== Initiating BLE test in Screen session ble_test_${env.TEST_HASH} sleep 5 - echo Pulling code changes from Gitea... + echo ==MC== Pulling code changes from Gitea... cd /opt/ble-test/ble_api git pull cd /opt/ble-test/ble_api/api @@ -93,7 +93,7 @@ pipeline { sshagent([env.SSH_CREDENTIALS_ID]) { sh """ ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF - echo === Initiating Tail Watchdog === + echo ==MC== Initiating Tail Watchdog screen -dmS ble_test_watchdog_${env.TEST_HASH} sh -c ' while ! pgrep -f "tail.*ble_test_${env.TEST_HASH}" > /dev/null; do sleep 1 @@ -108,6 +108,7 @@ pipeline { done exit ' + echo ==MC== Tail watchdog running in screen session ble_test_watchdog_${env.TEST_HASH} """ } } diff --git a/api/ble.py b/api/ble.py index 6c2af47..d541d00 100644 --- a/api/ble.py +++ b/api/ble.py @@ -319,8 +319,9 @@ def test_driver(test_count = 0, bt_usb_id = None): # If all the MACs have been scanned, then this test is complete. if len(mac_list) == len(passed_list): log.info(f" Test run {test_count} completed, yee-haw") + test_complete = True print_sensor_data(sensors) - return summarize_test_run(sensors) + return summarize_test_run(sensors, found_macs) # If not, then re-scan the failed sensors else: log.warning(f" Test run incomplete/failed, attempt {len(mac_history)} of {reset_retries}, re-running, loop {test_loop_count}. Updating test list.") @@ -336,14 +337,13 @@ def test_driver(test_count = 0, bt_usb_id = None): #################################################### # helper function for summarizing test run results -def summarize_test_run(sensors): +def summarize_test_run(sensors, found_macs): for sensor in sensors: log.info(f" {sensor['name']} - Temp: {temp_ctof(sensor['temp'])} | Humidity: {sensor['humidity']}") result = { "found_macs": found_macs, "sensor_results": sensors } - test_complete = True return result # helper function for processing failed tests