From the chdkptp thread:
I think the script shooting hooks could be useful in a script for testing hooking success under various shooting conditions...
This seems like a very good idea. In trunk 4194, I added hooktest.lua
This attempts to verify that each hook is reached, and also attempts to check whether the file counter increments by the time the raw hook is entered (i.e. is PAUSE_FOR_FILE_COUNTER required)
The script can test single shoot(), a burst of hold shoot_half + click shoot_full_only (referred to as "fast"), and continuous mode.
A pass / fail is printed in the console, and detailed results are logged in A/hooktest.log
If a hook isn't reached, the single shot test will generate errors like:
0020660: FAIL: hook_raw count 0 expect 1
and the fast and cont tests will generate errors like:
0037700: FAIL: hook_raw wait timeout
If the file counter isn't incremented when the raw hook is entered, you will get something like
0527810: FAIL: exp count 9812 expect 9813
All my cameras pass the tests, except for the A540 file counter issue mentioned below.
The log lines are timestamped with get_tick_count so you can see how much time passes waiting for the hooks etc. The exposure counter is also logged at various points.
There are a number of quirks and possible false positives:
* On old cameras like A540, get_exp_count()
does not return the same value used for raw file numbering. This will cause the fast and cont exposure count tests to fail once per run. Due to a quirk in the script, only the first shot of a burst will be counted as a failure. On these cameras, it appears the file counter always updates after the raw hook, so code defines get_file_next_counter to be file counter + 1. However, get_exp_count() always returns the actual file counter. This has various implications for scripts that use get_exp_count()
* The test for PAUSE_FOR_FILE_COUNTER doesn't seem to be definitive. ixus140, which needs this but usually only requires a 10ms sleep didn't report any errors in a build with the define removed. I suspect this is due to the sleep loops in the hook system allowing enough time for it to increment. Shooting a burst of raw+jpeg in continuous mode and verifying there is an equal number of files is probably a better test.
* The file counter test tries to handle wrapping (9999->1) but I haven't verified this, and there may be other cases where the file counter will reset.
* If the camera isn't in canon continuous mode, the cont test will be skipped.
This script is currently only in the trunk, but aside from the new style script parameters, I think it should be compatible with 1.3.