示例#1
0
def showSingleRun(maker, ex, extraArgs = ''):
  if isinstance(ex, list):
    exampleName = os.path.splitext(os.path.basename(ex[0]))[0]
    exampleDir  = os.path.dirname(ex[0])
  else:
    exampleName = os.path.splitext(os.path.basename(ex))[0]
    exampleDir  = os.path.dirname(ex)
  objDir        = maker.getObjDir(exampleName)
  executable    = os.path.join(objDir, exampleName)
  paramKey      = os.path.join(os.path.relpath(exampleDir, maker.petscDir), os.path.basename(executable))
  if paramKey in builder.regressionRequirements:
    if not builder.regressionRequirements[paramKey].issubset(packageNames):
      raise RuntimeError('This test requires packages: %s' % builder.regressionRequirements[paramKey])
  params = builder.regressionParameters.get(paramKey, {})
  if not params:
    params = builder.getRegressionParameters(maker, exampleDir).get(paramKey, {})
    maker.logPrint('Makefile params '+strparams)
  if not isinstance(params, list):
    params = [params]
  for testnum, param in enumerate(params):
    if 'num' in param: testnum = param['num']
    if not args.testnum is None and testnum != args.testnum: continue
    if not 'args' in param: param['args'] = ''
    param['args'] += extraArgs
    print(str(testnum)+':  '+maker.getTestCommand(executable, **param))
  return 0
示例#2
0
def showSingleRun(maker, ex, extraArgs=''):
    if isinstance(ex, list):
        exampleName = os.path.splitext(os.path.basename(ex[0]))[0]
        exampleDir = os.path.dirname(ex[0])
    else:
        exampleName = os.path.splitext(os.path.basename(ex))[0]
        exampleDir = os.path.dirname(ex)
    objDir = maker.getObjDir(exampleName)
    executable = os.path.join(objDir, exampleName)
    paramKey = os.path.join(os.path.relpath(exampleDir, maker.petscDir),
                            os.path.basename(executable))
    if paramKey in builder.regressionRequirements:
        if not builder.regressionRequirements[paramKey].issubset(packageNames):
            raise RuntimeError('This test requires packages: %s' %
                               builder.regressionRequirements[paramKey])
    params = builder.regressionParameters.get(paramKey, {})
    if not params:
        params = builder.getRegressionParameters(maker,
                                                 exampleDir).get(paramKey, {})
        maker.logPrint('Makefile params ' + strparams)
    if not isinstance(params, list):
        params = [params]
    for testnum, param in enumerate(params):
        if 'num' in param: testnum = param['num']
        if not args.testnum is None and testnum != args.testnum: continue
        if not 'args' in param: param['args'] = ''
        param['args'] += extraArgs
        print(str(testnum) + ':  ' + maker.getTestCommand(executable, **param))
    return 0
示例#3
0
def checkSingleRun(maker, ex, replace, extraArgs=''):
    import shutil

    if isinstance(ex, list):
        exampleName = os.path.splitext(os.path.basename(ex[0]))[0]
        exampleDir = os.path.dirname(ex[0])
    else:
        exampleName = os.path.splitext(os.path.basename(ex))[0]
        exampleDir = os.path.dirname(ex)
    objDir = maker.getObjDir(exampleName)
    if os.path.isdir(objDir): shutil.rmtree(objDir)
    os.mkdir(objDir)
    executable = os.path.join(objDir, exampleName)
    paramKey = os.path.join(os.path.relpath(exampleDir, maker.petscDir),
                            os.path.basename(executable))
    if paramKey in builder.regressionRequirements:
        if not builder.regressionRequirements[paramKey].issubset(packageNames):
            raise RuntimeError('This test requires packages: %s' %
                               builder.regressionRequirements[paramKey])
    params = builder.regressionParameters.get(paramKey, {})
    if not params:
        params = builder.getRegressionParameters(maker,
                                                 exampleDir).get(paramKey, {})
        print 'Makefile params', params
    if not isinstance(params, list):
        params = [params]
    # NOTE: testnum will be wrong for single tests, just push fixes to PETSc
    rebuildTest = True
    numtests = 1 if args.testnum is not None else len(params)
    maker.logPrint('Running %d tests\n' % (numtests, ),
                   debugSection='screen',
                   forceScroll=True)
    for testnum, param in enumerate(params):
        if 'num' in param: testnum = param['num']
        if not args.testnum is None and testnum != args.testnum: continue
        if 'setup' in param:
            print(param['setup'])
            os.system('python ' + param['setup'])
            rebuildTest = True
        if 'source' in param:
            if not isinstance(ex, list):
                ex = [ex] + param['source']
            else:
                ex = ex + param['source']
        if rebuildTest:
            objects = maker.buildFile(ex, objDir)
            if not len(objects):
                print('TEST BUILD FAILED (check make.log for details)')
                return 1
            maker.link(executable, objects,
                       maker.configInfo.languages.clanguage)
        if not 'args' in param: param['args'] = ''
        param['args'] += extraArgs
        if maker.runTest(exampleDir, executable, testnum, replace, **param):
            print('TEST RUN FAILED (check make.log for details)')
            return 1
        rebuildTest = False
    if not args.retain and os.path.isdir(objDir): shutil.rmtree(objDir)
    return 0
示例#4
0
def checkSingleRun(maker, ex, replace, extraArgs = ''):
  import shutil

  if isinstance(ex, list):
    exampleName = os.path.splitext(os.path.basename(ex[0]))[0]
    exampleDir  = os.path.dirname(ex[0])
  else:
    exampleName = os.path.splitext(os.path.basename(ex))[0]
    exampleDir  = os.path.dirname(ex)
  objDir        = maker.getObjDir(exampleName)
  if os.path.isdir(objDir): shutil.rmtree(objDir)
  os.mkdir(objDir)
  executable  = os.path.join(objDir, exampleName)
  paramKey    = os.path.join(os.path.relpath(exampleDir, maker.petscDir), os.path.basename(executable))
  if paramKey in builder.regressionRequirements:
    if not builder.regressionRequirements[paramKey].issubset(packageNames):
      raise RuntimeError('This test requires packages: %s' % builder.regressionRequirements[paramKey])
  params = builder.regressionParameters.get(paramKey, {})
  if not params:
    params = builder.getRegressionParameters(maker, exampleDir).get(paramKey, {})
    print 'Makefile params',params
  if not isinstance(params, list):
    params = [params]
  # NOTE: testnum will be wrong for single tests, just push fixes to PETSc
  rebuildTest = True
  numtests = 1 if args.testnum is not None else len(params)
  maker.logPrint('Running %d tests\n' % (numtests,), debugSection='screen', forceScroll=True)
  for testnum, param in enumerate(params):
    if 'num' in param: testnum = param['num']
    if not args.testnum is None and testnum != args.testnum: continue
    if 'setup' in param:
      print(param['setup'])
      os.system('python '+param['setup'])
      rebuildTest = True
    if 'source' in param:
      if not isinstance(ex, list):
        ex = [ex]+param['source']
      else:
        ex = ex+param['source']
    if rebuildTest:
      objects = maker.buildFile(ex, objDir)
      if not len(objects):
        print('TEST BUILD FAILED (check make.log for details)')
        return 1
      maker.link(executable, objects, maker.configInfo.languages.clanguage)
    if not 'args' in param: param['args'] = ''
    param['args'] += extraArgs
    if maker.runTest(exampleDir, executable, testnum, replace, **param):
      print('TEST RUN FAILED (check make.log for details)')
      return 1
    rebuildTest = False
  if not args.retain and os.path.isdir(objDir): shutil.rmtree(objDir)
  return 0
示例#5
0
def showSingleRun(maker, ex, extraArgs=''):
    packageNames = set([p.name for p in maker.framework.packages])
    if isinstance(ex, list):
        exampleName = os.path.splitext(os.path.basename(ex[0]))[0]
        exampleDir = os.path.dirname(ex[0])
    else:
        exampleName = os.path.splitext(os.path.basename(ex))[0]
        exampleDir = os.path.dirname(ex)
    objDir = maker.getObjDir(exampleName)
    executable = os.path.join(objDir, exampleName)
    paramKey = os.path.join(os.path.relpath(exampleDir, maker.petscDir),
                            os.path.basename(executable))
    params = builder.regressionParameters.get(paramKey, {})
    if not params:
        params = builder.getRegressionParameters(maker,
                                                 exampleDir).get(paramKey, {})
        maker.logPrint('Makefile params ' + str(params))
    if not isinstance(params, list):
        params = [params]
    # Process testnum
    if args.testnum is not None:
        if args.testnum[0] == '[':
            validTestnum = args.testnum[1:-1].split(',')
        else:
            validTestnum = [args.testnum]
        numtests = len(validTestnum)
    else:
        numtests = len(params)
    maker.logPrint('Running %d tests\n' % (numtests, ),
                   debugSection='screen',
                   forceScroll=True)
    for testnum, param in enumerate(params):
        testnum = str(testnum)
        if 'requires' in param:
            if not set(param['requires']).issubset(packageNames):
                maker.logPrint('Test %s requires packages %s\n' %
                               (testnum, param['requires']),
                               debugSection='screen',
                               forceScroll=True)
                continue
        if 'num' in param: testnum = param['num']
        if not args.testnum is None and not testnum in validTestnum: continue
        if not 'args' in param: param['args'] = ''
        param['args'] += extraArgs
        print(str(testnum) + ':  ' + maker.getTestCommand(executable, **param))
    return 0
示例#6
0
文件: builder2.py 项目: 00liujj/petsc
def showSingleRun(maker, ex, extraArgs = ''):
  packageNames = set([p.name for p in maker.framework.packages])
  if isinstance(ex, list):
    exampleName = os.path.splitext(os.path.basename(ex[0]))[0]
    exampleDir  = os.path.dirname(ex[0])
  else:
    exampleName = os.path.splitext(os.path.basename(ex))[0]
    exampleDir  = os.path.dirname(ex)
  objDir        = maker.getObjDir(exampleName)
  executable    = os.path.join(objDir, exampleName)
  paramKey      = os.path.join(os.path.relpath(exampleDir, maker.petscDir), os.path.basename(executable))
  params = builder.regressionParameters.get(paramKey, {})
  if not params:
    params = builder.getRegressionParameters(maker, exampleDir).get(paramKey, {})
    maker.logPrint('Makefile params '+str(params))
  if not isinstance(params, list):
    params = [params]
  # Process testnum
  if args.testnum is not None:
    if args.testnum[0] == '[':
      validTestnum = args.testnum[1:-1].split(',')
    else:
      validTestnum = [args.testnum]
    numtests = len(validTestnum)
  else:
    numtests = len(params)
  maker.logPrint('Running %d tests\n' % (numtests,), debugSection='screen', forceScroll=True)
  for testnum, param in enumerate(params):
    testnum = str(testnum)
    if 'requires' in param:
      if not set(param['requires']).issubset(packageNames):
        maker.logPrint('Test %s requires packages %s\n' % (testnum, param['requires']), debugSection='screen', forceScroll=True)
        continue
    if 'num' in param: testnum = param['num']
    if not args.testnum is None and not testnum in validTestnum: continue
    if not 'args' in param: param['args'] = ''
    param['args'] += extraArgs
    print(str(testnum)+':  '+maker.getTestCommand(executable, **param))
  return 0
