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 | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame^] | 47 | pch='test-pch.hpp', |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 48 | ) |
| 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 Shang | 53df163 | 2014-04-21 12:01:32 -0700 | [diff] [blame] | 56 | 'daemon/face/unix-*.cpp', |
| 57 | 'daemon/face/websocket-*.cpp']), |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 58 | use='daemon-objects unit-tests-main', |
| 59 | includes='.', |
Alexander Afanasyev | 9a0c2d0 | 2014-04-27 20:26:26 -0700 | [diff] [blame] | 60 | install_path=None, |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame^] | 61 | pch='test-pch.hpp', |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 62 | ) |
| 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 Shang | 53df163 | 2014-04-21 12:01:32 -0700 | [diff] [blame] | 70 | if bld.env['HAVE_WEBSOCKET']: |
| 71 | unit_tests_nfd.source += bld.path.ant_glob('daemon/face/websocket-*.cpp') |
| 72 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 73 | 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 Afanasyev | 9a0c2d0 | 2014-04-27 20:26:26 -0700 | [diff] [blame] | 79 | install_path=None, |
Alexander Afanasyev | 8552a38 | 2014-05-15 20:13:42 -0700 | [diff] [blame^] | 80 | pch='test-pch.hpp', |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 81 | ) |
| 82 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 83 | # 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") |