mirror of
https://github.com/infiniteCable2/opendbc.git
synced 2026-02-18 13:03:52 +08:00
libsafety: fix building with mutation env (#3001)
* build_env * default * conditional * need it there * try that * fix * rm those
This commit is contained in:
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
||||
scons -j8
|
||||
cd opendbc/safety/tests && ./mutation.sh
|
||||
|
||||
# TODO: this needs to move to opendbc
|
||||
# TODO: this test needs to move to opendbc
|
||||
test_models:
|
||||
name: test models
|
||||
runs-on: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
|
||||
@@ -69,7 +69,7 @@ jobs:
|
||||
env:
|
||||
BASE_IMAGE: openpilot-base
|
||||
BUILD: selfdrive/test/docker_build.sh base
|
||||
RUN: docker run --shm-size 2G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e CI=1 -e PYTHONWARNINGS=error -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c
|
||||
RUN: docker run --shm-size 2G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e CI=1 -e PYTHONWARNINGS=default -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c
|
||||
PYTEST: pytest --continue-on-collection-errors --durations=0 --durations-min=5 -n logical
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
path: .ci_cache/comma_download_cache
|
||||
key: car_models-${{ hashFiles('selfdrive/car/tests/test_models.py', 'opendbc/car/tests/routes.py') }}-${{ matrix.job }}
|
||||
- name: Build openpilot
|
||||
run: ${{ env.RUN }} "scons -j$(nproc) common/ cereal/ selfdrive/pandad/ msgq_repo/ opendbc_repo"
|
||||
run: ${{ env.RUN }} "VIRTUAL_ENV= opendbc_repo/setup.sh && scons -j$(nproc) common/ cereal/ selfdrive/pandad/ msgq_repo/ opendbc_repo"
|
||||
- name: Test car models
|
||||
timeout-minutes: ${{ contains(runner.name, 'nsc') && (steps.routes-cache.outputs.cache-hit == 'true') && ((steps.setup-step.outputs.duration < 18) && 1 || 2) || 6 }}
|
||||
run: |
|
||||
|
||||
@@ -56,14 +56,16 @@ flags = [
|
||||
'-grecord-command-line',
|
||||
]
|
||||
menv['CFLAGS'] += flags
|
||||
menv['LINKFLAGS'] += flags
|
||||
menv['LINKFLAGS'] = flags
|
||||
menv['CFLAGS'].remove('-fprofile-arcs')
|
||||
menv['CFLAGS'].remove('-ftest-coverage')
|
||||
|
||||
for build_env, suffix in ((env, ""), (menv, "_mutation")):
|
||||
# TODO: add macOS support
|
||||
if (build_env == menv) and (system == "Darwin"):
|
||||
continue
|
||||
safety = env.SharedObject(f"safety{suffix}.os", "safety.c")
|
||||
libsafety = env.SharedLibrary(f"libsafety{suffix}.so", [safety])
|
||||
safety = build_env.SharedObject(f"safety{suffix}.os", "safety.c")
|
||||
libsafety = build_env.SharedLibrary(f"libsafety{suffix}.so", [safety])
|
||||
|
||||
# GCC note file is generated by compiler, allow scons to clean it up
|
||||
env.SideEffect("safety.gcno", safety)
|
||||
build_env.SideEffect("safety.gcno", safety)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name = "opendbc"
|
||||
version = "0.2.1"
|
||||
description = "CAN bus databases and tools"
|
||||
license = { file = "LICENSE" }
|
||||
license = "MIT"
|
||||
authors = [{ name = "Vehicle Researcher", email = "user@comma.ai" }]
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11,<3.13" # pycapnp doesn't work with 3.13
|
||||
|
||||
8
setup.sh
8
setup.sh
@@ -10,15 +10,19 @@ export PYTHONPATH=$BASEDIR
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
# TODO: add macOS support
|
||||
if ! command -v "mull-runner-17" > /dev/null 2>&1; then
|
||||
sudo apt-get update && sudo apt-get install -y curl clang-17
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/mull-project/mull-stable/setup.deb.sh' | sudo -E bash
|
||||
sudo apt-get update && sudo apt-get install -y mull-17
|
||||
sudo apt-get update && sudo apt-get install -y clang-17 mull-17
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! command -v uv &>/dev/null; then
|
||||
echo "'uv' is not installed. Installing 'uv'..."
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
|
||||
# must source this after install on some platforms
|
||||
if [ -f $HOME/.local/bin/env ]; then
|
||||
source $HOME/.local/bin/env
|
||||
fi
|
||||
fi
|
||||
|
||||
export UV_PROJECT_ENVIRONMENT="$BASEDIR/.venv"
|
||||
|
||||
Reference in New Issue
Block a user