summaryrefslogtreecommitdiff
path: root/src/mongo/stdx/SConscript
blob: ece7efba3f5d80b1117701446f97d5c76a7f8180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# -*- mode: python -*-

Import("env")

env = env.Clone()

env.Benchmark(
    target='condition_variable_bm',
    source=[
        'condition_variable_bm.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
)

env.Library(
    target='stdx',
    source=[
        'set_terminate_internals.cpp',
    ],
    LIBDEPS=[
        # Ideally, there should be no linking dependencies upon any other libraries, for `libstdx`.
        # This library is a shim filling in for deficiencies in various standard library
        # implementations.  There should never be any link-time dependencies into mongo internals.
    ],
)

env.CppUnitTest(
    target='stdx_test',
    source=[
        'unordered_map_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/third_party/shim_abseil',
    ],
)

# Specify UNITTEST_HAS_CUSTOM_MAINLINE because it needs low-level control of
# thread creation and signals, so it shouldn't use unittest_main and typical
# mongo startup routines.
env.CppUnitTest(
    target='sigaltstack_location_test',
    source=[
        'sigaltstack_location_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
    UNITTEST_HAS_CUSTOM_MAINLINE=True,
)

# The tests for `stdx::set_terminate` need to run outside of the mongo unittest harneses.
# The tests require altering the global `set_terminate` handler, which our unittest framework
# doesn't expect to have happen.  Further, the tests have to return successfully from a
# terminate condition which interacts poorly with the unittest framework.
#
# A set of dedicated binaries to each test case is actually the simplest way to accomplish
# robust testing of this mechanism.

# Needs to be a different test -- It has to have direct control over the `main()` entry point.
env.CppUnitTest(
    target='set_terminate_dispatch_test',
    source=[
        'set_terminate_dispatch_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
    UNITTEST_HAS_CUSTOM_MAINLINE=True,
)

# Needs to be a different test -- It has to have direct control over the `main()` entry point.
env.CppUnitTest(
    target='set_terminate_from_main_die_in_thread_test',
    source=[
        'set_terminate_from_main_die_in_thread_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
    UNITTEST_HAS_CUSTOM_MAINLINE=True,
)

# Needs to be a different test -- It has to have direct control over the `main()` entry point.
env.CppUnitTest(
    target='set_terminate_from_thread_die_in_main_test',
    source=[
        'set_terminate_from_thread_die_in_main_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
    UNITTEST_HAS_CUSTOM_MAINLINE=True,
)

# Needs to be a different test -- It has to have direct control over the `main()` entry point.
env.CppUnitTest(
    target='set_terminate_from_thread_die_in_thread_test',
    source=[
        'set_terminate_from_thread_die_in_thread_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
    UNITTEST_HAS_CUSTOM_MAINLINE=True,
)