Mark legacy BabyLIN adapter as deprecated across code and docs
The MUM (Melexis Universal Master) adapter is the current default; the
BabyLIN SDK adapter is retained only for backward compatibility with
existing rigs.
Code:
- Emit DeprecationWarning when BabyLinInterface is instantiated and
when tests/conftest.py routes interface.type=='babylin' to it.
- Update module/class docstrings in ecu_framework/{__init__,config,
lin/__init__,lin/babylin}.py to label BabyLIN-specific fields and
paths as deprecated.
Config / scripts / pytest:
- pytest.ini: relabel the babylin marker as deprecated.
- config/{babylin.example,examples,test_config}.yaml: add deprecation
banners and field comments.
- scripts/99-babylin.rules and scripts/pi_install.sh: annotate the
udev-rule install block as legacy-only.
Documentation:
- TESTING_FRAMEWORK_GUIDE.md, docs/08_babylin_internals.md, and
vendor/README.md: prepend explicit "DEPRECATED" banners.
- docs/{README,01,02,04,05,07,09,10,12,13,14,15,18,DEVELOPER_COMMIT_
GUIDE}.md: relabel "legacy" to "deprecated" where babylin is
mentioned, present MUM as the primary path, and steer new work
toward the MUM examples.
No tests, configs, or modules were deleted; existing BabyLIN setups
keep working but now produce a clear DeprecationWarning at runtime.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d268d845ce
commit
582764d410
@ -1,14 +1,17 @@
|
|||||||
# ECU Testing Framework - Complete Guide
|
# ECU Testing Framework - Complete Guide
|
||||||
|
|
||||||
|
> **Heads-up:** the BabyLIN LIN adapter is **deprecated** and retained for backward compatibility only. New tests and deployments should target the MUM (Melexis Universal Master) adapter — see `docs/16_mum_internals.md`. The BabyLIN-related sections below are kept so existing rigs can still be maintained.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
This comprehensive ECU Testing Framework provides a robust solution for testing Electronic Control Units (ECUs) using pytest with BabyLIN LIN bus communication. The framework includes detailed test documentation, enhanced reporting, mock interfaces for development, and real hardware integration capabilities.
|
This comprehensive ECU Testing Framework provides a robust solution for testing Electronic Control Units (ECUs) using pytest with the MUM LIN adapter (current) or the deprecated BabyLIN adapter. The framework includes detailed test documentation, enhanced reporting, mock interfaces for development, and real hardware integration capabilities.
|
||||||
|
|
||||||
## Framework Features
|
## Framework Features
|
||||||
|
|
||||||
### ✅ **Complete Implementation Status**
|
### ✅ **Complete Implementation Status**
|
||||||
- **✅ pytest-based testing framework** with custom plugins
|
- **✅ pytest-based testing framework** with custom plugins
|
||||||
- **✅ BabyLIN LIN communication integration** via the official SDK Python wrapper (`BabyLIN_library.py`)
|
- **✅ MUM (Melexis Universal Master) LIN integration** via the `pylin` / `pymumclient` packages — current default
|
||||||
|
- **⚠️ BabyLIN LIN integration (DEPRECATED)** via the official SDK Python wrapper (`BabyLIN_library.py`)
|
||||||
- **✅ Mock interface for hardware-independent development**
|
- **✅ Mock interface for hardware-independent development**
|
||||||
- **✅ Enhanced HTML/XML reporting with test metadata**
|
- **✅ Enhanced HTML/XML reporting with test metadata**
|
||||||
- **✅ Detailed test documentation extraction**
|
- **✅ Detailed test documentation extraction**
|
||||||
@ -76,20 +79,20 @@ ecu_tests/
|
|||||||
│ ├── lin/ # LIN communication interfaces
|
│ ├── lin/ # LIN communication interfaces
|
||||||
│ │ ├── base.py # Abstract LinInterface definition
|
│ │ ├── base.py # Abstract LinInterface definition
|
||||||
│ │ ├── mock.py # Mock interface for development
|
│ │ ├── mock.py # Mock interface for development
|
||||||
│ │ └── babylin.py # Real BabyLin hardware interface
|
│ │ └── babylin.py # DEPRECATED BabyLin hardware interface (kept for legacy rigs)
|
||||||
│ └── flashing/ # Hex file flashing capabilities
|
│ └── flashing/ # Hex file flashing capabilities
|
||||||
│ └── hex_flasher.py # ECU flash programming
|
│ └── hex_flasher.py # ECU flash programming
|
||||||
├── tests/ # Test suite
|
├── tests/ # Test suite
|
||||||
│ ├── conftest.py # pytest fixtures and configuration
|
│ ├── conftest.py # pytest fixtures and configuration
|
||||||
│ ├── test_smoke_mock.py # Mock interface validation tests
|
│ ├── test_smoke_mock.py # Mock interface validation tests
|
||||||
│ ├── test_babylin_hardware_smoke.py # Hardware smoke tests
|
│ ├── test_babylin_hardware_smoke.py # Hardware smoke tests (deprecated BabyLIN)
|
||||||
│ └── test_hardware_placeholder.py # Future hardware tests
|
│ └── test_hardware_placeholder.py # Future hardware tests
|
||||||
├── config/ # Configuration files
|
├── config/ # Configuration files
|
||||||
│ ├── test_config.yaml # Main test configuration
|
│ ├── test_config.yaml # Main test configuration
|
||||||
│ └── babylin.example.yaml # BabyLin configuration template
|
│ └── babylin.example.yaml # DEPRECATED BabyLin configuration template
|
||||||
├── vendor/ # BabyLIN SDK placement
|
├── vendor/ # SDK placement (BabyLIN paths are deprecated)
|
||||||
| ├── BabyLIN_library.py # Official SDK Python wrapper
|
| ├── BabyLIN_library.py # Official SDK Python wrapper (deprecated)
|
||||||
| └── platform libs # OS-specific native libs (DLL/.so/.dylib)
|
| └── platform libs # OS-specific native libs (DLL/.so/.dylib) — deprecated
|
||||||
├── reports/ # Generated test reports
|
├── reports/ # Generated test reports
|
||||||
│ ├── report.html # Enhanced HTML report
|
│ ├── report.html # Enhanced HTML report
|
||||||
│ └── junit.xml # JUnit XML report
|
│ └── junit.xml # JUnit XML report
|
||||||
@ -114,7 +117,8 @@ python -m pytest tests\test_smoke_mock.py -v
|
|||||||
python -m pytest -m "smoke" -v
|
python -m pytest -m "smoke" -v
|
||||||
python -m pytest -m "req_001" -v
|
python -m pytest -m "req_001" -v
|
||||||
|
|
||||||
# Run hardware tests (requires BabyLIN hardware); join with adapter marker
|
# Run hardware tests (requires deprecated BabyLIN hardware); join with adapter marker
|
||||||
|
# Prefer MUM for new work: pytest -m "hardware and mum" -v
|
||||||
python -m pytest -m "hardware and babylin" -v
|
python -m pytest -m "hardware and babylin" -v
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -166,7 +170,7 @@ Tests automatically generate enhanced reports:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
interface:
|
interface:
|
||||||
type: mock # or babylin for hardware
|
type: mock # or "mum" for hardware (current); "babylin" is deprecated
|
||||||
timeout: 1.0
|
timeout: 1.0
|
||||||
|
|
||||||
flash:
|
flash:
|
||||||
@ -178,11 +182,13 @@ ecu:
|
|||||||
lin_id_range: [0x01, 0x3F]
|
lin_id_range: [0x01, 0x3F]
|
||||||
```
|
```
|
||||||
|
|
||||||
### BabyLIN Configuration (`config/babylin.example.yaml`)
|
### BabyLIN Configuration (`config/babylin.example.yaml`) — DEPRECATED
|
||||||
|
|
||||||
|
> Retained for backward compatibility. Prefer `config/mum.example.yaml` for new work.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
interface:
|
interface:
|
||||||
type: babylin
|
type: babylin # deprecated; prefer "mum"
|
||||||
channel: 0 # channel index used by the SDK wrapper
|
channel: 0 # channel index used by the SDK wrapper
|
||||||
bitrate: 19200 # typically set by SDF
|
bitrate: 19200 # typically set by SDF
|
||||||
sdf_path: ./vendor/Example.sdf
|
sdf_path: ./vendor/Example.sdf
|
||||||
@ -202,9 +208,9 @@ interface:
|
|||||||
|
|
||||||
**Status**: **7 tests passing** - Complete implementation
|
**Status**: **7 tests passing** - Complete implementation
|
||||||
|
|
||||||
### 2. Hardware Smoke Tests (`test_babylin_hardware_smoke.py`)
|
### 2. Hardware Smoke Tests (`test_babylin_hardware_smoke.py`) — DEPRECATED
|
||||||
|
|
||||||
**Purpose**: Basic BabyLIN hardware connectivity validation
|
**Purpose**: Basic BabyLIN hardware connectivity validation (deprecated path; prefer the MUM smoke tests under `tests/hardware/`)
|
||||||
- ✅ SDK wrapper import and device open
|
- ✅ SDK wrapper import and device open
|
||||||
- ✅ Interface connection establishment
|
- ✅ Interface connection establishment
|
||||||
- ✅ Basic send/receive operations
|
- ✅ Basic send/receive operations
|
||||||
@ -231,8 +237,9 @@ The framework includes custom markers for test categorization and requirement tr
|
|||||||
markers =
|
markers =
|
||||||
smoke: Basic functionality tests
|
smoke: Basic functionality tests
|
||||||
integration: Integration tests requiring hardware
|
integration: Integration tests requiring hardware
|
||||||
hardware: Tests requiring physical BabyLin hardware
|
hardware: Tests requiring physical hardware (MUM or, deprecated, BabyLin)
|
||||||
babylin: Tests targeting the BabyLIN SDK adapter
|
babylin: DEPRECATED. Tests targeting the legacy BabyLIN SDK adapter
|
||||||
|
mum: Tests targeting the current MUM (Melexis Universal Master) adapter
|
||||||
unit: Fast unit tests (no hardware)
|
unit: Fast unit tests (no hardware)
|
||||||
boundary: Boundary condition and edge case tests
|
boundary: Boundary condition and edge case tests
|
||||||
req_001: Tests validating requirement REQ-001 (LIN Interface Basic Operations)
|
req_001: Tests validating requirement REQ-001 (LIN Interface Basic Operations)
|
||||||
@ -241,11 +248,13 @@ markers =
|
|||||||
req_004: Tests validating requirement REQ-004 (Timeout Handling)
|
req_004: Tests validating requirement REQ-004 (Timeout Handling)
|
||||||
```
|
```
|
||||||
|
|
||||||
## BabyLIN Integration Details
|
## BabyLIN Integration Details (DEPRECATED)
|
||||||
|
|
||||||
|
> Kept for backward compatibility only. New tests should use the MUM adapter (`docs/16_mum_internals.md`).
|
||||||
|
|
||||||
### SDK Python wrapper
|
### SDK Python wrapper
|
||||||
|
|
||||||
The framework uses the official SDK Python wrapper `BabyLIN_library.py` (placed under `vendor/`) and calls its BLC_* APIs.
|
The deprecated BabyLIN adapter uses the official SDK Python wrapper `BabyLIN_library.py` (placed under `vendor/`) and calls its BLC_* APIs.
|
||||||
|
|
||||||
Key calls in the adapter (`ecu_framework/lin/babylin.py`):
|
Key calls in the adapter (`ecu_framework/lin/babylin.py`):
|
||||||
- `BLC_getBabyLinPorts`, `BLC_openPort` — discovery and open
|
- `BLC_getBabyLinPorts`, `BLC_openPort` — discovery and open
|
||||||
@ -264,7 +273,8 @@ python -m pytest tests\test_smoke_mock.py -v
|
|||||||
|
|
||||||
### 2. Hardware Integration Phase
|
### 2. Hardware Integration Phase
|
||||||
```powershell
|
```powershell
|
||||||
# Test with real BabyLIN hardware
|
# Test with deprecated BabyLIN hardware (legacy rigs only)
|
||||||
|
# Prefer MUM: python -m pytest -m "hardware and mum" -v
|
||||||
python -m pytest -m "hardware and babylin" -v
|
python -m pytest -m "hardware and babylin" -v
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -303,7 +313,7 @@ The enhanced HTML report includes:
|
|||||||
**Configuration System**: ✅ **Complete**
|
**Configuration System**: ✅ **Complete**
|
||||||
- YAML configuration loading: ✅ Working
|
- YAML configuration loading: ✅ Working
|
||||||
- Environment variable override: ✅ Working
|
- Environment variable override: ✅ Working
|
||||||
- BabyLIN SDF/schedule configuration: ✅ Working
|
- BabyLIN SDF/schedule configuration: ✅ Working (deprecated path)
|
||||||
- Power supply (PSU) configuration: ✅ Working (see `config/test_config.yaml` → `power_supply`)
|
- Power supply (PSU) configuration: ✅ Working (see `config/test_config.yaml` → `power_supply`)
|
||||||
|
|
||||||
## Owon Power Supply (PSU) Integration
|
## Owon Power Supply (PSU) Integration
|
||||||
@ -342,7 +352,7 @@ power_supply:
|
|||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
1. **Hardware Testing**: Connect BabyLin hardware and validate hardware smoke tests
|
1. **Hardware Testing**: Connect MUM hardware (or, for legacy rigs, BabyLin) and validate the corresponding hardware smoke tests
|
||||||
2. **ECU Integration**: Define ECU-specific communication protocols and diagnostic commands
|
2. **ECU Integration**: Define ECU-specific communication protocols and diagnostic commands
|
||||||
3. **Hex Flashing**: Implement complete hex file flashing workflow
|
3. **Hex Flashing**: Implement complete hex file flashing workflow
|
||||||
4. **CI/CD Integration**: Set up automated testing pipeline with generated reports
|
4. **CI/CD Integration**: Set up automated testing pipeline with generated reports
|
||||||
@ -356,4 +366,4 @@ pytest-xdist>=3.8.0
|
|||||||
pyyaml>=6.0.2
|
pyyaml>=6.0.2
|
||||||
```
|
```
|
||||||
|
|
||||||
This framework provides a complete, production-ready testing solution for ECU development with BabyLIN communication, featuring enhanced documentation, traceability, and reporting capabilities.
|
This framework provides a complete, production-ready testing solution for ECU development. The current LIN path uses the MUM adapter; the BabyLIN adapter is retained as a deprecated fallback for legacy rigs. Enhanced documentation, traceability, and reporting are available regardless of the adapter in use.
|
||||||
@ -1,4 +1,6 @@
|
|||||||
# Example configuration for BabyLIN hardware runs (SDK Python wrapper)
|
# DEPRECATED: example configuration for BabyLIN hardware runs (SDK Python wrapper).
|
||||||
|
# The BabyLIN adapter is kept for backward compatibility only. New environments
|
||||||
|
# should target MUM — see config/mum.example.yaml.
|
||||||
interface:
|
interface:
|
||||||
type: babylin
|
type: babylin
|
||||||
channel: 0 # Channel index (0-based) as used by the SDK
|
channel: 0 # Channel index (0-based) as used by the SDK
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# Examples: Mock-only and BabyLIN hardware configurations
|
# Examples: Mock-only and (DEPRECATED) BabyLIN hardware configurations.
|
||||||
|
# For current MUM-based hardware setups, see config/mum.example.yaml.
|
||||||
#
|
#
|
||||||
# How to use (Windows PowerShell):
|
# How to use (Windows PowerShell):
|
||||||
# # Point the framework to a specific config file
|
# # Point the framework to a specific config file
|
||||||
@ -21,11 +22,13 @@ mock_profile:
|
|||||||
enabled: false
|
enabled: false
|
||||||
hex_path:
|
hex_path:
|
||||||
|
|
||||||
# --- BABYLIN PROFILE --------------------------------------------------------
|
# --- BABYLIN PROFILE (DEPRECATED) -------------------------------------------
|
||||||
|
# Retained for backward compatibility with existing BabyLIN rigs only. New
|
||||||
|
# setups should use config/mum.example.yaml.
|
||||||
# Requires: vendor/BabyLIN_library.py and platform libraries placed per vendor/README.md
|
# Requires: vendor/BabyLIN_library.py and platform libraries placed per vendor/README.md
|
||||||
babylin_profile:
|
babylin_profile:
|
||||||
interface:
|
interface:
|
||||||
type: babylin
|
type: babylin # deprecated
|
||||||
channel: 0 # SDK channel index (0-based)
|
channel: 0 # SDK channel index (0-based)
|
||||||
bitrate: 19200 # Informational; SDF usually defines effective timing
|
bitrate: 19200 # Informational; SDF usually defines effective timing
|
||||||
node_name: ECU_TEST_NODE # Optional label
|
node_name: ECU_TEST_NODE # Optional label
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
interface:
|
interface:
|
||||||
# MUM (Melexis Universal Master) is the current default. Switch type to
|
# MUM (Melexis Universal Master) is the current default. Switch type to
|
||||||
# 'babylin' for the legacy SDK flow, or 'mock' for hardware-free runs.
|
# 'mock' for hardware-free runs, or to 'babylin' for the DEPRECATED legacy
|
||||||
|
# SDK flow (kept only so existing BabyLIN rigs can keep running).
|
||||||
type: mum
|
type: mum
|
||||||
host: 192.168.7.2 # MUM IP (USB-RNDIS default)
|
host: 192.168.7.2 # MUM IP (USB-RNDIS default)
|
||||||
lin_device: lin0 # MUM LIN device name
|
lin_device: lin0 # MUM LIN device name
|
||||||
@ -14,7 +15,7 @@ interface:
|
|||||||
ldf_path: ./vendor/4SEVEN_color_lib_test.ldf
|
ldf_path: ./vendor/4SEVEN_color_lib_test.ldf
|
||||||
frame_lengths: {} # leave empty unless you need a non-LDF override
|
frame_lengths: {} # leave empty unless you need a non-LDF override
|
||||||
|
|
||||||
# --- BabyLIN (legacy) settings, used only when type: babylin ---
|
# --- BabyLIN (DEPRECATED) settings, used only when type: babylin ---
|
||||||
channel: 0
|
channel: 0
|
||||||
node_name: ECU_TEST_NODE
|
node_name: ECU_TEST_NODE
|
||||||
sdf_path: .\vendor\4SEVEN_color_lib_test.sdf
|
sdf_path: .\vendor\4SEVEN_color_lib_test.sdf
|
||||||
|
|||||||
@ -9,7 +9,7 @@ This document walks through the exact order of operations when you run the frame
|
|||||||
3. Test discovery collects tests under `tests/`
|
3. Test discovery collects tests under `tests/`
|
||||||
4. Session fixtures run:
|
4. Session fixtures run:
|
||||||
- `config()` loads YAML configuration
|
- `config()` loads YAML configuration
|
||||||
- `lin()` selects and connects the LIN interface (Mock, MUM, or legacy BabyLIN)
|
- `lin()` selects and connects the LIN interface (Mock, MUM, or the deprecated BabyLIN)
|
||||||
- `flash_ecu()` optionally flashes the ECU (if enabled)
|
- `flash_ecu()` optionally flashes the ECU (if enabled)
|
||||||
5. Tests execute using fixtures and call interface methods
|
5. Tests execute using fixtures and call interface methods
|
||||||
6. Our plugin extracts test metadata (Title, Requirements, Steps) from docstrings
|
6. Our plugin extracts test metadata (Title, Requirements, Steps) from docstrings
|
||||||
@ -78,7 +78,7 @@ Session fixture: lin(config)
|
|||||||
→ chooses interface by config.interface.type
|
→ chooses interface by config.interface.type
|
||||||
- mock → ecu_framework.lin.mock.MockBabyLinInterface(...)
|
- mock → ecu_framework.lin.mock.MockBabyLinInterface(...)
|
||||||
- mum → ecu_framework.lin.mum.MumLinInterface(host, lin_device, power_device, ...)
|
- mum → ecu_framework.lin.mum.MumLinInterface(host, lin_device, power_device, ...)
|
||||||
- babylin → ecu_framework.lin.babylin.BabyLinInterface(...) [legacy]
|
- babylin → ecu_framework.lin.babylin.BabyLinInterface(...) [DEPRECATED]
|
||||||
→ lin.connect()
|
→ lin.connect()
|
||||||
- MUM connect() also powers up the ECU via power_out0 and waits boot_settle_seconds
|
- MUM connect() also powers up the ECU via power_out0 and waits boot_settle_seconds
|
||||||
↓
|
↓
|
||||||
@ -104,7 +104,7 @@ Reports written
|
|||||||
- pytest configuration: `pytest.ini`
|
- pytest configuration: `pytest.ini`
|
||||||
- YAML config (default): `config/test_config.yaml`
|
- YAML config (default): `config/test_config.yaml`
|
||||||
- YAML override via env var: `ECU_TESTS_CONFIG`
|
- YAML override via env var: `ECU_TESTS_CONFIG`
|
||||||
- BabyLIN SDK wrapper and SDF path: `interface.sdf_path` and `interface.schedule_nr` in YAML
|
- BabyLIN SDK wrapper and SDF path (DEPRECATED): `interface.sdf_path` and `interface.schedule_nr` in YAML
|
||||||
- Test metadata: parsed from each test’s docstring
|
- Test metadata: parsed from each test’s docstring
|
||||||
- Markers: declared in `pytest.ini`, attached in tests via `@pytest.mark.*`
|
- Markers: declared in `pytest.ini`, attached in tests via `@pytest.mark.*`
|
||||||
|
|
||||||
@ -115,13 +115,13 @@ Reports written
|
|||||||
- `ecu_framework/lin/base.py`: abstract LIN interface contract and frame shape
|
- `ecu_framework/lin/base.py`: abstract LIN interface contract and frame shape
|
||||||
- `ecu_framework/lin/mock.py`: mock behavior for send/receive/request
|
- `ecu_framework/lin/mock.py`: mock behavior for send/receive/request
|
||||||
- `ecu_framework/lin/mum.py`: MUM adapter (Melexis Universal Master via pylin + pymumclient)
|
- `ecu_framework/lin/mum.py`: MUM adapter (Melexis Universal Master via pylin + pymumclient)
|
||||||
- `ecu_framework/lin/babylin.py`: BabyLIN SDK wrapper adapter (legacy real hardware via BabyLIN_library.py)
|
- `ecu_framework/lin/babylin.py`: BabyLIN SDK wrapper adapter (DEPRECATED real hardware path via BabyLIN_library.py; emits `DeprecationWarning` on use)
|
||||||
- `ecu_framework/flashing/hex_flasher.py`: placeholder flashing logic
|
- `ecu_framework/flashing/hex_flasher.py`: placeholder flashing logic
|
||||||
- `conftest_plugin.py`: report customization and metadata extraction
|
- `conftest_plugin.py`: report customization and metadata extraction
|
||||||
|
|
||||||
## Edge cases and behavior
|
## Edge cases and behavior
|
||||||
|
|
||||||
- If `interface.type` is `babylin` but the SDK wrapper or libraries cannot be loaded, hardware tests are skipped
|
- If `interface.type` is `babylin` (deprecated) but the SDK wrapper or libraries cannot be loaded, hardware tests are skipped
|
||||||
- If `interface.type` is `mum` but `pylin` / `pymumclient` aren't importable, or `interface.host` is unset, hardware tests are skipped with a clear message
|
- If `interface.type` is `mum` but `pylin` / `pymumclient` aren't importable, or `interface.host` is unset, hardware tests are skipped with a clear message
|
||||||
- If `flash.enabled` is true but `hex_path` is missing, flashing fixture skips
|
- If `flash.enabled` is true but `hex_path` is missing, flashing fixture skips
|
||||||
- Timeouts are honored in `receive()` and `request()` implementations
|
- Timeouts are honored in `receive()` and `request()` implementations
|
||||||
|
|||||||
@ -15,13 +15,13 @@ From highest to lowest precedence:
|
|||||||
|
|
||||||
- `EcuTestConfig`
|
- `EcuTestConfig`
|
||||||
- `interface: InterfaceConfig`
|
- `interface: InterfaceConfig`
|
||||||
- `type`: `mock`, `mum`, or `babylin`
|
- `type`: `mock`, `mum`, or `babylin` (deprecated)
|
||||||
- `channel`: LIN channel index (0-based in SDK wrapper) — BabyLIN-specific
|
- `channel`: LIN channel index (0-based in SDK wrapper) — BabyLIN-specific (deprecated)
|
||||||
- `bitrate`: LIN baudrate (e.g., 19200). The MUM uses this directly; BabyLIN typically takes it from the SDF
|
- `bitrate`: LIN baudrate (e.g., 19200). The MUM uses this directly; BabyLIN typically takes it from the SDF (deprecated path)
|
||||||
- `sdf_path`: Path to SDF file (BabyLIN; required for typical operation)
|
- `sdf_path`: Path to SDF file (BabyLIN; deprecated — required for typical BabyLIN operation)
|
||||||
- `schedule_nr`: Schedule number to start on connect (BabyLIN). `-1` = skip
|
- `schedule_nr`: Schedule number to start on connect (BabyLIN; deprecated). `-1` = skip
|
||||||
- `node_name`: Optional node identifier (informational)
|
- `node_name`: Optional node identifier (informational)
|
||||||
- `dll_path`, `func_names`: Legacy fields from the old ctypes adapter; not used with the SDK wrapper
|
- `dll_path`, `func_names`: Deprecated legacy fields from the old ctypes adapter; not used with the SDK wrapper
|
||||||
- `host`: MUM IP address (MUM-only). Required when `type: mum`
|
- `host`: MUM IP address (MUM-only). Required when `type: mum`
|
||||||
- `lin_device`: MUM LIN device name (MUM-only, default `lin0`)
|
- `lin_device`: MUM LIN device name (MUM-only, default `lin0`)
|
||||||
- `power_device`: MUM power-control device (MUM-only, default `power_out0`)
|
- `power_device`: MUM power-control device (MUM-only, default `power_out0`)
|
||||||
@ -71,11 +71,11 @@ flash:
|
|||||||
enabled: false
|
enabled: false
|
||||||
```
|
```
|
||||||
|
|
||||||
Hardware (BabyLIN SDK wrapper) configuration:
|
Hardware (BabyLIN SDK wrapper) configuration — DEPRECATED, prefer the MUM example above:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
interface:
|
interface:
|
||||||
type: babylin
|
type: babylin # deprecated
|
||||||
channel: 0 # 0-based channel index
|
channel: 0 # 0-based channel index
|
||||||
bitrate: 19200 # optional; typically driven by SDF
|
bitrate: 19200 # optional; typically driven by SDF
|
||||||
node_name: "ECU_TEST_NODE"
|
node_name: "ECU_TEST_NODE"
|
||||||
@ -128,10 +128,10 @@ central defaults in `config/test_config.yaml`.
|
|||||||
|
|
||||||
## How tests and adapters consume config
|
## How tests and adapters consume config
|
||||||
|
|
||||||
- `lin` fixture picks `mock`, `mum`, or `babylin` based on `interface.type`
|
- `lin` fixture picks `mock`, `mum`, or `babylin` (deprecated) based on `interface.type`
|
||||||
- Mock adapter uses `bitrate` and `channel` to simulate timing/behavior
|
- Mock adapter uses `bitrate` and `channel` to simulate timing/behavior
|
||||||
- MUM adapter uses `host`, `lin_device`, `power_device`, `bitrate`, `boot_settle_seconds`, and `frame_lengths` to open the MUM, set up the LIN bus, and power up the ECU on connect
|
- MUM adapter uses `host`, `lin_device`, `power_device`, `bitrate`, `boot_settle_seconds`, and `frame_lengths` to open the MUM, set up the LIN bus, and power up the ECU on connect
|
||||||
- BabyLIN adapter (SDK wrapper) uses `sdf_path`, `schedule_nr`, `channel` to open the device, load the SDF, and start a schedule. `bitrate` is informational unless explicitly applied via commands/SDF
|
- BabyLIN adapter (SDK wrapper, **DEPRECATED**) uses `sdf_path`, `schedule_nr`, `channel` to open the device, load the SDF, and start a schedule. `bitrate` is informational unless explicitly applied via commands/SDF. Selecting `interface.type: babylin` emits a `DeprecationWarning`.
|
||||||
- `flash_ecu` uses `flash.enabled` and `flash.hex_path`
|
- `flash_ecu` uses `flash.enabled` and `flash.hex_path`
|
||||||
- PSU-related tests or utilities read `config.power_supply` for serial parameters
|
- PSU-related tests or utilities read `config.power_supply` for serial parameters
|
||||||
and optional actions (IDN assertions, on/off toggle, set/measure). The reference
|
and optional actions (IDN assertions, on/off toggle, set/measure). The reference
|
||||||
@ -142,7 +142,7 @@ central defaults in `config/test_config.yaml`.
|
|||||||
|
|
||||||
- Keep multiple YAMLs and switch via `ECU_TESTS_CONFIG`
|
- Keep multiple YAMLs and switch via `ECU_TESTS_CONFIG`
|
||||||
- Check path validity for `sdf_path` and `hex_path` before running hardware tests
|
- Check path validity for `sdf_path` and `hex_path` before running hardware tests
|
||||||
- Ensure `vendor/BabyLIN_library.py` and the platform-specific libraries from the SDK are available on `PYTHONPATH`
|
- For the deprecated BabyLIN path only: ensure `vendor/BabyLIN_library.py` and the platform-specific libraries from the SDK are available on `PYTHONPATH`
|
||||||
- Use environment-specific YAML files for labs vs. CI
|
- Use environment-specific YAML files for labs vs. CI
|
||||||
- For PSU, prefer `OWON_PSU_CONFIG` or `config/owon_psu.yaml` to avoid committing
|
- For PSU, prefer `OWON_PSU_CONFIG` or `config/owon_psu.yaml` to avoid committing
|
||||||
local COM port settings. Central defaults can live in `config/test_config.yaml`.
|
local COM port settings. Central defaults can live in `config/test_config.yaml`.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# LIN Interface Call Flow
|
# LIN Interface Call Flow
|
||||||
|
|
||||||
This document explains how LIN operations flow through the abstraction for the Mock, MUM, and legacy BabyLIN adapters.
|
This document explains how LIN operations flow through the abstraction for the Mock, MUM, and the deprecated BabyLIN adapters.
|
||||||
|
|
||||||
## Contract (base)
|
## Contract (base)
|
||||||
|
|
||||||
@ -61,9 +61,11 @@ Configuration:
|
|||||||
- `interface.bitrate` is the actual LIN baudrate the MUM drives
|
- `interface.bitrate` is the actual LIN baudrate the MUM drives
|
||||||
- `interface.frame_lengths` lets you map slave frame IDs to their fixed data lengths so `receive(id)` can fetch the correct number of bytes; built-in defaults cover ALM_Status (4) and ALM_Req_A (8)
|
- `interface.frame_lengths` lets you map slave frame IDs to their fixed data lengths so `receive(id)` can fetch the correct number of bytes; built-in defaults cover ALM_Status (4) and ALM_Req_A (8)
|
||||||
|
|
||||||
## BabyLIN adapter flow (SDK wrapper)
|
## BabyLIN adapter flow (SDK wrapper) — DEPRECATED
|
||||||
|
|
||||||
File: `ecu_framework/lin/babylin.py`
|
> Retained only so existing BabyLIN rigs can keep running. New work should use the MUM flow above.
|
||||||
|
|
||||||
|
File: `ecu_framework/lin/babylin.py` (emits `DeprecationWarning` on instantiation)
|
||||||
|
|
||||||
- `connect()`: import SDK `BabyLIN_library.py`, discover ports, open first, optionally `BLC_loadSDF`, get channel handle, and `BLC_sendCommand("start schedule N;")`
|
- `connect()`: import SDK `BabyLIN_library.py`, discover ports, open first, optionally `BLC_loadSDF`, get channel handle, and `BLC_sendCommand("start schedule N;")`
|
||||||
- `send(frame)`: calls `BLC_mon_set_xmit(channelHandle, frameId, data, slotTime=0)`
|
- `send(frame)`: calls `BLC_mon_set_xmit(channelHandle, frameId, data, slotTime=0)`
|
||||||
|
|||||||
@ -10,7 +10,7 @@ This document provides a high-level view of the framework’s components and how
|
|||||||
- LIN Abstraction — `ecu_framework/lin/base.py` (`LinInterface`, `LinFrame`)
|
- LIN Abstraction — `ecu_framework/lin/base.py` (`LinInterface`, `LinFrame`)
|
||||||
- Mock LIN Adapter — `ecu_framework/lin/mock.py`
|
- Mock LIN Adapter — `ecu_framework/lin/mock.py`
|
||||||
- MUM LIN Adapter — `ecu_framework/lin/mum.py` (Melexis Universal Master via `pylin` + `pymumclient`)
|
- MUM LIN Adapter — `ecu_framework/lin/mum.py` (Melexis Universal Master via `pylin` + `pymumclient`)
|
||||||
- BabyLIN Adapter — `ecu_framework/lin/babylin.py` (SDK wrapper → BabyLIN_library.py; legacy)
|
- BabyLIN Adapter — `ecu_framework/lin/babylin.py` (SDK wrapper → BabyLIN_library.py; **DEPRECATED**, kept for legacy rigs only)
|
||||||
- LDF Database — `ecu_framework/lin/ldf.py` (`LdfDatabase`/`Frame` over `ldfparser`; per-frame `pack`/`unpack`)
|
- LDF Database — `ecu_framework/lin/ldf.py` (`LdfDatabase`/`Frame` over `ldfparser`; per-frame `pack`/`unpack`)
|
||||||
- Flasher — `ecu_framework/flashing/hex_flasher.py`
|
- Flasher — `ecu_framework/flashing/hex_flasher.py`
|
||||||
- Power Supply (PSU) control — `ecu_framework/power/owon_psu.py` (serial SCPI)
|
- Power Supply (PSU) control — `ecu_framework/power/owon_psu.py` (serial SCPI)
|
||||||
@ -33,7 +33,7 @@ flowchart TB
|
|||||||
BASE[ecu_framework/lin/base.py]
|
BASE[ecu_framework/lin/base.py]
|
||||||
MOCK[ecu_framework/lin/mock.py]
|
MOCK[ecu_framework/lin/mock.py]
|
||||||
MUM[ecu_framework/lin/mum.py]
|
MUM[ecu_framework/lin/mum.py]
|
||||||
BABY[ecu_framework/lin/babylin.py]
|
BABY[ecu_framework/lin/babylin.py<br/>DEPRECATED]
|
||||||
LDF[ecu_framework/lin/ldf.py]
|
LDF[ecu_framework/lin/ldf.py]
|
||||||
FLASH[ecu_framework/flashing/hex_flasher.py]
|
FLASH[ecu_framework/flashing/hex_flasher.py]
|
||||||
POWER[ecu_framework/power/owon_psu.py]
|
POWER[ecu_framework/power/owon_psu.py]
|
||||||
@ -41,10 +41,10 @@ flowchart TB
|
|||||||
|
|
||||||
subgraph Artifacts
|
subgraph Artifacts
|
||||||
REP[reports/report.html<br/>reports/junit.xml]
|
REP[reports/report.html<br/>reports/junit.xml]
|
||||||
YAML[config/*.yaml<br/>test_config.yaml<br/>mum.example.yaml<br/>babylin.example.yaml]
|
YAML[config/*.yaml<br/>test_config.yaml<br/>mum.example.yaml<br/>babylin.example.yaml — deprecated]
|
||||||
PSU_YAML[config/owon_psu.yaml<br/>OWON_PSU_CONFIG]
|
PSU_YAML[config/owon_psu.yaml<br/>OWON_PSU_CONFIG]
|
||||||
MELEXIS[Melexis pylin + pymumclient<br/>MUM @ 192.168.7.2]
|
MELEXIS[Melexis pylin + pymumclient<br/>MUM @ 192.168.7.2]
|
||||||
SDK[vendor/BabyLIN_library.py<br/>platform-specific libs]
|
SDK[vendor/BabyLIN_library.py<br/>platform-specific libs<br/>DEPRECATED]
|
||||||
OWON[vendor/Owon/owon_psu_quick_demo.py]
|
OWON[vendor/Owon/owon_psu_quick_demo.py]
|
||||||
LDFFILE[vendor/*.ldf]
|
LDFFILE[vendor/*.ldf]
|
||||||
LDFLIB[ldfparser PyPI]
|
LDFLIB[ldfparser PyPI]
|
||||||
|
|||||||
@ -16,7 +16,7 @@ sequenceDiagram
|
|||||||
participant P as pytest
|
participant P as pytest
|
||||||
participant F as flash_ecu fixture
|
participant F as flash_ecu fixture
|
||||||
participant H as HexFlasher
|
participant H as HexFlasher
|
||||||
participant L as LinInterface (mock/mum/babylin)
|
participant L as LinInterface (mock/mum/babylin — babylin deprecated)
|
||||||
participant E as ECU
|
participant E as ECU
|
||||||
|
|
||||||
P->>F: Evaluate flashing precondition
|
P->>F: Evaluate flashing precondition
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
# BabyLIN Adapter Internals (SDK Python wrapper)
|
# BabyLIN Adapter Internals (SDK Python wrapper)
|
||||||
|
|
||||||
|
> **Status: DEPRECATED.** The BabyLIN adapter is retained for backward compatibility only. New tests and deployments should target the MUM (Melexis Universal Master) adapter — see `16_mum_internals.md`. This document is kept so existing BabyLIN setups can still be maintained.
|
||||||
|
|
||||||
This document describes how the real hardware adapter binds to the BabyLIN SDK via the official Python wrapper `BabyLIN_library.py` and how frames move across the boundary.
|
This document describes how the real hardware adapter binds to the BabyLIN SDK via the official Python wrapper `BabyLIN_library.py` and how frames move across the boundary.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
# Raspberry Pi Deployment Guide
|
# Raspberry Pi Deployment Guide
|
||||||
|
|
||||||
This guide explains how to run the ECU testing framework on a Raspberry Pi (Debian/Raspberry Pi OS). It covers environment setup, hardware integration via MUM (recommended) or BabyLin (legacy), running tests headless, and installing as a systemd service.
|
This guide explains how to run the ECU testing framework on a Raspberry Pi (Debian/Raspberry Pi OS). It covers environment setup, hardware integration via MUM (recommended) or the deprecated BabyLin (legacy rigs only), running tests headless, and installing as a systemd service.
|
||||||
|
|
||||||
> Note: The MUM (Melexis Universal Master) is **networked**, so the Pi only
|
> Note: The MUM (Melexis Universal Master) is **networked**, so the Pi only
|
||||||
> needs IP reachability to the MUM (default `192.168.7.2`) — there are no
|
> needs IP reachability to the MUM (default `192.168.7.2`) — there are no
|
||||||
> Pi-side native libs to worry about. BabyLin needs ARM Linux native
|
> Pi-side native libs to worry about. BabyLin (deprecated) needs ARM Linux
|
||||||
> libraries; if those aren't available, use Mock or MUM on the Pi instead.
|
> native libraries; if those aren't available, use Mock or MUM on the Pi
|
||||||
|
> instead. New deployments should not target BabyLin.
|
||||||
|
|
||||||
## 1) Choose your interface
|
## 1) Choose your interface
|
||||||
|
|
||||||
- **MUM (recommended for hardware on Pi)**: `interface.type: mum`. Requires Melexis `pylin` + `pymumclient` (see `vendor/automated_lin_test/install_packages.sh`) and IP reachability to the MUM device.
|
- **MUM (recommended for hardware on Pi)**: `interface.type: mum`. Requires Melexis `pylin` + `pymumclient` (see `vendor/automated_lin_test/install_packages.sh`) and IP reachability to the MUM device.
|
||||||
- Mock (recommended for headless/dev on Pi): `interface.type: mock`
|
- Mock (recommended for headless/dev on Pi): `interface.type: mock`
|
||||||
- BabyLIN (only if ARM/Linux support is available): `interface.type: babylin` and ensure the SDK's `BabyLIN_library.py` and corresponding Linux/ARM shared libraries are available under `vendor/` or on PYTHONPATH/LD_LIBRARY_PATH.
|
- BabyLIN (**DEPRECATED** — only for legacy rigs and only if ARM/Linux support is available): `interface.type: babylin` and ensure the SDK's `BabyLIN_library.py` and corresponding Linux/ARM shared libraries are available under `vendor/` or on PYTHONPATH/LD_LIBRARY_PATH. Selecting this path emits a `DeprecationWarning`.
|
||||||
|
|
||||||
## 2) Install prerequisites
|
## 2) Install prerequisites
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ sudo apt update
|
|||||||
sudo apt install -y python3 python3-venv python3-pip git
|
sudo apt install -y python3 python3-venv python3-pip git
|
||||||
```
|
```
|
||||||
|
|
||||||
Optional (for BabyLin or USB tools):
|
Optional (for the deprecated BabyLin path or USB tools):
|
||||||
```bash
|
```bash
|
||||||
sudo apt install -y libusb-1.0-0 udev
|
sudo apt install -y libusb-1.0-0 udev
|
||||||
```
|
```
|
||||||
@ -46,7 +47,7 @@ Create or edit `config/test_config.yaml`:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
interface:
|
interface:
|
||||||
type: mock # or babylin (if supported on ARM/Linux)
|
type: mock # or "mum" for hardware (current); "babylin" is deprecated
|
||||||
channel: 1
|
channel: 1
|
||||||
bitrate: 19200
|
bitrate: 19200
|
||||||
flash:
|
flash:
|
||||||
@ -79,11 +80,11 @@ Confirm reachability before running tests:
|
|||||||
ping -c 2 192.168.7.2
|
ping -c 2 192.168.7.2
|
||||||
```
|
```
|
||||||
|
|
||||||
If using BabyLIN on Linux/ARM with the SDK wrapper, set:
|
If using BabyLIN on Linux/ARM with the SDK wrapper (**DEPRECATED**, legacy rigs only), set:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
interface:
|
interface:
|
||||||
type: babylin
|
type: babylin # deprecated; prefer "mum"
|
||||||
channel: 0
|
channel: 0
|
||||||
sdf_path: "/home/pi/ecu_tests/vendor/Example.sdf"
|
sdf_path: "/home/pi/ecu_tests/vendor/Example.sdf"
|
||||||
schedule_nr: 0
|
schedule_nr: 0
|
||||||
@ -160,12 +161,12 @@ systemctl status ecu-tests.service
|
|||||||
- Create udev rules for your device (if required by vendor)
|
- Create udev rules for your device (if required by vendor)
|
||||||
- Add user to dialout or plugdev groups if serial/USB access is needed
|
- Add user to dialout or plugdev groups if serial/USB access is needed
|
||||||
- Confirm your hardware library is found by Python and the dynamic linker:
|
- Confirm your hardware library is found by Python and the dynamic linker:
|
||||||
- Ensure `vendor/BabyLIN_library.py` is importable (add `vendor/` to PYTHONPATH if needed)
|
- For the deprecated BabyLIN path only: ensure `vendor/BabyLIN_library.py` is importable (add `vendor/` to PYTHONPATH if needed)
|
||||||
- Ensure `.so` files are discoverable (e.g., place in `/usr/local/lib` and run `sudo ldconfig`, or set `LD_LIBRARY_PATH`)
|
- Ensure `.so` files are discoverable (e.g., place in `/usr/local/lib` and run `sudo ldconfig`, or set `LD_LIBRARY_PATH`)
|
||||||
|
|
||||||
## 8) Tips
|
## 8) Tips
|
||||||
|
|
||||||
- Use the mock interface on Pi for quick smoke tests and documentation/report generation
|
- Use the mock interface on Pi for quick smoke tests and documentation/report generation
|
||||||
- For full HIL on Pi, the **MUM is the easiest path** — it's IP-reachable so the Pi doesn't need vendor-specific native libraries, just the Melexis Python packages (`pylin`, `pymumclient`)
|
- For full HIL on Pi, the **MUM is the easiest path** — it's IP-reachable so the Pi doesn't need vendor-specific native libraries, just the Melexis Python packages (`pylin`, `pymumclient`)
|
||||||
- For BabyLIN HIL, ensure vendor SDK supports Linux/ARM and provide a shared object (`.so`) and headers
|
- For the deprecated BabyLIN HIL path, ensure vendor SDK supports Linux/ARM and provide a shared object (`.so`) and headers — but prefer migrating these rigs to MUM
|
||||||
- If only Windows is supported by your hardware path, run the hardware suite on a Windows host and use the Pi for lightweight tasks (archiving, reporting, quick checks)
|
- If only Windows is supported by your hardware path, run the hardware suite on a Windows host and use the Pi for lightweight tasks (archiving, reporting, quick checks)
|
||||||
|
|||||||
@ -6,9 +6,10 @@ This guide walks you through building your own Raspberry Pi OS image that alread
|
|||||||
> the recommended hardware path — it's IP-reachable so the Pi only needs the
|
> the recommended hardware path — it's IP-reachable so the Pi only needs the
|
||||||
> Melexis Python packages (`pylin`, `pymumclient`), no native libraries. Bake
|
> Melexis Python packages (`pylin`, `pymumclient`), no native libraries. Bake
|
||||||
> those into the image's site-packages from the Melexis IDE bundle. BabyLin
|
> those into the image's site-packages from the Melexis IDE bundle. BabyLin
|
||||||
> support on ARM/Linux depends on vendor SDKs; if no `.so` is provided for
|
> is **deprecated**; its support on ARM/Linux depends on vendor SDKs and is
|
||||||
> ARM, either use the Mock or MUM interface on the Pi, or keep BabyLIN
|
> kept only for legacy rigs. If no `.so` is provided for ARM, either use the
|
||||||
> hardware tests on Windows.
|
> Mock or MUM interface on the Pi, or keep deprecated BabyLIN hardware tests
|
||||||
|
> on Windows until you can migrate.
|
||||||
|
|
||||||
## Approach A: Using pi-gen (official)
|
## Approach A: Using pi-gen (official)
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ This guide walks you through building your own Raspberry Pi OS image that alread
|
|||||||
sudo install -Dm644 "$REPO_DIR/scripts/ecu-tests.timer" /etc/systemd/system/ecu-tests.timer
|
sudo install -Dm644 "$REPO_DIR/scripts/ecu-tests.timer" /etc/systemd/system/ecu-tests.timer
|
||||||
sudo systemctl enable ecu-tests.service
|
sudo systemctl enable ecu-tests.service
|
||||||
sudo systemctl enable ecu-tests.timer || true
|
sudo systemctl enable ecu-tests.timer || true
|
||||||
# Optional udev rules
|
# Optional udev rules (DEPRECATED: only needed for legacy BabyLIN hardware)
|
||||||
if [ -f "$REPO_DIR/scripts/99-babylin.rules" ]; then
|
if [ -f "$REPO_DIR/scripts/99-babylin.rules" ]; then
|
||||||
sudo install -Dm644 "$REPO_DIR/scripts/99-babylin.rules" /etc/udev/rules.d/99-babylin.rules
|
sudo install -Dm644 "$REPO_DIR/scripts/99-babylin.rules" /etc/udev/rules.d/99-babylin.rules
|
||||||
fi
|
fi
|
||||||
@ -71,7 +72,7 @@ This guide walks you through building your own Raspberry Pi OS image that alread
|
|||||||
|
|
||||||
## Hardware Notes
|
## Hardware Notes
|
||||||
|
|
||||||
- If using BabyLin, ensure: `.so` for ARM, udev rules, and any kernel modules.
|
- If using the deprecated BabyLin path (legacy rigs), ensure: `.so` for ARM, udev rules, and any kernel modules. New deployments should target MUM instead.
|
||||||
- Validate the SDK wrapper and libraries are present under `/opt/ecu_tests/vendor/` (or your chosen path). Ensure `.so` files are on the linker path (run `sudo ldconfig`) and `BabyLIN_library.py` is importable.
|
- Validate the SDK wrapper and libraries are present under `/opt/ecu_tests/vendor/` (or your chosen path). Ensure `.so` files are on the linker path (run `sudo ldconfig`) and `BabyLIN_library.py` is importable.
|
||||||
|
|
||||||
## Boot-time Behavior
|
## Boot-time Behavior
|
||||||
|
|||||||
@ -7,7 +7,7 @@ This guide shows common ways to run the test framework: from fast local mock run
|
|||||||
- Python 3.x and a virtual environment
|
- Python 3.x and a virtual environment
|
||||||
- Dependencies installed (see `requirements.txt`)
|
- Dependencies installed (see `requirements.txt`)
|
||||||
- For MUM hardware: Melexis `pylin` and `pymumclient` Python packages on `PYTHONPATH` (see `vendor/automated_lin_test/install_packages.sh`) plus a reachable MUM (default IP `192.168.7.2`)
|
- For MUM hardware: Melexis `pylin` and `pymumclient` Python packages on `PYTHONPATH` (see `vendor/automated_lin_test/install_packages.sh`) plus a reachable MUM (default IP `192.168.7.2`)
|
||||||
- For BabyLIN (legacy) hardware: SDK files placed under `vendor/` as described in `vendor/README.md`
|
- For BabyLIN (**DEPRECATED**, legacy rigs only) hardware: SDK files placed under `vendor/` as described in `vendor/README.md`
|
||||||
|
|
||||||
## Configuring tests
|
## Configuring tests
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ $env:ECU_TESTS_CONFIG = ".\config\mock.yml"
|
|||||||
# Use a hardware config with the MUM (current default)
|
# Use a hardware config with the MUM (current default)
|
||||||
$env:ECU_TESTS_CONFIG = ".\config\mum.example.yaml"
|
$env:ECU_TESTS_CONFIG = ".\config\mum.example.yaml"
|
||||||
|
|
||||||
# Use a hardware config with the BabyLIN SDK wrapper (legacy)
|
# Use a hardware config with the BabyLIN SDK wrapper (DEPRECATED, legacy rigs only)
|
||||||
$env:ECU_TESTS_CONFIG = ".\config\babylin.example.yaml"
|
$env:ECU_TESTS_CONFIG = ".\config\babylin.example.yaml"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -34,8 +34,8 @@ Quick try with provided examples:
|
|||||||
$env:ECU_TESTS_CONFIG = ".\config\examples.yaml"
|
$env:ECU_TESTS_CONFIG = ".\config\examples.yaml"
|
||||||
# The 'active' section defaults to the mock profile; run non-hardware tests
|
# The 'active' section defaults to the mock profile; run non-hardware tests
|
||||||
pytest -m "not hardware" -v
|
pytest -m "not hardware" -v
|
||||||
# Edit 'active' to the mum or babylin profile (or point to mum.example.yaml /
|
# Edit 'active' to the mum (preferred) or babylin (deprecated) profile, or
|
||||||
# babylin.example.yaml) and run hardware tests
|
# point to mum.example.yaml / babylin.example.yaml, and run hardware tests
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running locally (mock interface)
|
## Running locally (mock interface)
|
||||||
@ -84,7 +84,9 @@ Tips:
|
|||||||
- The MUM is master-driven: `lin.receive(id)` requires a frame ID. The default `frame_lengths` covers ALM_Status (4 B) and ALM_Req_A (8 B); add others in YAML when you need slave-published frames at non-standard lengths.
|
- The MUM is master-driven: `lin.receive(id)` requires a frame ID. The default `frame_lengths` covers ALM_Status (4 B) and ALM_Req_A (8 B); add others in YAML when you need slave-published frames at non-standard lengths.
|
||||||
- For BSM-SNPD diagnostic frames (service ID 0xB5), use `lin.send_raw(bytes)` — it routes through the transport layer's `ld_put_raw`, which uses LIN 1.x **Classic** checksum. `send()` uses Enhanced and the firmware will reject these frames.
|
- For BSM-SNPD diagnostic frames (service ID 0xB5), use `lin.send_raw(bytes)` — it routes through the transport layer's `ld_put_raw`, which uses LIN 1.x **Classic** checksum. `send()` uses Enhanced and the firmware will reject these frames.
|
||||||
|
|
||||||
## Running on hardware (BabyLIN SDK wrapper — legacy)
|
## Running on hardware (BabyLIN SDK wrapper — DEPRECATED)
|
||||||
|
|
||||||
|
> Retained only so existing BabyLIN rigs can keep running. New work should use the MUM section above. Selecting `interface.type: babylin` emits a `DeprecationWarning`.
|
||||||
|
|
||||||
1) Place SDK files per `vendor/README.md`.
|
1) Place SDK files per `vendor/README.md`.
|
||||||
2) Select a config that defines `interface.type: babylin`, `sdf_path`, and `schedule_nr`.
|
2) Select a config that defines `interface.type: babylin`, `sdf_path`, and `schedule_nr`.
|
||||||
@ -113,7 +115,7 @@ Markers in use:
|
|||||||
- `smoke`: quick confidence tests
|
- `smoke`: quick confidence tests
|
||||||
- `hardware`: needs real device (any LIN master)
|
- `hardware`: needs real device (any LIN master)
|
||||||
- `mum`: targets the Melexis Universal Master adapter (current default)
|
- `mum`: targets the Melexis Universal Master adapter (current default)
|
||||||
- `babylin`: targets the legacy BabyLIN SDK adapter
|
- `babylin`: targets the **deprecated** BabyLIN SDK adapter
|
||||||
- `unit`: pure unit tests (no hardware, no external I/O)
|
- `unit`: pure unit tests (no hardware, no external I/O)
|
||||||
- `req_XXX`: requirement mapping (e.g., `@pytest.mark.req_001`)
|
- `req_XXX`: requirement mapping (e.g., `@pytest.mark.req_001`)
|
||||||
|
|
||||||
@ -193,15 +195,15 @@ pytest -m smoke --maxfail=1 -q
|
|||||||
Running tests headless via systemd typically involves:
|
Running tests headless via systemd typically involves:
|
||||||
|
|
||||||
- A service that sets `ECU_TESTS_CONFIG` to a hardware YAML
|
- A service that sets `ECU_TESTS_CONFIG` to a hardware YAML
|
||||||
- Running `pytest -m "hardware and mum"` (or `"hardware and babylin"`) on boot or via timer
|
- Running `pytest -m "hardware and mum"` (or, for legacy rigs only, `"hardware and babylin"` — deprecated) on boot or via timer
|
||||||
|
|
||||||
## Troubleshooting quick hits
|
## Troubleshooting quick hits
|
||||||
|
|
||||||
- ImportError for `pylin` / `pymumclient`: install Melexis packages (`vendor/automated_lin_test/install_packages.sh`); the MUM adapter raises a clear error pointing at this script.
|
- ImportError for `pylin` / `pymumclient`: install Melexis packages (`vendor/automated_lin_test/install_packages.sh`); the MUM adapter raises a clear error pointing at this script.
|
||||||
- "interface.host is required when interface.type == 'mum'": set `interface.host` in YAML.
|
- "interface.host is required when interface.type == 'mum'": set `interface.host` in YAML.
|
||||||
- MUM unreachable: `ping 192.168.7.2`; check the USB-RNDIS link.
|
- MUM unreachable: `ping 192.168.7.2`; check the USB-RNDIS link.
|
||||||
- ImportError for `BabyLIN_library`: verify placement under `vendor/` and native library presence.
|
- ImportError for `BabyLIN_library` (DEPRECATED path): verify placement under `vendor/` and native library presence. Consider migrating the rig to MUM, which avoids vendor DLLs.
|
||||||
- No BabyLIN devices found: check USB connection, drivers, and permissions.
|
- No BabyLIN devices found (DEPRECATED): check USB connection, drivers, and permissions.
|
||||||
- Timeouts on receive: increase `timeout` or verify schedule activity and SDF correctness.
|
- Timeouts on receive: increase `timeout` or verify schedule activity and SDF correctness.
|
||||||
- Missing reports: ensure `pytest.ini` includes the HTML/JUnit plugins and the custom plugin is loaded.
|
- Missing reports: ensure `pytest.ini` includes the HTML/JUnit plugins and the custom plugin is loaded.
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ This guide explains how the project's unit tests are organized, how to run them
|
|||||||
- `tests/unit/` — pure unit tests (no hardware, no external I/O)
|
- `tests/unit/` — pure unit tests (no hardware, no external I/O)
|
||||||
- `test_config_loader.py` — config precedence and defaults
|
- `test_config_loader.py` — config precedence and defaults
|
||||||
- `test_linframe.py` — `LinFrame` validation
|
- `test_linframe.py` — `LinFrame` validation
|
||||||
- `test_babylin_adapter_mocked.py` — BabyLIN adapter error paths with a mocked SDK wrapper
|
- `test_babylin_adapter_mocked.py` — DEPRECATED BabyLIN adapter error paths with a mocked SDK wrapper
|
||||||
- `test_mum_adapter_mocked.py` — MUM adapter (`MumLinInterface`) plumbing exercised through fake `pylin` / `pymumclient` modules
|
- `test_mum_adapter_mocked.py` — MUM adapter (`MumLinInterface`) plumbing exercised through fake `pylin` / `pymumclient` modules
|
||||||
- `test_hex_flasher.py` — flashing scaffold against a stub LIN interface
|
- `test_hex_flasher.py` — flashing scaffold against a stub LIN interface
|
||||||
- `tests/plugin/` — plugin self-tests using `pytester`
|
- `tests/plugin/` — plugin self-tests using `pytester`
|
||||||
@ -59,10 +59,10 @@ pytest -q -o addopts=""
|
|||||||
## Writing unit tests
|
## Writing unit tests
|
||||||
|
|
||||||
- Prefer small, focused tests
|
- Prefer small, focused tests
|
||||||
- For BabyLIN adapter logic, inject `wrapper_module` with the mock:
|
- For the **deprecated** BabyLIN adapter logic, inject `wrapper_module` with the mock (kept for legacy coverage; new tests should target MUM):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from ecu_framework.lin.babylin import BabyLinInterface
|
from ecu_framework.lin.babylin import BabyLinInterface # DeprecationWarning on use
|
||||||
from vendor import mock_babylin_wrapper as mock_bl
|
from vendor import mock_babylin_wrapper as mock_bl
|
||||||
|
|
||||||
lin = BabyLinInterface(wrapper_module=mock_bl)
|
lin = BabyLinInterface(wrapper_module=mock_bl)
|
||||||
@ -84,7 +84,7 @@ lin.connect()
|
|||||||
# exercise send / receive / send_raw / power_*
|
# exercise send / receive / send_raw / power_*
|
||||||
```
|
```
|
||||||
|
|
||||||
- To simulate specific SDK signatures, use a thin shim (see `_MockBytesOnly` in `tests/test_babylin_wrapper_mock.py`).
|
- To simulate specific (deprecated) SDK signatures, use a thin shim (see `_MockBytesOnly` in `tests/test_babylin_wrapper_mock.py`).
|
||||||
- Include a docstring with Title/Description/Requirements/Steps/Expected Result so the reporting plugin can extract metadata (this also helps the HTML report).
|
- Include a docstring with Title/Description/Requirements/Steps/Expected Result so the reporting plugin can extract metadata (this also helps the HTML report).
|
||||||
- When testing the plugin itself, use the `pytester` fixture to generate a temporary test run and validate artifacts exist and contain expected entries.
|
- When testing the plugin itself, use the `pytester` fixture to generate a temporary test run and validate artifacts exist and contain expected entries.
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ start .\reports\report.html
|
|||||||
|
|
||||||
- Run `-m unit` and `tests/plugin` on every PR
|
- Run `-m unit` and `tests/plugin` on every PR
|
||||||
- Optionally run mock integration/smoke on PR
|
- Optionally run mock integration/smoke on PR
|
||||||
- Run hardware test matrix on a nightly or on-demand basis (`-m "hardware and mum"` or `-m "hardware and babylin"`)
|
- Run hardware test matrix on a nightly or on-demand basis (`-m "hardware and mum"`; `-m "hardware and babylin"` is deprecated and only for legacy rigs)
|
||||||
- Publish artifacts from `reports/`: HTML/JUnit/coverage JSON/summary MD
|
- Publish artifacts from `reports/`: HTML/JUnit/coverage JSON/summary MD
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|||||||
@ -7,7 +7,7 @@ This guide covers using the Owon bench power supply via SCPI over serial with th
|
|||||||
> `connect()` / `disconnect()` automatically. The Owon PSU is **not required**
|
> `connect()` / `disconnect()` automatically. The Owon PSU is **not required**
|
||||||
> for the standard MUM flow — leave `power_supply.enabled: false`. The Owon
|
> for the standard MUM flow — leave `power_supply.enabled: false`. The Owon
|
||||||
> remains useful for over/under-voltage scenarios, separate-rail tests, or
|
> remains useful for over/under-voltage scenarios, separate-rail tests, or
|
||||||
> when running with the legacy BabyLIN adapter (which has no built-in power).
|
> when running with the deprecated BabyLIN adapter (which has no built-in power).
|
||||||
|
|
||||||
- Library: `ecu_framework/power/owon_psu.py`
|
- Library: `ecu_framework/power/owon_psu.py`
|
||||||
- Hardware test: `tests/hardware/test_owon_psu.py`
|
- Hardware test: `tests/hardware/test_owon_psu.py`
|
||||||
|
|||||||
@ -9,7 +9,7 @@ This keeps reports consistent and easy to scan across suites.
|
|||||||
- config_source: defaults | file | env | env+overrides (already used in unit tests)
|
- config_source: defaults | file | env | env+overrides (already used in unit tests)
|
||||||
|
|
||||||
## LIN (common)
|
## LIN (common)
|
||||||
- lin_type: mock | babylin
|
- lin_type: mock | mum | babylin (babylin is deprecated)
|
||||||
- tx_id: hex string or int (e.g., "0x12")
|
- tx_id: hex string or int (e.g., "0x12")
|
||||||
- tx_data: list of ints (bytes)
|
- tx_data: list of ints (bytes)
|
||||||
- rx_present: bool
|
- rx_present: bool
|
||||||
@ -17,7 +17,7 @@ This keeps reports consistent and easy to scan across suites.
|
|||||||
- rx_data: list of ints
|
- rx_data: list of ints
|
||||||
- timeout_s: float seconds
|
- timeout_s: float seconds
|
||||||
|
|
||||||
## BabyLIN specifics
|
## BabyLIN specifics (DEPRECATED)
|
||||||
- sdf_path: string
|
- sdf_path: string
|
||||||
- schedule_nr: int
|
- schedule_nr: int
|
||||||
- receive_result: frame | timeout
|
- receive_result: frame | timeout
|
||||||
@ -42,7 +42,7 @@ This keeps reports consistent and easy to scan across suites.
|
|||||||
- flash_result: ok | fail (for future real flashing)
|
- flash_result: ok | fail (for future real flashing)
|
||||||
|
|
||||||
## Configuration highlights
|
## Configuration highlights
|
||||||
- interface_type: mock | babylin
|
- interface_type: mock | mum | babylin (babylin is deprecated)
|
||||||
- interface_channel: int
|
- interface_channel: int
|
||||||
- flash_enabled: bool
|
- flash_enabled: bool
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Generated by hand from the source files; rerun
|
|||||||
| Mock-loopback smoke | 2 | 6 | none |
|
| Mock-loopback smoke | 2 | 6 | none |
|
||||||
| Plugin self-test | 1 | 1 | none |
|
| Plugin self-test | 1 | 1 | none |
|
||||||
| Hardware – MUM | 4 | 12 | MUM + ECU |
|
| Hardware – MUM | 4 | 12 | MUM + ECU |
|
||||||
| Hardware – BabyLIN (legacy) | 4 | 4 | BabyLIN + ECU + Owon PSU |
|
| Hardware – BabyLIN (DEPRECATED) | 4 | 4 | BabyLIN + ECU + Owon PSU |
|
||||||
| Hardware – Owon PSU | 1 | 1 | Owon PSU |
|
| Hardware – Owon PSU | 1 | 1 | Owon PSU |
|
||||||
| **Total** | **18** | **52** | mixed |
|
| **Total** | **18** | **52** | mixed |
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ The numbers count the cases pytest reports when collecting. Some tests are
|
|||||||
pytest -m "unit" # pure unit tests
|
pytest -m "unit" # pure unit tests
|
||||||
pytest -m "not hardware" # everything except hardware (≈ 35 cases)
|
pytest -m "not hardware" # everything except hardware (≈ 35 cases)
|
||||||
pytest -m "hardware and mum" # MUM-only hardware tests
|
pytest -m "hardware and mum" # MUM-only hardware tests
|
||||||
pytest -m "hardware and babylin" # legacy BabyLIN hardware tests
|
pytest -m "hardware and babylin" # DEPRECATED BabyLIN hardware tests (legacy rigs only)
|
||||||
pytest -m "hardware and not slow" # hardware excluding the slow auto-addressing test
|
pytest -m "hardware and not slow" # hardware excluding the slow auto-addressing test
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -232,17 +232,19 @@ Source: [tests/hardware/test_mum_auto_addressing.py](tests/hardware/test_mum_aut
|
|||||||
- Marked `slow` because the full sequence runs in ~3-4 seconds (two BSM cycles plus settle). Skip with `-m "hardware and mum and not slow"`.
|
- Marked `slow` because the full sequence runs in ~3-4 seconds (two BSM cycles plus settle). Skip with `-m "hardware and mum and not slow"`.
|
||||||
- Restore is best-effort: if the second BSM cycle fails, the bench stays at the target NAD. The restore failure is visible as `restore_warning` / `restore_error` in the report properties.
|
- Restore is best-effort: if the second BSM cycle fails, the bench stays at the target NAD. The restore failure is visible as `restore_warning` / `restore_error` in the report properties.
|
||||||
|
|
||||||
### 4.4 `test_e2e_power_on_lin_smoke.py` *(legacy, BabyLIN-marked)*
|
### 4.4 `test_e2e_power_on_lin_smoke.py` *(DEPRECATED, BabyLIN-marked)*
|
||||||
|
|
||||||
Source: [tests/hardware/test_e2e_power_on_lin_smoke.py](tests/hardware/test_e2e_power_on_lin_smoke.py)
|
Source: [tests/hardware/test_e2e_power_on_lin_smoke.py](tests/hardware/test_e2e_power_on_lin_smoke.py)
|
||||||
|
|
||||||
Despite living in `tests/hardware/`, this file targets the **BabyLIN** adapter (it predates the MUM migration). See section 5.4.
|
Despite living in `tests/hardware/`, this file targets the **deprecated BabyLIN** adapter (it predates the MUM migration). See section 5.4.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 5. Hardware – BabyLIN (legacy)
|
## 5. Hardware – BabyLIN (DEPRECATED)
|
||||||
|
|
||||||
Tests gated on `interface.type == "babylin"`. Require:
|
> Retained only so existing BabyLIN rigs can keep running. New work should add tests under section 4 (Hardware – MUM).
|
||||||
|
|
||||||
|
Tests gated on `interface.type == "babylin"` (deprecated). Require:
|
||||||
|
|
||||||
- BabyLIN device + native libraries placed under `vendor/`
|
- BabyLIN device + native libraries placed under `vendor/`
|
||||||
- An SDF compiled from your LDF, path supplied via `interface.sdf_path`
|
- An SDF compiled from your LDF, path supplied via `interface.sdf_path`
|
||||||
@ -310,7 +312,7 @@ When adding new tests, follow these patterns so the catalog stays scannable:
|
|||||||
|
|
||||||
- **Unit tests** live in `tests/unit/` and carry `@pytest.mark.unit`. Filename starts with `test_<thing>_<scope>` (e.g., `test_mum_adapter_mocked.py`).
|
- **Unit tests** live in `tests/unit/` and carry `@pytest.mark.unit`. Filename starts with `test_<thing>_<scope>` (e.g., `test_mum_adapter_mocked.py`).
|
||||||
- **Mock smoke tests** live in `tests/` and use either the in-process Mock adapter (override the `lin` fixture locally) or an injected SDK mock wrapper.
|
- **Mock smoke tests** live in `tests/` and use either the in-process Mock adapter (override the `lin` fixture locally) or an injected SDK mock wrapper.
|
||||||
- **Hardware tests** live in `tests/hardware/` (preferred) or `tests/` (legacy) and carry `@pytest.mark.hardware` plus an adapter marker (`mum` / `babylin`).
|
- **Hardware tests** live in `tests/hardware/` (preferred) or `tests/` (legacy) and carry `@pytest.mark.hardware` plus an adapter marker (`mum` for current work, `babylin` for the deprecated path).
|
||||||
- **Slow tests** (>5 s) carry `@pytest.mark.slow` so they can be excluded with `-m "not slow"`.
|
- **Slow tests** (>5 s) carry `@pytest.mark.slow` so they can be excluded with `-m "not slow"`.
|
||||||
- **Requirement traceability** is via `req_NNN` markers on the test function and a `Requirements:` line in the docstring (parsed by the reporting plugin).
|
- **Requirement traceability** is via `req_NNN` markers on the test function and a `Requirements:` line in the docstring (parsed by the reporting plugin).
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ This guide explains exactly what to commit to source control for this repository
|
|||||||
- `ecu_framework/config.py`
|
- `ecu_framework/config.py`
|
||||||
- `ecu_framework/lin/base.py`
|
- `ecu_framework/lin/base.py`
|
||||||
- `ecu_framework/lin/mock.py`
|
- `ecu_framework/lin/mock.py`
|
||||||
- `ecu_framework/lin/babylin.py`
|
- `ecu_framework/lin/babylin.py` (deprecated, retained for backward compatibility)
|
||||||
- `ecu_framework/flashing/hex_flasher.py`
|
- `ecu_framework/flashing/hex_flasher.py`
|
||||||
|
|
||||||
### Pytest plugin and config
|
### Pytest plugin and config
|
||||||
@ -20,7 +20,7 @@ This guide explains exactly what to commit to source control for this repository
|
|||||||
### Tests and fixtures
|
### Tests and fixtures
|
||||||
- `tests/conftest.py`
|
- `tests/conftest.py`
|
||||||
- `tests/test_smoke_mock.py`
|
- `tests/test_smoke_mock.py`
|
||||||
- `tests/test_babylin_hardware_smoke.py` (if present)
|
- `tests/test_babylin_hardware_smoke.py` (if present; deprecated BabyLIN path)
|
||||||
- `tests/test_hardware_placeholder.py` (if present)
|
- `tests/test_hardware_placeholder.py` (if present)
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
@ -34,7 +34,7 @@ This guide explains exactly what to commit to source control for this repository
|
|||||||
- `docs/05_architecture_overview.md`
|
- `docs/05_architecture_overview.md`
|
||||||
- `docs/06_requirement_traceability.md`
|
- `docs/06_requirement_traceability.md`
|
||||||
- `docs/07_flash_sequence.md`
|
- `docs/07_flash_sequence.md`
|
||||||
- `docs/08_babylin_internals.md`
|
- `docs/08_babylin_internals.md` (deprecated)
|
||||||
|
|
||||||
### Vendor guidance (no binaries)
|
### Vendor guidance (no binaries)
|
||||||
- `vendor/README.md`
|
- `vendor/README.md`
|
||||||
|
|||||||
@ -6,18 +6,18 @@ A guided tour of the ECU testing framework. Start here:
|
|||||||
2. `02_configuration_resolution.md` — How configuration is loaded and merged
|
2. `02_configuration_resolution.md` — How configuration is loaded and merged
|
||||||
3. `03_reporting_and_metadata.md` — How test documentation becomes report metadata
|
3. `03_reporting_and_metadata.md` — How test documentation becomes report metadata
|
||||||
4. `11_conftest_plugin_overview.md` — Custom pytest plugin: hooks, call sequence, and artifacts
|
4. `11_conftest_plugin_overview.md` — Custom pytest plugin: hooks, call sequence, and artifacts
|
||||||
5. `04_lin_interface_call_flow.md` — LIN abstraction and adapter behavior (Mock, MUM, legacy BabyLIN)
|
5. `04_lin_interface_call_flow.md` — LIN abstraction and adapter behavior (Mock, MUM, and the deprecated BabyLIN)
|
||||||
6. `05_architecture_overview.md` — High-level architecture and components
|
6. `05_architecture_overview.md` — High-level architecture and components
|
||||||
7. `06_requirement_traceability.md` — Requirement markers and coverage visuals
|
7. `06_requirement_traceability.md` — Requirement markers and coverage visuals
|
||||||
8. `07_flash_sequence.md` — ECU flashing workflow and sequence diagram
|
8. `07_flash_sequence.md` — ECU flashing workflow and sequence diagram
|
||||||
9. `08_babylin_internals.md` — BabyLIN SDK wrapper internals and call flow (legacy)
|
9. `08_babylin_internals.md` — BabyLIN SDK wrapper internals and call flow (DEPRECATED)
|
||||||
10. `16_mum_internals.md` — MUM (Melexis Universal Master) adapter internals and call flow
|
10. `16_mum_internals.md` — MUM (Melexis Universal Master) adapter internals and call flow
|
||||||
11. `17_ldf_parser.md` — LDF parser, `ldf` fixture, and per-frame `pack`/`unpack` helpers
|
11. `17_ldf_parser.md` — LDF parser, `ldf` fixture, and per-frame `pack`/`unpack` helpers
|
||||||
12. `18_test_catalog.md` — Per-test catalog: purpose, markers, hardware needs, expected result
|
12. `18_test_catalog.md` — Per-test catalog: purpose, markers, hardware needs, expected result
|
||||||
13. `DEVELOPER_COMMIT_GUIDE.md` — What to commit vs ignore, commands
|
13. `DEVELOPER_COMMIT_GUIDE.md` — What to commit vs ignore, commands
|
||||||
14. `09_raspberry_pi_deployment.md` — Run on Raspberry Pi (venv, service, hardware notes)
|
14. `09_raspberry_pi_deployment.md` — Run on Raspberry Pi (venv, service, hardware notes)
|
||||||
15. `10_build_custom_image.md` — Build a custom Raspberry Pi OS image with the framework baked in
|
15. `10_build_custom_image.md` — Build a custom Raspberry Pi OS image with the framework baked in
|
||||||
16. `12_using_the_framework.md` — Practical usage: local, hardware (MUM/BabyLIN), CI, and Pi
|
16. `12_using_the_framework.md` — Practical usage: local, hardware (MUM, or the deprecated BabyLIN), CI, and Pi
|
||||||
17. `13_unit_testing_guide.md` — Unit tests layout, markers, coverage, and tips
|
17. `13_unit_testing_guide.md` — Unit tests layout, markers, coverage, and tips
|
||||||
18. `14_power_supply.md` — Owon PSU control, configuration, tests, and quick demo script
|
18. `14_power_supply.md` — Owon PSU control, configuration, tests, and quick demo script
|
||||||
19. `15_report_properties_cheatsheet.md` — Standardized keys for record_property/rp across suites
|
19. `15_report_properties_cheatsheet.md` — Standardized keys for record_property/rp across suites
|
||||||
@ -26,6 +26,6 @@ Related references:
|
|||||||
|
|
||||||
- Root project guide: `../README.md`
|
- Root project guide: `../README.md`
|
||||||
- Full framework guide: `../TESTING_FRAMEWORK_GUIDE.md`
|
- Full framework guide: `../TESTING_FRAMEWORK_GUIDE.md`
|
||||||
- BabyLIN placement and integration: `../vendor/README.md`
|
- BabyLIN placement and integration: `../vendor/README.md` (deprecated; only relevant for legacy rigs)
|
||||||
- MUM source scripts and protocol details: `../vendor/automated_lin_test/README.md`
|
- MUM source scripts and protocol details: `../vendor/automated_lin_test/README.md`
|
||||||
- PSU quick demo and scripts: `../vendor/Owon/`
|
- PSU quick demo and scripts: `../vendor/Owon/`
|
||||||
|
|||||||
@ -3,7 +3,7 @@ ECU Tests framework package.
|
|||||||
|
|
||||||
Provides:
|
Provides:
|
||||||
- config: YAML configuration loader and types
|
- config: YAML configuration loader and types
|
||||||
- lin: LIN interface abstraction and adapters (mock and BabyLIN)
|
- lin: LIN interface abstraction and adapters (mock, MUM, and the deprecated BabyLIN)
|
||||||
|
|
||||||
Package version is exposed as __version__.
|
Package version is exposed as __version__.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -24,15 +24,15 @@ class FlashConfig:
|
|||||||
class InterfaceConfig:
|
class InterfaceConfig:
|
||||||
"""LIN interface configuration.
|
"""LIN interface configuration.
|
||||||
|
|
||||||
type: Adapter type — "mock" (simulated), "babylin" (legacy BabyLIN SDK), or "mum"
|
type: Adapter type — "mock" (simulated), "mum" (Melexis Universal Master, current),
|
||||||
(Melexis Universal Master).
|
or "babylin" (DEPRECATED BabyLIN SDK).
|
||||||
channel: Channel index to use (0-based in most SDKs); BabyLIN-specific.
|
channel: Channel index to use (0-based in most SDKs); BabyLIN-specific (deprecated).
|
||||||
bitrate: Effective LIN bitrate; the MUM uses this directly, the BabyLIN SDF may override.
|
bitrate: Effective LIN bitrate; the MUM uses this directly, the BabyLIN SDF may override.
|
||||||
dll_path: Legacy/optional pointer to vendor DLLs when using ctypes (not used by SDK wrapper).
|
dll_path: DEPRECATED. Legacy/optional pointer to vendor DLLs when using ctypes (not used by SDK wrapper).
|
||||||
node_name: Optional friendly name for display/logging.
|
node_name: Optional friendly name for display/logging.
|
||||||
func_names: Legacy mapping for ctypes function names; ignored by SDK wrapper.
|
func_names: DEPRECATED. Legacy mapping for ctypes function names; ignored by SDK wrapper.
|
||||||
sdf_path: Path to the SDF to load on connect (BabyLIN only).
|
sdf_path: DEPRECATED. Path to the SDF to load on connect (BabyLIN only).
|
||||||
schedule_nr: Schedule index to start after connect (BabyLIN only). -1 = skip.
|
schedule_nr: DEPRECATED. Schedule index to start after connect (BabyLIN only). -1 = skip.
|
||||||
host: MUM IP address (MUM only).
|
host: MUM IP address (MUM only).
|
||||||
lin_device: MUM LIN device name (MUM only, default 'lin0').
|
lin_device: MUM LIN device name (MUM only, default 'lin0').
|
||||||
power_device: MUM power-control device name (MUM only, default 'power_out0').
|
power_device: MUM power-control device name (MUM only, default 'power_out0').
|
||||||
@ -41,13 +41,13 @@ class InterfaceConfig:
|
|||||||
MUM adapter when receiving slave-published frames.
|
MUM adapter when receiving slave-published frames.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type: str = "mock" # "mock", "babylin", or "mum"
|
type: str = "mock" # "mock", "mum", or "babylin" (deprecated)
|
||||||
channel: int = 1
|
channel: int = 1
|
||||||
bitrate: int = 19200
|
bitrate: int = 19200
|
||||||
dll_path: Optional[str] = None
|
dll_path: Optional[str] = None # deprecated (BabyLIN)
|
||||||
node_name: Optional[str] = None
|
node_name: Optional[str] = None
|
||||||
func_names: Dict[str, str] = field(default_factory=dict)
|
func_names: Dict[str, str] = field(default_factory=dict) # deprecated (BabyLIN)
|
||||||
# BabyLIN-specific
|
# BabyLIN-specific (deprecated)
|
||||||
sdf_path: Optional[str] = None
|
sdf_path: Optional[str] = None
|
||||||
schedule_nr: int = 0
|
schedule_nr: int = 0
|
||||||
# MUM-specific
|
# MUM-specific
|
||||||
@ -65,7 +65,7 @@ class InterfaceConfig:
|
|||||||
class EcuTestConfig:
|
class EcuTestConfig:
|
||||||
"""Top-level, fully-typed configuration for the framework.
|
"""Top-level, fully-typed configuration for the framework.
|
||||||
|
|
||||||
interface: Settings for LIN communication (mock or BabyLIN).
|
interface: Settings for LIN communication (mock, MUM, or the deprecated BabyLIN).
|
||||||
flash: Optional flashing behavior configuration.
|
flash: Optional flashing behavior configuration.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@ -4,11 +4,12 @@ LIN interface package.
|
|||||||
Exports:
|
Exports:
|
||||||
- LinInterface, LinFrame: core abstraction and frame type
|
- LinInterface, LinFrame: core abstraction and frame type
|
||||||
- MockBabyLinInterface: mock implementation for fast, hardware-free tests
|
- MockBabyLinInterface: mock implementation for fast, hardware-free tests
|
||||||
|
(the ``BabyLin`` part of the name is historical; the mock is interface-agnostic)
|
||||||
|
|
||||||
Real hardware adapters live in their own modules and are imported by the
|
Real hardware adapters live in their own modules and are imported by the
|
||||||
fixture only when selected by config:
|
fixture only when selected by config:
|
||||||
- babylin.BabyLinInterface (legacy; needs the BabyLIN SDK + native libs)
|
|
||||||
- mum.MumLinInterface (current; needs Melexis pylin + pymumclient)
|
- mum.MumLinInterface (current; needs Melexis pylin + pymumclient)
|
||||||
|
- babylin.BabyLinInterface (DEPRECATED; needs the BabyLIN SDK + native libs)
|
||||||
"""
|
"""
|
||||||
from .base import LinInterface, LinFrame
|
from .base import LinInterface, LinFrame
|
||||||
from .mock import MockBabyLinInterface
|
from .mock import MockBabyLinInterface
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
|
"""DEPRECATED: Legacy BabyLIN SDK adapter.
|
||||||
|
|
||||||
|
This module is retained for backward compatibility only. New work should use
|
||||||
|
the MUM (Melexis Universal Master) adapter in ``ecu_framework.lin.mum``.
|
||||||
|
Instantiating :class:`BabyLinInterface` emits a :class:`DeprecationWarning`.
|
||||||
|
"""
|
||||||
from __future__ import annotations # Enable postponed evaluation of annotations (PEP 563/649 style)
|
from __future__ import annotations # Enable postponed evaluation of annotations (PEP 563/649 style)
|
||||||
|
|
||||||
|
import warnings # Used to surface the deprecation notice on instantiation
|
||||||
from typing import Optional # For optional type hints
|
from typing import Optional # For optional type hints
|
||||||
|
|
||||||
from .base import LinInterface, LinFrame # Base abstraction and frame dataclass used by all LIN adapters
|
from .base import LinInterface, LinFrame # Base abstraction and frame dataclass used by all LIN adapters
|
||||||
@ -8,6 +15,11 @@ from .base import LinInterface, LinFrame # Base abstraction and frame dataclass
|
|||||||
class BabyLinInterface(LinInterface):
|
class BabyLinInterface(LinInterface):
|
||||||
"""LIN adapter that uses the vendor's BabyLIN Python SDK wrapper.
|
"""LIN adapter that uses the vendor's BabyLIN Python SDK wrapper.
|
||||||
|
|
||||||
|
.. deprecated::
|
||||||
|
The BabyLIN adapter is deprecated and kept only for backward
|
||||||
|
compatibility. Use :class:`ecu_framework.lin.mum.MumLinInterface`
|
||||||
|
for new tests and deployments.
|
||||||
|
|
||||||
- Avoids manual ctypes; relies on BabyLIN_library.py BLC_* functions.
|
- Avoids manual ctypes; relies on BabyLIN_library.py BLC_* functions.
|
||||||
- Keeps the same LinInterface contract for send/receive/request/flush.
|
- Keeps the same LinInterface contract for send/receive/request/flush.
|
||||||
"""
|
"""
|
||||||
@ -23,6 +35,11 @@ class BabyLinInterface(LinInterface):
|
|||||||
schedule_nr: int = 0, # Schedule number to start after connect
|
schedule_nr: int = 0, # Schedule number to start after connect
|
||||||
wrapper_module: Optional[object] = None, # Inject a wrapper (e.g., mock) for tests
|
wrapper_module: Optional[object] = None, # Inject a wrapper (e.g., mock) for tests
|
||||||
) -> None:
|
) -> None:
|
||||||
|
warnings.warn(
|
||||||
|
"BabyLinInterface is deprecated; use ecu_framework.lin.mum.MumLinInterface instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
self.bitrate = bitrate # Store configured (informational) bitrate
|
self.bitrate = bitrate # Store configured (informational) bitrate
|
||||||
self.channel_index = channel # Desired channel index
|
self.channel_index = channel # Desired channel index
|
||||||
self.node_name = node_name or "ECU_TEST_NODE" # Default node name if not provided
|
self.node_name = node_name or "ECU_TEST_NODE" # Default node name if not provided
|
||||||
|
|||||||
@ -17,7 +17,7 @@ addopts = -ra --junitxml=reports/junit.xml --html=reports/report.html --self-con
|
|||||||
# Use with: pytest -m "markername"
|
# Use with: pytest -m "markername"
|
||||||
markers =
|
markers =
|
||||||
hardware: requires real hardware (LIN master + ECU); excluded by default in mock runs
|
hardware: requires real hardware (LIN master + ECU); excluded by default in mock runs
|
||||||
babylin: tests that use the legacy BabyLIN interface (may require hardware)
|
babylin: DEPRECATED. Tests targeting the legacy BabyLIN interface; use the `mum` marker for new tests.
|
||||||
mum: tests that use the Melexis Universal Master (MUM) interface (requires hardware)
|
mum: tests that use the Melexis Universal Master (MUM) interface (requires hardware)
|
||||||
unit: fast, isolated tests (no hardware, no external I/O)
|
unit: fast, isolated tests (no hardware, no external I/O)
|
||||||
req_001: REQ-001 - Mock interface shall echo transmitted frames for local testing
|
req_001: REQ-001 - Mock interface shall echo transmitted frames for local testing
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
# Example udev rules for BabyLin-like USB device
|
# DEPRECATED: example udev rules for the legacy BabyLin USB device.
|
||||||
|
# Kept for backward compatibility only; new deployments target the MUM adapter
|
||||||
|
# over Ethernet and do not need a udev rule.
|
||||||
|
#
|
||||||
# Replace ATTRS{idVendor} and ATTRS{idProduct} with actual values
|
# Replace ATTRS{idVendor} and ATTRS{idProduct} with actual values
|
||||||
# Find values with: lsusb
|
# Find values with: lsusb
|
||||||
|
|
||||||
|
|||||||
@ -54,6 +54,9 @@ if [[ -f /etc/systemd/system/ecu-tests.timer ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "Installing udev rules (if provided)..."
|
log "Installing udev rules (if provided)..."
|
||||||
|
# DEPRECATED: the babylin udev rule is only needed for the legacy BabyLIN USB
|
||||||
|
# adapter. MUM deployments do not require this and the block can be removed
|
||||||
|
# once no babylin hardware remains in the field.
|
||||||
if [[ -f scripts/99-babylin.rules ]]; then
|
if [[ -f scripts/99-babylin.rules ]]; then
|
||||||
install -Dm644 scripts/99-babylin.rules /etc/udev/rules.d/99-babylin.rules
|
install -Dm644 scripts/99-babylin.rules /etc/udev/rules.d/99-babylin.rules
|
||||||
udevadm control --reload-rules || true
|
udevadm control --reload-rules || true
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import os
|
|||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
import typing as t
|
import typing as t
|
||||||
|
import warnings
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ from ecu_framework.lin.base import LinInterface
|
|||||||
from ecu_framework.lin.mock import MockBabyLinInterface
|
from ecu_framework.lin.mock import MockBabyLinInterface
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ecu_framework.lin.babylin import BabyLinInterface # type: ignore
|
from ecu_framework.lin.babylin import BabyLinInterface # type: ignore # deprecated
|
||||||
except Exception:
|
except Exception:
|
||||||
BabyLinInterface = None # type: ignore
|
BabyLinInterface = None # type: ignore
|
||||||
|
|
||||||
@ -37,6 +38,12 @@ def lin(config: EcuTestConfig) -> t.Iterator[LinInterface]:
|
|||||||
elif iface_type == "babylin":
|
elif iface_type == "babylin":
|
||||||
if BabyLinInterface is None:
|
if BabyLinInterface is None:
|
||||||
pytest.skip("BabyLin interface not available in this environment")
|
pytest.skip("BabyLin interface not available in this environment")
|
||||||
|
warnings.warn(
|
||||||
|
"interface.type='babylin' selects the deprecated BabyLIN adapter; "
|
||||||
|
"switch to interface.type='mum' for new tests.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
lin = BabyLinInterface(
|
lin = BabyLinInterface(
|
||||||
dll_path=config.interface.dll_path,
|
dll_path=config.interface.dll_path,
|
||||||
bitrate=config.interface.bitrate,
|
bitrate=config.interface.bitrate,
|
||||||
|
|||||||
6
vendor/README.md
vendored
6
vendor/README.md
vendored
@ -1,4 +1,6 @@
|
|||||||
# BabyLIN SDK placement
|
# BabyLIN SDK placement (DEPRECATED)
|
||||||
|
|
||||||
|
> The BabyLIN adapter is deprecated and retained for backward compatibility only. New deployments should target the MUM (Melexis Universal Master) adapter — see `automated_lin_test/README.md` and `../docs/16_mum_internals.md`. This guide is kept so existing BabyLIN rigs can still be set up.
|
||||||
|
|
||||||
Place the SDK's Python wrapper and platform-specific libraries here so the test framework can import and use them.
|
Place the SDK's Python wrapper and platform-specific libraries here so the test framework can import and use them.
|
||||||
|
|
||||||
@ -42,7 +44,7 @@ Point your config to the SDF and schedule:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
interface:
|
interface:
|
||||||
type: babylin
|
type: babylin # deprecated; emits a DeprecationWarning at runtime
|
||||||
channel: 0
|
channel: 0
|
||||||
sdf_path: ./vendor/Example.sdf
|
sdf_path: ./vendor/Example.sdf
|
||||||
schedule_nr: 0
|
schedule_nr: 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user