ble - fixing some coding typos
This commit is contained in:
1 parent
d3a866329d
commit
90cb977b35
2 files changed
+22
-7
No files matched your search
@@ -24,7 +24,7 @@ pipeline {
|
|||||||
stages {
|
stages {
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// 1. Build a unique screen session name
|
// 1. Build a unique screen session name, disable MOTD
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
stage('Prepare Test Hash') {
|
stage('Prepare Test Hash') {
|
||||||
steps {
|
steps {
|
||||||
@@ -36,7 +36,15 @@ pipeline {
|
|||||||
env.TEST_HASH =
|
env.TEST_HASH =
|
||||||
"${String.format('%06d', epochSec % 1_000_000)}"
|
"${String.format('%06d', epochSec % 1_000_000)}"
|
||||||
|
|
||||||
sh "echo Test Hash - ${env.TEST_HASH}"
|
sh """
|
||||||
|
cd /tmp
|
||||||
|
echo Test Hash - ${env.TEST_HASH}
|
||||||
|
echo Disabling MOTD...
|
||||||
|
touch .hushlogin
|
||||||
|
scp .hushlogin root@${params.host_ip}:/root/.hushlogin
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,6 +57,7 @@ pipeline {
|
|||||||
sshagent([env.SSH_CREDENTIALS_ID]) {
|
sshagent([env.SSH_CREDENTIALS_ID]) {
|
||||||
sh """
|
sh """
|
||||||
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
||||||
|
echo Checking for screen application...
|
||||||
if ! command -v screen > /dev/null; then
|
if ! command -v screen > /dev/null; then
|
||||||
echo "screen not found - installing"
|
echo "screen not found - installing"
|
||||||
apt-get update && apt-get install -y screen
|
apt-get update && apt-get install -y screen
|
||||||
@@ -66,6 +75,7 @@ pipeline {
|
|||||||
sshagent([env.SSH_CREDENTIALS_ID]) {
|
sshagent([env.SSH_CREDENTIALS_ID]) {
|
||||||
sh """
|
sh """
|
||||||
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
ssh -q -o StrictHostKeyChecking=no root@${params.host_ip} -o ServerAliveInterval=60 -o ServerAliveCountMax=120 << EOF
|
||||||
|
echo Starting BLE test
|
||||||
sleep 5
|
sleep 5
|
||||||
cd /opt/ble-test/ble_api
|
cd /opt/ble-test/ble_api
|
||||||
git pull
|
git pull
|
||||||
|
|||||||
+10
-5
@@ -282,6 +282,7 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
|||||||
####################################################
|
####################################################
|
||||||
# here is the big main test loop
|
# here is the big main test loop
|
||||||
# only for second function
|
# only for second function
|
||||||
|
# it loops until all MACs in mac_list are found
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
while not test_complete:
|
while not test_complete:
|
||||||
@@ -325,7 +326,7 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
|||||||
log.warning(f" Test run incomplete/failed, attempt {len(mac_history)} of {reset_retries}, re-running, loop {test_loop_count}. Updating test list.")
|
log.warning(f" Test run incomplete/failed, attempt {len(mac_history)} of {reset_retries}, re-running, loop {test_loop_count}. Updating test list.")
|
||||||
print_sensor_data(sensors)
|
print_sensor_data(sensors)
|
||||||
# here is where test_list might shrink
|
# here is where test_list might shrink
|
||||||
test_list = get_failed_macs(sensors, mac_list, passed_list)
|
test_list = get_failed_macs(mac_list, passed_list)
|
||||||
log.warning(f" Re-do list - {test_list}")
|
log.warning(f" Re-do list - {test_list}")
|
||||||
|
|
||||||
# end of the big main test loop and test_driver function
|
# end of the big main test loop and test_driver function
|
||||||
@@ -336,7 +337,7 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
|||||||
|
|
||||||
# helper function for summarizing test run results
|
# helper function for summarizing test run results
|
||||||
def summarize_test_run(sensors):
|
def summarize_test_run(sensors):
|
||||||
log.info(f" {sensor['name']} - Temp: {round(temp_f,1)} | Humidity: {sensor['humidity']}")
|
log.info(f" {sensors['name']} - Temp: {temp_ctof(sensors['name'])} | Humidity: {sensors['humidity']}")
|
||||||
result = {
|
result = {
|
||||||
"found_macs": found_macs,
|
"found_macs": found_macs,
|
||||||
"sensor_results": sensors
|
"sensor_results": sensors
|
||||||
@@ -345,7 +346,7 @@ def summarize_test_run(sensors):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
# helper function for processing failed tests
|
# helper function for processing failed tests
|
||||||
def get_failed_macs(sensors, mac_list, passed_list):
|
def get_failed_macs(mac_list, passed_list):
|
||||||
mac_list_new = []
|
mac_list_new = []
|
||||||
for mac in mac_list:
|
for mac in mac_list:
|
||||||
if mac not in passed_list:
|
if mac not in passed_list:
|
||||||
@@ -356,8 +357,12 @@ def get_failed_macs(sensors, mac_list, passed_list):
|
|||||||
def print_sensor_data(sensors):
|
def print_sensor_data(sensors):
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
# Sorry I can't feel celcius, I want my freedom degrees
|
# Sorry I can't feel celcius, I want my freedom degrees
|
||||||
temp_f = (sensor['temp'] * 1.80) + 32.0
|
log.info(f" {sensor['name']} - Temp: {temp_ctof(sensor['temp'])} | Humidity: {sensor['humidity']}")
|
||||||
log.info(f" {sensor['name']} - Temp: {round(temp_f,1)} | Humidity: {sensor['humidity']}")
|
|
||||||
|
# yes i am an insufferable american that doesn't think in celcius, sue me
|
||||||
|
def temp_ctof(c_temp):
|
||||||
|
f_temp = (c_temp * 1.80) + 32.0
|
||||||
|
return f_temp
|
||||||
|
|
||||||
# This resets the BT adapter when things go caca
|
# This resets the BT adapter when things go caca
|
||||||
def reset_adapter():
|
def reset_adapter():
|
||||||
|
|||||||
Reference in new issue
Block a user