diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2015-01-24 15:48:09 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2015-01-24 15:48:09 +0200 |
commit | ed160fbbe4def47d47f99285e8fd8c412470dae9 (patch) | |
tree | 7bbc63fc7b2b8221feb0cf576fe9658178984830 | |
parent | 9b79c635f8e9c90e01dcd1a3e16d0890ccb8bbac (diff) | |
download | meson-ed160fbbe4def47d47f99285e8fd8c412470dae9.zip meson-ed160fbbe4def47d47f99285e8fd8c412470dae9.tar.gz meson-ed160fbbe4def47d47f99285e8fd8c412470dae9.tar.bz2 |
Made Boost unit testing framework work and added a test.
-rw-r--r-- | dependencies.py | 14 | ||||
-rw-r--r-- | test cases/frameworks/1 boost/meson.build | 3 | ||||
-rw-r--r-- | test cases/frameworks/1 boost/unit_test.cpp | 10 |
3 files changed, 27 insertions, 0 deletions
diff --git a/dependencies.py b/dependencies.py index 20f4f2f..3e3f877 100644 --- a/dependencies.py +++ b/dependencies.py @@ -266,6 +266,11 @@ class ExternalLibrary(Dependency): return [] class BoostDependency(Dependency): + # Some boost libraries have different names for + # their sources and libraries. This dict maps + # between the two. + name2lib = {'test' : 'unit_test_framework'} + def __init__(self, kwargs): Dependency.__init__(self) self.name = 'boost' @@ -372,12 +377,21 @@ class BoostDependency(Dependency): # pkg-config returns. args.append('-L' + os.path.join(self.boost_root, 'lib')) for module in self.requested_modules: + module = BoostDependency.name2lib.get(module, module) if module in self.lib_modules or module in self.lib_modules_mt: linkcmd = '-lboost_' + module args.append(linkcmd) + # FIXME a hack, but Boost's testing framework has a lot of + # different options and it's hard to determine what to do + # without feedback from actual users. Update this + # as we get more bug reports. + if module == 'unit_testing_framework': + args.append('-lboost_test_exec_monitor') elif module + '-mt' in self.lib_modules_mt: linkcmd = '-lboost_' + module + '-mt' args.append(linkcmd) + if module == 'unit_testing_framework': + args.append('-lboost_test_exec_monitor-mt') return args def get_sources(self): diff --git a/test cases/frameworks/1 boost/meson.build b/test cases/frameworks/1 boost/meson.build index 88b3036..f1a7d0e 100644 --- a/test cases/frameworks/1 boost/meson.build +++ b/test cases/frameworks/1 boost/meson.build @@ -10,9 +10,12 @@ endif nolinkdep = dependency('boost', modules: 'utility') linkdep = dependency('boost', modules : ['thread', 'system']) +testdep = dependency('boost', modules : 'test') nolinkexe = executable('nolinkedexe', 'nolinkexe.cc', dependencies : nolinkdep) linkexe = executable('linkedexe', 'linkexe.cc', dependencies : linkdep) +unitexe = executable('utf', 'unit_test.cpp', dependencies: testdep) test('Boost nolinktext', nolinkexe) test('Boost linktext', linkexe) +test('Boost UTF test', unitexe) diff --git a/test cases/frameworks/1 boost/unit_test.cpp b/test cases/frameworks/1 boost/unit_test.cpp new file mode 100644 index 0000000..3505999 --- /dev/null +++ b/test cases/frameworks/1 boost/unit_test.cpp @@ -0,0 +1,10 @@ +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "MesonTest" +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE(m_test) { + int x = 2+2; + BOOST_CHECK(true); + BOOST_CHECK_EQUAL(x, 4); +} |