Beispiel #1
0
    def mutate_population(self, new_population):
        mutated_population = []
        for i in range(len(new_population)):
            target_test_suite = new_population[i].additional
            if (random.random() < self.mutation_rate):
                new_test_suite = self.mutate_test_suite(target_test_suite)
                mutated_population.append(TestSuite(self.base, new_test_suite))
            else:
                mutated_population.append(
                    TestSuite(self.base, target_test_suite))

        return mutated_population
    def testSuite(self):
        suite = TestSuite()
        suite.addTest(WasRun("testMethod"))
        suite.addTest(WasRun("testBrokenMethod"))

        suite.run(self.result)
        assert("testBrokenMethod FAILED\n2 run, 1 failed" == self.result.summary())
Beispiel #3
0
 def initial_population(self):
     # Using Approach 1: randomly choosing from the greedy - test suite
     initial_population = []
     for i in range(self.population_num):
         gene = random.choices(self.greedy_suite,
                               k=self.budget - len(self.base))
         new_suite = TestSuite(self.base, gene)
         initial_population.append(new_suite)
     self.population = initial_population
Beispiel #4
0
 def findTestSuites(self):
     self.basepath = os.path.dirname(os.path.abspath(__file__))
     suitesdir = os.path.normpath(
         os.path.join(self.basepath, '../testsuites'))
     testsuites = [
         os.path.join(suitesdir, suite) for suite in os.listdir(suitesdir)
         if not suite.startswith('.svn')
     ]
     self.testsuites = [
         TestSuite(t) for t in testsuites if os.path.isdir(t)
     ]
Beispiel #5
0
def main():
    """
	A script to test how we are able to read and reproduce the mctal file structure. It reads the original mctal file into a binary object, generates another mctal file based on this object and then compares both files using GNU diffutils.
	Exit status is 0 if both files are the same, 1 if different.
	"""
    parser = argparse.ArgumentParser(
        description=main.__doc__,
        epilog="Homepage: https://github.com/kbat/mc-tools")
    parser.add_argument('-v',
                        '--verbose',
                        action='store_true',
                        default=False,
                        dest='verbosity',
                        help='explain what is being done')
    parser.add_argument('mctal', type=str, help='mctal file to use for test')

    arguments = parser.parse_args()

    m = MCTAL(arguments.mctal, arguments.verbosity)
    m.Read()

    t = TestSuite(m, arguments.verbosity)
    return t.Test()
Beispiel #6
0
    def next_generation(self):

        elite_num = int(self.population_num * 4 / 10)

        children_num = int(self.population_num * 4 / 10)

        random_children_num = self.population_num - elite_num - children_num

        sorted_population = sorted(
            self.population, key=lambda test_suite: test_suite.fitness_value)
        elite_children = sorted_population[self.population_num - elite_num:]
        print(sorted_population[-1].fitness_value)
        # for i in range(len(sorted_population)):
        #    print(sorted_population[i].fitness_value)

        children = []
        for i in range(children_num):
            [parent1, parent2] = self.select_parent()
            child = self.make_children(parent1, parent2)
            children.append(TestSuite(self.base, child))

        random_children = []
        for i in range(random_children_num):
            random_child = random.choice(self.population)
            random_children.append(random_child)

        new_population = elite_children + children + random_children

        mutated_population = self.mutate_population(new_population)

        #    print("previous generation")
        #    for i in range(len(self.population)):
        #        print(self.population[i].additional)
        #    print("next_generation")
        #    for i in range(len(self.population)):
        #        print(new_population[i].additional)

        self.population = mutated_population
 def testAddingTestCaseToTestSuite(self):
     suite = TestSuite();
     suite.addTestCase(WasRun);
     suite.run(self.result);
     assert("testBrokenMethod FAILED\n2 run, 1 failed" == self.result.summary())
def run_testcase_by_id(testcase_id, testplan='无计划'):
    try:
        testcase_info = mytestlink.getTestCase(testcase_id)  # 获取测试用例基本信息
        logger.info('获取测试用例信息 %s' % testcase_info)
    except Exception as e:
        logger.error('获取用例信息失败 %s,,暂停执行该用例' % e)
        return ('Fail', [('global_funtion_module', '获取用例信息失败 %s' % e)])
    # 获取用例所在套件和项目名称
    response = mytestlink.getFullPath([int(testcase_id)])
    response = response[str(testcase_id)]
    testsuite_name = ''
    for suit in response[1:]:
        testsuite_name = testsuite_name + '-' + suit
        testsuite_name = testsuite_name.lstrip('-')
    project_name = response[0]

    # 构造测试用例对象
    testcase_name = testcase_info[0]['name']
    testcase_steps = testcase_info[0]['steps']
    testcase_isactive = int(testcase_info[0]['active'])
    testcase_obj = TestCase(testcase_id, testcase_name, testcase_steps,
                            testcase_isactive, project_name)

    testsuite_id = int(testcase_info[0]['testsuite_id'])
    logger.info('正在读取套件[id=%s]的协议,host,端口配置...' % (testsuite_id))

    testsuite_info = mytestlink.getTestSuiteByID(testsuite_id)
    testsuite_name = testsuite_info['name']
    testsuite_details = other_tools.conver_date_from_testlink(
        testsuite_info['details'])
    project = mytestlink.getFullPath(testsuite_id)
    project = project[str(testsuite_id)][0]
    testsuite_obj = TestSuite(testsuite_id, testsuite_name, testsuite_details,
                              project)
    testsuite_conf = testsuite_obj.get_testsuite_conf()  # 获取套件基本信息
    if '' == testsuite_conf:
        logger.error('测试套件[id=%s ,name=%s]未配置协议,host,端口信息,暂时无法执行' %
                     (testsuite_id, testsuite_name))
        return ('Fail', [('golbal_function_module',
                          '测试套件[id=%s ,name=%s]未配置协议,host,端口信息,暂时无法执行' %
                          (testsuite_id, testsuite_name))])

    try:
        details = json.loads(testsuite_conf)
        protocol = details['protocol']
        host = details['host']
        port = details['port']
    except Exception as e:
        logger.error('测试套件[id=%s ,name=%s]协议,host,端口信息配置错误,未执行:%s' %
                     (testsuite_id, testsuite_name, e))
        return ('Fail', [('golbal_function_module',
                          '测试套件[id=%s ,name=%s]协议,host,端口信息配置错误,未执行:%s' %
                          (testsuite_id, testsuite_name, e))])

    # 构造http对象
    myhttp = MyHttp(protocol, host, port)

    try:
        sql_insert = 'INSERT INTO '+testcase_report_tb +'(executed_history_id, testcase_id, testcase_name, testsuit, testplan, project, runresult, runtime)' \
                                                        ' VALUES(%s, %s, %s, %s, %s, %s, %s, %s)'
        data = (executed_history_id, testcase_id, testcase_name,
                testsuite_name, testplan, project_name, 'Block',
                '0000-00-00 00:00:00')
        logger.info('记录测试用例到测试用例报表')
        testdb.execute_insert(sql_insert, data)

        logger.info('开始执行测试用例[id=%s,name=%s]' % (testcase_id, testcase_name))
        run_time = time.strftime('%Y-%m-%d %H:%M:%S',
                                 time.localtime())  # 记录运行时间
        testcase_run_result = testcase_obj.run_testcase(myhttp, testplan)

        logger.info('正在更新用例执行结果')
        sql_update = 'UPDATE '+testcase_report_tb +' SET runresult=\"%s\", runtime=\"%s\"' \
                                                   ' WHERE executed_history_id = %s and testcase_id = %s' \
                                                   ' AND project=\'%s\' AND testplan=\'%s\''
        data = (testcase_run_result[0], run_time, executed_history_id,
                testcase_id, project_name, testplan)
        testdb.execute_update(sql_update, data)

        logger.info('指定用例[%s]已执行完' % testcase_id)

        return testcase_run_result
    except Exception as e:
        logger.error('运行用例出错 %s' % e)
        return ('Fail', [('golbal_function_module', '%s' % e)])
Beispiel #9
0
#
#     CasADi is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with CasADi; if not, write to the Free Software
#     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
#
import sys
src = sys.argv[1]
import os
import shutil

from testsuite import TestSuite

t = TestSuite(
    dirname=src,
    suffix="m",
    command=lambda dir, fn, opt:
    ["matlab", "-nodisplay", "-nosplash", "-nodesktop", "-nojvm"] + opt,
    skipdirs=[".svn", "ctemplate", "defs"],
    inputs=lambda dir, fn: {fn: file(dir + "/" + fn, "r").read()},
    args=sys.argv[2:],
    stderr_trigger=["^(?!(Reference counting|Warning|$))"],
    check_depreciation=True)

t.run()
Beispiel #10
0
#     CasADi is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with CasADi; if not, write to the Free Software
#     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
#
import sys
src = sys.argv[1]
import os
import shutil

from testsuite import TestSuite

t = TestSuite(
    dirname=src,
    suffix="m",
    command=lambda dir, fn, opt: ["octave", "--no-gui", "--no-window-system"
                                  ] + opt,
    skipdirs=[".svn", "ctemplate", "defs"],
    inputs=lambda dir, fn:
    {fn: "graphics_toolkit('gnuplot');" + file(dir + "/" + fn, "r").read()},
    args=sys.argv[2:],
    stderr_trigger=["^(?!(Reference counting|warning|$))"],
    check_depreciation=True)

t.run()
Beispiel #11
0

def setdummybackend(dir):
    """
  Set the matplotlib backend to a dummy value, so that no graphs are generated.
  """
    shutil.copy('internal/pylab.py', dir)
    f = file(dir + '/matplotlibrc', 'w')
    f.write('backend : Template')
    f.close()


def removedummybackend(dir):
    if os.path.exists(dir + '/matplotlibrc'):
        os.remove(dir + '/matplotlibrc')
    if os.path.exists(dir + '/pylab.pyc'):
        os.remove(dir + '/pylab.pyc')
    if os.path.exists(dir + '/pylab.py'):
        os.remove(dir + '/pylab.py')


t = TestSuite(dirname=src,
              suffix="py",
              preRun=setdummybackend,
              postRun=removedummybackend,
              command=lambda dir, fn, opt: ["python", fn] + opt,
              skipdirs=[".svn", "ctemplate"],
              args=sys.argv[2:])

t.run()
Beispiel #12
0
import os
import shutil

from testsuite import TestSuite

iswindows = os.name == "nt"

if iswindows:
    t = TestSuite(
        dirname=src,
        suffix="m",
        command=lambda dir, fn, opt: [
            "matlab", "-nodisplay", "-nosplash", "-nodesktop", "-nojvm",
            "-logfile", fn + ".log", "-wait", "-r", "try," + fn[:-2] +
            ", disp('MATLABOKAY') , catch E , disp(getReport(E)), disp('MATLABERROR'), end;quit"
        ] + opt,
        skipdirs=[".svn", "ctemplate", "defs"],
        inputs=lambda dir, fn: {fn: file(dir + "/" + fn, "r").read()},
        args=sys.argv[2:],
        stdout_trigger=["MATLABOKAY"],
        custom_stdout=lambda dir, fn: file(dir + "/" + fn + ".log", "r").read(
        ),
        default_fail=True)
else:
    t = TestSuite(
        dirname=src,
        suffix="m",
        command=lambda dir, fn, opt: [
            "matlab", "-nodisplay", "-nosplash", "-nodesktop", "-nojvm", "-r",
            fn[:-2] + ";clear"
        ] + opt,
        assert ("1 run, 0 failed" == self.result.summary())

    def testFailedResultFormatting(self):
        result = TestResult()
        result.testStarted()
        result.testFailed()
        assert ("1 run, 1 failed" == result.summary())

    def testFailedResult(self):
        test = WasRun("testBrokenMethod")
        test.run(self.result)
        assert ("1 run, 1 failed" == self.result.summary())

    def testSuite(self):
        suite = TestSuite()
        suite.add(WasRun("testMethod"))
        suite.add(WasRun("testBrokenMethod"))
        suite.run(self.result)
        assert ("2 run, 1 failed" == self.result.summary())


suite = TestSuite()
suite.add(TestCaseTest("testTemplateMethod"))
suite.add(TestCaseTest("testResult"))
suite.add(TestCaseTest("testFailedResultFormatting"))
suite.add(TestCaseTest("testFailedResult"))
suite.add(TestCaseTest("testSuite"))
result = TestResult()
suite.run(result)
print result.summary()
Beispiel #14
0
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with CasADi; if not, write to the Free Software
#     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
#

import sys

src = sys.argv[1]
import os

from testsuite import TestSuite

path = os.getcwd() + '/../build/lib'
if 'CASADILIBDIR' in os.environ:
    path = os.environ['CASADILIBDIR']

t = TestSuite(dirname=src,
              suffix="m",
              command=lambda dir, fn, opt:
              ["octave", '--no-init-file', '-p', path, fn] + opt,
              skipdirs=[".svn", "ctemplate"],
              allowable_returncodes=[127],
              stderr_trigger=["error"],
              args=sys.argv[2:])

t.run()
Beispiel #15
0
#
#     CasADi is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with CasADi; if not, write to the Free Software
#     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
#
import sys
src = sys.argv[1]
import os
import shutil

from testsuite import TestSuite

    
t = TestSuite(dirname=src,
  suffix="m",
  command = lambda dir,fn, opt:  ["matlab","-nodisplay","-nosplash","-nodesktop","-nojvm"] + opt,
  skipdirs=[".svn","ctemplate"],
   inputs = lambda dir,fn : {fn: file(dir + "/" + fn,"r").read()},
    args=sys.argv[2:],
   stderr_trigger=["Error(?! unsubscribing to signals)",r"\?\?\?"],
   check_depreciation=True
   )
  
t.run()

    def testSuite(self):
        suite = TestSuite()
        suite.addTest(WasRun("testMethod"))
        suite.addTest(WasRun("testBrokenMethod"))

        suite.run(self.result)
        assert("testBrokenMethod FAILED\n2 run, 1 failed" == self.result.summary())

    def testTearDownRunsAfterFailedTest(self):
        self.brokenTest.run(self.result)
        assert("setUp|testBrokenMethod|tearDown|" == self.brokenTest.log)

    def testSetUpFailIsReported(self):
        self.brokenSetup.run(self.result)
        assert("setUp FAILED\n0 run, 0 failed" == self.result.summary())

    def testAddingTestCaseToTestSuite(self):
        suite = TestSuite();
        suite.addTestCase(WasRun);
        suite.run(self.result);
        assert("testBrokenMethod FAILED\n2 run, 1 failed" == self.result.summary())


suite = TestSuite()
suite.addTestCase(TestCaseTest)
result = TestResult()
suite.run(result)
print result.summary()
Beispiel #17
0
def main():
    parser = argparse.ArgumentParser()

    parser.add_argument(
        "test_directory",
        help="The directory where the toolchain tests are located.")

    parser.add_argument("-v",
                        "--verbose",
                        action="store_true",
                        help="Print verbose output")
    parser.add_argument(
        "-j",
        "--jobs",
        type=int,
        default=int(os.cpu_count() / 2),
        help=
        "Number of threads to use for parallel execution (defaults to half of the system max)",
    )
    parser.add_argument("-t",
                        "--tests",
                        default="all",
                        help="Test/Testsuite to run (defaults to all)")
    parser.add_argument(
        "--format",
        choices=("human", "xunit"),
        default="human",
        help="Format of the test output (defaults to human)",
    )
    parser.add_argument(
        "--cdt",
        default=get_cdt_path(),
        help="Path to CDT (defaults to built CDT in this repo)",
    )

    args = parser.parse_args()

    P.verbose = args.verbose

    abs_test_directory = os.path.abspath(args.test_directory)

    temp_dir = tempfile.mkdtemp()

    P.print(f"Temp files will be written to {temp_dir}", verbose=True)

    os.chdir(temp_dir)

    test_directories: List[str] = []

    for f in os.listdir(abs_test_directory):
        abs_f = os.path.join(abs_test_directory, f)

        if os.path.isdir(abs_f):
            test_directories.append(abs_f)

    test_suites = list(map(lambda d: TestSuite(d, args.cdt), test_directories))

    start = timer()
    test_runner = TestRunner(test_suites, args.tests, args.jobs)
    test_results = test_runner.run_tests()
    end = timer()

    if args.format == "human":
        failures = print_test_results(test_results, end - start)
    else:
        failures = print_test_results_machine(test_results, end - start)

    if failures:
        sys.exit(1)

    sys.exit(0)
Beispiel #18
0
#     You should have received a copy of the GNU Lesser General Public
#     License along with CasADi; if not, write to the Free Software
#     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
#
import sys
src = sys.argv[1]
import os

"""
Test cpp files that are made with CMAKE and put in the /build/bin directory
"""

from testsuite import TestSuite

from subprocess import *

t = TestSuite(dirname=src,
  suffix="cpp",
  command = lambda dir,fn,opt:  ['./bin/'+fn.replace('.cpp','')]+opt,
  workingdir = lambda dir: '../build',
  skipdirs=[".svn","ctemplate"],
  args=sys.argv[2:]
  )

t.run()




Beispiel #19
0
def doit():
    path = sys.argv[1]
    ts = TestSuite(path)
    ts.run()
Beispiel #20
0
import sys
src = sys.argv[1]
import os

from testsuite import TestSuite

from subprocess import *

print "Compiling"
p=Popen(['make', 'cpp'],cwd=src,stdout=PIPE, stderr=PIPE)
stdoutdata, stderrdata = p.communicate()
if p.returncode==0:
  print "Done compiling"
else:
  print stdoutdata
  print stderrdata
  raise Exception("Was unable to compile.")

t = TestSuite(dirname=src,
  suffix="run",
  command = lambda dir,fn,opt:  ['./'+fn]+opt,
  skipdirs=[".svn","ctemplate"],
    args=sys.argv[2:]
  )

t.run()




Beispiel #21
0
 def __init__(self, debug, config_file):
     TestSuite.__init__(self, debug, config_file)
Beispiel #22
0
        logger.info('已获取配置的套件id列表:%s' % testsuits_id_list)

        testsuits_id_list = eval(testsuits_id_list)
        for testsuite_id in testsuits_id_list:
            # 构造测试套件对象
            try:
                testsuite_info = mytestlink.getTestSuiteByID(testsuite_id)
            except Exception as e:
                logger.error('测试套件[id=%s]不存在,暂时无法执行' % testsuite_id)
                continue

            testsuite_name = testsuite_info['name']
            testsuite_details = other_tools.conver_date_from_testlink(testsuite_info['details'])
            project = mytestlink.getFullPath(testsuite_id)
            project = project[str(testsuite_id)][0]
            testsuite_obj = TestSuite(testsuite_id, testsuite_name, testsuite_details, project)

            logger.info('正在读取套件[id=%s,name=%s]的协议,host,端口配置...' % (testsuite_id, testsuite_name))
            testsuite_conf = testsuite_obj.get_testsuite_conf()  # 获取套件基本信息
            testsuite_conf = other_tools.conver_date_from_testlink(testsuite_conf)
            if '' == testsuite_conf:
                logger.error('测试套件[id=%s ,name=%s]未配置协议,host,端口信息,暂时无法执行' % (testsuite_id, testsuite_name))
                continue

            try:
                details = json.loads(testsuite_conf)
                protocol = details['protocol']
                host = details['host']
                port = details['port']
            except Exception as e:
                logger.error('测试套件[id=%s ,name=%s]协议,host,端口信息配置错误,未执行:%s'% (testsuite_id, testsuite_name, e))
Beispiel #23
0
#     CasADi is free software; you can redistribute it and/or
#     modify it under the terms of the GNU Lesser General Public
#     License as published by the Free Software Foundation; either
#     version 3 of the License, or (at your option) any later version.
#
#     CasADi is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with CasADi; if not, write to the Free Software
#     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
#
import sys
src = sys.argv[1]
import os

from testsuite import TestSuite

from subprocess import *

t = TestSuite(dirname=src,
              workingdir=lambda dir: os.path.join(dir, '..'),
              command=lambda dir, fn, opt: ['bin/' + fn] + opt,
              inputs={'det_minor': "5"},
              args=sys.argv[2:])

t.run()
Beispiel #24
0
        logger.info('已获取配置的套件id列表:%s' % testsuits_id_list)

        for testsuite_id in testsuits_id_list:
            # 构造测试套件对象
            try:
                testsuite_info = mytestlink.getTestSuiteByID(testsuite_id)
            except Exception as e:
                logger.error('测试套件[id=%s]不存在,暂时无法执行' % testsuite_id)
                continue

            testsuite_name = testsuite_info['name']
            testsuite_details = other_tools.conver_date_from_testlink(
                testsuite_info['details'])
            project = mytestlink.getFullPath(testsuite_id)
            project_name = project[str(testsuite_id)][0]
            testsuite_obj = TestSuite(testsuite_id, testsuite_name,
                                      testsuite_details, project_name)

            logger.info('正在执行测试套件[id=%s ,name=%s]' %
                        (testsuite_id, testsuite_name))
            # 构造http对象
            if project_name in project_httpobj_dict.keys():
                myhttp = project_httpobj_dict[project_name]
            else:
                myhttp = get_http_conf_of_project(project_name)
                if not myhttp:
                    logger.critical('套件所在项目配置存在问题,跳过执行该套件')
                    continue
            testsuite_obj.run_testsuite(myhttp)

    elif 4 == run_mode:
        logger.info('运行指定用例……')
    exclude_file = args['-e']
if '-l' in args:
    list_only = True
if '-q' in args:
    quiet = True
if '-t' in args:
    threads = int(args['-t'])
if '-p' in args:
    procs = int(args['-p'])
    
tests = testsuite.find_testcases(recursive)
if len(tests) == 0:
    print 'Error: no testcases were found.'
    sys.exit(1)

suite = TestSuite(' '.join(sys.argv), tests=tests)
if exclude_file is not None:
    try:
        names = [ n.lstrip().rstrip() for n in open(exclude_file, 'r').read().lstrip().rstrip().split('\n') ]
        suite.remove_tests(names)
    except OSError as e:
        print 'Warning: an error occurred while parsing the exclude file'
        print e
        
if list_only:
    base = ''
    if recursive and len(tests) > 1:
        base = '%s/' % os.getcwd()
        print 'Base Directory: %s\n' % base

    suite.print_tests(base)
 def testSuite(self):
     suite = TestSuite()
     suite.add(WasRun("testMethod"))
     suite.add(WasRun("testBrokenMethod"))
     suite.run(self.result)
     assert ("2 run, 1 failed" == self.result.summary())
Beispiel #27
0
  """
  #shutil.copy('internal/pylab.py',dir)
  f=open(dir+'/matplotlibrc','w')
  f.write('backend : Template')
  f.close()

def removedummybackend(dir):
  if os.path.exists(dir+'/matplotlibrc'):
    os.remove(dir+'/matplotlibrc')
  if os.path.exists(dir+'/pylab.pyc'):
    os.remove(dir+'/pylab.pyc')
  if os.path.exists(dir+'/pylab.py'):
    os.remove(dir+'/pylab.py')

python = "python"

if "WITH_PYTHON3" in os.environ:
  python = "python3"

t = TestSuite(dirname=src,
  suffix="py",
  preRun=setdummybackend,
  postRun=removedummybackend,
  command = lambda dir,fn, opt:  [python,"-W","error::SyntaxWarning","-W","error:This CasADi:DeprecationWarning", fn] + opt,
  stdout_must_have = ["STATUS_RAN_ALL_TESTS"],
  skipdirs=[".svn","ctemplate"],
    args=sys.argv[2:]
  )

t.run()
Beispiel #28
0
#
#     CasADi is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with CasADi; if not, write to the Free Software
#     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
#
import sys
src = sys.argv[1]
import os
import shutil

from testsuite import TestSuite


t = TestSuite(dirname=src,
  suffix="m",
  command = lambda dir,fn, opt:  ["octave","--no-gui","--no-window-system"] + opt,
  skipdirs=[".svn","ctemplate","defs"],
   inputs = lambda dir,fn : {fn: file(dir + "/" + fn,"r").read()},
    args=sys.argv[2:],
   stderr_trigger=["^(?!(Reference counting|warning|$))"],
   check_depreciation=True
   )

t.run()
Beispiel #29
0
#     CasADi is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with CasADi; if not, write to the Free Software
#     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
#
import sys

src = sys.argv[1]
import os
import shutil

from testsuite import TestSuite

t = TestSuite(
    dirname=src,
    suffix="m",
    command=lambda dir, fn, opt:
    ["matlab", "-nodisplay", "-nosplash", "-nodesktop", "-nojvm"] + opt,
    skipdirs=[".svn", "ctemplate"],
    inputs=lambda dir, fn: {fn: file(dir + "/" + fn, "r").read()},
    args=sys.argv[2:],
    stderr_trigger=["Error", r"\?\?\?"],
)

t.run()