Revision 9b773665

b/autotools/convert-constants
30 30
from ganeti import constants
31 31
from ganeti import errors
32 32
from ganeti import luxi
33
from ganeti import opcodes
33 34
from ganeti import qlang
34 35

  
35 36

  
......
296 297
  return "\n".join(lines)
297 298

  
298 299

  
300
def ConvertMisc():
301
  """Convert some extra computed-values to Haskell.
302

  
303
  """
304
  lines = [""]
305
  lines.extend(ConvertVariable("opcodes", "OP_IDS",
306
                               opcodes.OP_MAPPING.keys(), {}))
307
  return "\n".join(lines)
308

  
309

  
299 310
def main():
300 311
  print Convert(constants, "")
301 312
  print Convert(luxi, "luxi")
302 313
  print Convert(qlang, "qlang")
303 314
  print Convert(_autoconf, "autoconf")
304 315
  print Convert(errors, "errors")
316
  print ConvertMisc()
305 317

  
306 318

  
307 319
if __name__ == "__main__":
b/htest/Test/Ganeti/OpCodes.hs
410 410
-- | Check that Python and Haskell defined the same opcode list.
411 411
case_AllDefined :: HUnit.Assertion
412 412
case_AllDefined = do
413
  py_stdout <- runPython "from ganeti import opcodes\n\
414
                         \print '\\n'.join(opcodes.OP_MAPPING.keys())" "" >>=
415
               checkPythonResult
416
  let py_ops = sort $ lines py_stdout
417
      hs_ops = OpCodes.allOpIDs
418
      -- extra_py = py_ops \\ hs_ops
413
  let py_ops = sort C.opcodesOpIds
414
      hs_ops = sort OpCodes.allOpIDs
415
      extra_py = py_ops \\ hs_ops
419 416
      extra_hs = hs_ops \\ py_ops
420
  -- FIXME: uncomment when we have parity
421
  -- HUnit.assertBool ("OpCodes missing from Haskell code:\n" ++
422
  --                  unlines extra_py) (null extra_py)
417
  HUnit.assertBool ("Missing OpCodes from the Haskell code:\n" ++
418
                    unlines extra_py) (null extra_py)
423 419
  HUnit.assertBool ("Extra OpCodes in the Haskell code code:\n" ++
424 420
                    unlines extra_hs) (null extra_hs)
425 421

  

Also available in: Unified diff