Make sensor scaffold standalone-buildable + CI pipeline smoke test#146
Merged
Make sensor scaffold standalone-buildable + CI pipeline smoke test#146
Conversation
trace_to_driver.py output now passes `gcc -Wall -Wextra -fsyntax-only` without any vendor headers. Replaces the previous stub `extern void <sensor>_write_register(...)` (which was never called) with a small "SDK stubs" block: a `typedef int VI_PIPE` and a no-op `sensor_write_register(addr, val)`. Comment block instructs how to swap the stubs out for hi_comm_video.h / hi_sns_ctrl.h plus the vendor's bus-aware implementation when integrating into a HiSilicon SDK build. `(void)ViPipe` cast inside each function silences the unused-parameter warning that the vendor's macro form would resolve. tools/test_pipeline.sh runs the full segment -> generate -> compile flow on a small synthetic trace and exits non-zero on any failure. Wired into pr-build-check.yml as test-extraction-pipeline, so a regression in any of the Python scripts that breaks the generator output is caught at PR time without hardware. Default-mode `ipctool trace` (no --output=) regression-checked on a real Majestic camera: identical output structure to the pre-#145 behaviour, with the well-understood fd-1 corruption pattern that motivated --output= in the first place. Confirms #145 is opt-in and the default codepath is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #145.
Summary
trace_to_driver.pynow emits self-contained C that passesgcc -Wall -Wextra -fsyntax-onlyandgcc -cstandalone, without any vendor SDK headerstools/test_pipeline.shruns the full segment → generate → compile flow on a synthetic trace, wired intopr-build-check.ymlas a newtest-extraction-pipelinejobipctool trace(no--output=) regression-checked on real hardware: behaviour unchanged from pre-Add sensor driver extraction toolkit and trace --output= flag #145Why
#145's review of the original plan flagged two real gaps:
(1) The generated scaffold didn't compile. It had
#include \"hi_comm_video.h\"/#include \"hi_sns_ctrl.h\"and usedVI_PIPE/sensor_write_registerwith no declarations or stubs, so a researcher couldn't even syntax-check the output let alone build it. Worse, the previousextern void <sensor>_write_register(...)was never actually called (the body usessensor_write_register(...), the vendor's macro form), so the declaration was just noise.(2) Default-mode trace had no regression baseline. #145 added
--output=PATHas an opt-in flag but never explicitly verified that the no-flag codepath still produced the same output as pre-#145. Took a fresh capture on the same Majestic camera with no--output=— identical to the pre-#145 run, with the well-understood fd-1 corruption pattern (single-byte truncation of0x3034=0x01inside the[rtsp] rtsp_initlog line that interleaves on shared stdout).Scaffold change
Before:
After:
The diff against
widgetii/smart_sc2315e/sc2315e_sensor_ctl.c::sc2315e_linear_1080P30_initis byte-for-byte unchanged in the function body — just header surroundings differ.CI integration
The synthetic trace embedded in the script exercises every phase (pre_sensor, init, post_init, runtime), so a regression in segmenter heuristics, generator output shape, or diff reporting is caught at PR time.
Test plan
gcc -Wall -Wextra -fsyntax-onlyon a real captured + generated scaffold passesgcc -con the same scaffold produces an objecttools/test_pipeline.shexits 0widgetii/smart_sc2315ereference unchangedipctool trace(no--output=) on real hardware: same output structure as pre-Add sensor driver extraction toolkit and trace --output= flag #145🤖 Generated with Claude Code