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 | //! boost unit test fixation (start procedure to call before testing) |
12 | struct ut_start |
13 | { |
14 | |
15 | //! start procedure before running the test |
16 | ut_start() |
17 | { |
18 | #ifdef CUDA_ON_CPU |
19 | init_wrappers(); |
20 | #endif |
21 | #ifdef PERFORMANCE_TEST |
22 | test_dir = getenv("OPENFPM_PERFORMANCE_TEST_DIR" ); |
23 | |
24 | if (test_dir == NULL) |
25 | { |
26 | 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" ; |
27 | exit(1); |
28 | } |
29 | #endif |
30 | |
31 | } |
32 | |
33 | //! post procedure to call after the test |
34 | ~ut_start() |
35 | { |
36 | } |
37 | }; |
38 | |
39 | //____________________________________________________________________________// |
40 | |
41 | BOOST_GLOBAL_FIXTURE( ut_start ); |
42 | |
43 | |
44 | |
45 | #endif /* UNIT_TEST_INIT_CLEANUP_HPP_ */ |
46 | |