Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
| 3 | """ |
| 4 | Copyright (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 | |
| 11 | This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | |
| 14 | NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | of the GNU General Public License as published by the Free Software Foundation, |
| 16 | either version 3 of the License, or (at your option) any later version. |
| 17 | |
| 18 | NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | PURPOSE. See the GNU General Public License for more details. |
| 21 | |
| 22 | You should have received a copy of the GNU General Public License along with |
| 23 | NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 24 | """ |
| 25 | |
| 26 | top = '..' |
| 27 | |
| 28 | def build(bld): |
| 29 | # Unit tests |
| 30 | if bld.env['WITH_TESTS']: |
Alexander Afanasyev | 58ea458 | 2014-05-30 08:38:56 +0300 | [diff] [blame^] | 31 | # main() |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 32 | unit_test_main = bld( |
| 33 | target='unit-tests-main', |
| 34 | name='unit-tests-main', |
| 35 | features='cxx', |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 36 | use='core-objects', |
Alexander Afanasyev | 58ea458 | 2014-05-30 08:38:56 +0300 | [diff] [blame^] | 37 | 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 Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 48 | ) |
| 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 Afanasyev | 58ea458 | 2014-05-30 08:38:56 +0300 | [diff] [blame^] | 55 | use='core-objects unit-tests-base unit-tests-main', |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 56 | includes='.', |
Alexander Afanasyev | 9a0c2d0 | 2014-04-27 20:26:26 -0700 | [diff] [blame] | 57 | install_path=None, |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 58 | ) |
| 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'], |
| 65 | excl=['daemon/face/ethernet.cpp', |
Wentao Shang | 53df163 | 2014-04-21 12:01:32 -0700 | [diff] [blame] | 66 | 'daemon/face/unix-*.cpp', |
| 67 | 'daemon/face/websocket-*.cpp']), |
Alexander Afanasyev | 58ea458 | 2014-05-30 08:38:56 +0300 | [diff] [blame^] | 68 | use='daemon-objects unit-tests-base unit-tests-main', |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 69 | includes='.', |
Alexander Afanasyev | 9a0c2d0 | 2014-04-27 20:26:26 -0700 | [diff] [blame] | 70 | install_path=None, |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 71 | ) |
| 72 | |
| 73 | if bld.env['HAVE_LIBPCAP']: |
| 74 | unit_tests_nfd.source += bld.path.ant_glob('daemon/face/ethernet.cpp') |
| 75 | |
| 76 | if bld.env['HAVE_UNIX_SOCKETS']: |
| 77 | unit_tests_nfd.source += bld.path.ant_glob('daemon/face/unix-*.cpp') |
| 78 | |
Wentao Shang | 53df163 | 2014-04-21 12:01:32 -0700 | [diff] [blame] | 79 | if bld.env['HAVE_WEBSOCKET']: |
| 80 | unit_tests_nfd.source += bld.path.ant_glob('daemon/face/websocket-*.cpp') |
| 81 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 82 | unit_tests_rib = bld.program( |
| 83 | target='../unit-tests-rib', |
| 84 | features='cxx cxxprogram', |
| 85 | source=bld.path.ant_glob(['rib/**/*.cpp']), |
Alexander Afanasyev | 58ea458 | 2014-05-30 08:38:56 +0300 | [diff] [blame^] | 86 | use='rib-objects unit-tests-base unit-tests-main', |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 87 | includes=['.'], |
Alexander Afanasyev | 9a0c2d0 | 2014-04-27 20:26:26 -0700 | [diff] [blame] | 88 | install_path=None, |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 89 | ) |
| 90 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 91 | # 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") |