コード例 #1
0
def extractTestedRequirements(args, data):
    # Here we will use the TestHarness to find all of the
    # test files where we can look for tested requirements.
    # Assume SQA docs are located in <MOOSE_DIR>/framework/doc/sqa
    test_app_name = args.application_name
    test_app_dir = os.path.join(args.application_path)

    #### TODO
    # figure out a cleaner way to set this up
    # If test_app_name is framework, we need to reword some things
    if test_app_name == 'framework':
        test_app_name = 'moose_test'
        test_app_dir = os.path.join(args.moose_dir, 'test')

    # Set the current working directory to test_app_dir
    saved_cwd = os.getcwd()
    os.chdir(test_app_dir)

    sys.path.append(os.path.join(args.moose_dir, 'python'))
    import path_tool
    path_tool.activate_module('TestHarness')

    from TestHarness import TestHarness
    from Tester import Tester

    # Build the TestHarness object here
    harness = TestHarness([], test_app_name, args.moose_dir)

    # Tell it to parse the test files only, not run them
    harness.findAndRunTests(find_only=True)

    # Now retrieve all of the accumlated Testers from the TestHarness warehouse
    testers = harness.warehouse.getAllObjects()
    for tester in testers:
        print tester.specs['test_name']
        input_filename = tester.getInputFile()
        if input_filename == None:
            continue

        input_path = os.path.join(tester.specs['test_dir'], input_filename)
        if not os.path.isfile(input_path):
            continue

        # Read the MOOSE input file
        f = open(os.path.join(tester.specs['test_dir'], tester.getInputFile()))
        text = f.read()
        f.close()

        # See if the file maps to a requirement (e.g. @Requirement)
        for req in re.finditer(r'@Requirement\s+([\w\.]+)', text):
            requirement = req.group(1)
            if requirement not in data:
                print 'Unable to find referenced requirement "' + requirement + '" in ' + input_path
            else:
                data[requirement][2].add(
                    os.path.relpath(input_path, args.moose_dir))

    os.chdir(saved_cwd)
コード例 #2
0
def extractTestedRequirements(args, data):
    # Here we will use the TestHarness to find all of the
    # test files where we can look for tested requirements.
    # Assume SQA docs are located in <MOOSE_DIR>/framework/doc/sqa
    test_app_name = args.application_name
    test_app_dir = os.path.join(args.application_path)

    #### TODO
    # figure out a cleaner way to set this up
    # If test_app_name is framework, we need to reword some things
    if test_app_name == 'framework':
        test_app_name = 'moose_test'
        test_app_dir = os.path.join(args.moose_dir, 'test')

    # Set the current working directory to test_app_dir
    saved_cwd = os.getcwd()
    os.chdir(test_app_dir)

    sys.path.append(os.path.join(args.moose_dir, 'python'))
    import path_tool
    path_tool.activate_module('TestHarness')

    from TestHarness import TestHarness
    from Tester import Tester

    # Build the TestHarness object here
    harness = TestHarness([], test_app_name, args.moose_dir)

    # Tell it to parse the test files only, not run them
    harness.findAndRunTests(find_only=True)

    # Now retrieve all of the accumlated Testers from the TestHarness warehouse
    testers = harness.warehouse.getAllObjects()
    for tester in testers:
        print tester.specs['test_name']
        input_filename = tester.getInputFile()
        if input_filename == None:
            continue

        input_path = os.path.join(tester.specs['test_dir'], input_filename)
        if not os.path.isfile(input_path):
            continue

        # Read the MOOSE input file
        f = open(os.path.join(tester.specs['test_dir'], tester.getInputFile()))
        text = f.read()
        f.close()

        # See if the file maps to a requirement (e.g. @Requirement)
        for req in re.finditer(r'@Requirement\s+([\w\.]+)', text):
            requirement = req.group(1)
            if requirement not in data:
                print 'Unable to find referenced requirement "' + requirement + '" in ' + input_path
            else:
                data[requirement][2].add(os.path.relpath(input_path, args.moose_dir))

    os.chdir(saved_cwd)
