Skip to content
Merged
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
36 changes: 19 additions & 17 deletions Runner/suites/Multimedia/Camera/Camera_NHX/README_Camera_NHX.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Camera_NHX

Camera NHX validation test for the Qualcomm CAMX proprietary camera stack. This test runs `nhx.sh`, collects generated image dumps, validates dumps (existence + non-zero size), and produces a PASS/FAIL `.res` file suitable for LAVA gating.
Camera NHX validation test for the Qualcomm CAMX proprietary camera stack. This test runs the available NHX launcher (`nhx.sh` or `camera-nhx`), collects generated image dumps, validates dumps (existence + non-zero size), and produces a PASS/FAIL `.res` file suitable for LAVA gating.

The test supports the legacy/default NHX flow, optional target-specific JSON selection for preview, video, preview+video, and snapshot validation, and an opt-in desktop CAMX package and FIT-DTB selection flow.

Expand Down Expand Up @@ -83,10 +83,10 @@ Snapshot JSON files are currently expected only for targets where the files are
- Sensor presence check is warn-only because NHX may still work depending on target/test config

4. **Runs NHX**
- Resolves `nhx.sh` from `PATH`, then falls back to the packaged CAMX location `/usr/libexec/camx/nhx.sh`.
- Default mode runs `nhx.sh` with no argument, preserving the existing SoC-specific default behavior.
- Resolves legacy `nhx.sh` from `PATH` first, then `camera-nhx` from `PATH`, and finally the packaged CAMX location `/usr/libexec/camx/nhx.sh`.
- Default mode runs the selected NHX launcher with no argument, preserving the existing SoC-specific default behavior.
- Optional mode accepts one selected JSON via `--json` and optionally `--target`.
- The selected JSON is staged to the location expected by the selected `nhx.sh` launcher.
- The selected JSON is staged to the location expected by the selected NHX launcher.

5. **Dump validation**
- Collects dump file list from NHX output and/or dump directory based on a marker timestamp.
Expand Down Expand Up @@ -157,13 +157,15 @@ operator to reboot manually. The test never issues a reboot itself.
./run.sh
```

This preserves the existing behavior and runs:
This preserves the existing behavior and runs the first available launcher in this order:

```sh
nhx.sh
```text
nhx.sh from PATH
camera-nhx from PATH
/usr/libexec/camx/nhx.sh
```

`nhx.sh` then selects the default JSON based on SoC ID:
The selected launcher then selects the default JSON based on SoC ID:

- Kodiak (`497`, `498`, `575`) -> `NHX.YUV_NV12_Prev_MaxRes`
- Lemans/Monaco (`534`, `606`, `667`, `674`, `675`, `676`) -> `NHX.YUV_NV12_Prev_MaxRes`
Expand Down Expand Up @@ -238,7 +240,7 @@ In that case, pass `--target`:

## How JSON staging works

The `nhx.sh` launcher does not accept an arbitrary absolute JSON path. It expects a JSON name and internally checks:
The NHX launcher does not accept an arbitrary absolute JSON path. It expects a JSON name and internally checks:

```sh
/etc/camera/test/NHX/${JSON_FILE}.json
Expand All @@ -250,13 +252,13 @@ For this reason, when `--json` is used, `run.sh` resolves the source file from t
/etc/camera/test/NHX/<target>/<json-file>.json
```

Then it calls `nhx.sh` with the launcher argument without `.json`, for example:
Then it calls the selected launcher with the launcher argument without `.json`, for example:

```sh
nhx.sh Lemans/Prev_plus_Video_YUVNV12_MaxResolution_NHX
camera-nhx Lemans/Prev_plus_Video_YUVNV12_MaxResolution_NHX
```

This causes `nhx.sh` to load:
The same argument is used when legacy `nhx.sh` is selected. This causes the launcher to load:

