src: Reorganizing source code in preparation to merge NRD code

Note that as of this commit, there are several changes in location of
compiled binaries in `build/` folder:

* `nfd` has been moved to `build/bin/nfd`
* `unit-tests` has been split into `unit-tests-core` and `unit-tests-daemon`

Change-Id: I2c830c117879edbaa5457d6423c13f0273285919
Refs: #1486
diff --git a/tests/mgmt/config-file.cpp b/tests/core/config-file.cpp
similarity index 95%
rename from tests/mgmt/config-file.cpp
rename to tests/core/config-file.cpp
index ff352d4..bb75b77 100644
--- a/tests/mgmt/config-file.cpp
+++ b/tests/core/config-file.cpp
@@ -22,7 +22,7 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#include "mgmt/config-file.hpp"
+#include "core/config-file.hpp"
 
 #include "tests/test-common.hpp"
 
@@ -218,7 +218,7 @@
   DummyAllSubscriber sub(file);
   std::ifstream input;
 
-  input.open("tests/mgmt/config_example.info");
+  input.open("tests/core/config_example.info");
   BOOST_REQUIRE(input.is_open());
 
   file.parse(input, false, "config_example.info");
@@ -280,7 +280,7 @@
   ConfigFile file;
   DummyAllSubscriber sub(file);
 
-  file.parse("tests/mgmt/config_example.info", false);
+  file.parse("tests/core/config_example.info", false);
 
   BOOST_CHECK(sub.allCallbacksFired());
 }
@@ -300,7 +300,7 @@
   ConfigFile file;
   DummyAllSubscriber sub(file);
 
-  BOOST_CHECK_THROW(file.parse("tests/mgmt/config_malformed.info", false), ConfigFile::Error);
+  BOOST_CHECK_THROW(file.parse("tests/core/config_malformed.info", false), ConfigFile::Error);
 
   BOOST_CHECK(sub.noCallbacksFired());
 }
@@ -311,10 +311,10 @@
   DummyAllSubscriber sub(file, true);
   std::ifstream input;
 
-  input.open("tests/mgmt/config_example.info");
+  input.open("tests/core/config_example.info");
   BOOST_REQUIRE(input.is_open());
 
-  file.parse(input, true, "tests/mgmt/config_example.info");
+  file.parse(input, true, "tests/core/config_example.info");
 
   BOOST_CHECK(sub.allCallbacksFired());
 
@@ -326,7 +326,7 @@
   ConfigFile file;
   DummyAllSubscriber sub(file, true);
 
-  file.parse("tests/mgmt/config_example.info", true);
+  file.parse("tests/core/config_example.info", true);
   BOOST_CHECK(sub.allCallbacksFired());
 }
 
diff --git a/tests/mgmt/config_example.info b/tests/core/config_example.info
similarity index 100%
rename from tests/mgmt/config_example.info
rename to tests/core/config_example.info
diff --git a/tests/mgmt/config_malformed.info b/tests/core/config_malformed.info
similarity index 100%
rename from tests/mgmt/config_malformed.info
rename to tests/core/config_malformed.info
diff --git a/tests/face/ethernet-address.cpp b/tests/core/ethernet.cpp
similarity index 98%
rename from tests/face/ethernet-address.cpp
rename to tests/core/ethernet.cpp
index d9e1b42..157f574 100644
--- a/tests/face/ethernet-address.cpp
+++ b/tests/core/ethernet.cpp
@@ -22,7 +22,7 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#include "face/ethernet.hpp"
+#include "core/ethernet.hpp"
 #include "tests/test-common.hpp"
 
 namespace nfd {
diff --git a/tests/core/face-uri.cpp b/tests/core/face-uri.cpp
index 5d31f66..0e54f04 100644
--- a/tests/core/face-uri.cpp
+++ b/tests/core/face-uri.cpp
@@ -24,7 +24,7 @@
 
 #include "core/face-uri.hpp"
 #ifdef HAVE_LIBPCAP
-#include "face/ethernet.hpp"
+#include "core/ethernet.hpp"
 #endif // HAVE_LIBPCAP
 
 #include "tests/test-common.hpp"
diff --git a/tests/core/version.cpp b/tests/core/version.cpp
index ee29615..669a866 100644
--- a/tests/core/version.cpp
+++ b/tests/core/version.cpp
@@ -22,7 +22,7 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#include "core/version.hpp"
+#include "version.hpp"
 #include "core/logger.hpp"
 
 #include "tests/test-common.hpp"
diff --git a/tests/face/dummy-face.hpp b/tests/daemon/face/dummy-face.hpp
similarity index 94%
rename from tests/face/dummy-face.hpp
rename to tests/daemon/face/dummy-face.hpp
index e4d75c2..7039286 100644
--- a/tests/face/dummy-face.hpp
+++ b/tests/daemon/face/dummy-face.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_TEST_FACE_DUMMY_FACE_HPP
-#define NFD_TEST_FACE_DUMMY_FACE_HPP
+#ifndef NFD_TESTS_NFD_FACE_DUMMY_FACE_HPP
+#define NFD_TESTS_NFD_FACE_DUMMY_FACE_HPP
 
 #include "face/face.hpp"
 #include "face/local-face.hpp"
@@ -90,4 +90,4 @@
 } // namespace tests
 } // namespace nfd
 
