Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# -------------------------------------------------------------------------------------------------- 

2# Copyright (c) Lukas Vik. All rights reserved. 

3# 

4# This file is part of the tsfpga project. 

5# https://tsfpga.com 

6# https://gitlab.com/tsfpga/tsfpga 

7# -------------------------------------------------------------------------------------------------- 

8 

9import os 

10import unittest 

11 

12import pytest 

13 

14from vunit import VUnitCLI 

15 

16from examples.simulate import setup_vunit_project 

17 

18 

19@pytest.mark.usefixtures("fixture_tmp_path") 

20class TestCompilation(unittest.TestCase): 

21 tmp_path = None 

22 

23 def setUp(self): 

24 self.old_environ = os.environ 

25 self.cli = VUnitCLI() 

26 self.argv = ["--compile", "--clean"] 

27 self.argv = ["--compile", "--clean", "--output-path", str(self.tmp_path)] 

28 self.args = self.cli.parse_args(argv=self.argv) 

29 self.args.vivado_skip = True 

30 

31 def tearDown(self): 

32 # Set old environment again 

33 os.environ = self.old_environ 

34 

35 def run_and_check_vunit_main(self): 

36 vunit_proj, _, _ = setup_vunit_project(self.args) 

37 with pytest.raises(SystemExit) as exit_code: 

38 vunit_proj.main() 

39 

40 assert exit_code.type == SystemExit 

41 assert exit_code.value.code == 0 

42 

43 def test_modelsim(self): 

44 os.environ["VUNIT_SIMULATOR"] = "modelsim" 

45 self.run_and_check_vunit_main() 

46 

47 def test_rivierapro(self): 

48 os.environ["VUNIT_SIMULATOR"] = "rivierapro" 

49 self.run_and_check_vunit_main()