```text
/etc/camera/test/NHX/Lemans/Prev_plus_Video_YUVNV12_MaxResolution_NHX.json
Expand Down Expand Up @@ -289,7 +291,7 @@ Options:
boot. Requires --overlay on a supported desktop distro.
Camera_NHX accepts camx, which is the --overlay default.

--json JSON_FILE NHX JSON file to pass to nhx.sh.
--json JSON_FILE NHX JSON file to pass to the selected NHX launcher.
Can be absolute, relative to Camera_NHX/, or relative
to the target folder when --target is provided.

Expand Down Expand Up @@ -458,7 +460,7 @@ run:

### SKIP

- Missing CAMX prerequisites, such as DT patterns, camera module artifact/loaded state, ICP firmware, CAMX packages, or an executable `nhx.sh` in `PATH` or `/usr/libexec/camx`
- Missing CAMX prerequisites, such as DT patterns, camera module artifact/loaded state, ICP firmware, CAMX packages, or an executable NHX launcher (`nhx.sh` or `camera-nhx` in `PATH`, or `/usr/libexec/camx/nhx.sh`)
- The CAMX FIT DTB selection was written and a manual reboot is required before validation
- EFI selects `camx`, but the board-specific camera module is not loaded, so a manual reboot is required
- `VendorDtbOverlays` is unavailable when `--overlay` was requested
Expand All @@ -475,7 +477,7 @@ run:

If logs show `1970-01-01`, the device clock is not set. This is common on early boot images or minimal init environments. It does not affect functional correctness, but it can make log browsing confusing.

### `nhx.sh` reports JSON file not found
### The NHX launcher reports JSON file not found

If you see a message similar to:

Expand All @@ -488,8 +490,8 @@ check that:
- `run.sh` logged a valid `NHX JSON resolved`
- `run.sh` logged a valid `NHX JSON argument`
- the selected JSON was staged under `/etc/camera/test/NHX`
- the argument passed to `nhx.sh` does not include an absolute `/tmp/...` path
- the argument passed to `nhx.sh` does not include the `.json` suffix
- the argument passed to the selected NHX launcher does not include an absolute `/tmp/...` path
- the argument passed to the selected NHX launcher does not include the `.json` suffix

Correct expected example:

Expand Down
36 changes: 22 additions & 14 deletions Runner/suites/Multimedia/Camera/Camera_NHX/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Options:
--fit-dtb NAME Select this FIT DTB compatibility name for the next boot.
Camera_NHX supports camx, which is the --overlay default.
This option requires --overlay.
--json JSON_FILE NHX JSON file to pass to nhx.sh.
--json JSON_FILE NHX JSON file to pass to the selected NHX launcher.
Can be absolute, relative to Camera_NHX/, or relative
to target folder when --target is provided.
--target TARGET Target folder name: Kodiak, Lemans, Monaco, Talos.
Expand Down Expand Up @@ -315,12 +315,20 @@ fi

NHX_RUNNER="$(command -v nhx.sh 2>/dev/null || true)"
if [ -n "$NHX_RUNNER" ] && [ -f "$NHX_RUNNER" ] && [ -x "$NHX_RUNNER" ]; then
NHX_RUNNER_SOURCE="PATH"
elif [ -f "/usr/libexec/camx/nhx.sh" ] && [ -x "/usr/libexec/camx/nhx.sh" ]; then
NHX_RUNNER_SOURCE="PATH-nhx.sh"
else
NHX_RUNNER="$(command -v camera-nhx 2>/dev/null || true)"
fi

if [ -z "$NHX_RUNNER_SOURCE" ] && \
[ -n "$NHX_RUNNER" ] && [ -f "$NHX_RUNNER" ] && [ -x "$NHX_RUNNER" ]; then
NHX_RUNNER_SOURCE="PATH-camera-nhx"
elif [ -z "$NHX_RUNNER_SOURCE" ] && \
[ -f "/usr/libexec/camx/nhx.sh" ] && [ -x "/usr/libexec/camx/nhx.sh" ]; then
NHX_RUNNER="/usr/libexec/camx/nhx.sh"
NHX_RUNNER_SOURCE="packaged-libexec"
else
log_skip "$TESTNAME SKIP nhx.sh not found in PATH or /usr/libexec/camx"
elif [ -z "$NHX_RUNNER_SOURCE" ]; then
log_skip "$TESTNAME SKIP NHX launcher not found, provide executable nhx.sh or camera-nhx in PATH, or /usr/libexec/camx/nhx.sh"
echo "$TESTNAME SKIP" >"$RES_FILE"
exit 0
fi
Expand Down Expand Up @@ -554,10 +562,10 @@ if [ -n "$CAM_SERVER_SERVICE" ]; then
"$RUN_LOG" "$CAM_SERVER_TS_BEFORE_STOP" "$CAM_SERVER_SERVICE" || true

if systemd_service_is_active "$CAM_SERVER_SERVICE"; then
log_info "Stopping active camera server before nhx.sh"
log_info "Stopping active camera server before NHX launcher"

if ! systemd_service_stop_safe "$CAM_SERVER_SERVICE"; then
log_fail "$TESTNAME FAIL - unable to stop active $CAM_SERVER_SERVICE before nhx.sh"
log_fail "$TESTNAME FAIL - unable to stop active $CAM_SERVER_SERVICE before NHX launcher"
echo "$TESTNAME FAIL" >"$RES_FILE"
exit 0
fi
Expand Down Expand Up @@ -621,13 +629,13 @@ if [ -n "$NHX_JSON" ]; then
NHX_JSON_ARG="$(nhx_stage_json_for_launcher "$SCRIPT_DIR" "$NHX_JSON_RESOLVED" "$NHX_TARGET" 2>/dev/null || true)"

if [ -z "$NHX_JSON_ARG" ]; then
log_skip "$TESTNAME SKIP failed to stage NHX JSON for nhx.sh: $NHX_JSON_RESOLVED"
log_skip "$TESTNAME SKIP failed to stage NHX JSON for selected launcher: $NHX_JSON_RESOLVED"
echo "$TESTNAME SKIP" >"$RES_FILE"
exit 0
fi

log_info "Launching nhx.sh with JSON source: $NHX_JSON_RESOLVED"
log_info "Launching nhx.sh with JSON argument: $NHX_JSON_ARG"
log_info "Launching NHX with JSON source: $NHX_JSON_RESOLVED"
log_info "Launching NHX with JSON argument: $NHX_JSON_ARG"

if command -v run_cmd_live_to_log >/dev/null 2>&1; then
run_cmd_live_to_log "$RUN_LOG" "$NHX_RUNNER" "$NHX_JSON_ARG"
Expand All @@ -651,7 +659,7 @@ if [ -n "$NHX_JSON" ]; then
wait "$TEEPID" 2>/dev/null || true
fi
else
log_info "Launching nhx.sh with default SoC-specific JSON"
log_info "Launching NHX with default SoC-specific JSON"

if command -v run_cmd_live_to_log >/dev/null 2>&1; then
run_cmd_live_to_log "$RUN_LOG" "$NHX_RUNNER"
Expand Down Expand Up @@ -680,7 +688,7 @@ fi
# Restore camera server state after NHX
# -----------------------------------------------------------------------------
if [ "$CAM_SERVER_STOPPED_FOR_TEST" -eq 1 ]; then
log_info "Restoring camera server after nhx.sh: $CAM_SERVER_SERVICE"
log_info "Restoring camera server after NHX launcher: $CAM_SERVER_SERVICE"
if systemd_service_start_safe "$CAM_SERVER_SERVICE"; then
CAM_SERVER_STOPPED_FOR_TEST=0
CAM_SERVER_TS_AFTER_START="$(date '+%Y-%m-%d %H:%M:%S')"
Expand All @@ -693,7 +701,7 @@ if [ "$CAM_SERVER_STOPPED_FOR_TEST" -eq 1 ]; then
systemd_service_stdout_since "Camera server AFTER restore (stdout since restore marker)" \
"$RUN_LOG" "$CAM_SERVER_TS_AFTER_START" "$CAM_SERVER_SERVICE" || true
else
log_warn "Failed to restore camera server after nhx.sh: $CAM_SERVER_SERVICE"
log_warn "Failed to restore camera server after NHX launcher: $CAM_SERVER_SERVICE"
fi
else
log_info "Camera server state was not changed for NHX, skipping restore"
Expand Down Expand Up @@ -753,7 +761,7 @@ TOTAL_BYTES=0
echo "========================================"
echo "$TESTNAME Summary"
echo "Timestamp: $TS"
echo "nhx.sh exit code: $NHX_RC"
echo "NHX launcher exit code: $NHX_RC"
echo "NHX runner: $NHX_RUNNER"
echo "NHX runner source: $NHX_RUNNER_SOURCE"
echo "NHX JSON requested: ${NHX_JSON:-<default>}"
Expand Down
2 changes: 1 addition & 1 deletion Runner/utils/camera/lib_camera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ nhx_resolve_json_file() {
}

# Stage resolved NHX JSON into the path expected by the NHX launcher.
# nhx.sh expects an argument without ".json" and internally looks under:
# NHX launchers expect an argument without ".json" and internally look under:
# /etc/camera/test/NHX/${JSON_FILE}.json
#
# Usage:
Expand Down
Loading