]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | /* |
2 | * This file is open source software, licensed to you under the terms | |
3 | * of the Apache License, Version 2.0 (the "License"). See the NOTICE file | |
4 | * distributed with this work for additional information regarding copyright | |
5 | * ownership. You may not use this file except in compliance with the License. | |
6 | * | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, | |
12 | * software distributed under the License is distributed on an | |
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
14 | * KIND, either express or implied. See the License for the | |
15 | * specific language governing permissions and limitations | |
16 | * under the License. | |
17 | */ | |
18 | ||
19 | /* | |
20 | * Copyright (C) 2018 ScyllaDB Ltd. | |
21 | */ | |
22 | ||
23 | #include <seastar/testing/entry_point.hh> | |
24 | #include <seastar/testing/seastar_test.hh> | |
25 | #include <seastar/testing/test_runner.hh> | |
26 | ||
27 | namespace seastar { | |
28 | ||
29 | namespace testing { | |
30 | ||
31 | static bool init_unit_test_suite() { | |
32 | const auto& tests = known_tests(); | |
33 | auto&& ts = boost::unit_test::framework::master_test_suite(); | |
34 | ts.p_name.set(tests.size() ? (tests)[0]->get_test_file() : "seastar-tests"); | |
35 | ||
36 | for (seastar_test* test : tests) { | |
37 | #if BOOST_VERSION > 105800 | |
38 | ts.add(boost::unit_test::make_test_case([test] { test->run(); }, test->get_name(), | |
9f95a23c TL |
39 | test->get_test_file(), 0), |
40 | test->get_expected_failures(), 0); | |
11fdf7f2 | 41 | #else |
9f95a23c TL |
42 | ts.add(boost::unit_test::make_test_case([test] { test->run(); }, test->get_name()), |
43 | test->get_expected_failures(), 0); | |
11fdf7f2 TL |
44 | #endif |
45 | } | |
46 | ||
9f95a23c | 47 | return global_test_runner().start(ts.argc, ts.argv); |
11fdf7f2 TL |
48 | } |
49 | ||
50 | int entry_point(int argc, char** argv) { | |
9f95a23c TL |
51 | const int boost_exit_code = ::boost::unit_test::unit_test_main(&init_unit_test_suite, argc, argv); |
52 | const int seastar_exit_code = seastar::testing::global_test_runner().finalize(); | |
53 | if (boost_exit_code) { | |
54 | return boost_exit_code; | |
55 | } | |
56 | return seastar_exit_code; | |
11fdf7f2 TL |
57 | } |
58 | ||
59 | } | |
60 | ||
61 | } |