diff options
-rw-r--r-- | slicer/db/Jamfile.jam | 6 | ||||
-rw-r--r-- | slicer/json/Jamfile.jam | 2 | ||||
-rw-r--r-- | slicer/test/Jamfile.jam | 51 | ||||
-rw-r--r-- | slicer/test/helpers.cpp | 36 | ||||
-rw-r--r-- | slicer/test/helpers.h | 12 | ||||
-rw-r--r-- | slicer/test/preprocessor.cpp | 46 | ||||
-rw-r--r-- | slicer/tool/Jamfile.jam | 1 | ||||
-rw-r--r-- | slicer/xml/Jamfile.jam | 2 |
8 files changed, 41 insertions, 115 deletions
diff --git a/slicer/db/Jamfile.jam b/slicer/db/Jamfile.jam index 9b51b82..c6915ef 100644 --- a/slicer/db/Jamfile.jam +++ b/slicer/db/Jamfile.jam @@ -40,7 +40,7 @@ run testSelect.cpp <library>boost_system <library>boost_filesystem <library>boost_utf - <library>../test//slicer-test + <library>../test//types <library>../test//common <library>../slicer//slicer <implicit-dependency>../slicer//slicer @@ -60,7 +60,7 @@ run testInsert.cpp <library>boost_system <library>boost_filesystem <library>boost_utf - <library>../test//slicer-test + <library>../test//types <library>../test//common <library>../slicer//slicer <implicit-dependency>../slicer//slicer @@ -81,7 +81,7 @@ run testUpdate.cpp <library>boost_system <library>boost_filesystem <library>boost_utf - <library>../test//slicer-test + <library>../test//types <library>../test//common <library>../slicer//slicer <implicit-dependency>../slicer//slicer diff --git a/slicer/json/Jamfile.jam b/slicer/json/Jamfile.jam index 34ca153..05b5228 100644 --- a/slicer/json/Jamfile.jam +++ b/slicer/json/Jamfile.jam @@ -31,7 +31,7 @@ run testSpecifics.cpp <define>BOOST_TEST_DYN_LINK <library>slicer-json <library>boost_utf - <library>../test//slicer-test + <library>../test//types <library>../test//common <library>../slicer//slicer <include>.. diff --git a/slicer/test/Jamfile.jam b/slicer/test/Jamfile.jam index 253ab2b..7bf0b05 100644 --- a/slicer/test/Jamfile.jam +++ b/slicer/test/Jamfile.jam @@ -1,4 +1,8 @@ import testing ; +import generators ; +import type ; +import feature ; +import toolset ; lib dl ; lib pthread ; @@ -6,44 +10,68 @@ lib Ice ; lib IceUtil ; lib boost_system ; lib boost_filesystem ; +lib boost_date_time ; lib boost_utf : : <name>boost_unit_test_framework ; -lib slicer-test : : <name>slicertypes <search>bin/slicer ; lib adhocutil : : : : <include>/usr/include/adhocutil ; +generators.register-standard $(__name__).slicer : SLICE : CPP : <slicer>pure ; +generators.override $(__name__).slicer : slice.slicer.pure ; +feature.feature slicerbin : : free dependency ; +toolset.flags slicer SLICERBIN <slicerbin> ; +toolset.flags slicer INCLUDES <include> ; +toolset.flags slicer ALLOWICE <allow-ice>yes : --ice ; + +actions slicer bind SLICERBIN +{ + truncate -c -s 0 $(1[1]) + "$(SLICERBIN)" -I"$(INCLUDES)" $(2) $(1[1]) $(ALLOWICE[1]) --headerPrefix="\"\"" +} + +cpp stypes : + types.ice + : + <slicer>pure + <slicerbin>../tool//slicer + <dependency>../tool//slicer + <include>included + ; + lib types : types.ice + stypes + conversions.cpp : <include>. <library>pthread <library>Ice <library>IceUtil <library>adhocutil + <library>boost_date_time <library>included//included + <library>../slicer//slicer <implicit-dependency>included//included + <implicit-dependency>../slicer//slicer : : <include>. <library>pthread <library>Ice <library>IceUtil <library>included//included + <library>../slicer//slicer ; path-constant me : . ; lib common : helpers.cpp - conversions.cpp fileStructure.cpp : - <library>dl - <library>types + <library>adhocutil <library>boost_system <library>boost_filesystem <library>boost_utf - <implicit-dependency>types <define>ROOT=\"$(me)\" : : - <library>types <library>boost_filesystem <library>boost_system <define>BOOST_TEST_DYN_LINK @@ -53,14 +81,10 @@ lib common : run preprocessor.cpp : : : - <linkflags>-rdynamic - <library>dl <library>common <library>adhocutil <include>.. - <library>../slicer//slicer <library>../tool//slicer-compiler - <dependency>../tool//slicer : preprocess ; @@ -70,19 +94,14 @@ run compilation.cpp <include>.. <library>../slicer//slicer <library>types - <dependency>preprocess - <library>slicer-test <library>common - <include>.. - <library>../slicer//slicer : compilation ; run serializers.cpp : : : - <dependency>preprocess - <library>slicer-test + <library>types <library>common <library>../slicer//slicer <implicit-dependency>../slicer//slicer diff --git a/slicer/test/helpers.cpp b/slicer/test/helpers.cpp index 73f3aa7..956b626 100644 --- a/slicer/test/helpers.cpp +++ b/slicer/test/helpers.cpp @@ -1,22 +1,8 @@ #include "helpers.h" -#include <stdexcept> -#include <stdlib.h> -#include <dlfcn.h> #include <fstream> #include <boost/test/test_tools.hpp> void -system(const std::string & cmd) -{ - if (system(cmd.c_str())) { - // LCOV_EXCL_START - fprintf(stderr, "Failed to execute:\n\t%s\n", cmd.c_str()); - throw std::runtime_error(cmd); - // LCOV_EXCL_STOP - } -} - -void diff(const boost::filesystem::path & left, const boost::filesystem::path & right) { std::ifstream fl(left.string()); @@ -29,25 +15,3 @@ diff(const boost::filesystem::path & left, const boost::filesystem::path & right BOOST_REQUIRE_EQUAL(l, r); } -void * -loadlib(const boost::filesystem::path & so) -{ - auto handle = dlopen(so.string().c_str(), RTLD_NOW | RTLD_GLOBAL); - if (!handle) { - // LCOV_EXCL_START - throw std::runtime_error(dlerror()); - // LCOV_EXCL_STOP - } - return handle; -} - -void -closelib(void * handle) -{ - if (dlclose(handle)) { - // LCOV_EXCL_START - throw std::runtime_error(dlerror()); - // LCOV_EXCL_STOP - } -} - diff --git a/slicer/test/helpers.h b/slicer/test/helpers.h index aba4974..95dbd4d 100644 --- a/slicer/test/helpers.h +++ b/slicer/test/helpers.h @@ -8,18 +8,6 @@ // These are just thin wrappers that throw exceptions DLL_PUBLIC void -system(const std::string &); - -DLL_PUBLIC -void * -loadlib(const boost::filesystem::path &); - -DLL_PUBLIC -void -closelib(void *); - -DLL_PUBLIC -void diff(const boost::filesystem::path & left, const boost::filesystem::path & right); #endif diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp index b715d50..fadbac9 100644 --- a/slicer/test/preprocessor.cpp +++ b/slicer/test/preprocessor.cpp @@ -2,12 +2,8 @@ #include <boost/test/unit_test.hpp> #include <tool/parser.h> -#include <boost/filesystem/convenience.hpp> -#include <boost/filesystem/operations.hpp> #include <boost/format.hpp> -#include <boost/function.hpp> #include <buffer.h> -#include <types.h> #include "helpers.h" #include "fileStructure.h" @@ -63,47 +59,5 @@ BOOST_AUTO_TEST_CASE( slicer_test_counts_interfacesOnly ) BOOST_REQUIRE_EQUAL(0, count); } -BOOST_AUTO_TEST_CASE( slicer_test_ice ) -{ - const fs::path cpp = fs::change_extension(tmp / base, ".cpp"); - BOOST_TEST_CHECKPOINT("cpp: " << cpp); - fs::remove(cpp); - const std::string doslice = stringbf( - "%s -I%s --headerPrefix='\"\"' %s %s", - root.parent_path() / "tool" / bjamout / "slicer", - included, - slice, cpp); - BOOST_TEST_CHECKPOINT("slicer: " << doslice); - system(doslice); - - const fs::path obj = fs::change_extension(tmp / base, ".o"); - const std::string compile = stringbf( - "g++ -Os -fPIC -c -std=c++1y -fvisibility=hidden -I%s -I tmp -I /usr/include/adhocutil -I /usr/include/Ice -I /usr/include/IceUtil -I %s -I %s -I %s -I %s -I %s %s -o %s", - root.parent_path() / "slicer", - root / bjamout, - root, - included / bjamout, - root.parent_path(), - root.parent_path() / "slicer" / bjamout, - cpp, obj); - BOOST_TEST_CHECKPOINT("compile: " << compile); - system(compile); - - const fs::path so = fs::change_extension(tmp / ("libslicer" + slice.filename().string()), ".so"); - const std::string link = stringbf( - "g++ -shared -Wl,--strip-all,--gc-sections -lboost_date_time -lIce -lIceUtil %s/lib%s.so %s/lib%s.so %s -o %s", - root / bjamout, base, - included / bjamout, included.leaf(), - obj, so); - BOOST_TEST_CHECKPOINT("link: " << link); - system(link); - - BOOST_TEST_CHECKPOINT("load: " << so); - auto handle = loadlib(so); - - BOOST_TEST_CHECKPOINT("unload: " << handle); - closelib(handle); -} - BOOST_AUTO_TEST_SUITE_END(); diff --git a/slicer/tool/Jamfile.jam b/slicer/tool/Jamfile.jam index c5f94a3..cc0ace7 100644 --- a/slicer/tool/Jamfile.jam +++ b/slicer/tool/Jamfile.jam @@ -22,6 +22,7 @@ lib slicer-compiler : <include>.. : : <include>.. + <library>../slicer//slicer ; exe slicer : diff --git a/slicer/xml/Jamfile.jam b/slicer/xml/Jamfile.jam index 0d170da..d16fc8a 100644 --- a/slicer/xml/Jamfile.jam +++ b/slicer/xml/Jamfile.jam @@ -33,7 +33,7 @@ run testSpecifics.cpp <library>slicer-xml <implicit-dependency>slicer-xml <library>boost_utf - <library>../test//slicer-test + <library>../test//types <library>../test//common <library>../slicer//slicer <include>.. |