mirror of https://github.com/KLayout/klayout.git
Added smoke tests for streams in Python module
This commit is contained in:
parent
9e9f52d692
commit
3809e44777
|
|
@ -102,6 +102,7 @@ PYTHONTEST (dbLayoutTest, "dbLayoutTest.py")
|
|||
PYTHONTEST (dbRegionTest, "dbRegionTest.py")
|
||||
PYTHONTEST (dbShapesTest, "dbShapesTest.py")
|
||||
PYTHONTEST (dbReaders, "dbReaders.py")
|
||||
PYTHONTEST (dbStreams, "dbStreams.py")
|
||||
PYTHONTEST (dbPCellsTest, "dbPCells.py")
|
||||
PYTHONTEST (dbPolygonTest, "dbPolygonTest.py")
|
||||
PYTHONTEST (dbTransTest, "dbTransTest.py")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pcb-project>
|
||||
<invert-negative-layers>false</invert-negative-layers>
|
||||
<border>5000</border>
|
||||
<free-layer-mapping>true</free-layer-mapping>
|
||||
<layout-layers>
|
||||
<layout-layer>1/0</layout-layer>
|
||||
<layout-layer>2/0</layout-layer>
|
||||
</layout-layers>
|
||||
<mounting>top</mounting>
|
||||
<num-metal-layers>0</num-metal-layers>
|
||||
<num-via-types>0</num-via-types>
|
||||
<artwork-files>
|
||||
</artwork-files>
|
||||
<drill-files>
|
||||
</drill-files>
|
||||
<free-files>
|
||||
<free-file>
|
||||
<filename>test1.gbr</filename>
|
||||
<layout-layers>
|
||||
<index>0</index>
|
||||
</layout-layers>
|
||||
</free-file>
|
||||
<free-file>
|
||||
<filename>test2.gbr</filename>
|
||||
<layout-layers>
|
||||
<index>1</index>
|
||||
</layout-layers>
|
||||
</free-file>
|
||||
</free-files>
|
||||
<reference-points>
|
||||
</reference-points>
|
||||
<explicit-trans>r0 *1 0,0</explicit-trans>
|
||||
<layer-properties-file/>
|
||||
<num-circle-points>-1</num-circle-points>
|
||||
<merge-flag>false</merge-flag>
|
||||
<dbu>0.001</dbu>
|
||||
<cell-name>PCB</cell-name>
|
||||
</pcb-project>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
%FSLAX46Y46*%
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G01*
|
||||
%ADD10C,0.050000*%
|
||||
D10*
|
||||
%LPD*%
|
||||
G36*
|
||||
X0070000000Y0050000000D02*
|
||||
X0020000000Y0050000000D01*
|
||||
X0020000000Y0080000000D01*
|
||||
X0070000000Y0080000000D01*
|
||||
X0170000000Y0050000000D02*
|
||||
X0120000000Y0080000000D01*
|
||||
X0170000000Y0080000000D01*
|
||||
G37*
|
||||
M02*
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
%FSLAX46Y46*%
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G01*
|
||||
%ADD10C,0.050000*%
|
||||
D10*
|
||||
%LPD*%
|
||||
G36*
|
||||
X0070000000Y0050000000D02*
|
||||
X0070000000Y0050000000D01*
|
||||
X0020000000Y0050000000D01*
|
||||
X0020000000Y0080000000D01*
|
||||
X0070000000Y0080000000D01*
|
||||
G37*
|
||||
M02*
|
||||
|
|
@ -16,6 +16,7 @@ import dbPCells
|
|||
import dbLayoutTest
|
||||
import dbPolygonTest
|
||||
import dbReaders
|
||||
import dbStreams
|
||||
import dbRegionTest
|
||||
import dbTransTest
|
||||
import dbLayoutToNetlist
|
||||
|
|
@ -32,6 +33,7 @@ if __name__ == '__main__':
|
|||
unittest.TestLoader().loadTestsFromTestCase(dbLayoutTest.DBLayoutTest),
|
||||
unittest.TestLoader().loadTestsFromTestCase(dbPolygonTest.DBPolygonTests),
|
||||
unittest.TestLoader().loadTestsFromTestCase(dbReaders.DBReadersTests),
|
||||
unittest.TestLoader().loadTestsFromTestCase(dbStreams.DBStreamsTests),
|
||||
unittest.TestLoader().loadTestsFromTestCase(dbRegionTest.DBRegionTest),
|
||||
unittest.TestLoader().loadTestsFromTestCase(dbTransTest.DBTransTests),
|
||||
# aborts on Azure/MSVC pipeline with "src\tl\tl\tlThreadedWorkers.cc,259,! m_running", needs debugging:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
# encoding: UTF-8
|
||||
|
||||
# KLayout Layout Viewer
|
||||
# Copyright (C) 2006-2025 Matthias Koefferlein
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
import pya
|
||||
import unittest
|
||||
import sys
|
||||
import os
|
||||
|
||||
class DBStreamsTests(unittest.TestCase):
|
||||
|
||||
# Full-spin read-write tests
|
||||
# This test is rather a smoke test
|
||||
def rw_test(self, format):
|
||||
|
||||
ly = pya.Layout()
|
||||
cell = ly.create_cell("TOP")
|
||||
l1 = ly.layer(1, 0)
|
||||
cell.shapes(l1).insert(pya.Box(0, 0, 1000, 2000))
|
||||
cell.shapes(l1).insert(pya.Box(-100, -200, 2000, 1000))
|
||||
bbox = cell.bbox()
|
||||
|
||||
opt = pya.SaveLayoutOptions()
|
||||
opt.format = format
|
||||
|
||||
b = ly.write_bytes(opt)
|
||||
|
||||
ly2 = pya.Layout()
|
||||
ly2.read_bytes(b)
|
||||
|
||||
tc = ly.top_cell()
|
||||
self.assertEqual(tc.name, "TOP")
|
||||
self.assertEqual(str(tc.bbox()), str(bbox))
|
||||
|
||||
def test_gds2(self):
|
||||
self.rw_test("GDS2")
|
||||
|
||||
def test_oasis(self):
|
||||
self.rw_test("OASIS")
|
||||
|
||||
def test_dxf(self):
|
||||
self.rw_test("DXF")
|
||||
|
||||
def test_cif(self):
|
||||
self.rw_test("CIF")
|
||||
|
||||
def test_lstream(self):
|
||||
self.rw_test("LStream")
|
||||
|
||||
def test_magic(self):
|
||||
# Smoke test
|
||||
ut_testsrc = os.getenv("TESTSRC")
|
||||
ly = pya.Layout()
|
||||
ly.read(os.path.join(ut_testsrc, "testdata", "magic", "ringo", "RINGO.mag"))
|
||||
|
||||
def test_maly(self):
|
||||
# Smoke test
|
||||
ut_testsrc = os.getenv("TESTSRC")
|
||||
ly = pya.Layout()
|
||||
ly.read(os.path.join(ut_testsrc, "testdata", "maly", "MALY_test10.maly"))
|
||||
|
||||
def test_pcb(self):
|
||||
# Smoke test
|
||||
ut_testsrc = os.getenv("TESTSRC")
|
||||
ly = pya.Layout()
|
||||
ly.read(os.path.join(ut_testsrc, "testdata", "pcb", "simple", "import.pcb"))
|
||||
|
||||
def test_lefdef(self):
|
||||
# Smoke test
|
||||
ut_testsrc = os.getenv("TESTSRC")
|
||||
ly = pya.Layout()
|
||||
ly.read(os.path.join(ut_testsrc, "testdata", "lefdef", "scanchain", "test.def"))
|
||||
|
||||
# run unit tests
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(DBStreamsTests)
|
||||
|
||||
if not unittest.TextTestRunner(verbosity = 1).run(suite).wasSuccessful():
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue