Coverage for tests/klayout/lvs_runner_test.py: 54%

24 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2024-12-17 17:24 +0000

1# 

2# -------------------------------------------------------------------------------- 

3# SPDX-FileCopyrightText: 2024 Martin Jan Köhler and Harald Pretl 

4# Johannes Kepler University, Institute for Integrated Circuits. 

5# 

6# This file is part of KPEX  

7# (see https://github.com/martinjankoehler/klayout-pex). 

8# 

9# This program is free software: you can redistribute it and/or modify 

10# it under the terms of the GNU General Public License as published by 

11# the Free Software Foundation, either version 3 of the License, or 

12# (at your option) any later version. 

13# 

14# This program is distributed in the hope that it will be useful, 

15# but WITHOUT ANY WARRANTY; without even the implied warranty of 

16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

17# GNU General Public License for more details. 

18# 

19# You should have received a copy of the GNU General Public License 

20# along with this program. If not, see <http://www.gnu.org/licenses/>. 

21# SPDX-License-Identifier: GPL-3.0-or-later 

22# -------------------------------------------------------------------------------- 

23# 

24from __future__ import annotations 

25 

26import allure 

27import os 

28import tempfile 

29import unittest 

30 

31from klayout_pex.klayout.lvs_runner import LVSRunner 

32 

33 

34@allure.parent_suite("Unit Tests") 

35@allure.tag("LVS", "KLayout") 

36@unittest.skip # NOTE: this is relatively long running! 

37class Test(unittest.TestCase): 

38 @property 

39 def testdata_dir(self) -> str: 

40 return os.path.realpath(os.path.join(__file__, '..', '..', '..', 'testdata', 'klayout', 'lvs')) 

41 

42 def test_run_klayout_lvs(self): 

43 gds_path = os.path.join(self.testdata_dir, 'nmos_diode2', 'nmos_diode2.gds.gz') 

44 schematic_path = os.path.join(self.testdata_dir, 'nmos_diode2', 'nmos_diode2.spice') 

45 

46 tmp_dir = tempfile.mkdtemp(prefix="lvs_run_") 

47 log_path = os.path.join(tmp_dir, "out.log") 

48 lvsdb_path = os.path.join(tmp_dir, "out.lvsdb.gz") 

49 

50 # TODO! 

51 # lvs_script = os.path.join(os.environ['PDKPATH'], 'libs.tech', 'klayout', 'lvs', 'sky130.lvs') 

52 lvs_script = os.path.join(os.environ['HOME'], '.klayout', 'salt', 'sky130A_el', 

53 'lvs', 'core', 'sky130.lvs') 

54 

55 runner = LVSRunner() 

56 runner.run_klayout_lvs(exe_path="klayout", 

57 lvs_script=lvs_script, 

58 gds_path=gds_path, 

59 schematic_path=schematic_path, 

60 log_path=log_path, 

61 lvsdb_path=lvsdb_path) 

62 print(f"LVS log file: {log_path}") 

63 print(f"LVSDB file: {lvsdb_path}")