示例#7
0
def checkSingleRun(maker, ex, replace, extraArgs='', isRegression=False):
    import shutil

    packageNames = set([p.name for p in maker.framework.packages])
    if isinstance(ex, list):
        exampleName = os.path.splitext(os.path.basename(ex[0]))[0]
        exampleDir = os.path.dirname(ex[0])
    else:
        exampleName = os.path.splitext(os.path.basename(ex))[0]
        exampleDir = os.path.dirname(ex)
    objDir = maker.getObjDir(exampleName)
    if os.path.isdir(objDir): shutil.rmtree(objDir)
    os.mkdir(objDir)
    executable = os.path.join(objDir, exampleName)
    paramKey = os.path.join(os.path.relpath(exampleDir, maker.petscDir),
                            os.path.basename(executable))
    params = builder.regressionParameters.get(paramKey, {})
    if not params:
        params = builder.getRegressionParameters(maker,
                                                 exampleDir).get(paramKey, {})
        if params:
            maker.logPrint('Retrieved test options from makefile: %s\n' %
                           (str(params), ))
    if isRegression and not params:
        return
    if not isinstance(params, list):
        params = [params]
    # Process testnum
    if args.testnum is not None:
        if args.testnum[0] == '[':
            validTestnum = args.testnum[1:-1].split(',')
        elif args.testnum[0] == '@':
            import re
            validTestnum = [
                str(num) if key is None else key for num, key in enumerate(
                    map(lambda p: p.get('num', None), params))
                if re.match(args.testnum[1:],
                            str(num) if key is None else key)
            ]
        else:
            validTestnum = [args.testnum]
        numtests = len(validTestnum)
    else:
        numtests = len(params)
    rebuildTest = True
    maker.logPrint('Running %d tests\n' % (numtests, ),
                   debugSection='screen',
                   forceScroll=True)
    for testnum, param in enumerate(params):
        testnum = str(testnum)
        if 'requires' in param:
            reqs = param['requires']
            if not isinstance(reqs, list):
                reqs = [reqs]
            if not set(reqs).issubset(packageNames):
                maker.logPrint('Test %s requires packages %s\n' %
                               (testnum, reqs),
                               debugSection='screen',
                               forceScroll=True)
                continue
        if 'num' in param: testnum = param['num']
        if 'numProcs' in args and not args.numProcs is None:
            param['numProcs'] = args.numProcs
        if not args.testnum is None and not testnum in validTestnum: continue
        if 'setup' in param:
            print(param['setup'])
            os.system(sys.executable + ' ' + param['setup'])
            rebuildTest = True
        if 'source' in param:
            if not isinstance(ex, list):
                ex = [ex] + param['source']
            else:
                ex = ex + param['source']
        # TODO: Fix this hack
        if ex[-1] == 'F':
            linkLanguage = 'FC'
        else:
            linkLanguage = maker.configInfo.languages.clanguage
        if rebuildTest:
            objects = maker.buildFile(ex, objDir)
            if not len(objects):
                print('TEST BUILD FAILED (check example.log for details)')
                return 1
            maker.link(executable, objects, linkLanguage)
        if not 'args' in param: param['args'] = ''
        param['args'] += extraArgs
        if maker.runTest(exampleDir, executable, testnum, replace, **param):
            print('TEST RUN FAILED (check example.log for details)')
            return 1
        rebuildTest = False
    if not args.retain and os.path.isdir(objDir): shutil.rmtree(objDir)
    return 0
示例#8
0
文件: builder2.py 项目: hansec/petsc
def checkSingleRun(maker, ex, replace, extraArgs = '', isRegression = False):
  import shutil

  packageNames = set([p.name for p in maker.framework.packages])
  if isinstance(ex, list):
    exampleName = os.path.splitext(os.path.basename(ex[0]))[0]
    exampleDir  = os.path.dirname(ex[0])
  else:
    exampleName = os.path.splitext(os.path.basename(ex))[0]
    exampleDir  = os.path.dirname(ex)
  objDir        = maker.getObjDir(exampleName)
  if os.path.isdir(objDir): shutil.rmtree(objDir)
  os.mkdir(objDir)
  executable  = os.path.join(objDir, exampleName)
  paramKey    = os.path.join(os.path.relpath(exampleDir, maker.petscDir), os.path.basename(executable))
  if paramKey in builder.regressionRequirements:
    if not builder.regressionRequirements[paramKey].issubset(packageNames):
      raise RuntimeError('This test requires packages: %s' % builder.regressionRequirements[paramKey])
  params = builder.regressionParameters.get(paramKey, {})
  if not params:
    params = builder.getRegressionParameters(maker, exampleDir).get(paramKey, {})
    if params: maker.logPrint('Retrieved test options from makefile: %s\n' % (str(params),))
  if isRegression and not params:
    return
  if not isinstance(params, list):
    params = [params]
  # Process testnum
  if args.testnum is not None:
    if args.testnum[0] == '[':
      testnum = args.testnum[1:-1].split(',')
    else:
      testnum = [args.testnum]
    numtests = len(testnum)
  else:
    numtests = len(params)
  rebuildTest = True
  maker.logPrint('Running %d tests\n' % (numtests,), debugSection='screen', forceScroll=True)
  for testnum, param in enumerate(params):
    testnum = str(testnum)
    if 'num' in param: testnum = param['num']
    if not args.testnum is None and not testnum in str(args.testnum): continue
    if 'setup' in param:
      print(param['setup'])
      os.system(sys.executable+' '+param['setup'])
      rebuildTest = True
    if 'source' in param:
      if not isinstance(ex, list):
        ex = [ex]+param['source']
      else:
        ex = ex+param['source']
    if rebuildTest:
      objects = maker.buildFile(ex, objDir)
      if not len(objects):
        print('TEST BUILD FAILED (check make.log for details)')
        return 1
      maker.link(executable, objects, maker.configInfo.languages.clanguage)
    if not 'args' in param: param['args'] = ''
    param['args'] += extraArgs
    if maker.runTest(exampleDir, executable, testnum, replace, **param):
      print('TEST RUN FAILED (check make.log for details)')
      return 1
    rebuildTest = False
  if not args.retain and os.path.isdir(objDir): shutil.rmtree(objDir)
  return 0
示例#9
0
def checkSingleRun(maker, ex, replace, extraArgs = '', isRegression = False):
  import shutil

  packageNames = set([p.name for p in maker.framework.packages])
  if isinstance(ex, list):
    exampleName = os.path.splitext(os.path.basename(ex[0]))[0]
    exampleDir  = os.path.dirname(ex[0])
  else:
    exampleName = os.path.splitext(os.path.basename(ex))[0]
    exampleDir  = os.path.dirname(ex)
  objDir        = maker.getObjDir(exampleName)
  if os.path.isdir(objDir): shutil.rmtree(objDir)
  os.mkdir(objDir)
  executable  = os.path.join(objDir, exampleName)
  paramKey    = os.path.join(os.path.relpath(exampleDir, maker.petscDir), os.path.basename(executable))
  params = builder.regressionParameters.get(paramKey, {})
  if not params:
    params = builder.getRegressionParameters(maker, exampleDir).get(paramKey, {})
    if params: maker.logPrint('Retrieved test options from makefile: %s\n' % (str(params),))
  if isRegression and not params:
    return
  if not isinstance(params, list):
    params = [params]
  # Process testnum
  if args.testnum is not None:
    if args.testnum[0] == '[':
      validTestnum = args.testnum[1:-1].split(',')
    elif args.testnum[0] == '@':
      import re
      validTestnum = [str(num) if key is None else key for num,key in enumerate(map(lambda p: p.get('num', None), params)) if re.match(args.testnum[1:], str(num) if key is None else key)]
    else:
      validTestnum = [args.testnum]
    numtests = len(validTestnum)
  else:
    numtests = len(params)
  rebuildTest = True
  maker.logPrint('Running %d tests\n' % (numtests,), debugSection='screen', forceScroll=True)
  for testnum, param in enumerate(params):
    testnum = str(testnum)
    if 'requires' in param:
      reqs = param['requires']
      if not isinstance(reqs,list):
        reqs = [reqs]
      if not set(reqs).issubset(packageNames):
        maker.logPrint('Test %s requires packages %s\n' % (testnum, reqs), debugSection='screen', forceScroll=True)
        continue
    if 'num' in param: testnum = param['num']
    if 'numProcs' in args and not args.numProcs is None:
      param['numProcs'] = args.numProcs
    if not args.testnum is None and not testnum in validTestnum: continue
    if 'setup' in param:
      print(param['setup'])
      os.system(sys.executable+' '+param['setup'])
      rebuildTest = True
    if 'source' in param:
      if not isinstance(ex, list):
        ex = [ex]+param['source']
      else:
        ex = ex+param['source']
    # TODO: Fix this hack
    if ex[-1] == 'F':
      linkLanguage = 'FC'
    else:
      linkLanguage = maker.configInfo.languages.clanguage
    if rebuildTest:
      objects = maker.buildFile(ex, objDir)
      if not len(objects):
        print('TEST BUILD FAILED (check example.log for details)')
        return 1
      maker.link(executable, objects, linkLanguage)
    if not 'args' in param: param['args'] = ''
    param['args'] += extraArgs
    if maker.runTest(exampleDir, executable, testnum, replace, **param):
      print('TEST RUN FAILED (check example.log for details)')
      return 1
    rebuildTest = False
  if not args.retain and os.path.isdir(objDir): shutil.rmtree(objDir)
  return 0