From 167df7eae6389e54868409947dd797d5632a5ca6 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 30 Dec 2017 16:46:49 -0800 Subject: [PATCH 1/8] Fixed a unit test bug - the dbCell test was working by coincidence on other systems. --- src/db/unit_tests/dbCell.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/db/unit_tests/dbCell.cc b/src/db/unit_tests/dbCell.cc index 4461dd7ae..d4f6c9658 100644 --- a/src/db/unit_tests/dbCell.cc +++ b/src/db/unit_tests/dbCell.cc @@ -570,13 +570,13 @@ TEST(2) } - c0.erase (i4); - EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2,3[r0 *1 0,0]#13"); - EXPECT_EQ (c0.cell_instances (), size_t (2)); c0.erase (i5); + EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); + EXPECT_EQ (c0.cell_instances (), size_t (2)); + c0.erase (i4); EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2"); EXPECT_EQ (c0.cell_instances (), size_t (1)); - // not yet: EXPECT_EQ (c0.empty (), false); + // Not yet: EXPECT_EQ (c0.empty (), false); // note: double delete is not supported in non-editable mode if (db::default_editable_mode ()) { @@ -608,7 +608,7 @@ TEST(2) c0.erase (i3); EXPECT_EQ (c2s_unsorted(c0), ""); EXPECT_EQ (c0.cell_instances (), size_t (0)); - // not yet: EXPECT_EQ (c0.empty (), true); + // Not yet: EXPECT_EQ (c0.empty (), true); } TEST(3) From 93572a8f0b5c85d7b6e8fdec23c2e5ad6364b889 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 30 Dec 2017 17:15:24 -0800 Subject: [PATCH 2/8] Fixed dbEdges iterator (ported fix of dbRegion iterator for MacOS/clang to dbEdges too) --- src/db/db/dbEdges.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/db/db/dbEdges.h b/src/db/db/dbEdges.h index 68fe606d2..17788cde3 100644 --- a/src/db/db/dbEdges.h +++ b/src/db/db/dbEdges.h @@ -229,8 +229,11 @@ private: * @brief ctor from a recursive shape iterator */ EdgesIterator (const db::RecursiveShapeIterator &iter, const db::ICplxTrans &trans) - : m_rec_iter (iter), m_iter_trans (trans) - { + : m_rec_iter (iter), m_iter_trans (trans), m_from (), m_to () + { + // NOTE: the following initialization appears to be required on some compilers + // (specifically MacOS/clang) to ensure the proper initialization of the iterators + m_from = m_to; set (); } From f5b7a037adc0ad0c7e42a5d9e31cfabd959912b9 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 09:51:38 -0800 Subject: [PATCH 3/8] Turn the unit test runner into a ordinary binary too. --- src/unit_tests/unit_tests.pro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/unit_tests/unit_tests.pro b/src/unit_tests/unit_tests.pro index 7e45e19fd..68df3dffc 100644 --- a/src/unit_tests/unit_tests.pro +++ b/src/unit_tests/unit_tests.pro @@ -6,6 +6,11 @@ include($$PWD/../with_all_libs.pri) TEMPLATE = app +# Don't build the ut_runner app as ordinary command line tool on MacOS +mac { + CONFIG -= app_bundle +} + TARGET = ut_runner SOURCES = \ From 2084a7e85c9dcee376ebec52032af0bf28778f6c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 09:52:54 -0800 Subject: [PATCH 4/8] Don't crash if no unit test libs are found in the unit test runner. --- src/unit_tests/unit_test_main.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/unit_tests/unit_test_main.cc b/src/unit_tests/unit_test_main.cc index 1d0bc6b79..80d64c7b5 100644 --- a/src/unit_tests/unit_test_main.cc +++ b/src/unit_tests/unit_test_main.cc @@ -365,6 +365,10 @@ main_cont (int argc, char **argv) } + if (! tl::TestRegistrar::instance()) { + throw tl::Exception ("No test libraries found - make sure, the *.ut files are next to the ut_runner executable."); + } + // No side effects lay::set_klayout_path (std::vector ()); From 48a6b4b57a1246ded75ffc0ed620c7a6b01621be Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 09:54:47 -0800 Subject: [PATCH 5/8] Exceptions have to be exported from DSO's too to make the recognized in catch statements. --- src/tl/tl/tlException.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tl/tl/tlException.h b/src/tl/tl/tlException.h index 306af3c95..0b1baafc0 100644 --- a/src/tl/tl/tlException.h +++ b/src/tl/tl/tlException.h @@ -137,7 +137,7 @@ private: * @brief A "neutral" exception thrown to terminate some operation * This exception is not shown. */ -struct CancelException +struct TL_PUBLIC CancelException : public Exception { CancelException () @@ -148,7 +148,7 @@ struct CancelException /** * @brief A special "internal" exception class used by tl_assert */ -struct InternalException +struct TL_PUBLIC InternalException : public Exception { InternalException (const char *file, int line, const char *cond) From b7a18b3278a150688f471a738b31d06fe4594bdc Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 09:55:23 -0800 Subject: [PATCH 6/8] Added method to derive application path for MacOS (/proc isn't there on MacOS) --- src/lay/lay/laySystemPaths.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lay/lay/laySystemPaths.cc b/src/lay/lay/laySystemPaths.cc index 6e458716c..2f5645c32 100644 --- a/src/lay/lay/laySystemPaths.cc +++ b/src/lay/lay/laySystemPaths.cc @@ -30,6 +30,9 @@ #ifdef _WIN32 # include +#elif __APPLE__ +# include +# include #else # include #endif @@ -79,6 +82,15 @@ get_inst_path_internal () return tl::to_string (fi.absolutePath ()); } +#elif __APPLE__ + + char buffer[PROC_PIDPATHINFO_MAXSIZE]; + int ret = proc_pidpath (getpid (), buffer, sizeof (buffer)); + if (ret > 0) { + // TODO: does this correctly translate paths? (MacOS uses UTF-8 encoding with D-like normalization) + return tl::to_string (QFileInfo (QString::fromUtf8 (buffer)).absolutePath ()); + } + #else QFileInfo proc_exe (tl::to_qstring (tl::sprintf ("/proc/%d/exe", getpid ()))); From 6b4d24b4424c1410de49101ab0591c002dee611f Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 10:23:54 -0800 Subject: [PATCH 7/8] One more external visibility ... --- src/gsi/gsi/gsiDeclBasic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gsi/gsi/gsiDeclBasic.h b/src/gsi/gsi/gsiDeclBasic.h index 7bafa8000..b77d46fda 100644 --- a/src/gsi/gsi/gsiDeclBasic.h +++ b/src/gsi/gsi/gsiDeclBasic.h @@ -37,7 +37,7 @@ namespace gsi /** * @brief Provides a basic implementation for a "boxed" plain value using a Variant as the basic type */ -class Value +class GSI_PUBLIC Value { public: /** From c4cf394719fe5be997352093d4c87f22d1fe5f37 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 31 Dec 2017 10:56:46 -0800 Subject: [PATCH 8/8] One more external visibility ... --- src/gsi/gsi/gsiCallback.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gsi/gsi/gsiCallback.h b/src/gsi/gsi/gsiCallback.h index 21a78ab62..f173bf0e7 100644 --- a/src/gsi/gsi/gsiCallback.h +++ b/src/gsi/gsi/gsiCallback.h @@ -34,7 +34,7 @@ namespace gsi * * This class is specialized to implement the actual call process later. */ -struct Callee +struct GSI_PUBLIC Callee : public tl::Object { Callee () { } @@ -49,7 +49,7 @@ struct Callee * This object holds informations about the actual implementation of the callback * on the scripting client's side. */ -struct Callback +struct Callback { Callback () : id (-1), callee (0), argsize (0), retsize (0)