mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-06-08 07:45:00 +08:00
make jenkins green again (#2230)
* just make it green * fix resetter * fix perms * better caching * just copy * simplify more * fix that up * nope
This commit is contained in:
24
Dockerfile
24
Dockerfile
@@ -1,21 +1,15 @@
|
||||
FROM ubuntu:24.04
|
||||
|
||||
ENV WORKDIR=/tmp/panda/
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONPATH=/tmp/pythonpath
|
||||
ENV PATH="$WORKDIR/.venv/bin:$PATH"
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
|
||||
# deps install
|
||||
COPY pyproject.toml __init__.py setup.sh /tmp/
|
||||
COPY python/__init__.py /tmp/python/
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends sudo && /tmp/setup.sh
|
||||
COPY pyproject.toml __init__.py setup.sh $WORKDIR
|
||||
RUN mkdir -p $WORKDIR/python/ && touch $WORKDIR/__init__.py
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends sudo && DEBIAN_FRONTEND=noninteractive $WORKDIR/setup.sh
|
||||
|
||||
COPY pyproject.toml __init__.py $PYTHONPATH/panda/
|
||||
COPY python/__init__.py $PYTHONPATH/panda/python/
|
||||
RUN pip3 install --break-system-packages --no-cache-dir $PYTHONPATH/panda/[dev]
|
||||
|
||||
RUN git config --global --add safe.directory $PYTHONPATH/panda
|
||||
|
||||
# for Jenkins
|
||||
COPY README.md panda.tar.* /tmp/
|
||||
RUN mkdir -p /tmp/pythonpath/panda && \
|
||||
tar -xvf /tmp/panda.tar.gz -C /tmp/pythonpath/panda/ || true
|
||||
RUN git config --global --add safe.directory $WORKDIR/panda
|
||||
COPY . $WORKDIR
|
||||
|
||||
5
Jenkinsfile
vendored
5
Jenkinsfile
vendored
@@ -4,7 +4,6 @@ def docker_run(String step_label, int timeout_mins, String cmd) {
|
||||
--env PYTHONWARNINGS=error \
|
||||
--volume /dev/bus/usb:/dev/bus/usb \
|
||||
--volume /var/run/dbus:/var/run/dbus \
|
||||
--workdir /tmp/pythonpath/panda \
|
||||
--net host \
|
||||
${env.DOCKER_IMAGE_TAG} \
|
||||
bash -c 'scons -j8 && ${cmd}'", \
|
||||
@@ -35,6 +34,9 @@ export PYTHONPATH=${env.TEST_DIR}/../
|
||||
export PYTHONWARNINGS=error
|
||||
ln -sf /data/openpilot/opendbc_repo/opendbc /data/opendbc
|
||||
|
||||
# TODO: this is an agnos issue
|
||||
export PYTEST_ADDOPTS="-p no:asyncio"
|
||||
|
||||
cd ${env.TEST_DIR} || true
|
||||
${cmd}
|
||||
exit 0
|
||||
@@ -83,7 +85,6 @@ pipeline {
|
||||
steps {
|
||||
timeout(time: 20, unit: 'MINUTES') {
|
||||
script {
|
||||
sh 'git archive -v -o panda.tar.gz --format=tar.gz HEAD'
|
||||
dockerImage = docker.build("${env.DOCKER_IMAGE_TAG}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,16 +522,16 @@ class Panda:
|
||||
dfu_list = PandaDFU.list()
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def wait_for_panda(serial: str | None, timeout: int) -> bool:
|
||||
@classmethod
|
||||
def wait_for_panda(cls, serial: str | None, timeout: int) -> bool:
|
||||
t_start = time.monotonic()
|
||||
serials = Panda.list()
|
||||
serials = cls.list()
|
||||
while (serial is None and len(serials) == 0) or (serial is not None and serial not in serials):
|
||||
logger.debug("waiting for panda...")
|
||||
time.sleep(0.1)
|
||||
if timeout is not None and (time.monotonic() - t_start) > timeout:
|
||||
return False
|
||||
serials = Panda.list()
|
||||
serials = cls.list()
|
||||
return True
|
||||
|
||||
def up_to_date(self, fn=None) -> bool:
|
||||
|
||||
@@ -4,7 +4,9 @@ import concurrent.futures
|
||||
from panda import PandaJungle, PandaJungleDFU, McuType
|
||||
from panda.tests.libs.resetter import Resetter
|
||||
|
||||
SERIALS = {'180019001451313236343430', '1d0017000c50435635333720'}
|
||||
SERIALS = {
|
||||
'180019001451313236343430', # jungle v2
|
||||
}
|
||||
|
||||
def recover(s):
|
||||
with PandaJungleDFU(s) as pd:
|
||||
@@ -25,9 +27,9 @@ if __name__ == "__main__":
|
||||
for i in range(1, 4):
|
||||
r.enable_power(i, 0)
|
||||
r.cycle_power(ports=[1, 2], dfu=True)
|
||||
|
||||
for s in SERIALS:
|
||||
assert PandaJungle.wait_for_dfu(PandaJungleDFU.st_serial_to_dfu_serial(s, McuType.H7), timeout=10)
|
||||
dfu_serials = PandaJungleDFU.list()
|
||||
print(len(dfu_serials), len(SERIALS))
|
||||
assert len(dfu_serials) == len(SERIALS)
|
||||
|
||||
with concurrent.futures.ProcessPoolExecutor(max_workers=len(dfu_serials)) as exc:
|
||||
@@ -36,7 +38,9 @@ if __name__ == "__main__":
|
||||
# power cycle for H7 bootloader bug
|
||||
r.cycle_power(ports=[1, 2])
|
||||
|
||||
serials = PandaJungle.list()
|
||||
# wait for them to come back up
|
||||
for s in SERIALS:
|
||||
assert PandaJungle.wait_for_panda(s, timeout=10)
|
||||
assert set(PandaJungle.list()) >= SERIALS
|
||||
mcu_types = list(exc.map(flash, SERIALS, timeout=20))
|
||||
assert set(mcu_types) == {McuType.F4, McuType.H7}
|
||||
assert set(mcu_types) == {McuType.H7, }
|
||||
|
||||
@@ -42,16 +42,17 @@ class Resetter():
|
||||
def enable_boot(self, enabled):
|
||||
self._handle.controlWrite((usb1.ENDPOINT_OUT | usb1.TYPE_VENDOR | usb1.RECIPIENT_DEVICE), 0xff, 0, enabled, b'')
|
||||
|
||||
def cycle_power(self, delay=5, dfu=False, ports=None):
|
||||
def cycle_power(self, dfu=False, ports=None):
|
||||
if ports is None:
|
||||
ports = [1, 2, 3]
|
||||
|
||||
self.enable_boot(dfu)
|
||||
for port in ports:
|
||||
self.enable_power(port, False)
|
||||
time.sleep(0.5)
|
||||
time.sleep(0.05)
|
||||
|
||||
for port in ports:
|
||||
self.enable_power(port, True)
|
||||
time.sleep(delay)
|
||||
time.sleep(0.05)
|
||||
self.enable_boot(False)
|
||||
time.sleep(0.12) # takes the kernel this long to detect the disconnect
|
||||
|
||||
Reference in New Issue
Block a user