CI: set PYTHONWARNINGS=error (#1323)

* CI: set PYTHONWARNINGS=error

* update resetter

* fix build warnings

* bump jungle

* fix one more

* fix linter

---------

Co-authored-by: Bruce Wayne <batman@comma.ai>
This commit is contained in:
Adeeb Shihadeh 2023-04-02 09:33:35 -07:00 committed by GitHub
parent 3e89b7127a
commit b6c378ad02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 43 deletions

View File

@ -12,6 +12,8 @@ env:
export DOCKER_BUILDKIT=1
docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ghcr.io/commaai/panda:latest -t panda -f Dockerfile .
PYTHONWARNINGS: "error"
jobs:
docker_push:
name: docker push

View File

@ -83,7 +83,7 @@ RUN cd /tmp/openpilot && \
git clone https://github.com/commaai/panda_jungle.git && \
cd panda_jungle && \
git fetch && \
git checkout 7b7197c605915ac34f3d62f314edd84e2e78a759 && \
git checkout 3a791be1f1877a69cf45de16a670992380622297 && \
rm -rf .git/
RUN cd /tmp/openpilot && \

3
Jenkinsfile vendored
View File

@ -2,6 +2,7 @@ def docker_run(String step_label, int timeout_mins, String cmd) {
timeout(time: timeout_mins, unit: 'MINUTES') {
sh script: "docker run --rm --privileged \
--env PARTIAL_TESTS=${env.PARTIAL_TESTS} \
--env PYTHONWARNINGS=error \
--volume /dev/bus/usb:/dev/bus/usb \
--volume /var/run/dbus:/var/run/dbus \
--workdir /tmp/openpilot/panda \
@ -32,6 +33,7 @@ export SOURCE_DIR=${env.SOURCE_DIR}
export GIT_BRANCH=${env.GIT_BRANCH}
export GIT_COMMIT=${env.GIT_COMMIT}
export PYTHONPATH=${env.TEST_DIR}/../
export PYTHONWARNINGS=error
cd ${env.TEST_DIR} || true
${cmd}
@ -61,6 +63,7 @@ pipeline {
environment {
CI = "1"
PARTIAL_TESTS = "${env.BRANCH_NAME == 'master' ? ' ' : '1'}"
PYTHONWARNINGS= "error"
DOCKER_IMAGE_TAG = "panda:build-${env.GIT_COMMIT}"
TEST_DIR = "/data/panda"

View File

@ -102,7 +102,8 @@ def get_key_header(name):
from Crypto.PublicKey import RSA
public_fn = File(f'../certs/{name}.pub').srcnode().abspath
rsa = RSA.importKey(open(public_fn).read())
with open(public_fn) as f:
rsa = RSA.importKey(f.read())
assert(rsa.size_in_bits() == 1024)
rr = pow(2**1024, 2, rsa.n)

View File

@ -9,7 +9,9 @@ import binascii
# increment this to make new hardware not run old versions
VERSION = 2
rsa = RSA.importKey(open(sys.argv[3]).read())
if __name__ == "__main__":
with open(sys.argv[3]) as k:
rsa = RSA.importKey(k.read())
with open(sys.argv[1], "rb") as f:
dat = f.read()

View File

@ -612,7 +612,7 @@ class Panda:
@staticmethod
def get_signature_from_firmware(fn) -> bytes:
f = open(fn, 'rb')
with open(fn, 'rb') as f:
f.seek(-128, 2) # Seek from end of file
return f.read(128)

View File

@ -9,18 +9,18 @@ class Resetter():
def close(self):
self._handle.close()
self._context.close()
self._handle = None
def connect(self):
if self._handle:
self.close()
context = usb1.USBContext()
self._handle = None
while True:
try:
for device in context.getDeviceList(skip_on_error=True):
self._context = usb1.USBContext()
self._context.open()
for device in self._context.getDeviceList(skip_on_error=True):
if device.getVendorID() == 0xbbaa and device.getProductID() == 0xddc0:
try:
self._handle = device.open()
@ -28,12 +28,6 @@ class Resetter():
break
except Exception as e:
print(e)
continue
except Exception as e:
print(e)
if self._handle:
break
context = usb1.USBContext()
assert self._handle
def enable_power(self, port, enabled):

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import os
import time
import subprocess