ci: usb hub ppps handling overhaul

This commit is contained in:
grvvy
2024-07-10 15:30:26 -06:00
parent 2d9a7dbd0b
commit ab69bef242
6 changed files with 29 additions and 17 deletions

View File

@ -1,12 +1,18 @@
# Sandbox test environment for HackRF # Environment for HackRF HIL testing with Jenkins CI
FROM ubuntu:22.04 FROM ubuntu:22.04
USER root USER root
# Override interactive installations and install prerequisites # Copy usb hub script from Jenkins' container
COPY --from=gsg-jenkins /startup/hubs.py /startup/hubs.py
COPY --from=gsg-jenkins /startup/.hubs /startup/.hubs
RUN ln -s /startup/hubs.py /usr/local/bin/hubs
# Override interactive installations and install software dependencies
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
build-essential \ build-essential \
cmake \ cmake \
curl \
dfu-util \ dfu-util \
gcc-arm-none-eabi \ gcc-arm-none-eabi \
git \ git \
@ -16,8 +22,18 @@ RUN apt-get update && apt-get install -y \
python3 \ python3 \
python3-pip \ python3-pip \
python3-yaml \ python3-yaml \
usbutils \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN pip3 install git+https://github.com/CapableRobot/CapableRobot_USBHub_Driver --upgrade
# Install USB hub PPPS dependencies
RUN pip3 install python-dotenv git+https://github.com/CapableRobot/CapableRobot_USBHub_Driver --upgrade
RUN curl -L https://github.com/mvp/uhubctl/archive/refs/tags/v2.5.0.tar.gz > uhubctl-2.5.0.tar.gz \
&& mkdir uhubctl-2.5.0 \
&& tar -xvzf uhubctl-2.5.0.tar.gz -C uhubctl-2.5.0 --strip-components 1 \
&& rm uhubctl-2.5.0.tar.gz \
&& cd uhubctl-2.5.0 \
&& make \
&& make install
# Inform Docker that the container is listening on port 8080 at runtime # Inform Docker that the container is listening on port 8080 at runtime
EXPOSE 8080 EXPOSE 8080

8
Jenkinsfile vendored
View File

@ -1,7 +1,7 @@
pipeline { pipeline {
agent { agent {
dockerfile { dockerfile {
args '--group-add=46 --device-cgroup-rule="c 189:* rmw" -v /dev/bus/usb:/dev/bus/usb' args '--group-add=20 --group-add=46 --device-cgroup-rule="c 189:* rmw" --device-cgroup-rule="c 166:* rmw" -v /dev/bus/usb:/dev/bus/usb -e TESTER=0000000000000000325866e629a25623 -e EUT=RunningFromRAM'
} }
} }
stages { stages {
@ -17,7 +17,7 @@ pipeline {
} }
stage('Test') { stage('Test') {
steps { steps {
sh './ci-scripts/configure-hubs.sh --off' sh 'hubs all off'
retry(3) { retry(3) {
sh './ci-scripts/test-host.sh' sh './ci-scripts/test-host.sh'
} }
@ -32,14 +32,14 @@ pipeline {
retry(3) { retry(3) {
sh 'python3 ci-scripts/test-transfer.py rx' sh 'python3 ci-scripts/test-transfer.py rx'
} }
sh './ci-scripts/configure-hubs.sh --off' sh 'hubs all off'
sh 'python3 ci-scripts/test-sgpio-debug.py' sh 'python3 ci-scripts/test-sgpio-debug.py'
sh './ci-scripts/configure-hubs.sh --reset'
} }
} }
} }
post { post {
always { always {
sh 'hubs all reset'
cleanWs(cleanWhenNotBuilt: false, cleanWs(cleanWhenNotBuilt: false,
deleteDirs: true, deleteDirs: true,
disableDeferredWipeout: true, disableDeferredWipeout: true,

View File

@ -1,4 +0,0 @@
#!/bin/bash
set -e
usbhub --disable-i2c --hub D9D1 power state --port 1,2,3,4 $1
usbhub --disable-i2c --hub 624C power state --port 1,2,3,4 $1

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
usbhub --disable-i2c --hub D9D1 power state --port 2 --reset hubs hackrf_dfu reset
sleep 1s sleep 1s
dfu-util --device 1fc9:000c --alt 0 --download firmware/hackrf_usb/build/hackrf_usb.dfu dfu-util --device 1fc9:000c --alt 0 --download firmware/hackrf_usb/build/hackrf_usb.dfu
sleep 1s sleep 1s

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
usbhub --disable-i2c --hub D9D1 power state --port 2 --reset hubs hackrf_dfu reset
sleep 1s sleep 1s
host/build/hackrf-tools/src/hackrf_info host/build/hackrf-tools/src/hackrf_info
EXIT_CODE="$?" EXIT_CODE="$?"

View File

@ -2,9 +2,10 @@
import subprocess import subprocess
import time import time
import sys import sys
from os import environ
EUT = "RunningFromRAM" EUT = environ.get('EUT')
TESTER = "0000000000000000325866e629a25623" TESTER = environ.get('TESTER')
PASS, FAIL = range(2) PASS, FAIL = range(2)
@ -87,8 +88,7 @@ def check_signal(freq, bins):
def main(): def main():
write_bytes() write_bytes()
tester_hub_on = subprocess.Popen(["usbhub", "--disable-i2c", "--hub", "624C", tester_hub_on = subprocess.Popen(["hubs", "hackrf", "reset"])
"power", "state", "--port", "2", "--reset"])
tester_hub_on.wait() tester_hub_on.wait()
time.sleep(1) time.sleep(1)
eut_clkout_on = subprocess.Popen(["host/build/hackrf-tools/src/hackrf_clock", eut_clkout_on = subprocess.Popen(["host/build/hackrf-tools/src/hackrf_clock",