コード例 #3
0
ファイル: tracability_matrix.py プロジェクト: bggaston/moose
def extractTestedRequirements(data):
  # Here we will use the TestHarness to find all of the
  # test files where we can look for tested requirements.
  # Assume SQA docs are located in <MOOSE_DIR>/framework/doc/sqa
  MOOSE_DIR = os.path.abspath(os.path.join('..', '..', '..'))
  #### See if MOOSE_DIR is already in the environment instead
  if os.environ.has_key("MOOSE_DIR"):
    MOOSE_DIR = os.environ['MOOSE_DIR']

  test_app_name = 'moose_test'
  test_app_dir = os.path.join(MOOSE_DIR, 'test')

  # Set the current working directory to test_app_dir
  saved_cwd = os.getcwd()
  os.chdir(test_app_dir)

  sys.path.append(os.path.join(MOOSE_DIR, 'python'))
  import path_tool
  path_tool.activate_module('TestHarness')

  from TestHarness import TestHarness
  from Tester import Tester

  # Build the TestHarness object here
  harness = TestHarness(sys.argv, test_app_name, MOOSE_DIR)
  # Tell it to parse the test files only, not run them
  harness.findAndRunTests(find_only=True)

  # Now retrieve all of the accumlated Testers from the TestHarness warehouse
  testers = harness.warehouse.getAllObjects()

  for tester in testers:
    print tester.specs['test_name']
    input_filename = tester.getInputFile()
    if input_filename == None:
      continue

    input_path = os.path.join(tester.specs['test_dir'], input_filename)
    if not os.path.isfile(input_path):
      continue

    # Read the MOOSE input file
    f = open(os.path.join(tester.specs['test_dir'], tester.getInputFile()))
    text = f.read()
    f.close()

    # See if the file maps to a requirement (e.g. @Requirement)
    m = re.search(r'@Requirement\s+([\w\.]+)', text)
    if m != None:
      requirement = m.group(1)
      if requirement not in data:
        print 'Unable to find referenced requirement "' + requirement + '" in ' + input_path
      else:
        data[requirement][2].add(os.path.relpath(input_path, MOOSE_DIR))

  os.chdir(saved_cwd)
コード例 #4
0
ファイル: Job.py プロジェクト: nikhilgv91/moose_nikhil
    pathname = os.path.abspath(pathname)

# Add the utilities/python_getpot directory
MOOSE_DIR = os.path.abspath(os.path.join(pathname, '../'))
FRAMEWORK_DIR = os.path.abspath(os.path.join(pathname, '../../', 'framework'))
#### See if MOOSE_DIR is already in the environment instead
if os.environ.has_key("MOOSE_DIR"):
    MOOSE_DIR = os.environ['MOOSE_DIR']
    FRAMEWORK_DIR = os.path.join(MOOSE_DIR, 'framework')
if os.environ.has_key("FRAMEWORK_DIR"):
    FRAMEWORK_DIR = os.environ['FRAMEWORK_DIR']

# Import the TestHarness and Helper functions from the MOOSE toolkit
sys.path.append(os.path.join(MOOSE_DIR, 'python'))
import path_tool
path_tool.activate_module('TestHarness')
path_tool.activate_module('FactorySystem')


class Job(object):
    def validParams():
        params = InputParameters()
        params.addRequiredParam(
            'type', "The type of test of Tester to create for this test.")
        params.addParam('template_script',
                        MOOSE_DIR + '/python/ClusterLauncher/pbs_submit.sh',
                        "The template job script to use.")
        params.addParam('job_name', 'The name of the job')
        params.addParam('test_name', 'None', 'The name of the test')
        return params
コード例 #5
0
ファイル: TestHarness.py プロジェクト: liuwenf/moose
import os, sys, re, inspect, types, errno, pprint, subprocess, io, shutil, time, copy
import path_tool

path_tool.activate_module('FactorySystem')

import ParseGetPot
from socket import gethostname
#from options import *
from util import *
from RunParallel import RunParallel
from CSVDiffer import CSVDiffer
from XMLDiffer import XMLDiffer
from Tester import Tester
from PetscJacobianTester import PetscJacobianTester
from InputParameters import InputParameters
from Factory import Factory
from Parser import Parser
from Warehouse import Warehouse

import argparse
from optparse import OptionParser, OptionGroup, Values
from timeit import default_timer as clock

class TestHarness:

  @staticmethod
  def buildAndRun(argv, app_name, moose_dir):
    if '--store-timing' in argv:
      harness = TestTimer(argv, app_name, moose_dir)
    else:
      harness = TestHarness(argv, app_name, moose_dir)
コード例 #6
0
ファイル: Job.py プロジェクト: ChaliZhg/moose
  pathname = os.path.abspath(pathname)

# Add the utilities/python_getpot directory
MOOSE_DIR = os.path.abspath(os.path.join(pathname, '../../'))
FRAMEWORK_DIR = os.path.abspath(os.path.join(pathname, '../../', 'framework'))
#### See if MOOSE_DIR is already in the environment instead
if os.environ.has_key("MOOSE_DIR"):
  MOOSE_DIR = os.environ['MOOSE_DIR']
  FRAMEWORK_DIR = os.path.join(MOOSE_DIR, 'framework')
if os.environ.has_key("FRAMEWORK_DIR"):
  FRAMEWORK_DIR = os.environ['FRAMEWORK_DIR']

# Import the TestHarness and Helper functions from the MOOSE toolkit
sys.path.append(os.path.join(MOOSE_DIR, 'python'))
import path_tool
path_tool.activate_module('TestHarness')
path_tool.activate_module('FactorySystem')

class Job(object):
  def validParams():
    params = InputParameters()
    params.addRequiredParam('type', "The type of test of Tester to create for this test.")
    params.addParam('template_script', FRAMEWORK_DIR + '/scripts/ClusterLauncher/pbs_submit.sh', "The template job script to use.")
    params.addParam('job_name', 'The name of the job')
    params.addParam('test_name', 'The name of the test')
    return params
  validParams = staticmethod(validParams)

  def __init__(self, name, params):
    self.specs = params
コード例 #7
0
import os, sys, re, inspect, types, errno, pprint, subprocess, io, shutil, time, copy
import path_tool

path_tool.activate_module('FactorySystem')
path_tool.activate_module('argparse')

from ParseGetPot import ParseGetPot
from socket import gethostname
#from options import *
from util import *
from RunParallel import RunParallel
from CSVDiffer import CSVDiffer
from XMLDiffer import XMLDiffer
from Tester import Tester
from PetscJacobianTester import PetscJacobianTester
from InputParameters import InputParameters
from Factory import Factory
from Parser import Parser
from Warehouse import Warehouse

import argparse
from optparse import OptionParser, OptionGroup, Values
from timeit import default_timer as clock

class TestHarness:

  @staticmethod
  def buildAndRun(argv, app_name, moose_dir):
    if '--store-timing' in argv:
      harness = TestTimer(argv, app_name, moose_dir)
    else:
コード例 #8
0
#!/usr/bin/env python
import unittest
import path_tool

path_tool.activate_module('TestHarness')
from util import *


class TestUtils(unittest.TestCase):
    def testRerverseReachability1(self):
        r = ReverseReachability()

        r.insertDependency('f', ['d'])
        r.insertDependency('e', ['d'])
        r.insertDependency('d', ['b'])
        r.insertDependency('c', ['b'])
        r.insertDependency('b', ['a'])

        all_sets = r.getReverseReachabilitySets()
        self.assertEqual(all_sets['a'], set(['b', 'c', 'd', 'e', 'f']))
        self.assertEqual(all_sets['b'], set(['c', 'd', 'e', 'f']))
        self.assertEqual(all_sets['c'], set())
        self.assertEqual(all_sets['d'], set(['e', 'f']))
        self.assertEqual(all_sets['e'], set())
        self.assertEqual(all_sets['f'], set())

    def testRerverseReachability2(self):
        r = ReverseReachability()

        r.insertDependency('c', ['a'])
        r.insertDependency('a', ['b'])
コード例 #9
0
ファイル: cluster_launcher.py プロジェクト: IoannisSt/moose
  pathname = os.path.abspath(pathname)

# Add the utilities/python_getpot directory
MOOSE_DIR = os.path.abspath(os.path.join(pathname, '../../'))
FRAMEWORK_DIR = os.path.abspath(os.path.join(pathname, '../../', 'framework'))
#### See if MOOSE_DIR is already in the environment instead
if os.environ.has_key("MOOSE_DIR"):
  MOOSE_DIR = os.environ['MOOSE_DIR']
  FRAMEWORK_DIR = os.path.join(MOOSE_DIR, 'framework')
if os.environ.has_key("FRAMEWORK_DIR"):
  FRAMEWORK_DIR = os.environ['FRAMEWORK_DIR']

# Import the TestHarness and Helper functions from the MOOSE toolkit
sys.path.append(os.path.join(MOOSE_DIR, 'python'))
import path_tool
path_tool.activate_module('TestHarness')
sys.path.append(os.path.join(FRAMEWORK_DIR, 'scripts', 'ClusterLauncher'))

import ParseGetPot
from InputParameters import InputParameters
from Factory import Factory
from PBSJob import PBSJob

# Default file to read if only a directory is supplied
job_list = 'job_list'

def getNextDirName(file_name, files):
  largest_serial_num = 0

  for name in files:
    m = re.search(file_name + '_(\d{3})', name)
コード例 #10
0
ファイル: TestHarness.py プロジェクト: rogermue/moose
import os, sys, re, inspect, types, errno, pprint, subprocess, io, shutil, time, copy
import path_tool

path_tool.activate_module("FactorySystem")
path_tool.activate_module("argparse")

from ParseGetPot import ParseGetPot
from socket import gethostname

# from options import *
from util import *
from RunParallel import RunParallel
from CSVDiffer import CSVDiffer
from XMLDiffer import XMLDiffer
from Tester import Tester
from PetscJacobianTester import PetscJacobianTester
from InputParameters import InputParameters
from Factory import Factory
from Parser import Parser
from Warehouse import Warehouse

import argparse
from optparse import OptionParser, OptionGroup, Values
from timeit import default_timer as clock


class TestHarness:
    @staticmethod
    def buildAndRun(argv, app_name, moose_dir):
        if "--store-timing" in argv:
            harness = TestTimer(argv, app_name, moose_dir)