Added tests for LEF/DEF mapfile, fixed a few bugs.

This commit is contained in:
Matthias Koefferlein
2020-05-02 09:30:17 +02:00
parent 97022a3a87
commit fd63d1017f
8 changed files with 123 additions and 7 deletions
@@ -128,7 +128,7 @@ private:
}
}
return tl::combine_path (m_stream.absolute_path (), fn);
return tl::combine_path (tl::dirname (m_stream.absolute_path ()), fn);
} else {
return fn;
@@ -604,12 +604,12 @@ LEFImporter::read_layer (Layout & /*layout*/)
} else if (test ("TYPE")) {
if (test ("ROUTING")) {
std::string type = get ();
if (type == "ROUTING" || type == "MASTERSLICE") {
m_routing_layers.insert (ln);
} else if (test ("CUT")) {
} else if (type == "CUT") {
m_cut_layers.insert (ln);
} else {
get ();
}
expect (";");
@@ -49,7 +49,7 @@ static db::LEFDEFReaderOptions default_options ()
return tc;
}
static void run_test (tl::TestBase *_this, const char *lef_dir, const char *filename, const char *au, const db::LEFDEFReaderOptions &tc, bool priv = true)
static void run_test (tl::TestBase *_this, const char *lef_dir, const char *filename, const char *au, const db::LEFDEFReaderOptions &options, bool priv = true)
{
std::string fn_path (priv ? tl::testsrc_private () : tl::testsrc ());
fn_path += "/testdata/lefdef/";
@@ -61,7 +61,7 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file
tl::Extractor ex (filename);
db::LEFDEFReaderState ld (&tc, layout);
db::LEFDEFReaderState ld (&options, layout);
db::DEFImporter imp;
@@ -103,6 +103,18 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file
db::Reader reader (stream);
reader.read (layout, db::LoadLayoutOptions ());
} else if (ex.test("read:")) {
std::string fn = fn_path, f;
ex.read_word_or_quoted (f);
fn += f;
tl::InputStream stream (fn);
db::Reader reader (stream);
db::LoadLayoutOptions lo;
lo.set_options (options);
reader.read (layout, lo);
} else {
break;
@@ -361,3 +373,11 @@ TEST(110_lefpins)
run_test (_this, "lefpins", "lef:in_tech.lef+lef:in.lef+def:in.def", "au_lefpins_mapped.oas.gz", options, false);
}
TEST(111_mapfile)
{
db::LEFDEFReaderOptions options = default_options ();
options.set_map_file ("test.map");
run_test (_this, "mapfile", "read:in.def", "au.oas.gz", options, false);
}