Beispiel #1
0
import sys
import os
import argparse
import testing.gen_data as gen_data
import testing.tool as tool
import testing.tooltester as tooltester

# argument handling - general flags
arg_parser = argparse.ArgumentParser(
    description='Test the OMR extensible class checker.')
arg_parser.add_argument('--checker',
                        dest='CHECKER',
                        type=str,
                        default=os.path.join(os.getcwd(), 'OMRChecker.so'))
tooltester.addTestArgs(arg_parser)


class OMRChecker(tool.Tool):
    '''A wrapper providing an interface for interacting with OMRChecker.'''
    def __init__(self, checker):
        clang = os.getenv('CLANG', 'clang++')
        base = [
            clang, '-fsyntax-only', '-Xclang', '-load', '-Xclang', checker,
            '-Xclang', '-add-plugin', '-Xclang', 'omr-checker'
        ]
        super(OMRChecker, self).__init__(lambda args: base + args)


class CheckerTestCase(tooltester.TestCase):
    def __init__(self, inputFilePath, checker):
Beispiel #2
0
# Contributors:
#    Multiple authors (IBM Corp.) - initial implementation and documentation
###############################################################################

import sys
import os
import argparse
import subprocess
import testing.gen_data as gen_data
import testing.tool as tool
import testing.tooltester as tooltester

# argument handling - general flags
arg_parser = argparse.ArgumentParser(description='Test the OMR extensible class rewriter.')
arg_parser.add_argument('--rewriter', dest='REWRITER', type=str, default=os.path.join(os.getcwd(), "OMRRewriter"))
tooltester.addTestArgs(arg_parser)


class OMRRewriter(tool.Tool):
   '''A wrapper providing an interface for interacting with OMRRewriter.'''

   def __init__(self, rewriter):
      base = [rewriter]
      super(OMRRewriter, self).__init__(lambda args: base + args[0] + ['--', '-std=c++0x', '-w'] + args[1], {'OMR_REWRITE_TRACE':'1'})
      
      
class OMRRewriterOutputChecker(tool.Tool):
   '''A wrapper providing an interface for interacting with the diff command.'''

   def __init__(self):
      super(OMRRewriterOutputChecker, self).__init__(lambda f: ['diff', '-s', f + '.OMRRewritten', f + '.fixed'])