blob: 7d8c36d1cc122b55c813afb91ec7b38473e14fa2 [file] [log] [blame]
Alexander Afanasyev613e2a92014-04-15 13:36:58 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
3"""
4Copyright (c) 2014 Regents of the University of California,
5 Arizona Board of Regents,
6 Colorado State University,
7 University Pierre & Marie Curie, Sorbonne University,
8 Washington University in St. Louis,
9 Beijing Institute of Technology
10
11This file is part of NFD (Named Data Networking Forwarding Daemon).
12See AUTHORS.md for complete list of NFD authors and contributors.
13
14NFD is free software: you can redistribute it and/or modify it under the terms
15of the GNU General Public License as published by the Free Software Foundation,
16either version 3 of the License, or (at your option) any later version.
17
18NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20PURPOSE. See the GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License along with
23NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24"""
25
26top = '..'
27
28def build(bld):
29 # Unit tests
30 if bld.env['WITH_TESTS']:
31 unit_test_main = bld(
32 target='unit-tests-main',
33 name='unit-tests-main',
34 features='cxx',
35 source=bld.path.ant_glob(['*.cpp']),
36 use='core-objects',
37 )
38
39 # core tests
40 unit_tests_core = bld.program(
41 target='../unit-tests-core',
42 features='cxx cxxprogram',
43 source=bld.path.ant_glob(['core/**/*.cpp']),
44 use='core-objects unit-tests-main',
45 includes='.',
Alexander Afanasyev9a0c2d02014-04-27 20:26:26 -070046 install_path=None,
Alexander Afanasyev8552a382014-05-15 20:13:42 -070047 pch='test-pch.hpp',
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070048 )
49
50 # NFD tests
51 unit_tests_nfd = bld.program(
52 target='../unit-tests-daemon',
53 features='cxx cxxprogram',
54 source=bld.path.ant_glob(['daemon/**/*.cpp'],
55 excl=['daemon/face/ethernet.cpp',
Wentao Shang53df1632014-04-21 12:01:32 -070056 'daemon/face/unix-*.cpp',
57 'daemon/face/websocket-*.cpp']),
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070058 use='daemon-objects unit-tests-main',
59 includes='.',
Alexander Afanasyev9a0c2d02014-04-27 20:26:26 -070060 install_path=None,
Alexander Afanasyev8552a382014-05-15 20:13:42 -070061 pch='test-pch.hpp',
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070062 )
63
64 if bld.env['HAVE_LIBPCAP']:
65 unit_tests_nfd.source += bld.path.ant_glob('daemon/face/ethernet.cpp')
66
67 if bld.env['HAVE_UNIX_SOCKETS']:
68 unit_tests_nfd.source += bld.path.ant_glob('daemon/face/unix-*.cpp')
69
Wentao Shang53df1632014-04-21 12:01:32 -070070 if bld.env['HAVE_WEBSOCKET']:
71 unit_tests_nfd.source += bld.path.ant_glob('daemon/face/websocket-*.cpp')
72
Alexander Afanasyev3ecec502014-04-16 13:42:44 -070073 unit_tests_rib = bld.program(
74 target='../unit-tests-rib',
75 features='cxx cxxprogram',
76 source=bld.path.ant_glob(['rib/**/*.cpp']),
77 use='rib-objects unit-tests-main',
78 includes=['.'],
Alexander Afanasyev9a0c2d02014-04-27 20:26:26 -070079 install_path=None,
Alexander Afanasyev8552a382014-05-15 20:13:42 -070080 pch='test-pch.hpp',
Alexander Afanasyev3ecec502014-04-16 13:42:44 -070081 )
82
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070083 # Other tests (e.g., stress tests that can be enabled even if unit tests are disabled)
84 if bld.env['WITH_TESTS'] or bld.env['WITH_OTHER_TESTS']:
85 bld.recurse("other")