grok: Refactored testcase, added grok debug option.