From b69d31cd29222178a47a2d1511c5c6d879d155ef Mon Sep 17 00:00:00 2001 From: commaci-public <60409688+commaci-public@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:14:12 -0700 Subject: [PATCH 1/3] pre-commit: autoupdate hooks (#2051) Update pre-commit hook versions Co-authored-by: adeebshihadeh --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c2759df9c..623a67e24 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,6 @@ repos: additional_dependencies: ['numpy', 'types-requests', 'types-atomicwrites', 'types-pycurl'] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.3 + rev: v0.6.8 hooks: - id: ruff From f5e1900537b39b98ca269fd3d934bac792c4ae12 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Tue, 1 Oct 2024 19:05:39 -0700 Subject: [PATCH 2/3] mutation tests: remove `cxx_assign_const` op (#2053) * no 42 * last one --- tests/safety/mutation.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/safety/mutation.sh b/tests/safety/mutation.sh index e8c242cab..9b40bdedd 100755 --- a/tests/safety/mutation.sh +++ b/tests/safety/mutation.sh @@ -8,7 +8,8 @@ $DIR/install_mull.sh GIT_REF="${GIT_REF:-origin/master}" GIT_ROOT=$(git rev-parse --show-toplevel) -echo -e "mutators:\n - cxx_all" > $GIT_ROOT/mull.yml +MULL_OPS="mutators: [cxx_increment, cxx_decrement, cxx_comparison, cxx_boundary, cxx_bitwise_assignment, cxx_bitwise, cxx_arithmetic_assignment, cxx_arithmetic]" +echo -e "$MULL_OPS" > $GIT_ROOT/mull.yml scons --mutation -j$(nproc) -D echo -e "timeout: 10000\ngitDiffRef: $GIT_REF\ngitProjectRoot: $GIT_ROOT" >> $GIT_ROOT/mull.yml From fab8d0bb4a7704d771bbac79e1cf94c6469f8888 Mon Sep 17 00:00:00 2001 From: Radek Date: Wed, 2 Oct 2024 20:53:32 +0100 Subject: [PATCH 3/3] CAN print improvement (#2052) * Jungle spam can. * Print all busses by default. Prettier print. * can_health printer * colors on can error --- board/jungle/scripts/can_health.py | 20 ++++++++++++++++++-- board/jungle/scripts/can_printer.py | 17 +++++++++++------ board/jungle/scripts/spam_can.py | 20 ++++++++++++++++++++ tests/can_health.py | 29 +++++++++++++++++++++++++++++ tests/can_printer.py | 20 ++++++++++---------- 5 files changed, 88 insertions(+), 18 deletions(-) create mode 100755 board/jungle/scripts/spam_can.py create mode 100755 tests/can_health.py diff --git a/board/jungle/scripts/can_health.py b/board/jungle/scripts/can_health.py index ff068b5ba..47efbb2e6 100755 --- a/board/jungle/scripts/can_health.py +++ b/board/jungle/scripts/can_health.py @@ -1,13 +1,29 @@ #!/usr/bin/env python3 - import time +import re from panda import PandaJungle +RED = '\033[91m' +GREEN = '\033[92m' + +def colorize_errors(value): + if isinstance(value, str): + if re.search(r'(?i)No error', value): + return f'{GREEN}{value}\033[0m' + elif re.search(r'(?i)(? 0.1: dd = chr(27) + "[2J" dd += "%5.2f\n" % (sec_since_boot() - start) - for k,v in sorted(zip(list(msgs.keys()), [binascii.hexlify(x[-1]) for x in list(msgs.values())], strict=True)): - dd += "%s(%6d) %s\n" % ("%04X(%4d)" % (k,k),len(msgs[k]), v) + for k, v in sorted(msgs.items()): + last_msg, last_src = v[-1] + dd += "%d: %s(%6d): %s\n" % (last_src, "%04X(%4d)" % (k, k), len(v), binascii.hexlify(last_msg).decode()) print(dd) lp = sec_since_boot() diff --git a/board/jungle/scripts/spam_can.py b/board/jungle/scripts/spam_can.py new file mode 100755 index 000000000..c3d798b47 --- /dev/null +++ b/board/jungle/scripts/spam_can.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +import os +import random +from panda import PandaJungle + +def get_test_string(): + return b"test" + os.urandom(10) + +if __name__ == "__main__": + p = PandaJungle() + + p.set_safety_mode(PandaJungle.SAFETY_ALLOUTPUT) + + print("Spamming all buses...") + while True: + at = random.randint(1, 2000) + st = get_test_string()[0:8] + bus = random.randint(0, 2) + p.can_send(at, st, bus) + # print("Sent message on bus: ", bus) diff --git a/tests/can_health.py b/tests/can_health.py new file mode 100755 index 000000000..26de9cdab --- /dev/null +++ b/tests/can_health.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +import time +import re +from panda import Panda + +RED = '\033[91m' +GREEN = '\033[92m' + +def colorize_errors(value): + if isinstance(value, str): + if re.search(r'(?i)No error', value): + return f'{GREEN}{value}\033[0m' + elif re.search(r'(?i)(? 0.1: dd = chr(27) + "[2J" dd += "%5.2f\n" % (sec_since_boot() - start) - for k, v in sorted(zip(list(msgs.keys()), [binascii.hexlify(x[-1]) for x in list(msgs.values())], strict=True)): - dd += "%s(%6d) %s\n" % ("%04X(%4d)" % (k, k), len(msgs[k]), v) + for k, v in sorted(msgs.items()): + last_msg, last_src = v[-1] + dd += "%d: %s(%6d): %s\n" % (last_src, "%04X(%4d)" % (k, k), len(v), binascii.hexlify(last_msg).decode()) print(dd) lp = sec_since_boot()