• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #866

14 Jan 2023 04:16PM UTC coverage: 85.951% (-0.5%) from 86.431%
#866

push

StellarBot
Merge #6134

6134: Adding notification function for parcelports to be called after early parcel handling r=hkaiser a=hkaiser

Parcelports now can override a new function `void initialized()` that will be called after early parcel handling is finished and before the thread pools are operational (i.e. before background work starts).

`@JiakunYan` please let me know if this is what you requested.

Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

4 of 4 new or added lines in 2 files covered. (100.0%)

173540 of 201905 relevant lines covered (85.95%)

1871917.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

14.49
/libs/full/runtime_components/tests/unit/components/copy_component.cpp
1
//  Copyright (c) 2013 Hartmut Kaiser
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
#include <hpx/config.hpp>
8
#if !defined(HPX_COMPUTE_DEVICE_CODE)
9
#include <hpx/hpx_main.hpp>
10
#include <hpx/include/actions.hpp>
11
#include <hpx/include/components.hpp>
12
#include <hpx/include/runtime.hpp>
13
#include <hpx/include/serialization.hpp>
14
#include <hpx/modules/testing.hpp>
15

16
#include <utility>
17
#include <vector>
18

19
///////////////////////////////////////////////////////////////////////////////
20
struct test_server : hpx::components::component_base<test_server>
21
{
22
    using base_type = hpx::components::component_base<test_server>;
23

24
    test_server() = default;
3✔
25
    ~test_server() = default;
4✔
26

27
    hpx::id_type call() const
2✔
28
    {
29
        return hpx::find_here();
2✔
30
    }
31

32
    // components which should be copied using hpx::copy<> need to
33
    // be Serializable and CopyConstructable. In the remote case
34
    // it can be MoveConstructable in which case the serialized data
35
    // is moved into the components constructor.
36
    test_server(test_server const& rhs) = default;
1✔
37
    test_server(test_server&& rhs) = default;
1✔
38

39
    test_server& operator=(test_server const&)
40
    {
41
        return *this;
42
    }
43
    test_server& operator=(test_server&&)
44
    {
45
        return *this;
46
    }
47

48
    HPX_DEFINE_COMPONENT_ACTION(test_server, call, call_action)
49

50
    template <typename Archive>
51
    void serialize(Archive&, unsigned)
3✔
52
    {
53
    }
3✔
54
};
55

56
using server_type = hpx::components::component<test_server>;
57
HPX_REGISTER_COMPONENT(server_type, test_server)
48✔
58

59
using call_action = test_server::call_action;
60
HPX_REGISTER_ACTION(call_action)
5✔
61

62
struct test_client : hpx::components::client_base<test_client, test_server>
×
63
{
64
    using base_type = hpx::components::client_base<test_client, test_server>;
65

66
    test_client() = default;
67
    test_client(hpx::shared_future<hpx::id_type> const& id)
×
68
      : base_type(id)
×
69
    {
×
70
    }
×
71
    test_client(hpx::id_type&& id)
×
72
      : base_type(std::move(id))
×
73
    {
×
74
    }
×
75

76
    hpx::id_type call() const
×
77
    {
78
        return call_action()(this->get_id());
×
79
    }
80
};
81

82
///////////////////////////////////////////////////////////////////////////////
83
bool test_copy_component(hpx::id_type id)
×
84
{
85
    // create component on given locality
86
    test_client t1 = hpx::new_<test_client>(id);
×
87
    HPX_TEST_NEQ(hpx::invalid_id, t1.get_id());
×
88

89
    try
90
    {
91
        // create a copy of t1 on same locality
92
        test_client t2(hpx::components::copy<test_server>(t1.get_id()));
×
93
        HPX_TEST_NEQ(hpx::invalid_id, t2.get_id());
×
94

95
        // the new object should life on id
96
        HPX_TEST_EQ(t2.call(), id);
×
97

98
        return true;
×
99
    }
×
100
    catch (hpx::exception const&)
101
    {
102
        HPX_TEST(false);
×
103
    }
×
104

105
    return false;
×
106
}
×
107

108
///////////////////////////////////////////////////////////////////////////////
109
bool test_copy_component_here(hpx::id_type id)
×
110
{
111
    // create component on given locality
112
    test_client t1 = hpx::new_<test_client>(id);
×
113
    HPX_TEST_NEQ(hpx::invalid_id, t1.get_id());
×
114

115
    try
116
    {
117
        // create a copy of t1 here
118
        test_client t2(
×
119
            hpx::components::copy<test_server>(t1.get_id(), hpx::find_here()));
×
120
        HPX_TEST_NEQ(hpx::invalid_id, t2.get_id());
×
121

122
        // the new object should life here
123
        HPX_TEST_EQ(t2.call(), hpx::find_here());
×
124

125
        return true;
×
126
    }
×
127
    catch (hpx::exception const&)
128
    {
129
        HPX_TEST(false);
×
130
    }
×
131

132
    return false;
×
133
}
×
134

135
///////////////////////////////////////////////////////////////////////////////
136
bool test_copy_component_there(hpx::id_type id)
×
137
{
138
    // create component on given locality
139
    test_client t1 = hpx::new_<test_client>(hpx::find_here());
×
140
    HPX_TEST_NEQ(hpx::invalid_id, t1.get_id());
×
141

142
    try
143
    {
144
        // create a copy of t1 on given locality
145
        test_client t2(hpx::components::copy<test_server>(t1.get_id(), id));
×
146
        HPX_TEST_NEQ(hpx::invalid_id, t2.get_id());
×
147

148
        // the new object should life there
149
        HPX_TEST_EQ(t2.call(), id);
×
150

151
        return true;
×
152
    }
×
153
    catch (hpx::exception const&)
154
    {
155
        HPX_TEST(false);
×
156
    }
×
157

158
    return false;
×
159
}
×
160

161
int main()
×
162
{
163
    HPX_TEST(test_copy_component(hpx::find_here()));
×
164
    HPX_TEST(test_copy_component_here(hpx::find_here()));
×
165
    HPX_TEST(test_copy_component_there(hpx::find_here()));
×
166

167
    std::vector<hpx::id_type> localities = hpx::find_remote_localities();
×
168
    for (hpx::id_type const& id : localities)
×
169
    {
170
        HPX_TEST(test_copy_component(id));
×
171
        HPX_TEST(test_copy_component_here(id));
×
172
        HPX_TEST(test_copy_component_there(id));
×
173
    }
174

175
    return hpx::util::report_errors();
×
176
}
×
177
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc