Tests/instrumentation: Refactor hook and arguments

Improve argument parsing in the hook script. Ensure consistency between
test cases by always configuring query files with their callback
defined by logic in the test case.
9 files changed