summaryrefslogtreecommitdiff
path: root/tests/SConscript
blob: 1f75e0d44b505df5c8552ef7adb4ecdeb23b11aa (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
from aptitude_build import CString
from aptitude_build import ShellEscape
import os.path

Import('base_env')
Import('cppunit_tests_env')
Import('boost_tests_env')
Import('gtest_tests_env')
base_env.Dist('Makefile.am', 'SConscript')

cppunit_test_sources = [
    'cppunit_test_main.cc',
    'test_choice.cc',
    'test_choice_set.cc',
    'test_config_pusher.cc',
    'test_dense_setset.cc',
    'test_incremental_expression.cc',
    'test_matching.cc',
    'test_misc.cc',
    'test_parsers.cc',
    'test_promotion_set.cc',
    'test_resolver.cc',
    'test_resolver_costs.cc',
    'test_resolver_hints.cc',
    'test_setset.cc',
    'test_tags.cc',
    'test_temp.cc',
    'test_wtree.cc',
    ]

cppunit_test_extra_deps = [
    '../src/generic/apt/apt.o',
    '../src/generic/apt/aptcache.o',
    '../src/generic/apt/aptitude_resolver.o',
    '../src/generic/apt/aptitude_resolver_cost_settings.o',
    '../src/generic/apt/aptitude_resolver_cost_syntax.o',
    '../src/generic/apt/aptitude_resolver_cost_types.o',
    '../src/generic/apt/aptitude_resolver_universe.o',
    '../src/generic/apt/aptitudepolicy.o',
    '../src/generic/apt/config_signal.o',
    '../src/generic/apt/download_queue.o',
    '../src/generic/apt/dump_packages.o',
    '../src/generic/apt/globals.o',
    '../src/generic/apt/matching/compare_patterns.o',
    '../src/generic/apt/matching/match.o',
    '../src/generic/apt/matching/parse.o',
    '../src/generic/apt/matching/pattern.o',
    '../src/generic/apt/matching/serialize.o',
    '../src/generic/apt/pkg_hier.o',
    '../src/generic/apt/resolver_manager.o',
    '../src/generic/apt/tags.o',
    '../src/generic/apt/tasks.o',
    '../src/generic/problemresolver/cost.o',
    '../src/generic/problemresolver/cost_limits.o',
    '../src/generic/problemresolver/dummy_universe.o',
    '../src/generic/problemresolver/incremental_expression.o',
    '../src/generic/util/file_cache.o',
    '../src/generic/util/logging.o',
    '../src/generic/util/refcounted_base.o',
    '../src/generic/util/sqlite.o',
    '../src/generic/util/temp.o',
    '../src/generic/util/undo.o',
    '../src/generic/util/util.o',
    '../src/loggers.o',
    ]

boost_test_sources = [
    'boost_test_main.cc',
    'test_dynamic_list.cc',
    'test_dynamic_set.cc',
    'test_enumerator.cc',
    'test_file_cache.cc',
    'test_search_input_controller.cc',
    'test_sqlite.cc'
    ]

boost_test_extra_deps = [
    '../src/generic/apt/globals.o',
    '../src/generic/apt/matching/compare_patterns.o',
    '../src/generic/apt/matching/parse.o',
    '../src/generic/apt/matching/pattern.o',
    '../src/generic/controllers/search_input.o',
    '../src/generic/util/file_cache.o',
    '../src/generic/util/logging.o',
    '../src/generic/util/refcounted_base.o',
    '../src/generic/util/sqlite.o',
    '../src/generic/util/temp.o',
    '../src/generic/util/util.o',
    '../src/generic/views/search_input.o',
    '../src/loggers.o',
    ]

gtest_test_sources = [
    'gtest_test_main.cc',
    'test_cmdline_download_progress_display.cc',
    'test_cmdline_download_status_display.cc',
    'test_cmdline_progress_display.cc',
    'test_cmdline_search_progress.cc',
    'test_logging.cc',
    'test_teletype_mock.cc',
    'test_terminal_mock.cc',
    'test_transient_message.o',
    ]

gtest_test_extra_deps = [
    '../src/cmdline/cmdline_download_progress_display.o',
    '../src/cmdline/cmdline_progress_display.o',
    '../src/cmdline/cmdline_search_progress.o',
    '../src/cmdline/mocks/teletype.o',
    '../src/cmdline/mocks/terminal.o',
    '../src/cmdline/terminal.o',
    '../src/cmdline/transient_message.o',
    '../src/generic/apt/globals.o',
    '../src/generic/util/logging.o',
    '../src/generic/util/progress_info.o',
    '../src/generic/util/throttle.o',
    '../src/generic/util/util.o',
    '../src/generic/views/download_progress.o',
    '../src/generic/views/mocks/download_progress.o',
    '../src/generic/views/progress.o',
    '../src/loggers.o',
    ]

test_data_files = [
    'file_caches/ver2_cache.db',
    'file_caches/ver3_cache.db',
    ]

boost_tests_env.Dist(boost_test_sources,
                     cppunit_test_sources,
                     gtest_test_sources,
                     test_data_files)

cppunit_test = cppunit_tests_env.Test('cppunit_test',
                                      (cppunit_test_sources,
                                       cppunit_test_extra_deps))

# The file cache test uses this to find its input data.  It must be
# the path of the parent of the file_caches directory, relative to the
# path of the test executable.  Since those are the same directory,
# "." is correct.
boost_tests_env.Append(CPPDEFINES = ('SRCDIR', ShellEscape(CString('.'))))

boost_test = boost_tests_env.Test('boost_test',
                                  (boost_test_sources,
                                   boost_test_extra_deps))

gtest_test = gtest_tests_env.Test('gtest_test',
                                  (gtest_test_sources,
                                   gtest_test_extra_deps))

# Ensure that the test file caches are copied to the build directory.
for test_input in test_data_files:
    test_file = boost_tests_env.Command(test_input,
                                        os.path.join('#', 'tests', test_input),
                                        Copy('$TARGET', '$SOURCE'))
    boost_tests_env.Requires(boost_test, test_file)