Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Local IDE / agent state
.vscode/
.claude/settings.local.json
.codex
**/.vscode/

# Generic build/install outputs
build/
install/
cmake-build-*/
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
compile_commands.json
*.o
*.a
*.so
*.d
*.dep
*build*
*install*
*include*
!*build*.sh

# Generated QNX artifacts
qnx/build/
qnx/install/
qnx/targets/*/output/
scripts/logs/

# Repo-local QNX assets are intentionally versionable even though the generic
# build/install/include patterns above would otherwise hide parts of them.
!qnx/
!qnx/toolchains/
!qnx/toolchains/**
!qnx/targets/
!qnx/targets/qemu-qnx800-*/
!qnx/targets/qemu-qnx800-*/mkqnximage-wrapper.sh
!qnx/targets/qemu-qnx800-*/local/
!qnx/targets/qemu-qnx800-*/local/options
!qnx/targets/qemu-qnx800-*/local/valgrind.files
!qnx/targets/qemu-qnx800-*/local/misc_files/
!qnx/targets/qemu-qnx800-*/local/snippets/
!qnx/targets/qemu-qnx800-*/local/snippets/data_files.custom
!qnx/targets/qemu-qnx800-*/local/snippets/ifs_files.custom
!qnx/targets/qemu-qnx800-*/local/snippets/profile.custom

# Local QNX keys/credentials and generated snippets are rewritten by QNX tooling
# or by the TPI launch scripts and must not be committed.
qnx/targets/qemu-qnx800-*/local/misc_files/*
qnx/targets/qemu-qnx800-*/local/ssh-ident
qnx/targets/qemu-qnx800-*/local/snippets/ifs_start.custom
qnx/targets/qemu-qnx800-*/local/snippets/post_start.custom
qnx/targets/qemu-qnx800-*/local/snippets/system_files.custom

