Exemple #1
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014, Lars Asplund [email protected]

import unittest
from os.path import abspath, join, basename, dirname

from vunit.ui import VUnit
from common import has_modelsim


@unittest.skipUnless(has_modelsim(), 'Requires modelsim')
class TestLogging(unittest.TestCase):
    def run_sim(self, vhdl_standard):
        output_path = join(dirname(abspath(__file__)), 'logging_out')
        vhdl_path = join(dirname(abspath(__file__)), '..', 'vhdl', 'logging')
        ui = VUnit(clean=True,
                   output_path=output_path,
                   vhdl_standard=vhdl_standard,
                   compile_builtins=False)

        ui.add_builtins('vunit_lib', mock_lang=True)
        ui.enable_location_preprocessing()
        lib = ui.add_library('lib')
        lib.add_source_files(join(vhdl_path, "test", "tb_logging.vhd"))

        try:
            ui.main()
        except SystemExit as e:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014, Lars Asplund [email protected]

import unittest
from os.path import join, dirname
from common import has_modelsim, check_report
from subprocess import check_call, call
import sys

@unittest.skipUnless(has_modelsim(), "Requires modelsim")
class TestExampleProjects(unittest.TestCase):
    def setUp(self):
        self.output_path = join(dirname(__file__), "example_project_out")
        self.report_file = join(self.output_path, "xunit.xml")

    def test_uart_example_project(self):
        path = join(dirname(__file__), "..", "examples")
        check_call([sys.executable, join(path, "uart", "run.py"),
                    "--clean",
                    "--output-path=%s" % self.output_path,
                    "--xunit-xml=%s" % self.report_file])
        check_call([sys.executable, join(path, "uart", "run_with_preprocessing.py"),
                    "--clean",
                    "--output-path=%s" % self.output_path,
                    "--xunit-xml=%s" % self.report_file])

    def test_logging_example_project(self):
        path = join(dirname(__file__), "..", "examples", "logging")