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']: |
| 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 Afanasyev | 9a0c2d0 | 2014-04-27 20:26:26 -0700 | [diff] [blame] | 46 | install_path=None, |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 47 | ) |
| 48 | |
| 49 | # NFD tests |
| 50 | unit_tests_nfd = bld.program( |
| 51 | target='../unit-tests-daemon', |
| 52 | features='cxx cxxprogram', |
| 53 | source=bld.path.ant_glob(['daemon/**/*.cpp'], |
| 54 | excl=['daemon/face/ethernet.cpp', |
Wentao Shang | 53df163 | 2014-04-21 12:01:32 -0700 | [diff] [blame^] | 55 | 'daemon/face/unix-*.cpp', |
| 56 | 'daemon/face/websocket-*.cpp']), |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 57 | use='daemon-objects unit-tests-main', |
| 58 | includes='.', |
Alexander Afanasyev | 9a0c2d0 | 2014-04-27 20:26:26 -0700 | [diff] [blame] | 59 | install_path=None, |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 60 | ) |
| 61 | |
| 62 | if bld.env['HAVE_LIBPCAP']: |
| 63 | unit_tests_nfd.source += bld.path.ant_glob('daemon/face/ethernet.cpp') |
| 64 | |
| 65 | if bld.env['HAVE_UNIX_SOCKETS']: |
| 66 | unit_tests_nfd.source += bld.path.ant_glob('daemon/face/unix-*.cpp') |
| 67 | |
Wentao Shang | 53df163 | 2014-04-21 12:01:32 -0700 | [diff] [blame^] | 68 | if bld.env['HAVE_WEBSOCKET']: |
| 69 | unit_tests_nfd.source += bld.path.ant_glob('daemon/face/websocket-*.cpp') |
| 70 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 71 | unit_tests_rib = bld.program( |
| 72 | target='../unit-tests-rib', |
| 73 | features='cxx cxxprogram', |
| 74 | source=bld.path.ant_glob(['rib/**/*.cpp']), |
| 75 | use='rib-objects unit-tests-main', |
| 76 | includes=['.'], |
Alexander Afanasyev | 9a0c2d0 | 2014-04-27 20:26:26 -0700 | [diff] [blame] | 77 | install_path=None, |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 78 | ) |
| 79 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 80 | # Other tests (e.g., stress tests that can be enabled even if unit tests are disabled) |
| 81 | if bld.env['WITH_TESTS'] or bld.env['WITH_OTHER_TESTS']: |
| 82 | bld.recurse("other") |