Esempio n. 1
0
    def run(self):
        tmp = Wdir('tmp_')

        # Compile all the sources.  This method will not work if there are
        # sources that are not in the "." directory, but since executabes are
        # processed next, there will be an error if not all sources are
        # compiled.
        project = gprfor(self.sources, srcdirs=[".."], main_cargs=self.options)
        gprbuild(project, gargs=["-bargs", "-z"])

        # If requested, check at least one non statement SCO in alis
        if self.ensure_dcscos:
            for ali in self.alis:
                thistest.fail_if(not match('^C[^S ]', ali, re.MULTILINE),
                                 "couldn't find non-statement SCO in %s" % ali)

        # Run xcov map-routines and check absence of errors
        mapoutput = do(
            maybe_valgrind([
                XCOV,
                'map-routines',
                '-v',
                '--scos=@{}'.format(list_to_file(self.alis)),
            ] + self.execs))

        maperrors = [
            str(m) for m in re.findall(r"(\*\*\*|\!\!\!)(.*)", mapoutput)
        ]

        thistest.log('\n'.join(maperrors))
        thistest.fail_if(
            maperrors,
            "expect no map-routines error for %s" % ", ".join(self.sources))

        tmp.to_homedir()
Esempio n. 2
0
    def check(self):

        nmatches = len (self.matches)

        0 and thistest.log (
            "--\nChecking %s:\n" % str(self)
            + "pattern = '%s', nexpected = %d, nmatches = %d\n"
               % (self.pattern, self.nexpected, nmatches)
            + "pre = %s" % str (self.pre)
            )


        # Check that we have the number of expected matches

        thistest.fail_if (
            nmatches != self.nexpected,
            '%d matches of pattern "%s", != expected %d' % (
                nmatches, self.pattern, self.nexpected)
            )

        # If we expected matches, have some, and have an ordering
        # constraint specified, check it

        if self.nexpected > 0 and nmatches != 0 and self.pre:
            last_pre = self.pre.__last_match().lno
            first_self = self.__first_match().lno
            thistest.fail_if (
                last_pre > first_self,
                'first match for "%s" (%d) too early wrt predecessor "%s" (%d)'
                % (self.pattern, first_self,  self.pre.pattern, last_pre)
                )
Esempio n. 3
0
    def check(self):
        """
        Check expectations once we're done going through all the report lines.
        """
        nmatches = len(self.matches)

        0 and thistest.log(
            "--\nChecking {}:\n"
            "pattern = '{}', nexpected = {}, nmatches = {}\n"
            "pre = {}".format(self, self.pattern, self.nexpected, nmatches,
                              self.pre))

        # Punt if we don't have the number of expected matches
        if nmatches != self.nexpected:
            thistest.failed('On "{}", {} matches != expected {}'.format(
                self.pattern, nmatches, self.nexpected))
            return

        # If we expected matches, have some, and have an ordering
        # constraint specified, check it
        if self.nexpected > 0 and nmatches != 0 and self.pre:
            last_pre = self.pre.__last_match()
            first_self = self.__first_match()
            if not last_pre:
                thistest.failed(
                    'On "%s", absence of  match for predecessor "%s"' %
                    (self.pattern, self.pre.pattern))
            elif last_pre.lno > first_self.lno:
                thistest.failed(
                    'first match for "%s" too early wrt predecessor "%s"' %
                    (self.pattern, self.pre.pattern))
Esempio n. 4
0
    def check(self):

        nmatches = len (self.matches)

        0 and thistest.log (
            "--\nChecking %s:\n" % str(self)
            + "pattern = '%s', nexpected = %d, nmatches = %d\n"
               % (self.pattern, self.nexpected, nmatches)
            + "pre = %s" % str (self.pre)
            )

        # Punt if we don't have the number of expected matches

        if nmatches != self.nexpected:
            thistest.failed(
                'On "%s", %d matches != expected %d' % (
                    self.pattern, nmatches, self.nexpected))
            return

        # If we expected matches, have some, and have an ordering
        # constraint specified, check it

        if self.nexpected > 0 and nmatches != 0 and self.pre:
            last_pre = self.pre.__last_match()
            first_self = self.__first_match()
            if not last_pre:
                thistest.failed(
                    'On "%s", absence of  match for predecessor "%s"' % (
                        self.pattern, self.pre.pattern))
            elif last_pre.lno > first_self.lno:
                thistest.failed(
                    'first match for "%s" too early wrt predecessor "%s"' % (
                        self.pattern, self.pre.pattern))