# fast_dds/ FastDDS components — source and generated IDL files are intentionally versioned.
# The broad patterns above (*include*, *build*, *install*) would otherwise hide them.
!fast_dds/
!fast_dds/**
fast_dds/build/
fast_dds/install/

# SafeDDS component headers are source files, not generated build artifacts.
!safe_dds/*/include/
!safe_dds/*/include/**
!common_server/include/
!common_server/include/**
314 changes: 314 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
# SafeEDGE

This repository is self-contained for SafeEDGE source code, QNX target definitions, build scripts, and test launchers.
It does not require the old `~/Safe/SAFE-EDGE` repository.

It does not vendor third-party SDKs or source trees. QNX SDP 8 and Safe-DDS source code must be installed/provided outside this repository and pointed to with environment variables.

## Running scripts

All scripts live under `scripts/` and resolve paths relative to their own location.
**Always run them from inside the `scripts/` directory:**

```bash
cd scripts
bash <script_name>.sh [options]
```

They also work when invoked from the repository root with a prefix (`bash scripts/<name>.sh`), but the canonical form is from inside `scripts/`.

## Customer Quick Start

For Ubuntu/Debian hosts, install the host packages that can be installed automatically:

```bash
cd scripts
bash install_host_deps.sh
```

Provide the two external inputs that are not stored in this repository:

```bash
export QNX_SDP_ROOT="/path/to/qnx800"
export QNX_HOST="$QNX_SDP_ROOT/host/linux/x86_64"
export QNX_TARGET="$QNX_SDP_ROOT/target/qnx"
export SAFE_DDS_PATH="/path/to/Safe-DDS-source-release"
```

`scripts/env.example` contains the same variables as a source-able template.

Check the environment:

```bash
bash check_setup.sh
```

Build and test (QNX):

```bash
bash build_safedds_qnx.sh -- -j2
bash build_qnx.sh -- -j2
bash launch_tpi_2_3_test.sh
bash launch_tpi_2_1_test.sh
bash launch_tpi_2_2_test.sh
```

Build and test (FastDDS / Docker):

```bash
bash build_ubuntu.sh --tests
bash launch_fast_server_test.sh
bash launch_fast_edge_test.sh
```

For Linux-only validation of the common server component:

```bash
bash install_host_deps.sh --linux-only
bash check_setup.sh --linux-only
bash launch_tpi_2_3_test.sh
```

## Repository Paths

- Shared IDL sources: `idl/`
- Safe DDS generated headers: `safe_dds/idl/`
- Shared server code: `common_server/`
- Safe DDS server: `safe_dds/server/`
- Safe DDS edge: `safe_dds/edge/`
- FastDDS server: `fast_dds/server/`
- FastDDS edge: `fast_dds/edge/`
- FastDDS generated headers: `fast_dds/idl/`
- FastDDS Dockerfiles: `fast_dds/docker/`
- QNX toolchain file: `qnx/toolchains/qnx8.cmake`
- Safe DDS QNX build script: `scripts/build_safedds_qnx.sh`
- Generated Safe DDS QNX package: `qnx/install/safedds-qnx8-x86_64/safedds`
- Bundled QNX QEMU target: `qnx/targets/qemu-qnx800-x86_64`
- Scripts: `scripts/`
- Test logs: `scripts/logs/`

## Versioned QNX Assets

These files are needed by the build and QNX test scripts and are intended to be kept in this repository:

- `qnx/toolchains/qnx8.cmake`
- `scripts/build_safedds_qnx.sh`
- `qnx/targets/qemu-qnx800-x86_64/mkqnximage-wrapper.sh`
- `qnx/targets/qemu-qnx800-x86_64/local/options`
- `qnx/targets/qemu-qnx800-x86_64/local/valgrind.files`
- stable snippets under `qnx/targets/qemu-qnx800-x86_64/local/snippets/`

These files are generated and should not be committed:

- `qnx/build/`
- `qnx/install/`
- `qnx/targets/qemu-qnx800-x86_64/output/`
- `scripts/logs/`
- `qnx/targets/qemu-qnx800-x86_64/local/misc_files/*`
- `qnx/targets/qemu-qnx800-x86_64/local/ssh-ident`
- `qnx/targets/qemu-qnx800-x86_64/local/snippets/ifs_start.custom`
- `qnx/targets/qemu-qnx800-x86_64/local/snippets/post_start.custom`
- `qnx/targets/qemu-qnx800-x86_64/local/snippets/system_files.custom`

The `misc_files` entries include QNX VM keys, `shadow`, and other local image files. The three generated snippets above are rewritten by `launch_tpi_2_1_test.sh` and `launch_tpi_2_2_test.sh`.

## External Prerequisites

### Required to build QNX targets

- QNX SDP 8 installed on the host
- Safe-DDS source tree available on the host
- `SAFE_DDS_PATH` exported and pointing to the Safe-DDS source tree
- Default SDK path used by scripts if `QNX_SDP_ROOT` is not set: `/home/$USER/qnx800`
- Required SDK files/directories:
- `$QNX_SDP_ROOT/qnxsdp-env.sh`
- `$QNX_SDP_ROOT/host/linux/x86_64`
- `$QNX_SDP_ROOT/target/qnx`
- `cmake`
- a C/C++ build toolchain usable by CMake on the host
- Internet access during configure time if GTest is not already available locally

`scripts/install_host_deps.sh` installs the host packages listed above where possible. It does not install QNX SDP 8 or Safe-DDS sources.

### Required to run QNX VM tests

- `qemu-system-x86_64`
- `sshpass`
- `brctl` from `bridge-utils`
- `file`

### Required to build and run FastDDS Docker tests

- Docker

FastDDS is provided by the base Docker image (`eprosima/vulcanexus:kilted-base`); no separate FastDDS installation is required on the host.

### Required to run the Linux test

- `cmake`
- `libcurl` development package
- Ubuntu/Debian: `sudo apt install libcurl4-openssl-dev`

## Environment Variables

Required for QNX builds:

```bash
export QNX_SDP_ROOT="/home/$USER/qnx800"
export QNX_HOST="$QNX_SDP_ROOT/host/linux/x86_64"
export QNX_TARGET="$QNX_SDP_ROOT/target/qnx"
export SAFE_DDS_PATH="/path/to/Safe-DDS-source-release"
```

Optional variables:

```bash
export QNX_ARCH="x86_64"
export CMAKE_BUILD_TYPE="Release"
```

## Setup Check

Install Ubuntu/Debian host packages:

```bash
cd scripts
bash install_host_deps.sh
```

For only the Linux test dependencies:

```bash
bash install_host_deps.sh --linux-only
```

Run:

```bash
bash check_setup.sh
```

What it does:

- checks for required host tools
- validates the expected QNX SDK path
- validates repo paths under `qnx/`
- validates that `SAFE_DDS_PATH` is defined for QNX builds
- reports local/generated QNX folders if they have not been created yet

For a Linux-only check:

```bash
bash check_setup.sh --linux-only
```

## Build

### QNX targets

Build and install Safe DDS for QNX if `qnx/install/safedds-qnx8-x86_64/safedds` is missing:

```bash
cd scripts
bash build_safedds_qnx.sh -- -j2
```

Build all QNX targets from this repository:

```bash
bash build_qnx.sh -- -j2
```

This configures and installs:

- `common_server`
- `safe_dds/server`
- `safe_dds/edge`

Installed binaries end up in:

- `common_server/install/server-common-qnx8-x86_64-Release/bin`
- `safe_dds/install/server-qnx8-x86_64-Release/bin`
- `safe_dds/install/edge-qnx8-x86_64-Release/bin`

### FastDDS Docker images

Build the runtime images:

```bash
cd scripts
bash build_ubuntu.sh
```

Build runtime and test images:

```bash
bash build_ubuntu.sh --tests
```

Images produced:

- `safe-edge-server:fast`
- `safe-edge-edge:fast`
- `safe-edge-server:fast-test` (with `--tests`)
- `safe-edge-edge:fast-test` (with `--tests`)

## Test

All test scripts log their output under `scripts/logs/`.

### KPI/TPI 2.3: Linux test

```bash
cd scripts
bash launch_tpi_2_3_test.sh
```

Log: `scripts/logs/launch_tpi_2_3.log`

### TPI 2.1: QNX server test

```bash
cd scripts
bash launch_tpi_2_1_test.sh
```

Log: `scripts/logs/launch_tpi_2_1.log`

### TPI 2.2: QNX edge test

```bash
cd scripts
bash launch_tpi_2_2_test.sh
```

Log: `scripts/logs/launch_tpi_2_2.log`

### FastDDS server integration test

```bash
cd scripts
bash launch_fast_server_test.sh
```

Log: `scripts/logs/launch_fast_server_test.log`

Builds `safe-edge-server:fast-test` automatically if the image is not present.

### FastDDS edge integration test

```bash
cd scripts
bash launch_fast_edge_test.sh
```

Log: `scripts/logs/launch_fast_edge_test.log`

Builds `safe-edge-edge:fast-test` automatically if the image is not present.

## Notes

- The QNX tests rebuild the QEMU image from `qnx/targets/qemu-qnx800-x86_64`.
- Generated target output is recreated under `qnx/targets/qemu-qnx800-x86_64/output/` and is ignored by git.
- The Linux test may execute real Pilot Server checks if `/etc/safe-edge/server.ini` exists on the host.
- The FastDDS Docker tests are self-contained: each test image spawns the component under test as a subprocess and communicates with it via DDS over the loopback interface.
Loading