blob: 7cfe4d26e9a20fd027139ff84d7c6a87f9acfde4 [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']:
Alexander Afanasyev58ea4582014-05-30 08:38:56 +030031 # main()
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070032 unit_test_main = bld(
33 target='unit-tests-main',
34 name='unit-tests-main',
35 features='cxx',
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070036 use='core-objects',
Alexander Afanasyev58ea4582014-05-30 08:38:56 +030037 source='main.cpp',
38 )
39
40 # common test modules
41 unit_test_base = bld(
42 target='unit-tests-base',
43 name='unit-tests-base',
44 features='cxx pch',
45 source=bld.path.ant_glob(['*.cpp'], excl='main.cpp'),
46 use='core-objects',
47 headers='../common.hpp boost-test.hpp',
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070048 )
49
50 # core tests
51 unit_tests_core = bld.program(
52 target='../unit-tests-core',
53 features='cxx cxxprogram',
54 source=bld.path.ant_glob(['core/**/*.cpp']),
Alexander Afanasyev58ea4582014-05-30 08:38:56 +030055 use='core-objects unit-tests-base unit-tests-main',
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070056 includes='.',
Alexander Afanasyev9a0c2d02014-04-27 20:26:26 -070057 install_path=None,
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070058 )
59
60 # NFD tests
61 unit_tests_nfd = bld.program(
62 target='../unit-tests-daemon',
63 features='cxx cxxprogram',
64 source=bld.path.ant_glob(['daemon/**/*.cpp'],
Spyridon Mastorakisd0381c02015-02-19 10:29:41 -080065 excl=['daemon/face/ethernet*.cpp',
66 'daemon/face/unix*.cpp',
Steve DiBenedettoef04f272014-06-04 14:28:31 -060067 'daemon/face/websocket*.cpp']),
Alexander Afanasyev58ea4582014-05-30 08:38:56 +030068 use='daemon-objects unit-tests-base unit-tests-main',
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070069 includes='.',
Alexander Afanasyev9a0c2d02014-04-27 20:26:26 -070070 install_path=None,
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070071 )
72
73 if bld.env['HAVE_LIBPCAP']:
Spyridon Mastorakisd0381c02015-02-19 10:29:41 -080074 unit_tests_nfd.source += bld.path.ant_glob('daemon/face/ethernet*.cpp')
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070075
76 if bld.env['HAVE_UNIX_SOCKETS']:
Spyridon Mastorakisd0381c02015-02-19 10:29:41 -080077 unit_tests_nfd.source += bld.path.ant_glob('daemon/face/unix*.cpp')
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070078
Wentao Shang53df1632014-04-21 12:01:32 -070079 if bld.env['HAVE_WEBSOCKET']:
Steve DiBenedettoef04f272014-06-04 14:28:31 -060080 unit_tests_nfd.source += bld.path.ant_glob('daemon/face/websocket*.cpp')
Wentao Shang53df1632014-04-21 12:01:32 -070081
Alexander Afanasyev3ecec502014-04-16 13:42:44 -070082 unit_tests_rib = bld.program(
83 target='../unit-tests-rib',
84 features='cxx cxxprogram',
85 source=bld.path.ant_glob(['rib/**/*.cpp']),
Alexander Afanasyev58ea4582014-05-30 08:38:56 +030086 use='rib-objects unit-tests-base unit-tests-main',
Steve DiBenedettoef04f272014-06-04 14:28:31 -060087 includes='.',
Alexander Afanasyev9a0c2d02014-04-27 20:26:26 -070088 install_path=None,
Alexander Afanasyev3ecec502014-04-16 13:42:44 -070089 )
90
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070091 # Other tests (e.g., stress tests that can be enabled even if unit tests are disabled)
92 if bld.env['WITH_TESTS'] or bld.env['WITH_OTHER_TESTS']:
93 bld.recurse("other")