Exemple #1
0
 def __init__(self, program, isa, os, recompile=False):
     make_dir = joinpath('test-progs', program)
     make_fixture = MakeFixture(make_dir)
     target = joinpath('bin', isa, os, program)
     super(TestProgram, self).__init__(target, make_fixture)
     self.path = joinpath(make_dir, target)
     self.recompile = recompile
Exemple #2
0
    def __init__(self, path, program, **kwargs):
        """
        path: string
            The path to the directory containing the binary relative to
            $GEM5_BASE/tests
        program: string
            The name of the binary file
        """
        super(DownloadedProgram, self).__init__("download-" + program,
                                                build_once=True, **kwargs)

        self.program_dir = path
        relative_path = joinpath(self.program_dir, program)
        self.url = self.urlbase + relative_path
        self.path = os.path.realpath(
                        joinpath(absdirpath(__file__), '../', relative_path)
                    )
    def __init__(self, path, program, **kwargs):
        """
        path: string
            The path to the directory containing the binary relative to
            $GEM5_BASE/tests
        program: string
            The name of the binary file
        """
        super(DownloadedProgram, self).__init__("download-" + program,
                                                build_once=True,
                                                **kwargs)

        self.program_dir = path
        relative_path = joinpath(self.program_dir, program)
        self.url = self.urlbase + relative_path
        self.path = os.path.realpath(
            joinpath(absdirpath(__file__), '../', relative_path))
Exemple #4
0
    def __init__(self, isa, variant):
        target = joinpath(isa.upper(), 'gem5.%s' % variant)
        super(Gem5Fixture, self).__init__(target)

        self.name = constants.gem5_binary_fixture_name
        self.path = self.target
        self.isa = isa
        self.variant = variant
Exemple #5
0
    def test(self, params):
        fixtures = params.fixtures
        # Get the file from the tempdir of the test.
        tempdir = fixtures[constants.tempdir_fixture_name].path

        for fname in self.filenames:
            if self.parse_file(joinpath(tempdir, fname)):
                return  # Success

        test_util.fail('Could not match regex.')
Exemple #6
0
    def test(self, params):
        fixtures = params.fixtures
        # Get the file from the tempdir of the test.
        tempdir = fixtures[constants.tempdir_fixture_name].path

        def parse_file(fname):
            with open(fname, 'r') as file_:
                for line in file_:
                    for regex in self.regex:
                        if re.match(regex, line):
                            return True

        if self.match_stdout:
            if parse_file(joinpath(tempdir, constants.gem5_simulation_stdout)):
                return  # Success
        if self.match_stderr:
            if parse_file(joinpath(tempdir, constants.gem5_simulation_stderr)):
                return  # Success
        test.fail('Could not match regex.')
Exemple #7
0
    def test(self, params):
        fixtures = params.fixtures
        # Get the file from the tempdir of the test.
        tempdir = fixtures[constants.tempdir_fixture_name].path

        def parse_file(fname):
            with open(fname, 'r') as file_:
                for line in file_:
                    for regex in self.regex:
                        if re.match(regex, line):
                            return True
        if self.match_stdout:
            if parse_file(joinpath(tempdir,
                                   constants.gem5_simulation_stdout)):
                return # Success
        if self.match_stderr:
            if parse_file(joinpath(tempdir,
                                   constants.gem5_simulation_stderr)):
                return # Success
        self.failed(fixtures)
        test.fail('Could not match regex.')
Exemple #8
0
    def test(self, params):
        # We need a tempdir fixture from our parent verifier suite.
        fixtures = params.fixtures
        # Get the file from the tempdir of the test.
        tempdir = fixtures[constants.tempdir_fixture_name].path
        self.test_filename = joinpath(tempdir, self.test_filename)

        diff = diff_out_file(self.standard_filename,
                             self.test_filename,
                             ignore_regexes=self.ignore_regex,
                             logger=params.log)
        if diff is not None:
            test.fail('Stdout did not match:\n%s\nSee %s for full results' %
                      (diff, tempdir))
