WIP: refactored GSI test classes so they are hard-linked into the ut_runner binary. Dynamic loading inside .ut files happens too late.

This commit is contained in:
Matthias Koefferlein 2018-06-19 21:12:53 +02:00
parent 361bc64870
commit f4dd012005
9 changed files with 65 additions and 8 deletions

View File

@ -1,7 +1,7 @@
TEMPLATE = subdirs
SUBDIRS = gsi unit_tests
SUBDIRS = gsi gsi_test unit_tests
gsi_test.depends += gsi
unit_tests.depends += gsi
unit_tests.depends += gsi_test

View File

@ -22,6 +22,7 @@
#include "gsiTest.h"
#include "gsiTestForceLink.h"
#include "gsiDecl.h"
#include "gsiEnums.h"
#include "gsiSignals.h"
@ -31,6 +32,14 @@
namespace gsi_test
{
/**
* @brief For the forceLink implementation
*/
int _force_link_f ()
{
return 0;
}
// ----------------------------------------------------------------
// Implementation of A

View File

@ -0,0 +1,46 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 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
*/
#ifndef HDR_gsiTestForceLink
#define HDR_gsiTestForceLink
#include "tlDefs.h"
#if defined(MAKE_GSI_TEST_LIBRARY)
# define GSI_TEST_PUBLIC DEF_INSIDE_PUBLIC
#else
# define GSI_TEST_PUBLIC DEF_OUTSIDE_PUBLIC
#endif
/**
* @file Include this function to force linking of the drc module
*/
namespace gsi_test
{
GSI_TEST_PUBLIC int _force_link_f ();
static int _force_link_target = _force_link_f ();
}
#endif

View File

@ -1,21 +1,21 @@
DESTDIR = $$OUT_PWD/../..
TARGET = gsi_test
TARGET = klayout_gsi_test
include($$PWD/../../lib.pri)
# don't install this test library
INSTALLS =
DEFINES += MAKE_GSI_LIBRARY
DEFINES += MAKE_GSI_TEST_LIBRARY
SOURCES = \
gsiTest.cc \
HEADERS = \
gsiTest.h \
gsiTestForceLink.h \
INCLUDEPATH += $$TL_INC $$GSI_INC
DEPENDPATH += $$TL_INC $$GSI_INC
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi

View File

@ -23,7 +23,6 @@
#include "gsiExpression.h"
#include "gsiDecl.h"
#include "gsiTest.h"
#include "tlUnitTest.h"

View File

@ -8,10 +8,8 @@ include($$PWD/../../lib_ut.pri)
SOURCES = \
gsiExpression.cc \
gsiTest.cc \
HEADERS += \
gsiTest.h \
INCLUDEPATH += $$TL_INC $$GSI_INC
DEPENDPATH += $$TL_INC $$GSI_INC

View File

@ -36,6 +36,9 @@
#include "gsiDecl.h"
#include "gsiExternalMain.h"
// This hard-links the GSI test classes
#include "../gsi_test/gsiTestForceLink.h"
#include "version.h"
#include <QDir>

View File

@ -24,6 +24,8 @@ HEADERS += \
LIBS += -ldl
}
LIBS += -lklayout_gsi_test
INCLUDEPATH += $$QTBASIC_INC
DEPENDPATH += $$QTBASIC_INC