| 1 | /* |
| 2 | * unit_test_init_cleanup.hpp |
| 3 | * |
| 4 | * Created on: Apr 17, 2015 |
| 5 | * Author: Pietro Incardona |
| 6 | */ |
| 7 | |
| 8 | #ifndef UNIT_TEST_INIT_CLEANUP_HPP_ |
| 9 | #define UNIT_TEST_INIT_CLEANUP_HPP_ |
| 10 | |
| 11 | #include "initialize/initialize_wrapper.hpp" |
| 12 | |
| 13 | const char * test_dir; |
| 14 | |
| 15 | struct ut_start |
| 16 | { |
| 17 | //! |
| 18 | ut_start() |
| 19 | { |
| 20 | BOOST_TEST_MESSAGE("Initialize global VCluster" ); |
| 21 | |
| 22 | openfpm_init_wrapper(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv); |
| 23 | |
| 24 | #ifdef PERFORMANCE_TEST |
| 25 | test_dir = getenv("OPENFPM_PERFORMANCE_TEST_DIR" ); |
| 26 | |
| 27 | if (test_dir == NULL) |
| 28 | { |
| 29 | std::cerr << "Error: " __FILE__ << ":" << __LINE__ << " in order to run the performance test you must set the environment variable $OPENFPM_PERFORMANCE_TEST_DIR to the test or an empty directory" ; |
| 30 | exit(1); |
| 31 | } |
| 32 | #endif |
| 33 | } |
| 34 | |
| 35 | ~ut_start() |
| 36 | { |
| 37 | BOOST_TEST_MESSAGE("Delete global VClster" ); |
| 38 | openfpm_finalize_wrapper(); |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | //____________________________________________________________________________// |
| 43 | |
| 44 | BOOST_GLOBAL_FIXTURE( ut_start ); |
| 45 | |
| 46 | |
| 47 | |
| 48 | #endif /* UNIT_TEST_INIT_CLEANUP_HPP_ */ |
| 49 | |