from ganeti import constants
from ganeti import errors
from ganeti import luxi
+from ganeti import opcodes
from ganeti import qlang
return "\n".join(lines)
+def ConvertMisc():
+ """Convert some extra computed-values to Haskell.
+
+ """
+ lines = [""]
+ lines.extend(ConvertVariable("opcodes", "OP_IDS",
+ opcodes.OP_MAPPING.keys(), {}))
+ return "\n".join(lines)
+
+
def main():
print Convert(constants, "")
print Convert(luxi, "luxi")
print Convert(qlang, "qlang")
print Convert(_autoconf, "autoconf")
print Convert(errors, "errors")
+ print ConvertMisc()
if __name__ == "__main__":
-- | Check that Python and Haskell defined the same opcode list.
case_AllDefined :: HUnit.Assertion
case_AllDefined = do
- py_stdout <- runPython "from ganeti import opcodes\n\
- \print '\\n'.join(opcodes.OP_MAPPING.keys())" "" >>=
- checkPythonResult
- let py_ops = sort $ lines py_stdout
- hs_ops = OpCodes.allOpIDs
- -- extra_py = py_ops \\ hs_ops
+ let py_ops = sort C.opcodesOpIds
+ hs_ops = sort OpCodes.allOpIDs
+ extra_py = py_ops \\ hs_ops
extra_hs = hs_ops \\ py_ops
- -- FIXME: uncomment when we have parity
- -- HUnit.assertBool ("OpCodes missing from Haskell code:\n" ++
- -- unlines extra_py) (null extra_py)
+ HUnit.assertBool ("Missing OpCodes from the Haskell code:\n" ++
+ unlines extra_py) (null extra_py)
HUnit.assertBool ("Extra OpCodes in the Haskell code code:\n" ++
unlines extra_hs) (null extra_hs)