Exemple #9
0
    def _init(self, url, path, filename, **kwargs):
        """
        url: string
            The url of the archive
        path: string
            The absolute path of the directory containing the archive
        filename: string
            The name of the archive
        """

        self.url = url
        self.path = path
        self.filename = joinpath(path, filename)
        self.name = "Downloaded:" + self.filename
Exemple #10
0
    def __init__(self, isa, variant, protocol=None):
        if protocol:
            # When specifying an non-default protocol, we have to make a
            # separate scons invocation with specific parameters. However, if
            # more than one tests needs the same target, we need to make sure
            # that we don't call scons too many times.
            target_dir = isa.upper()+'-'+protocol
            target = joinpath(target_dir, 'gem5.%s' % variant)
            if target_dir in self.other_invocations.keys():
                invocation = self.other_invocations[target_dir]
            else:
                options = ['PROTOCOL='+protocol, '--default='+isa.upper()]
                invocation = SConsFixture(options=options)
                globalfixture(invocation)
                Gem5Fixture.other_invocations[target_dir] = invocation
        else:
            target = joinpath(isa.upper(), 'gem5.%s' % variant)
            invocation = None # use default
        super(Gem5Fixture, self).__init__(target, invocation=invocation)

        self.name = constants.gem5_binary_fixture_name
        self.path = self.target
        self.isa = isa
        self.variant = variant
    def __init__(self, isa, variant, protocol=None):
        if protocol:
            # When specifying an non-default protocol, we have to make a
            # separate scons invocation with specific parameters. However, if
            # more than one tests needs the same target, we need to make sure
            # that we don't call scons too many times.
            target_dir = isa.upper() + '-' + protocol
            target = joinpath(target_dir, 'gem5.%s' % variant)
            if target_dir in self.other_invocations.keys():
                invocation = self.other_invocations[target_dir]
            else:
                options = ['PROTOCOL=' + protocol, '--default=' + isa.upper()]
                invocation = SConsFixture(options=options)
                globalfixture(invocation)
                Gem5Fixture.other_invocations[target_dir] = invocation
        else:
            target = joinpath(isa.upper(), 'gem5.%s' % variant)
            invocation = None  # use default
        super(Gem5Fixture, self).__init__(target, invocation=invocation)

        self.name = constants.gem5_binary_fixture_name
        self.path = self.target
        self.isa = isa
        self.variant = variant
Exemple #12
0
    def test(self, params):
        # We need a tempdir fixture from our parent verifier suite.
        fixtures = params.fixtures
        # Get the file from the tempdir of the test.
        tempdir = fixtures[constants.tempdir_fixture_name].path
        self.test_filename = joinpath(tempdir, self.test_filename)

        diff = diff_out_file(self.standard_filename,
                            self.test_filename,
                            ignore_regexes=self.ignore_regex,
                            logger=params.log)
        if diff is not None:
            self.failed(fixtures)
            test.fail('Stdout did not match:\n%s\nSee %s for full results'
                      % (diff, tempdir))
Exemple #13
0
    def _init(self, url, path, filename, gzip_decompress=False, **kwargs):
        """
        url: string
            The url of the archive
        path: string
            The absolute path of the directory containing the archive
        filename: string
            The name of the archive
        gzip_decompress: boolean
            True if this target resource have been compressed using gzip and
            is to be decompressed prior to usage.
        """

        self.url = url
        self.path = path
        self.filename = joinpath(path, filename)
        self.name = "Downloaded:" + self.filename
        self.gzip_decompress = gzip_decompress
Exemple #14
0
 def __new__(cls, url, path, filename, gzip_decompress=False):
     target = joinpath(path, filename)
     return super(DownloadedProgram, cls).__new__(cls, target)
Exemple #15
0
 def test(self, params):
     tempdir = params.fixtures[constants.tempdir_fixture_name].path
     h5_file = joinpath(tempdir, self.stats_file)
     if not os.path.isfile(h5_file):
         test_util.fail('Could not find h5 stats file %s', h5_file)
Exemple #16
0
 def __new__(cls, url, path, filename):
     target = joinpath(path, filename)
     return super(DownloadedProgram, cls).__new__(cls, target)