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

STEllAR-GROUP / hpx / #864

12 Jan 2023 03:29PM UTC coverage: 86.354% (-0.2%) from 86.533%
#864

push

web-flow
Merge pull request #6133 from STEllAR-GROUP/background_scheduler

Adding abridged static scheduler that supports running background threads only

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

174319 of 201865 relevant lines covered (86.35%)

1939452.8 hits per line

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

69.23
/libs/full/resiliency_distributed/tests/unit/async_replay_distributed_plain.cpp
1
//  Copyright (c) 2019-2020 Nikunj Gupta
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

10
#include <hpx/actions_base/plain_action.hpp>
11
#include <hpx/hpx_init.hpp>
12
#include <hpx/include/runtime.hpp>
13
#include <hpx/modules/futures.hpp>
14
#include <hpx/modules/resiliency.hpp>
15
#include <hpx/modules/resiliency_distributed.hpp>
16
#include <hpx/modules/testing.hpp>
17

18
#include <cstddef>
19
#include <random>
20
#include <vector>
21

22
std::random_device rd;
2✔
23
std::mt19937 mt(rd());
2✔
24
std::uniform_real_distribution<double> dist(1.0, 10.0);
2✔
25

26
int universal_ans()
2✔
27
{
28
    if (dist(mt) > 5)
2✔
29
        return 42;
2✔
30
    return 84;
×
31
}
2✔
32

33
HPX_PLAIN_ACTION(universal_ans, universal_action)
6✔
34

35
bool validate(int ans)
1✔
36
{
37
    return ans == 42;
1✔
38
}
39

40
int hpx_main()
1✔
41
{
42
    std::vector<hpx::id_type> locals = hpx::find_all_localities();
1✔
43

44
    // Allow a task to replay on the same locality if there is only 1 locality
45
    if (locals.size() == 1)
1✔
46
    {
47
        locals.insert(locals.end(), 9, hpx::find_here());
×
48
    }
×
49

50
    {
51
        universal_action our_action;
52
        hpx::future<int> f =
53
            hpx::resiliency::experimental::async_replay(locals, our_action);
1✔
54

55
        try
56
        {
57
            f.get();
1✔
58
        }
1✔
59
        catch (hpx::resiliency::experimental::abort_replay_exception const&)
60
        {
61
            HPX_TEST(true);
×
62
        }
×
63
        catch (...)
64
        {
65
            HPX_TEST(false);
×
66
        }
×
67
    }
1✔
68

69
    {
70
        universal_action our_action;
71
        hpx::future<int> f =
72
            hpx::resiliency::experimental::async_replay_validate(
1✔
73
                locals, &validate, our_action);
1✔
74

75
        try
76
        {
77
            f.get();
1✔
78
        }
1✔
79
        catch (hpx::resiliency::experimental::abort_replay_exception const&)
80
        {
81
            HPX_TEST(true);
×
82
        }
×
83
        catch (...)
84
        {
85
            HPX_TEST(false);
×
86
        }
×
87
    }
1✔
88

89
    return hpx::finalize();
1✔
90
}
1✔
91

92
int main(int argc, char* argv[])
2✔
93
{
94
    // Initialize and run HPX
95
    HPX_TEST(hpx::init(argc, argv) == 0);
2✔
96
    return hpx::util::report_errors();
2✔
97
}
×
98

99
#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

© 2026 Coveralls, Inc