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

STEllAR-GROUP / hpx / #856

28 Dec 2022 02:00AM UTC coverage: 86.602% (+0.05%) from 86.55%
#856

push

StellarBot
Merge #6119

6119: Update CMakeLists.txt r=hkaiser a=khuck

updating the default APEX version


Co-authored-by: Kevin Huck <khuck@cs.uoregon.edu>

174566 of 201573 relevant lines covered (86.6%)

1876093.78 hits per line

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

85.42
/libs/core/testing/src/testing.cpp
1
//  Copyright (c) 2020 ETH Zurich
2
//  Copyright (c) 2013-2022 Hartmut Kaiser
3
//  Copyright (c) 2017 Denis Blank
4
//
5
//  SPDX-License-Identifier: BSL-1.0
6
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
7
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8

9
#define HPX_NO_VERSION_CHECK
10

11
#include <hpx/assert.hpp>
12
#include <hpx/modules/format.hpp>
13
#include <hpx/modules/testing.hpp>
14
#include <hpx/modules/util.hpp>
15

16
#include <atomic>
17
#include <cstddef>
18
#include <cstdint>
19
#include <functional>
20
#include <iostream>
21
#include <string>
22

23
namespace hpx::util {
24

25
    static test_failure_handler_type test_failure_handler;
1,251✔
26

27
    void set_test_failure_handler(test_failure_handler_type f)
1,221✔
28
    {
29
        test_failure_handler = HPX_MOVE(f);
1,221✔
30
    }
1,221✔
31

32
    namespace detail {
33

34
        std::atomic<std::size_t> sanity_failures_(0);
35
        std::atomic<std::size_t> test_failures_(0);
36

37
        void fixture::increment(counter_type c) noexcept
926✔
38
        {
39
            if (test_failure_handler)
926✔
40
            {
41
                test_failure_handler();
925✔
42
            }
925✔
43

44
            switch (c)
926✔
45
            {
46
            case counter_type::sanity:
47
                ++sanity_failures_;
×
48
                return;
×
49
            case counter_type::test:
50
                ++test_failures_;
926✔
51
                return;
926✔
52
            default:
53
                break;
×
54
            }
55
            HPX_ASSERT(false);
×
56
        }
926✔
57

58
        std::size_t fixture::get(counter_type c) const noexcept
1,776✔
59
        {
60
            switch (c)
1,776✔
61
            {
62
            case counter_type::sanity:
63
                return sanity_failures_;
888✔
64
            case counter_type::test:
65
                return test_failures_;
888✔
66
            default:
67
                break;
×
68
            }
69
            HPX_ASSERT(false);
×
70
            return std::size_t(-1);
×
71
        }
1,776✔
72

73
        fixture& global_fixture() noexcept
59,508,434✔
74
        {
75
            static fixture fixture_(std::cerr);
59,508,434✔
76
            return fixture_;
59,510,460✔
77
        }
78
    }    // namespace detail
79

80
    ////////////////////////////////////////////////////////////////////////////
81
    int report_errors()
888✔
82
    {
83
        return report_errors(std::cerr);
888✔
84
    }
85

86
    int report_errors(std::ostream& stream)
888✔
87
    {
88
        std::size_t sanity = detail::global_fixture().get(counter_type::sanity),
888✔
89
                    test = detail::global_fixture().get(counter_type::test);
888✔
90
        if (sanity == 0 && test == 0)
888✔
91
            return 0;
886✔
92

93
        else
94
        {
95
            hpx::util::ios_flags_saver ifs(stream);
2✔
96
            stream << sanity << " sanity check"    //-V128
2✔
97
                   << ((sanity == 1) ? " and " : "s and ") << test << " test"
2✔
98
                   << ((test == 1) ? " failed." : "s failed.") << std::endl;
2✔
99
            return 1;
2✔
100
        }
2✔
101
    }
888✔
102

103
    void print_cdash_timing(char const* name, double time)
22✔
104
    {
105
        // use format followed by single cout for better multi-threaded output
106
        std::string temp =
107
            hpx::util::format("<DartMeasurement name=\"{}\" "
22✔
108
                              "type=\"numeric/double\">{}</DartMeasurement>",
109
                name, time);
110
        std::cout << temp << std::endl;
22✔
111
    }
22✔
112

113
    void print_cdash_timing(char const* name, std::uint64_t time)
3✔
114
    {
115
        print_cdash_timing(name, time / 1e9);
3✔
116
    }
3✔
117
}    // namespace hpx::util
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