X-Git-Url: https://git.cworth.org/git?p=apitrace-tests;a=blobdiff_plain;f=checker.py;h=2f69dd369590c0170ca9943ef60a1998da1f84cc;hp=08ef9d324c9d12bc1a2134a491131d3e11376e3a;hb=0bd09c5ea7617754dfa0699337d049535b351a7c;hpb=09690a098cc072323bc1364119be0b9e1ce60d11 diff --git a/checker.py b/checker.py index 08ef9d3..2f69dd3 100755 --- a/checker.py +++ b/checker.py @@ -202,6 +202,11 @@ class CallMatcher(Matcher): return s +class TraceMismatch(Exception): + + pass + + class TraceMatcher: def __init__(self, calls): @@ -217,9 +222,9 @@ class TraceMatcher: srcCall = srcCalls.next() except StopIteration: if skippedSrcCalls: - raise Exception('missing call `%s` (found `%s`)' % (refCall, skippedSrcCalls[0])) + raise TraceMismatch('missing call `%s` (found `%s`)' % (refCall, skippedSrcCalls[0])) else: - raise Exception('missing call %s' % refCall) + raise TraceMismatch('missing call %s' % refCall) if refCall.match(srcCall, mo): break else: @@ -490,17 +495,12 @@ class TraceParser(Parser): def parse_element(self): if self.lookahead.type == PRAGMA: - # TODO token = self.consume() self.handlePragma(token.text) else: self.parse_call() def parse_call(self): - while self.lookahead.type == PRAGMA: - # TODO - token = self.consume() - if self.lookahead.type == NUMBER: token = self.consume() callNo = self.handleInt(int(token.text)) @@ -649,7 +649,7 @@ class TraceParser(Parser): raise NotImplementedError def handlePragma(self, line): - pass + raise NotImplementedError class RefTraceParser(TraceParser): @@ -689,6 +689,9 @@ class RefTraceParser(TraceParser): def handleCall(self, callNo, functionName, args, ret): call = CallMatcher(callNo, functionName, args, ret) self.calls.append(call) + + def handlePragma(self, line): + pass class SrcTraceParser(TraceParser):