-#endif // TEST_FACE_DUMMY_FACE_HPP
+#endif // NFD_TESTS_NFD_FACE_DUMMY_FACE_HPP
diff --git a/tests/face/ethernet.cpp b/tests/daemon/face/ethernet.cpp
similarity index 100%
rename from tests/face/ethernet.cpp
rename to tests/daemon/face/ethernet.cpp
diff --git a/tests/face/face.cpp b/tests/daemon/face/face.cpp
similarity index 100%
rename from tests/face/face.cpp
rename to tests/daemon/face/face.cpp
diff --git a/tests/face/ndnlp.cpp b/tests/daemon/face/ndnlp.cpp
similarity index 100%
rename from tests/face/ndnlp.cpp
rename to tests/daemon/face/ndnlp.cpp
diff --git a/tests/face/tcp.cpp b/tests/daemon/face/tcp.cpp
similarity index 99%
rename from tests/face/tcp.cpp
rename to tests/daemon/face/tcp.cpp
index 0c2a094..07e6ec5 100644
--- a/tests/face/tcp.cpp
+++ b/tests/daemon/face/tcp.cpp
@@ -26,7 +26,7 @@
 #include <ndn-cpp-dev/security/key-chain.hpp>
 
 #include "tests/test-common.hpp"
-#include "tests/core/limited-io.hpp"
+#include "tests/limited-io.hpp"
 
 namespace nfd {
 namespace tests {
diff --git a/tests/face/udp.cpp b/tests/daemon/face/udp.cpp
similarity index 99%
rename from tests/face/udp.cpp
rename to tests/daemon/face/udp.cpp
index 776d9a7..2dfca3a 100644
--- a/tests/face/udp.cpp
+++ b/tests/daemon/face/udp.cpp
@@ -25,7 +25,7 @@
 #include "face/udp-factory.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/core/limited-io.hpp"
+#include "tests/limited-io.hpp"
 
 namespace nfd {
 namespace tests {
diff --git a/tests/face/unix-stream.cpp b/tests/daemon/face/unix-stream.cpp
similarity index 99%
rename from tests/face/unix-stream.cpp
rename to tests/daemon/face/unix-stream.cpp
index 7e08b78..4181aa1 100644
--- a/tests/face/unix-stream.cpp
+++ b/tests/daemon/face/unix-stream.cpp
@@ -25,7 +25,7 @@
 #include "face/unix-stream-factory.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/core/limited-io.hpp"
+#include "tests/limited-io.hpp"
 
 namespace nfd {
 namespace tests {
diff --git a/tests/fw/broadcast-strategy.cpp b/tests/daemon/fw/broadcast-strategy.cpp
similarity index 98%
rename from tests/fw/broadcast-strategy.cpp
rename to tests/daemon/fw/broadcast-strategy.cpp
index 7a4c6dc..cde9b44 100644
--- a/tests/fw/broadcast-strategy.cpp
+++ b/tests/daemon/fw/broadcast-strategy.cpp
@@ -24,7 +24,7 @@
 
 #include "fw/broadcast-strategy.hpp"
 #include "strategy-tester.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 #include "tests/test-common.hpp"
 
diff --git a/tests/fw/client-control-strategy.cpp b/tests/daemon/fw/client-control-strategy.cpp
similarity index 98%
rename from tests/fw/client-control-strategy.cpp
rename to tests/daemon/fw/client-control-strategy.cpp
index 3ee72ca..c76fb52 100644
--- a/tests/fw/client-control-strategy.cpp
+++ b/tests/daemon/fw/client-control-strategy.cpp
@@ -24,7 +24,7 @@
 
 #include "fw/client-control-strategy.hpp"
 #include "strategy-tester.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 #include "tests/test-common.hpp"
 
diff --git a/tests/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp
similarity index 94%
rename from tests/fw/dummy-strategy.hpp
rename to tests/daemon/fw/dummy-strategy.hpp
index 5f6587b..67784fc 100644
--- a/tests/fw/dummy-strategy.hpp
+++ b/tests/daemon/fw/dummy-strategy.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_TEST_FW_DUMMY_STRATEGY_HPP
-#define NFD_TEST_FW_DUMMY_STRATEGY_HPP
+#ifndef NFD_TESTS_NFD_FW_DUMMY_STRATEGY_HPP
+#define NFD_TESTS_NFD_FW_DUMMY_STRATEGY_HPP
 
 #include "fw/strategy.hpp"
 
@@ -83,4 +83,4 @@
 } // namespace tests
 } // namespace nfd
 
-#endif // TEST_FW_DUMMY_STRATEGY_HPP
+#endif // NFD_TESTS_NFD_FW_DUMMY_STRATEGY_HPP
diff --git a/tests/fw/face-table.cpp b/tests/daemon/fw/face-table.cpp
similarity index 98%
rename from tests/fw/face-table.cpp
rename to tests/daemon/fw/face-table.cpp
index 42d1f53..daf9256 100644
--- a/tests/fw/face-table.cpp
+++ b/tests/daemon/fw/face-table.cpp
@@ -26,7 +26,7 @@
 #include "fw/forwarder.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 namespace nfd {
 namespace tests {
diff --git a/tests/fw/forwarder.cpp b/tests/daemon/fw/forwarder.cpp
similarity index 99%
rename from tests/fw/forwarder.cpp
rename to tests/daemon/fw/forwarder.cpp
index a2ee67e..0151460 100644
--- a/tests/fw/forwarder.cpp
+++ b/tests/daemon/fw/forwarder.cpp
@@ -23,11 +23,11 @@
  **/
 
 #include "fw/forwarder.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 #include "dummy-strategy.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/core/limited-io.hpp"
+#include "tests/limited-io.hpp"
 
 namespace nfd {
 namespace tests {
diff --git a/tests/fw/ncc-strategy.cpp b/tests/daemon/fw/ncc-strategy.cpp
similarity index 97%
rename from tests/fw/ncc-strategy.cpp
rename to tests/daemon/fw/ncc-strategy.cpp
index 493e621..29db3b3 100644
--- a/tests/fw/ncc-strategy.cpp
+++ b/tests/daemon/fw/ncc-strategy.cpp
@@ -24,8 +24,8 @@
 
 #include "fw/ncc-strategy.hpp"
 #include "strategy-tester.hpp"
-#include "tests/face/dummy-face.hpp"
-#include "tests/core/limited-io.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
+#include "tests/limited-io.hpp"
 
 #include "tests/test-common.hpp"
 
diff --git a/tests/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
similarity index 94%
rename from tests/fw/strategy-tester.hpp
rename to tests/daemon/fw/strategy-tester.hpp
index c268a8e..e3debef 100644
--- a/tests/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_TEST_FW_STRATEGY_TESTER_HPP
-#define NFD_TEST_FW_STRATEGY_TESTER_HPP
+#ifndef NFD_TESTS_NFD_FW_STRATEGY_TESTER_HPP
+#define NFD_TESTS_NFD_FW_STRATEGY_TESTER_HPP
 
 #include <boost/tuple/tuple_comparison.hpp>
 #include "fw/strategy.hpp"
@@ -86,4 +86,4 @@
 } // namespace tests
 } // namespace nfd
 
-#endif // TEST_FW_STRATEGY_TESTER_HPP
+#endif // NFD_TESTS_NFD_FW_STRATEGY_TESTER_HPP
diff --git a/tests/mgmt/command-validator.cpp b/tests/daemon/mgmt/command-validator.cpp
similarity index 90%
rename from tests/mgmt/command-validator.cpp
rename to tests/daemon/mgmt/command-validator.cpp
index 69c44a0..cb8031a 100644
--- a/tests/mgmt/command-validator.cpp
+++ b/tests/daemon/mgmt/command-validator.cpp
@@ -23,7 +23,7 @@
  **/
 
 #include "mgmt/command-validator.hpp"
-#include "mgmt/config-file.hpp"
+#include "core/config-file.hpp"
 
 #include "tests/test-common.hpp"
 
@@ -44,7 +44,7 @@
 // {
 //   authorize
 //   {
-//     certfile "tests/mgmt/cert1.ndncert"
+//     certfile "tests/daemon/mgmt/cert1.ndncert"
 //     privileges
 //     {
 //       fib
@@ -54,7 +54,7 @@
 
 //   authorize
 //   {
-//     certfile "tests/mgmt/cert2.ndncert"
+//     certfile "tests/daemon/mgmt/cert2.ndncert"
 //     privileges
 //     {
 //       faces
@@ -67,7 +67,7 @@
 "{\n"
 "  authorize\n"
 "  {\n"
-"    certfile \"tests/mgmt/cert1.ndncert\"\n"
+"    certfile \"tests/daemon/mgmt/cert1.ndncert\"\n"
 "    privileges\n"
 "    {\n"
 "      fib\n"
@@ -76,7 +76,7 @@
 "  }\n"
 "  authorize\n"
 "  {\n"
-"    certfile \"tests/mgmt/cert2.ndncert\"\n"
+"    certfile \"tests/daemon/mgmt/cert2.ndncert\"\n"
 "    privileges\n"
 "    {\n"
 "      faces\n"
@@ -190,17 +190,17 @@
   TwoValidatorFixture()
   {
     m_tester1.generateIdentity("/test/CommandValidator/TwoKeys/id1");
-    m_tester1.saveIdentityToFile("tests/mgmt/cert1.ndncert");
+    m_tester1.saveIdentityToFile("tests/daemon/mgmt/cert1.ndncert");
 
     m_tester2.generateIdentity("/test/CommandValidator/TwoKeys/id2");
-    m_tester2.saveIdentityToFile("tests/mgmt/cert2.ndncert");
+    m_tester2.saveIdentityToFile("tests/daemon/mgmt/cert2.ndncert");
   }
 
   ~TwoValidatorFixture()
   {
     boost::system::error_code error;
-    boost::filesystem::remove("tests/mgmt/cert1.ndncert", error);
-    boost::filesystem::remove("tests/mgmt/cert2.ndncert", error);
+    boost::filesystem::remove("tests/daemon/mgmt/cert1.ndncert", error);
+    boost::filesystem::remove("tests/daemon/mgmt/cert2.ndncert", error);
   }
 
 protected:
@@ -264,11 +264,11 @@
 {
   CommandValidatorTester tester1;
   tester1.generateIdentity("/test/CommandValidator/TwoKeys/id1");
-  tester1.saveIdentityToFile("tests/mgmt/cert1.ndncert");
+  tester1.saveIdentityToFile("tests/daemon/mgmt/cert1.ndncert");
 
   CommandValidatorTester tester2;
   tester2.generateIdentity("/test/CommandValidator/TwoKeys/id2");
-  tester2.saveIdentityToFile("tests/mgmt/cert2.ndncert");
+  tester2.saveIdentityToFile("tests/daemon/mgmt/cert2.ndncert");
 
   shared_ptr<Interest> fibCommand = make_shared<Interest>("/localhost/nfd/fib/insert");
   shared_ptr<Interest> statsCommand = make_shared<Interest>("/localhost/nfd/stats/dosomething");
@@ -341,7 +341,7 @@
     "{\n"
     "  authorize\n"
     "  {\n"
-    "    certfile \"tests/mgmt/cert1.ndncert\"\n"
+    "    certfile \"tests/daemon/mgmt/cert1.ndncert\"\n"
     "  }\n"
     "}\n";
 
@@ -360,7 +360,7 @@
     "{\n"
     "  authorize\n"
     "  {\n"
-    "    certfile \"tests/mgmt/notacertfile.ndncert\"\n"
+    "    certfile \"tests/daemon/mgmt/notacertfile.ndncert\"\n"
     "    privileges\n"
     "    {\n"
     "      fib\n"
@@ -406,7 +406,7 @@
     "{\n"
     "  authorize\n"
     "  {\n"
-    "    certfile \"tests/mgmt/malformed.ndncert\"\n"
+    "    certfile \"tests/daemon/mgmt/malformed.ndncert\"\n"
     "    privileges\n"
     "    {\n"
     "      fib\n"
@@ -459,11 +459,11 @@
     "{\n"
     "  authorize\n"
     "  {\n"
-    "    certfile \"tests/mgmt/cert1.ndncert\"\n"
+    "    certfile \"tests/daemon/mgmt/cert1.ndncert\"\n"
     "  }\n"
     "  authorize\n"
     "  {\n"
-    "    certfile \"tests/mgmt/cert2.ndncert\"\n"
+    "    certfile \"tests/daemon/mgmt/cert2.ndncert\"\n"
     "  }\n"
     "}\n";
 
@@ -473,9 +473,9 @@
   validator.setConfigFile(config);
 
   std::stringstream expectedError;
-  expectedError << "No privileges section found for certificate file tests/mgmt/cert1.ndncert "
+  expectedError << "No privileges section found for certificate file tests/daemon/mgmt/cert1.ndncert "
                 << "(" << m_tester1.getPublicKeyName().toUri() << ")\n"
-                << "No privileges section found for certificate file tests/mgmt/cert2.ndncert "
+                << "No privileges section found for certificate file tests/daemon/mgmt/cert2.ndncert "
                 << "(" << m_tester2.getPublicKeyName().toUri() << ")";
 
   BOOST_CHECK_EXCEPTION(config.parse(NO_PRIVILEGES_CONFIG, true, CONFIG_PATH.native()),
@@ -492,7 +492,7 @@
     "{\n"
     "  authorize\n"
     "  {\n"
-    "    certfile \"tests/mgmt/notacertfile.ndncert\"\n"
+    "    certfile \"tests/daemon/mgmt/notacertfile.ndncert\"\n"
     "    privileges\n"
     "    {\n"
     "      fib\n"
@@ -501,7 +501,7 @@
     "  }\n"
     "  authorize\n"
     "  {\n"
-    "    certfile \"tests/mgmt/stillnotacertfile.ndncert\"\n"
+    "    certfile \"tests/daemon/mgmt/stillnotacertfile.ndncert\"\n"
     "    privileges\n"
     "    {\n"
     "    }\n"
@@ -515,9 +515,9 @@
 
   std::stringstream error;
   error << "Unable to open certificate file "
-        << absolute("tests/mgmt/notacertfile.ndncert").native() << "\n"
+        << absolute("tests/daemon/mgmt/notacertfile.ndncert").native() << "\n"
         << "Unable to open certificate file "
-        << absolute("tests/mgmt/stillnotacertfile.ndncert").native();
+        << absolute("tests/daemon/mgmt/stillnotacertfile.ndncert").native();
 
   BOOST_CHECK_EXCEPTION(config.parse(INVALID_KEY_CONFIG, true, CONFIG_PATH.native()),
                         ConfigFile::Error,
@@ -563,7 +563,7 @@
     "{\n"
     "  authorize\n"
     "  {\n"
-    "    certfile \"tests/mgmt/malformed.ndncert\"\n"
+    "    certfile \"tests/daemon/mgmt/malformed.ndncert\"\n"
     "    privileges\n"
     "    {\n"
     "      fib\n"
@@ -572,7 +572,7 @@
     "  }\n"
     "  authorize\n"
     "  {\n"
-    "    certfile \"tests/mgmt/malformed.ndncert\"\n"
+    "    certfile \"tests/daemon/mgmt/malformed.ndncert\"\n"
     "  }\n"
     "}\n";
 
@@ -584,9 +584,9 @@
 
   std::stringstream error;
   error << "Malformed certificate file "
-        << absolute("tests/mgmt/malformed.ndncert").native() << "\n"
+        << absolute("tests/daemon/mgmt/malformed.ndncert").native() << "\n"
         << "Malformed certificate file "
-        << absolute("tests/mgmt/malformed.ndncert").native();
+        << absolute("tests/daemon/mgmt/malformed.ndncert").native();
 
   BOOST_CHECK_EXCEPTION(config.parse(MALFORMED_CERT_CONFIG, true, CONFIG_PATH.native()),
                         ConfigFile::Error,
diff --git a/tests/mgmt/face-flags.cpp b/tests/daemon/mgmt/face-flags.cpp
similarity index 97%
rename from tests/mgmt/face-flags.cpp
rename to tests/daemon/mgmt/face-flags.cpp
index 102c8a2..0aa6c09 100644
--- a/tests/mgmt/face-flags.cpp
+++ b/tests/daemon/mgmt/face-flags.cpp
@@ -25,7 +25,7 @@
 #include "mgmt/face-flags.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 namespace nfd {
 namespace tests {
diff --git a/tests/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
similarity index 100%
rename from tests/mgmt/face-manager.cpp
rename to tests/daemon/mgmt/face-manager.cpp
diff --git a/tests/mgmt/face-status-publisher-common.hpp b/tests/daemon/mgmt/face-status-publisher-common.hpp
similarity index 95%
rename from tests/mgmt/face-status-publisher-common.hpp
rename to tests/daemon/mgmt/face-status-publisher-common.hpp
index 1c8369d..11ed191 100644
--- a/tests/mgmt/face-status-publisher-common.hpp
+++ b/tests/daemon/mgmt/face-status-publisher-common.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_TESTS_MGMT_FACE_STATUS_PUBLISHER_COMMON_HPP
-#define NFD_TESTS_MGMT_FACE_STATUS_PUBLISHER_COMMON_HPP
+#ifndef NFD_TESTS_NFD_MGMT_FACE_STATUS_PUBLISHER_COMMON_HPP
+#define NFD_TESTS_NFD_MGMT_FACE_STATUS_PUBLISHER_COMMON_HPP
 
 #include "mgmt/face-status-publisher.hpp"
 #include "mgmt/app-face.hpp"
@@ -32,7 +32,7 @@
 #include "fw/forwarder.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 #include <ndn-cpp-dev/management/nfd-face-status.hpp>
 
@@ -189,4 +189,4 @@
 } // namespace tests
 } // namespace nfd
 
-#endif // NFD_TESTS_MGMT_FACE_STATUS_PUBLISHER_COMMON_HPP
+#endif // NFD_TESTS_NFD_MGMT_FACE_STATUS_PUBLISHER_COMMON_HPP
diff --git a/tests/mgmt/face-status-publisher.cpp b/tests/daemon/mgmt/face-status-publisher.cpp
similarity index 100%
rename from tests/mgmt/face-status-publisher.cpp
rename to tests/daemon/mgmt/face-status-publisher.cpp
diff --git a/tests/mgmt/fib-enumeration-publisher-common.hpp b/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
similarity index 96%
rename from tests/mgmt/fib-enumeration-publisher-common.hpp
rename to tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
index 7507c5d..6befe54 100644
--- a/tests/mgmt/fib-enumeration-publisher-common.hpp
+++ b/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_TESTS_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
-#define NFD_TESTS_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
+#ifndef NFD_TESTS_NFD_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
+#define NFD_TESTS_NFD_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
 
 #include "mgmt/fib-enumeration-publisher.hpp"
 
@@ -216,4 +216,4 @@
 } // namespace tests
 } // namespace nfd
 
-#endif // NFD_TESTS_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
+#endif // NFD_TESTS_NFD_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
diff --git a/tests/mgmt/fib-enumeration-publisher.cpp b/tests/daemon/mgmt/fib-enumeration-publisher.cpp
similarity index 100%
rename from tests/mgmt/fib-enumeration-publisher.cpp
rename to tests/daemon/mgmt/fib-enumeration-publisher.cpp
diff --git a/tests/mgmt/fib-manager.cpp b/tests/daemon/mgmt/fib-manager.cpp
similarity index 99%
rename from tests/mgmt/fib-manager.cpp
rename to tests/daemon/mgmt/fib-manager.cpp
index 0e2e8c0..b38c3b8 100644
--- a/tests/mgmt/fib-manager.cpp
+++ b/tests/daemon/mgmt/fib-manager.cpp
@@ -27,7 +27,7 @@
 #include "table/fib-nexthop.hpp"
 #include "face/face.hpp"
 #include "mgmt/internal-face.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 #include "validation-common.hpp"
 #include "tests/test-common.hpp"
diff --git a/tests/mgmt/internal-face.cpp b/tests/daemon/mgmt/internal-face.cpp
similarity index 98%
rename from tests/mgmt/internal-face.cpp
rename to tests/daemon/mgmt/internal-face.cpp
index 595f05f..04ef4a2 100644
--- a/tests/mgmt/internal-face.cpp
+++ b/tests/daemon/mgmt/internal-face.cpp
@@ -23,7 +23,7 @@
  **/
 
 #include "mgmt/internal-face.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 #include "tests/test-common.hpp"
 
diff --git a/tests/mgmt/malformed.ndncert b/tests/daemon/mgmt/malformed.ndncert
similarity index 100%
rename from tests/mgmt/malformed.ndncert
rename to tests/daemon/mgmt/malformed.ndncert
diff --git a/tests/mgmt/manager-base.cpp b/tests/daemon/mgmt/manager-base.cpp
similarity index 100%
rename from tests/mgmt/manager-base.cpp
rename to tests/daemon/mgmt/manager-base.cpp
diff --git a/tests/mgmt/notification-stream.cpp b/tests/daemon/mgmt/notification-stream.cpp
similarity index 100%
rename from tests/mgmt/notification-stream.cpp
rename to tests/daemon/mgmt/notification-stream.cpp
diff --git a/tests/mgmt/segment-publisher.cpp b/tests/daemon/mgmt/segment-publisher.cpp
similarity index 100%
rename from tests/mgmt/segment-publisher.cpp
rename to tests/daemon/mgmt/segment-publisher.cpp
diff --git a/tests/mgmt/status-server.cpp b/tests/daemon/mgmt/status-server.cpp
similarity index 98%
rename from tests/mgmt/status-server.cpp
rename to tests/daemon/mgmt/status-server.cpp
index 14cdf44..75b4114 100644
--- a/tests/mgmt/status-server.cpp
+++ b/tests/daemon/mgmt/status-server.cpp
@@ -24,11 +24,11 @@
 
 #include "mgmt/status-server.hpp"
 #include "fw/forwarder.hpp"
-#include "core/version.hpp"
+#include "version.hpp"
 #include "mgmt/internal-face.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 namespace nfd {
 namespace tests {
diff --git a/tests/mgmt/strategy-choice-manager.cpp b/tests/daemon/mgmt/strategy-choice-manager.cpp
similarity index 99%
rename from tests/mgmt/strategy-choice-manager.cpp
rename to tests/daemon/mgmt/strategy-choice-manager.cpp
index 43d163c..99d5636 100644
--- a/tests/mgmt/strategy-choice-manager.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.cpp
@@ -29,8 +29,8 @@
 #include "table/strategy-choice.hpp"
 #include "fw/forwarder.hpp"
 #include "fw/strategy.hpp"
-#include "tests/face/dummy-face.hpp"
-#include "tests/fw/dummy-strategy.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
+#include "tests/daemon/fw/dummy-strategy.hpp"
 
 #include "tests/test-common.hpp"
 #include "validation-common.hpp"
diff --git a/tests/mgmt/validation-common.cpp b/tests/daemon/mgmt/validation-common.cpp
similarity index 100%
rename from tests/mgmt/validation-common.cpp
rename to tests/daemon/mgmt/validation-common.cpp
diff --git a/tests/mgmt/validation-common.hpp b/tests/daemon/mgmt/validation-common.hpp
similarity index 94%
rename from tests/mgmt/validation-common.hpp
rename to tests/daemon/mgmt/validation-common.hpp
index dd7b443..9aa2e28 100644
--- a/tests/mgmt/validation-common.hpp
+++ b/tests/daemon/mgmt/validation-common.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_TEST_MGMT_VALIDATION_COMMON_HPP
-#define NFD_TEST_MGMT_VALIDATION_COMMON_HPP
+#ifndef NFD_TESTS_NFD_MGMT_VALIDATION_COMMON_HPP
+#define NFD_TESTS_NFD_MGMT_VALIDATION_COMMON_HPP
 
 #include "common.hpp"
 #include <ndn-cpp-dev/util/command-interest-generator.hpp>
@@ -122,4 +122,4 @@
 } // namespace tests
 } // namespace nfd
 
-#endif // NFD_TEST_MGMT_VALIDATION_COMMON_HPP
+#endif // NFD_TESTS_NFD_MGMT_VALIDATION_COMMON_HPP
diff --git a/tests/table/cs.cpp b/tests/daemon/table/cs.cpp
similarity index 100%
rename from tests/table/cs.cpp
rename to tests/daemon/table/cs.cpp
diff --git a/tests/table/fib.cpp b/tests/daemon/table/fib.cpp
similarity index 99%
rename from tests/table/fib.cpp
rename to tests/daemon/table/fib.cpp
index 629a10f..bdf2fca 100644
--- a/tests/table/fib.cpp
+++ b/tests/daemon/table/fib.cpp
@@ -23,7 +23,7 @@
  **/
 
 #include "table/fib.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 #include "tests/test-common.hpp"
 
diff --git a/tests/table/measurements-accessor.cpp b/tests/daemon/table/measurements-accessor.cpp
similarity index 100%
rename from tests/table/measurements-accessor.cpp
rename to tests/daemon/table/measurements-accessor.cpp
diff --git a/tests/table/measurements.cpp b/tests/daemon/table/measurements.cpp
similarity index 100%
rename from tests/table/measurements.cpp
rename to tests/daemon/table/measurements.cpp
diff --git a/tests/table/name-tree.cpp b/tests/daemon/table/name-tree.cpp
similarity index 100%
rename from tests/table/name-tree.cpp
rename to tests/daemon/table/name-tree.cpp
diff --git a/tests/table/pit.cpp b/tests/daemon/table/pit.cpp
similarity index 99%
rename from tests/table/pit.cpp
rename to tests/daemon/table/pit.cpp
index d32cc1a..c77c909 100644
--- a/tests/table/pit.cpp
+++ b/tests/daemon/table/pit.cpp
@@ -23,7 +23,7 @@
  **/
 
 #include "table/pit.hpp"
-#include "tests/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
 
 #include "tests/test-common.hpp"
 
diff --git a/tests/table/strategy-choice.cpp b/tests/daemon/table/strategy-choice.cpp
similarity index 98%
rename from tests/table/strategy-choice.cpp
rename to tests/daemon/table/strategy-choice.cpp
index b382ce3..6927375 100644
--- a/tests/table/strategy-choice.cpp
+++ b/tests/daemon/table/strategy-choice.cpp
@@ -23,7 +23,7 @@
  **/
 
 #include "table/strategy-choice.hpp"
-#include "tests/fw/dummy-strategy.hpp"
+#include "tests/daemon/fw/dummy-strategy.hpp"
 
 #include "tests/test-common.hpp"
 
diff --git a/tests/table/strategy-info-host.cpp b/tests/daemon/table/strategy-info-host.cpp
similarity index 100%
rename from tests/table/strategy-info-host.cpp
rename to tests/daemon/table/strategy-info-host.cpp
diff --git a/tests/core/global-configuration.cpp b/tests/global-configuration.cpp
similarity index 96%
rename from tests/core/global-configuration.cpp
rename to tests/global-configuration.cpp
index 77c28c4..2b4ce9d 100644
--- a/tests/core/global-configuration.cpp
+++ b/tests/global-configuration.cpp
@@ -22,9 +22,9 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#include "../test-common.hpp"
+#include "test-common.hpp"
 #include "core/logger.hpp"
-#include "mgmt/config-file.hpp"
+#include "core/config-file.hpp"
 
 #include <boost/filesystem.hpp>
 
diff --git a/tests/core/limited-io.cpp b/tests/limited-io.cpp
similarity index 100%
rename from tests/core/limited-io.cpp
rename to tests/limited-io.cpp
diff --git a/tests/core/limited-io.hpp b/tests/limited-io.hpp
similarity index 95%
rename from tests/core/limited-io.hpp
rename to tests/limited-io.hpp
index 2d5788c..cb81247 100644
--- a/tests/core/limited-io.hpp
+++ b/tests/limited-io.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_TEST_CORE_LIMITED_IO_HPP
-#define NFD_TEST_CORE_LIMITED_IO_HPP
+#ifndef NFD_TESTS_LIMITED_IO_HPP
+#define NFD_TESTS_LIMITED_IO_HPP
 
 #include "core/global-io.hpp"
 #include "core/scheduler.hpp"
@@ -85,4 +85,4 @@
 } // namespace tests
 } // namespace nfd
 
-#endif // NFD_TEST_CORE_LIMITED_IO_HPP
+#endif // NFD_TESTS_LIMITED_IO_HPP
diff --git a/tests/other/cs-smoketest.cpp b/tests/other/cs-smoketest.cpp
new file mode 100644
index 0000000..7c50d49
--- /dev/null
+++ b/tests/other/cs-smoketest.cpp
@@ -0,0 +1,110 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014  Regents of the University of California,
+ *                     Arizona Board of Regents,
+ *                     Colorado State University,
+ *                     University Pierre & Marie Curie, Sorbonne University,
+ *                     Washington University in St. Louis,
+ *                     Beijing Institute of Technology
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * \author Ilya Moiseenko <iliamo@ucla.edu>
+ **/
+
+#include "table/cs.hpp"
+#include "table/cs-entry.hpp"
+#include <ndn-cpp-dev/security/key-chain.hpp>
+
+namespace nfd {
+
+static void
+runStressTest()
+{
+  shared_ptr<Data> dataWorkload[70000];
+  shared_ptr<Interest> interestWorkload[70000];
+
+  ndn::SignatureSha256WithRsa fakeSignature;
+  fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue,
+                                        reinterpret_cast<const uint8_t*>(0), 0));
+
+  // 182 MB in memory
+  for (int i = 0; i < 70000; i++)
+    {
+      Name name("/stress/test");
+      name.appendNumber(i % 4);
+      name.appendNumber(i);
+
+      shared_ptr<Interest> interest = make_shared<Interest>(name);
+      interestWorkload[i] = interest;
+
+      shared_ptr<Data> data = make_shared<Data>(name);
+      data->setSignature(fakeSignature);
+      dataWorkload[i] = data;
+    }
+
+  time::duration<double, boost::nano> previousResult(0);
+
+  for (size_t nInsertions = 1000; nInsertions < 10000000; nInsertions *= 2)
+    {
+      Cs cs;
+      srand(time::toUnixTimestamp(time::system_clock::now()).count());
+
+      time::steady_clock::TimePoint startTime = time::steady_clock::now();
+
+      size_t workloadCounter = 0;
+      for (size_t i = 0; i < nInsertions; i++)
+        {
+          if (workloadCounter > 69999)
+            workloadCounter = 0;
+
+          cs.find(*interestWorkload[workloadCounter]);
+          cs.insert(*dataWorkload[workloadCounter]);
+
+          workloadCounter++;
+        }
+
+      time::steady_clock::TimePoint endTime = time::steady_clock::now();
+
+      time::duration<double, boost::nano> runDuration = endTime - startTime;
+      time::duration<double, boost::nano> perOperationTime = runDuration / nInsertions;
+
+      std::cout << "nItem = " << nInsertions << std::endl;
+      std::cout << "Total running time = "
+                << time::duration_cast<time::duration<double> >(runDuration)
+                << std::endl;
+      std::cout << "Average per-operation time = "
+                << time::duration_cast<time::duration<double, boost::micro> >(perOperationTime)
+                << std::endl;
+
+      if (previousResult > time::nanoseconds(1))
+        std::cout << "Change compared to the previous: "
+                  << (100.0 * perOperationTime / previousResult) << "%" << std::endl;
+
+      std::cout << "\n=================================\n" << std::endl;
+
+      previousResult = perOperationTime;
+    }
+}
+
+} // namespace nfd
+
+int
+main(int argc, char** argv)
+{
+  nfd::runStressTest();
+
+  return 0;
+}
diff --git a/tests/other/wscript b/tests/other/wscript
new file mode 100644
index 0000000..20cae46
--- /dev/null
+++ b/tests/other/wscript
@@ -0,0 +1,32 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+"""
+Copyright (c) 2014  Regents of the University of California,
+                    Arizona Board of Regents,
+                    Colorado State University,
+                    University Pierre & Marie Curie, Sorbonne University,
+                    Washington University in St. Louis,
+                    Beijing Institute of Technology
+
+This file is part of NFD (Named Data Networking Forwarding Daemon).
+See AUTHORS.md for complete list of NFD authors and contributors.
+
+NFD is free software: you can redistribute it and/or modify it under the terms
+of the GNU General Public License as published by the Free Software Foundation,
+either version 3 of the License, or (at your option) any later version.
+
+NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+top = '../..'
+
+def build(bld):
+    bld.program(target="../../cs-smoketest",
+                source="cs-smoketest.cpp",
+                use='daemon-objects',
+                install_path=None)
diff --git a/tests/test-skeleton.cpp b/tests/test-case.cpp.sample
similarity index 100%
rename from tests/test-skeleton.cpp
rename to tests/test-case.cpp.sample
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 2e555b4..f4fc0ed 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_TEST_COMMON_HPP
-#define NFD_TEST_COMMON_HPP
+#ifndef NFD_TESTS_TEST_COMMON_HPP
+#define NFD_TESTS_TEST_COMMON_HPP
 
 #include <boost/test/unit_test.hpp>
 #include "core/global-io.hpp"
@@ -79,4 +79,4 @@
 } // namespace tests
 } // namespace nfd
 
-#endif // NFD_TEST_COMMON_HPP
+#endif // NFD_TESTS_TEST_COMMON_HPP
diff --git a/tests/wscript b/tests/wscript
new file mode 100644
index 0000000..423e5e3
--- /dev/null
+++ b/tests/wscript
@@ -0,0 +1,69 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+"""
+Copyright (c) 2014  Regents of the University of California,
+                    Arizona Board of Regents,
+                    Colorado State University,
+                    University Pierre & Marie Curie, Sorbonne University,
+                    Washington University in St. Louis,
+                    Beijing Institute of Technology
+
+This file is part of NFD (Named Data Networking Forwarding Daemon).
+See AUTHORS.md for complete list of NFD authors and contributors.
+
+NFD is free software: you can redistribute it and/or modify it under the terms
+of the GNU General Public License as published by the Free Software Foundation,
+either version 3 of the License, or (at your option) any later version.
+
+NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+top = '..'
+
+def build(bld):
+    # Unit tests
+    if bld.env['WITH_TESTS']:
+        unit_test_main = bld(
+            target='unit-tests-main',
+            name='unit-tests-main',
+            features='cxx',
+            source=bld.path.ant_glob(['*.cpp']),
+            use='core-objects',
+          )
+
+        # core tests
+        unit_tests_core = bld.program(
+            target='../unit-tests-core',
+            features='cxx cxxprogram',
+            source=bld.path.ant_glob(['core/**/*.cpp']),
+            use='core-objects unit-tests-main',
+            includes='.',
+            install_prefix=None,
+          )
+
+        # NFD tests
+        unit_tests_nfd = bld.program(
+            target='../unit-tests-daemon',
+            features='cxx cxxprogram',
+            source=bld.path.ant_glob(['daemon/**/*.cpp'],
+                                     excl=['daemon/face/ethernet.cpp',
+                                           'daemon/face/unix-*.cpp']),
+            use='daemon-objects unit-tests-main',
+            includes='.',
+            install_prefix=None,
+          )
+
+        if bld.env['HAVE_LIBPCAP']:
+            unit_tests_nfd.source += bld.path.ant_glob('daemon/face/ethernet.cpp')
+
+        if bld.env['HAVE_UNIX_SOCKETS']:
+            unit_tests_nfd.source += bld.path.ant_glob('daemon/face/unix-*.cpp')
+
+    # Other tests (e.g., stress tests that can be enabled even if unit tests are disabled)
+    if bld.env['WITH_TESTS'] or bld.env['WITH_OTHER_TESTS']:
+        bld.recurse("other")