Merge pull request #1555 from KLayout/issue-1531

Fixed issue #1531 (DEF format not recognized in symlink): use origina…
This commit is contained in:
Matthias Köfferlein 2023-12-08 07:26:07 +01:00 committed by GitHub
commit 3550d81c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 95 additions and 7 deletions

View File

@ -183,7 +183,7 @@ SpiceReaderStream::line_number () const
std::string
SpiceReaderStream::source () const
{
return mp_stream->source ();
return mp_stream->absolute_path ();
}
bool
@ -495,7 +495,7 @@ SpiceCircuitDict::read (tl::InputStream &stream)
m_global_net_names.clear ();
m_global_nets.clear ();
m_file_id = file_id (stream.source ());
m_file_id = file_id (stream.absolute_path ());
while (! at_end ()) {
read_card ();

View File

@ -1017,6 +1017,32 @@ TEST(210_overlaps)
run_test (_this, "issue-1499", "map:tech.map+lef:tech.lef+lef:blocks.lef+def:top.def", "au.oas", default_options (), false);
}
// issue-1531
TEST(211_symlinks)
{
db::Layout ly;
std::string fn_path (tl::testdata ());
fn_path += "/lefdef/issue-1531/";
db::LEFDEFReaderOptions lefdef_opt = default_options ();
lefdef_opt.set_map_file ("tech.map");
std::vector<std::string> lf;
lf.push_back ("tech.lef");
lf.push_back ("blocks.lef");
lefdef_opt.set_lef_files (lf);
lefdef_opt.set_read_lef_with_def (false);
db::LoadLayoutOptions opt;
opt.set_options (lefdef_opt);
{
tl::InputStream is (fn_path + "top.def");
db::Reader reader (is);
reader.read (ly, opt);
}
db::compare_layouts (_this, ly, fn_path + "au.oas", db::WriteOAS);
}
// issue-1528
TEST(212_widthtable)

View File

@ -747,18 +747,20 @@ InputFile::filename () const
InputZLibFile::InputZLibFile (const std::string &path)
: mp_d (new ZLibFilePrivate ())
{
m_source = tl::absolute_file_path (path);
m_source = path;
std::string source = tl::absolute_file_path (path);
#if defined(_WIN32)
int fd = _wopen (tl::to_wstring (m_source).c_str (), _O_BINARY | _O_RDONLY | _O_SEQUENTIAL);
int fd = _wopen (tl::to_wstring (source).c_str (), _O_BINARY | _O_RDONLY | _O_SEQUENTIAL);
if (fd < 0) {
throw FileOpenErrorException (m_source, errno);
throw FileOpenErrorException (source, errno);
}
mp_d->zs = gzdopen (fd, "rb");
#else
mp_d->zs = gzopen (tl::string_to_system (m_source).c_str (), "rb");
mp_d->zs = gzopen (tl::string_to_system (source).c_str (), "rb");
#endif
if (mp_d->zs == NULL) {
throw FileOpenErrorException (m_source, errno);
throw FileOpenErrorException (source, errno);
}
}

BIN
testdata/lefdef/issue-1531/au.oas vendored Normal file

Binary file not shown.

31
testdata/lefdef/issue-1531/blocks.lef vendored Normal file
View File

@ -0,0 +1,31 @@
VERSION 5.8 ;
MACRO a
ORIGIN 0 0 ;
SIZE 600 BY 600 ;
OBS
LAYER M1 ;
RECT 10 10 590 590 ;
END
END a
MACRO b
ORIGIN -600 0 ;
SIZE 400 BY 500 ;
OBS
LAYER M1 ;
RECT 610 10 990 490 ;
END
END b
MACRO c
ORIGIN -500 -500 ;
SIZE 500 BY 500 ;
OBS
LAYER M1 ;
POLYGON 510 610 610 610 610 510 990 510 990 990 510 990 ;
LAYER overlap ;
RECT 500 700 1000 1000 ;
POLYGON 500 600 600 600 600 500 1000 500 1000 700 500 700 ;
END
END c

12
testdata/lefdef/issue-1531/tech.lef vendored Normal file
View File

@ -0,0 +1,12 @@
VERSION 5.8 ;
LAYER M1
TYPE ROUTING ;
DIRECTION HORIZONTAL ;
WIDTH 0.1 ;
PITCH 0.1 ;
END M1
LAYER overlap
TYPE OVERLAP ;
END overlap

6
testdata/lefdef/issue-1531/tech.map vendored Normal file
View File

@ -0,0 +1,6 @@
DIEAREA ALL 1 0
#BOUNDARY DIEAREA 1 0
BOUNDARY MACRO 1 0
#M1 LEFOBS 2 0
M1 LEFOBS 3 0
M1 BLOCKAGE 3 0

10
testdata/lefdef/issue-1531/top vendored Normal file
View File

@ -0,0 +1,10 @@
VERSION 5.8 ;
DESIGN top ;
UNITS DISTANCE MICRONS 1000 ;
DIEAREA ( 0 0 ) ( 1000000 1000000 ) ;
COMPONENTS 3 ;
- a a + PLACED ( 0 0 ) N ;
- b b + PLACED ( 600000 0 ) N ;
- c c + PLACED ( 500000 500000 ) N ;
END COMPONENTS
END DESIGN

1
testdata/lefdef/issue-1531/top.def vendored Symbolic link
View File

@ -0,0 +1 @@
top