tests: Refactor GlobalRoutingHelper tests

Change-Id: I06d35178c3f1617823119324e4ed58f3d25ce55f
diff --git a/tests/unit-tests/helper/ndn-global-routing-helper.t.cpp b/tests/unit-tests/helper/ndn-global-routing-helper.t.cpp
index 318c824..d37c747 100644
--- a/tests/unit-tests/helper/ndn-global-routing-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-global-routing-helper.t.cpp
@@ -35,14 +35,32 @@
 
 #include "../tests-common.hpp"
 
+#include <boost/filesystem.hpp>
+
 namespace ns3 {
 namespace ndn {
 
-BOOST_FIXTURE_TEST_SUITE(HelperGlobalRoutingHelper, CleanupFixture)
+const boost::filesystem::path TEST_TOPO_TXT = boost::filesystem::path(TEST_CONFIG_PATH) / "topo.txt";
+
+class GlobalRoutingHelperFixture : public CleanupFixture
+{
+public:
+  GlobalRoutingHelperFixture()
+  {
+    boost::filesystem::create_directories(TEST_CONFIG_PATH);
+  }
+
+  ~GlobalRoutingHelperFixture()
+  {
+    boost::filesystem::remove(TEST_TOPO_TXT);
+  }
+};
+
+BOOST_FIXTURE_TEST_SUITE(HelperGlobalRoutingHelper, GlobalRoutingHelperFixture)
 
 BOOST_AUTO_TEST_CASE(CalculateRouteCase1)
 {
-  ofstream file1("/tmp/topo1.txt");
+  ofstream file1(TEST_TOPO_TXT.string().c_str());
   file1 << "router\n\n"
         << "#node city  y x mpi-partition\n"
         << "A1  NA  1 1 1\n"
@@ -56,7 +74,7 @@
   file1.close();
 
   AnnotatedTopologyReader topologyReader("");
-  topologyReader.SetFileName("/tmp/topo1.txt");
+  topologyReader.SetFileName(TEST_TOPO_TXT.string().c_str());
   topologyReader.Read();
 
   // Install NDN stack on all nodes
@@ -82,14 +100,11 @@
       isFirst = false;
     }
   }
-
-  Simulator::Stop(Seconds(20.0));
-  Simulator::Run();
 }
 
 BOOST_AUTO_TEST_CASE(CalculateRouteCase2)
 {
-  ofstream file1("/tmp/topo2.txt");
+  ofstream file1(TEST_TOPO_TXT.string().c_str());
   file1 << "router\n\n"
         << "#node city  y x mpi-partition\n"
         << "A2  NA  1 1 1\n"
@@ -103,7 +118,7 @@
   file1.close();
 
   AnnotatedTopologyReader topologyReader("");
-  topologyReader.SetFileName("/tmp/topo2.txt");
+  topologyReader.SetFileName(TEST_TOPO_TXT.string().c_str());
   topologyReader.Read();
 
   // Install NDN stack on all nodes
@@ -129,9 +144,6 @@
       isFirst = false;
     }
   }
-
-  Simulator::Stop(Seconds(20.0));
-  Simulator::Run();
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/wscript b/tests/wscript
index 3a565d8..26d020b 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -8,6 +8,7 @@
     tests = bld.create_ns3_program('ndnSIM-unit-tests', all_modules)
     tests.source = bld.path.ant_glob(['main.cpp', 'unit-tests/**/*.cpp'])
     tests.includes = ['#', '.', '../NFD/', "../NFD/daemon", "../NFD/core", "../helper", "../model", "../apps", "../utils", "../examples"]
+    tests.defines = 'TEST_CONFIG_PATH=\"%s/conf-test\"' %(bld.bldnode)
 
     # Other tests
     for i in bld.path.ant_glob(['other/*.cpp']):