Fail call log code generation if method had zero matching outputs.
authorJarkko Pöyry <jpoyry@google.com>
Tue, 17 Feb 2015 19:15:47 +0000 (11:15 -0800)
committerJarkko Pöyry <jpoyry@google.com>
Wed, 25 Feb 2015 22:03:37 +0000 (14:03 -0800)
Change-Id: Icca57a4c4ee51adb3d3d3d67ec45ff132b4053aa

scripts/opengl/gen_call_log_wrapper.py

index 9fee311..b6ea95e 100644 (file)
@@ -415,10 +415,15 @@ def commandLogWrapperMemberDef (command):
                                printouts += "\t\tm_log << TestLog::Message << \"// %s = \" << %s << TestLog::EndMessage;\n" % (param.name, logSpec.argOutPrints[paramNdx](param.name))
                                numPrintouts += 1
 
-               if numPrintouts > 1:
+               # If print handlers do not match the actual command, that is very likely an error. Check
+               # print handlers is a subset of all arguments.
+               if numPrintouts == 0 or len(set(logSpec.argOutPrints.keys()) - set(range(len(command.params)))) > 0:
+                       raise Exception("Invalid print handlers when processing command %s" % command.name)
+
+               if numPrintouts != 1:
                        src += "\t{\n"
                src += printouts
-               if numPrintouts > 1:
+               if numPrintouts != 1:
                        src += "\t}\n"
 
        if not isVoid: