Beispiel #1
0
def do_auxiliary():
    """Generates an auxiliary f90 file with an interface to save all the user-derived
    type variables referenced anywhere in the code.
    """
    from os import path
    from fortpy.testing.auxiliary import generate
    codedir = path.abspath(path.expanduser(args["codedir"]))
    parser = _get_parser(codedir)

    complist = _get_compilers()
    for c in complist:
        generate(parser, codedir, args["stagedir"], c, debug=(not args["nodebug"]),
                 profile=args["profile"], strict=args["strict"], docompile=args["compileaux"])
Beispiel #2
0
    def runall(self, compiler=None):
        """Compiles and runs each new or modified unit test executable.
        After the run is complete, the outcomes are checked for consistency.

        :arg compiler: the name of the compiler in 'compilers.xml' to use.
        """
        #We will likely need a file comparer for the outcomes testing
        self.comparer = FileComparer(self.fortpy_templates,
                                     self.compare_templates)

        if self._written:
            self.set_compiler(compiler)

            from fortpy.testing.compilers import replace
            from fortpy.testing.auxiliary import generate
            from fortpy.utility import symlink
            from fortpy.code import config
            #Run them each individually and return a dictionary of all the
            #test results
            result = {}
            fpyauxs = []
            for composite_id in self.tgenerator.tests_to_run:
                identifier, testid = composite_id.split("|")
                #Compile and copy fpy_auxiliary if it isn't in the identifiers directory yet.
                source = path.join(self.libraryroot(identifier), identifier)
                target = replace(source + ".[c]", self.compiler)
                if not path.isdir(target):
                    from os import mkdir
                    mkdir(target)
                if self.writer(
                        identifier).autoclass and identifier not in fpyauxs:
                    code, success, fpytarget = generate(
                        self.parser, self._codefolder,
                        self.libraryroot(identifier), self.compiler,
                        self.debug, self.profile, self.strict)
                    sopath = path.join(fpytarget, "fpy_aux.so")
                    sotarget = path.join(target, "fpy_aux.so")
                    mpath = path.join(fpytarget, "fpy_auxiliary.mod")
                    mtarget = path.join(target, "fpy_auxiliary.mod")
                    symlink(sopath, sotarget)
                    symlink(mpath, mtarget)
                    fpyauxs.append(identifier)

                oneresult = self._run_single(identifier, testid, source)
                if oneresult is not None:
                    result[composite_id] = oneresult

            return result
        else:
            msg.warn(
                "you can't run tests until the executables have been written. Exiting."
            )
            return None
Beispiel #3
0
    def runall(self, compiler=None):
        """Compiles and runs each new or modified unit test executable.
        After the run is complete, the outcomes are checked for consistency.

        :arg compiler: the name of the compiler in 'compilers.xml' to use.
        """
        #We will likely need a file comparer for the outcomes testing
        self.comparer = FileComparer(self.fortpy_templates, self.compare_templates)

        if self._written:
            self.set_compiler(compiler)

            from fortpy.testing.compilers import replace
            from fortpy.testing.auxiliary import generate
            from fortpy.utility import symlink
            from fortpy.code import config
            #Run them each individually and return a dictionary of all the
            #test results
            result = {}
            fpyauxs= []            
            for composite_id in self.tgenerator.tests_to_run:
                identifier, testid = composite_id.split("|")
                #Compile and copy fpy_auxiliary if it isn't in the identifiers directory yet.
                source = path.join(self.libraryroot(identifier), identifier)
                target = replace(source + ".[c]", self.compiler)
                if not path.isdir(target):
                    from os import mkdir
                    mkdir(target)
                if self.writer(identifier).autoclass and identifier not in fpyauxs:
                    code, success, fpytarget = generate(self.parser, self._codefolder,
                                                        self.libraryroot(identifier), self.compiler,
                                                        self.debug, self.profile, self.strict)
                    sopath = path.join(fpytarget, "fpy_aux.so")
                    sotarget = path.join(target, "fpy_aux.so")
                    mpath = path.join(fpytarget, "fpy_auxiliary.mod")
                    mtarget = path.join(target, "fpy_auxiliary.mod")
                    symlink(sopath, sotarget)
                    symlink(mpath, mtarget)
                    fpyauxs.append(identifier)
                
                oneresult = self._run_single(identifier, testid, source)
                if oneresult is not None:
                    result[composite_id] = oneresult

            return result
        else:
            msg.warn("you can't run tests until the executables have been written. Exiting.")
            return None