Example #1
0
def initialize():
    from fortpy.msg import set_quiet
    set_quiet(args["quiet"])
    
    t = UnitTester(args["stagedir"], args["verbose"], args["templates"], args["fortpy"],
                   args["rerun"], debug=(not args["nodebug"]), profile=args["profile"])

    complist = []
    if args["compiler"] and args["compiler"] != "*":
        complist.append(args["compiler"])
    elif args["compiler"] == "*":
        from fortpy.testing.compilers import compilers
        for c in compilers:
            complist.append(c)
    else:
        complist.append("gfortran")

    #We only have to write the testing folder once; it gets copied for all
    #the remaining tests that need to be run for different compilers.
    t.writeall(args["codedir"])

    for c in complist:
        result = t.runall(c)
        print("")

        for idk in result:
            totaltime = result[idk].totaltime
            if totaltime is not None:
                timestr = "{0:.4f}".format(totaltime*1000)
            else:
                timestr = "<untimed>"
            print_result(idk, result[idk].percent, timestr, result[idk].common)
Example #2
0
def do_testing():
    """Runs the unit tests for all the modules in the code directory."""
    from fortpy.msg import set_quiet
    from fortpy.testing.tester import UnitTester
    set_quiet(args["quiet"])

    t = UnitTester(args["stagedir"],
                   args["verbose"],
                   args["templates"],
                   args["fortpy"],
                   args["rerun"],
                   debug=(not args["nodebug"]),
                   profile=args["profile"],
                   strict=args["strict"],
                   quiet=args["quiet"])

    #We only have to write the testing folder once; it gets copied for all
    #the remaining tests that need to be run for different compilers.
    t.writeall(args["codedir"])

    complist = _get_compilers()
    for c in complist:
        result = t.runall(c)
        print("")

        for idk in result:
            totaltime = result[idk].totaltime
            if totaltime is not None:
                timestr = "{0:.4f}".format(totaltime * 1000)
            else:
                timestr = "<untimed>"
            print_result(idk, result[idk].percent, timestr, result[idk].common)
Example #3
0
def do_testing():
    """Runs the unit tests for all the modules in the code directory."""
    from fortpy.msg import set_quiet
    from fortpy.testing.tester import UnitTester
    set_quiet(args["quiet"])
    
    t = UnitTester(args["stagedir"], args["verbose"], args["templates"], args["fortpy"],
                   args["rerun"], debug=(not args["nodebug"]), profile=args["profile"],
                   strict=args["strict"], quiet=args["quiet"])

    #We only have to write the testing folder once; it gets copied for all
    #the remaining tests that need to be run for different compilers.
    t.writeall(args["codedir"])

    complist = _get_compilers()
    for c in complist:
        result = t.runall(c)
        print("")

        for idk in result:
            totaltime = result[idk].totaltime
            if totaltime is not None:
                timestr = "{0:.4f}".format(totaltime*1000)
            else:
                timestr = "<untimed>"
            print_result(idk, result[idk].percent, timestr, result[idk].common)
Example #4
0
def do_testing(args):
    """Runs the unit tests for all the modules in the code directory."""
    from os import path
    if not path.isdir(args["codedir"]):
        msg.err("The source code directory '{}' does not exist.".format(
            args["codedir"]))
        exit(2)

    from fortpy.msg import set_quiet
    from fortpy.testing.tester import UnitTester
    set_quiet(args["quiet"])

    t = UnitTester(args["stagedir"],
                   args["verbose"],
                   args["templates"],
                   args["fortpy"],
                   args["rerun"],
                   debug=(not args["nodebug"]),
                   profile=args["profile"],
                   strict=args["strict"],
                   quiet=args["quiet"],
                   nprocs=args["nprocs"])

    #We only have to write the testing folder once; it gets copied for all
    #the remaining tests that need to be run for different compilers.
    t.writeall(args["codedir"])

    complist = _get_compilers()
    totalperc = 0
    totaltest = 0
    msg.info("Running for compilers: {}".format(', '.join(complist)))
    for c in complist:
        result = t.runall(c)
        print("")

        for idk in result:
            totaltime = result[idk].totaltime
            if totaltime is not None:
                timestr = "{0:.4f}".format(totaltime * 1000)
            else:
                timestr = "<untimed>"
            print_result(idk, result[idk].percent, timestr, result[idk].common,
                         c)
            totalperc += result[idk].percent
            totaltest += 1

    #This section for exit codes helps the continuous integration server to know what's
    #going on with all the test results.
    if totaltest == 0 and totalperc == 0:
        _exit_code(0, "No Tests")
    else:
        score = totalperc / totaltest

    print("@CI: {0:.2%}".format(score))
    if score == 1.:
        _exit_code(0, "Success")
    elif score < 1.:
        _exit_code(4, "Failure")
    else:
        _exit_code(5, "Didn't Run")
Example #5
0
def do_testing(args):
    """Runs the unit tests for all the modules in the code directory."""
    from os import path
    if not path.isdir(args["codedir"]):
        msg.err("The source code directory '{}' does not exist.".format(args["codedir"]))
        exit(2)
    
    from fortpy.msg import set_quiet
    from fortpy.testing.tester import UnitTester
    set_quiet(args["quiet"])
    
    t = UnitTester(args["stagedir"], args["verbose"], args["templates"], args["fortpy"],
                   args["rerun"], debug=(not args["nodebug"]), profile=args["profile"],
                   strict=args["strict"], quiet=args["quiet"], nprocs=args["nprocs"])

    #We only have to write the testing folder once; it gets copied for all
    #the remaining tests that need to be run for different compilers.
    t.writeall(args["codedir"])

    complist = _get_compilers()
    totalperc = 0
    totaltest = 0
    msg.info("Running for compilers: {}".format(', '.join(complist)))
    for c in complist:
        result = t.runall(c)
        print("")

        for idk in result:
            totaltime = result[idk].totaltime
            if totaltime is not None:
                timestr = "{0:.4f}".format(totaltime*1000)
            else:
                timestr = "<untimed>"
            print_result(idk, result[idk].percent, timestr, result[idk].common, c)
            totalperc += result[idk].percent
            totaltest += 1

    #This section for exit codes helps the continuous integration server to know what's
    #going on with all the test results.
    if totaltest == 0 and totalperc == 0:
        _exit_code(0, "No Tests")
    else:
        score = totalperc/totaltest

    print("@CI: {0:.2%}".format(score))        
    if score == 1.:
        _exit_code(0, "Success")
    elif score < 1.:
        _exit_code(4, "Failure")
    else:
        _exit_code(5, "Didn't Run")
Example #6
0
def initialize():
    from fortpy.msg import set_quiet
    set_quiet(args["quiet"])

    t = UnitTester(args["stagedir"],
                   args["verbose"],
                   args["templates"],
                   args["fortpy"],
                   args["rerun"],
                   debug=(not args["nodebug"]),
                   profile=args["profile"])

    complist = []
    if args["compiler"] and args["compiler"] != "*":
        complist.append(args["compiler"])
    elif args["compiler"] == "*":
        from fortpy.testing.compilers import compilers
        for c in compilers:
            complist.append(c)
    else:
        complist.append("gfortran")

    #We only have to write the testing folder once; it gets copied for all
    #the remaining tests that need to be run for different compilers.
    t.writeall(args["codedir"])

    for c in complist:
        result = t.runall(c)
        print("")

        for idk in result:
            totaltime = result[idk].totaltime
            if totaltime is not None:
                timestr = "{0:.4f}".format(totaltime * 1000)
            else:
                timestr = "<untimed>"
            print_result(idk, result[idk].percent, timestr, result[idk].common)
Example #7
0
import os
import sys

sys.path.append("/Users/trunks/codes/fortpy-dist")
import fortpy
from fortpy.testing.tester import UnitTester

t = UnitTester("./tests/staging", False, "./tests/unittests/templates",
               "./fortpy/templates", "*")
t.parser.reparse(
    os.path.abspath("./tests/unittests/derivative_structure_generator.f90"))
t.writeall("./tests/unittests")
Example #8
0
import os
import sys

sys.path.append("/Users/trunks/codes/fortpy-dist")
import fortpy
from fortpy.testing.tester import UnitTester

t = UnitTester("./tests/staging", False, "./tests/unittests/templates", "./fortpy/templates",
               "*")
t.parser.reparse(os.path.abspath("./tests/unittests/derivative_structure_generator.f90"))
t.writeall("./tests/unittests")