|
| 1 | +# Camera_NHX |
| 2 | + |
| 3 | +Camera NHX validation test for Qualcomm CAMX proprietary camera stack. This test runs `nhx.sh`, collects the generated image dumps, validates dumps (existence + non-zero size), and produces a PASS/FAIL `.res` file suitable for LAVA gating. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Location |
| 8 | + |
| 9 | +- Test script: `Runner/suites/Multimedia/Camera/Camera_NHX/run.sh` |
| 10 | +- Utilities: |
| 11 | + - `Runner/utils/functestlib.sh` |
| 12 | + - `Runner/utils/camera/lib_camera.sh` |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## What this test does |
| 17 | + |
| 18 | +1. **Environment setup** |
| 19 | + - Locates and sources `init_env` |
| 20 | + - Sources `functestlib.sh` and `lib_camera.sh` |
| 21 | + |
| 22 | +2. **Dependency checks** |
| 23 | + - Uses `check_dependencies` from `functestlib.sh` to ensure required commands exist. |
| 24 | + |
| 25 | +3. **CAMX proprietary prechecks (gate where required)** |
| 26 | + - Device-tree presence checks for camera/CAMX patterns |
| 27 | + - `fdtdump` scan for camera-related nodes (via helper) |
| 28 | + - Camera kernel module detection + “loaded” validation |
| 29 | + - ICP firmware presence check (CAMERA_ICP) |
| 30 | + - `dmesg` scan for camera warnings/errors (warn-only) |
| 31 | + - Gate on “bind graph observed” markers |
| 32 | + |
| 33 | +4. **Runs NHX** |
| 34 | + - Executes `nhx.sh` and captures all output to a timestamped log. |
| 35 | + |
| 36 | +5. **Dump validation** |
| 37 | + - Collects dump file list from NHX output and/or dump directory based on a marker timestamp. |
| 38 | + - Validates: |
| 39 | + - Dump list is non-empty |
| 40 | + - Each dump file exists |
| 41 | + - Each dump file size is **> 0 bytes** |
| 42 | + - Optionally generates checksums (sha256sum/md5sum/cksum) and writes checksum files. |
| 43 | + |
| 44 | +6. **Result decision** |
| 45 | + - Parses `Final Report -> [X PASSED] [Y FAILED] [Z SKIPPED]` from the NHX log |
| 46 | + - FAIL if: |
| 47 | + - Final Report missing/unparseable |
| 48 | + - NHX reports FAILED > 0 |
| 49 | + - No dumps detected |
| 50 | + - Any dump missing/zero bytes |
| 51 | + - Dump checksum validation helper fails |
| 52 | + - Writes final result to: `Camera_NHX.res` |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | +## Outputs |
| 57 | + |
| 58 | +Created under the test directory: |
| 59 | + |
| 60 | +- Logs: |
| 61 | + - `logs/Camera_NHX_<timestamp>.log` |
| 62 | + - `logs/dmesg_<timestamp>/dmesg_snapshot.log` |
| 63 | + - `logs/dmesg_<timestamp>/dmesg_errors.log` (if any matches) |
| 64 | + |
| 65 | +- Out files: |
| 66 | + - `out/Camera_NHX_summary_<timestamp>.txt` |
| 67 | + - Dump list file (path depends on `lib_camera.sh` helper output; typically under `out/`) |
| 68 | + - Checksum file(s) (if enabled by helper/tool availability) |
| 69 | + |
| 70 | +- LAVA gating result: |
| 71 | + - `Camera_NHX.res` |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +## Dump directory |
| 76 | + |
| 77 | +By default the test expects NHX dumps under: |
| 78 | + |
| 79 | +- `/var/cache/camera/nativehaltest` |
| 80 | + |
| 81 | +(Referenced in `run.sh` as `DUMP_DIR`.) |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## How to run locally |
| 86 | + |
| 87 | +From the test folder: |
| 88 | + |
| 89 | +```sh |
| 90 | +cd Runner/suites/Multimedia/Camera/Camera_NHX |
| 91 | +./run.sh |
| 92 | +cat Camera_NHX.res |
| 93 | +``` |
| 94 | + |
| 95 | +This script is LAVA-friendly and exits `0` even on FAIL/SKIP; gating is via `.res`. |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +## How to run in LAVA |
| 100 | + |
| 101 | +Example Lava-Test definition: |
| 102 | + |
| 103 | +```yaml |
| 104 | +metadata: |
| 105 | + name: camera_nhx |
| 106 | + format: "Lava-Test Test Definition 1.0" |
| 107 | + description: "Camera NHX validation" |
| 108 | + os: |
| 109 | + - linux |
| 110 | + scope: |
| 111 | + - functional |
| 112 | + |
| 113 | +run: |
| 114 | + steps: |
| 115 | + - REPO_PATH=$PWD |
| 116 | + - cd Runner/suites/Multimedia/Camera/Camera_NHX |
| 117 | + - ./run.sh || true |
| 118 | + - $REPO_PATH/Runner/utils/send-to-lava.sh Camera_NHX.res |
| 119 | +``` |
| 120 | +
|
| 121 | +--- |
| 122 | +
|
| 123 | +## PASS/FAIL/SKIP semantics |
| 124 | +
|
| 125 | +- **PASS** |
| 126 | + - NHX `Final Report` parsed successfully |
| 127 | + - `FAILED=0` |
| 128 | + - Dump list is non-empty |
| 129 | + - All dump files exist and are **non-zero** |
| 130 | + - Dump checksum validation helper did not fail (if used) |
| 131 | + |
| 132 | +- **FAIL** |
| 133 | + - Any PASS condition not met (including missing/zero dumps) |
| 134 | + |
| 135 | +- **SKIP** |
| 136 | + - Missing CAMX prerequisites (DT patterns, camera module artifact/loaded, ICP firmware, CAMX packages, etc.) |
| 137 | + - `nhx.sh` not found in PATH |
| 138 | + - `fdtdump` not available / inconclusive camera node evidence (as per helper return codes) |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +## Notes / Troubleshooting |
| 143 | + |
| 144 | +### Timestamps show 1970-01-01 |
| 145 | + |
| 146 | +If logs show `1970-01-01`, the device clock is not set (common on early boot images or minimal init). This doesn’t affect functional correctness, but it can make log browsing confusing. Consider enabling NTP or setting RTC/time before running. |
| 147 | + |
| 148 | +### No dumps detected |
| 149 | + |
| 150 | +- Confirm NHX actually produced dumps and the dump path matches `DUMP_DIR` |
| 151 | +- Check `logs/Camera_NHX_<ts>.log` for `Saving image to file:` lines |
| 152 | +- Check permissions and free space under `/var/cache/camera/nativehaltest` |
| 153 | + |
| 154 | +### dmesg warnings |
| 155 | + |
| 156 | +The script scans dmesg and reports warnings, but does **not** SKIP just because camera warnings exist. Use the saved snapshot/errors logs to debug. |
| 157 | + |
| 158 | +### CAMX bind graph not observed (SKIP) |
| 159 | + |
| 160 | +If the bind graph markers are not seen enough times, the script SKIPs. This usually indicates CAMX stack did not fully initialize or relevant drivers/services didn’t come up. |
0 commit comments