From 00c826688fa59dcc23facb1b8db681891ab39743 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 18 Mar 2026 22:01:26 +0100 Subject: [PATCH] Added the ability to run DRC and LVS from strmrun --- src/buddies/src/bd/bd.pro | 4 +- src/buddies/src/bd/strmrun.cc | 2 + src/buddies/src/buddy_app.pri | 2 +- src/buddies/unit_tests/bdStrmrunTests.cc | 44 ++++++++++++++++------ src/drc/drc/built-in-macros/_drc_engine.rb | 16 ++++---- 5 files changed, 46 insertions(+), 22 deletions(-) diff --git a/src/buddies/src/bd/bd.pro b/src/buddies/src/bd/bd.pro index d3b3faa09..9d913cffe 100644 --- a/src/buddies/src/bd/bd.pro +++ b/src/buddies/src/bd/bd.pro @@ -41,7 +41,9 @@ INCLUDEPATH += $$RBA_INC DEPENDPATH += $$RBA_INC equals(HAVE_RUBY, "1") { - LIBS += -lklayout_rba + INCLUDEPATH += $$DRC_INC $$LVS_INC + DEPENDPATH += $$DRC_INC $$LVS_INC + LIBS += -lklayout_rba -lklayout_drc -lklayout_lvs } else { LIBS += -lklayout_rbastub } diff --git a/src/buddies/src/bd/strmrun.cc b/src/buddies/src/bd/strmrun.cc index b324ecc88..1bcc83b76 100644 --- a/src/buddies/src/bd/strmrun.cc +++ b/src/buddies/src/bd/strmrun.cc @@ -36,6 +36,8 @@ #include "libForceLink.h" #include "rdbForceLink.h" #include "pexForceLink.h" +#include "drcForceLink.h" +#include "lvsForceLink.h" #include "lymMacro.h" #include "lymMacroCollection.h" diff --git a/src/buddies/src/buddy_app.pri b/src/buddies/src/buddy_app.pri index 58da418bf..d7a96c693 100644 --- a/src/buddies/src/buddy_app.pri +++ b/src/buddies/src/buddy_app.pri @@ -25,7 +25,7 @@ INCLUDEPATH += $$RBA_INC DEPENDPATH += $$RBA_INC equals(HAVE_RUBY, "1") { - LIBS += -lklayout_rba + LIBS += -lklayout_rba -lklayout_drc -lklayout_lvs } else { LIBS += -lklayout_rbastub } diff --git a/src/buddies/unit_tests/bdStrmrunTests.cc b/src/buddies/unit_tests/bdStrmrunTests.cc index 0766c7bd9..c4762915e 100644 --- a/src/buddies/unit_tests/bdStrmrunTests.cc +++ b/src/buddies/unit_tests/bdStrmrunTests.cc @@ -28,10 +28,7 @@ TEST(1) { #if defined(HAVE_PYTHON) - std::string fp (tl::testsrc ()); - fp += "/testdata/bd/strmrun.py"; - - std::string cmd; + std::string cmd_call; #if defined(__APPLE__) // NOTE: because of system integrity, MacOS does not inherit DYLD_LIBRARY_PATH to child @@ -39,19 +36,42 @@ TEST(1) const char *ldpath_name = "DYLD_LIBRARY_PATH"; const char *ldpath = getenv (ldpath_name); if (ldpath) { - cmd += std::string (ldpath_name) + "=\"" + ldpath + "\"; export " + ldpath_name + "; "; + cmd_call += std::string (ldpath_name) + "=\"" + ldpath + "\"; export " + ldpath_name + "; "; } #endif - cmd += tl::combine_path (tl::get_inst_path (), "strmrun ") + fp; - tl::info << cmd; + cmd_call += tl::combine_path (tl::get_inst_path (), "strmrun"); - tl::InputPipe pipe (cmd); - tl::InputStream is (pipe); - std::string data = is.read_all (); - tl::info << data; + { + std::string fp (tl::testsrc ()); + fp += "/testdata/bd/strmrun.py"; + + std::string cmd = cmd_call + " " + fp; + tl::info << cmd; + + tl::InputPipe pipe (cmd); + tl::InputStream is (pipe); + std::string data = is.read_all (); + tl::info << data; + + EXPECT_EQ (data, "Hello, world (0,-42;42,0)!\n"); + } + + { + std::string fp (tl::testsrc ()); + fp += "/testdata/bd/strmrun.drc"; + + std::string cmd = cmd_call + " " + fp; + tl::info << cmd; + + tl::InputPipe pipe (cmd); + tl::InputStream is (pipe); + std::string data = is.read_all (); + tl::info << data; + + EXPECT_EQ (data, "This is DRC.\n"); + } - EXPECT_EQ (data, "Hello, world (0,-42;42,0)!\n"); #endif } diff --git a/src/drc/drc/built-in-macros/_drc_engine.rb b/src/drc/drc/built-in-macros/_drc_engine.rb index e2ff2b7ee..9aee34eca 100644 --- a/src/drc/drc/built-in-macros/_drc_engine.rb +++ b/src/drc/drc/built-in-macros/_drc_engine.rb @@ -164,7 +164,7 @@ module DRC def initialize - cv = RBA::CellView::active + cv = RBA.const_defined?(:CellView) && RBA::CellView::active @time = Time::now @force_gc = ($drc_force_gc == true) # for testing, $drc_force_gc can be set to true @@ -1444,7 +1444,7 @@ module DRC if arg =~ /^@(\d+)/ n = $1.to_i - 1 - view = RBA::LayoutView::current + view = RBA.const_defined?(:LayoutView) && RBA::LayoutView::current view || raise("No view open") (n >= 0 && view.cellviews > n) || raise("Invalid layout index @#{n + 1}") cv = view.cellview(n) @@ -1543,7 +1543,7 @@ module DRC if arg =~ /^@(\d+)/ n = $1.to_i - 1 - view = RBA::LayoutView::current + view = RBA.const_defined?(:LayoutView) && RBA::LayoutView::current view || raise("No view open") (n >= 0 && view.cellviews > n) || raise("Invalid layout index @#{n + 1}") cv = view.cellview(n) @@ -1608,7 +1608,7 @@ module DRC self._context("report") do # finish what we got so far - view = RBA::LayoutView::current + view = RBA.const_defined?(:LayoutView) && RBA::LayoutView::current @def_output && @def_output.finish(false, view) @def_output = nil @@ -2925,7 +2925,7 @@ CODE def _start(job_description) # clearing the selection avoids some nasty problems - view = RBA::LayoutView::current + view = RBA.const_defined?(:LayoutView) && RBA::LayoutView::current view && view.cancel @total_timer = RBA::Timer::new @@ -2950,7 +2950,7 @@ CODE _flush - view = RBA::LayoutView::current + view = RBA.const_defined?(:LayoutView) && RBA::LayoutView::current @def_output && @def_output.finish(final, view) @@ -3484,7 +3484,7 @@ CODE output_rdb_index = nil - view = RBA::LayoutView::current + view = RBA.const_defined?(:LayoutView) && RBA::LayoutView::current if view if self._rdb_index output_rdb = RBA::ReportDatabase::new("") # reuse existing name @@ -3518,7 +3518,7 @@ CODE if arg =~ /^@(\d+|\+)/ - view = RBA::LayoutView::current + view = RBA.const_defined?(:LayoutView) && RBA::LayoutView::current view || raise("No view open") if $1 == "+" prev_cv = view.active_cellview_index