Make tests pass on MinGW, add fifth tutorial example
authorCraig Dowell <craigdo@ee.washington.edu>
Thu Nov 05 22:29:53 2009 -0800 (3 months ago)
changeset 5483ad83d869c08c
parent 5482 fbfdb256aaed
child 5485 1739c7bafd29
Make tests pass on MinGW, add fifth tutorial example
src/core/test.cc
test.py
     1.1 --- a/src/core/test.cc	Thu Nov 05 19:15:28 2009 -0800
     1.2 +++ b/src/core/test.cc	Thu Nov 05 22:29:53 2009 -0800
     1.3 @@ -204,6 +204,10 @@
     1.4  void 
     1.5  TestCase::SetBaseDir (std::string basedir)
     1.6  {
     1.7 +  //
     1.8 +  // C and C++ allow one to use forward slashes even on systems where the 
     1.9 +  // separator is actually a backslash.
    1.10 +  //
    1.11    if (basedir[basedir.length () - 1] != '/')
    1.12      {
    1.13        m_basedir = basedir + "/";
    1.14 @@ -223,6 +227,10 @@
    1.15  void 
    1.16  TestCase::SetTempDir (std::string tempdir)
    1.17  {
    1.18 +  //
    1.19 +  // C and C++ allow one to use forward slashes even on systems where the 
    1.20 +  // separator is actually a backslash.
    1.21 +  //
    1.22    if (tempdir[tempdir.length () - 1] != '/')
    1.23      {
    1.24        m_tempdir = tempdir + "/";
    1.25 @@ -242,9 +250,25 @@
    1.26  std::string 
    1.27  TestCase::GetSourceDir (std::string file)
    1.28  {
    1.29 +  //
    1.30 +  // The <file> parameter is actually going to be __FILE__ which may have 
    1.31 +  // backslashes in it on win32 systems.  For example,
    1.32 +  //
    1.33 +  //   ..\src\common\pcap-file-test-suite.cc  (win32)
    1.34 +  //
    1.35 +  // or
    1.36 +  //
    1.37 +  //   ../src/common/pcap-file-test-suite.cc  (grown-up systems)
    1.38 +  //
    1.39 +#ifdef WIN32
    1.40 +  std::string::size_type relPathBegin = file.find_first_of ("\\");
    1.41 +  std::string::size_type relPathEnd = file.find_last_of ("\\");
    1.42 +#else
    1.43    std::string::size_type relPathBegin = file.find_first_of ("/");
    1.44 +  std::string::size_type relPathEnd = file.find_last_of ("/");
    1.45 +#endif
    1.46 +
    1.47    NS_ABORT_MSG_IF (relPathBegin == std::string::npos, "TestCase::GetSourceDir(): Internal Error");
    1.48 -  std::string::size_type relPathEnd = file.find_last_of ("/");
    1.49    NS_ABORT_MSG_IF (relPathEnd == std::string::npos, "TestCase::GetSourceDir(): Internal Error");
    1.50  
    1.51    return GetBaseDir () + file.substr (relPathBegin, relPathEnd + 1 - relPathBegin);
    1.52 @@ -504,6 +528,10 @@
    1.53  void 
    1.54  TestSuite::SetBaseDir (std::string basedir)
    1.55  {
    1.56 +  //
    1.57 +  // C and C++ allow one to use forward slashes even on systems where the 
    1.58 +  // separator is actually a backslash.
    1.59 +  //
    1.60    if (basedir[basedir.length () - 1] != '/')
    1.61      {
    1.62        m_basedir = basedir + "/";
    1.63 @@ -523,6 +551,10 @@
    1.64  void 
    1.65  TestSuite::SetTempDir (std::string tempdir)
    1.66  {
    1.67 +  //
    1.68 +  // C and C++ allow one to use forward slashes even on systems where the 
    1.69 +  // separator is actually a backslash.
    1.70 +  //
    1.71    if (tempdir[tempdir.length () - 1] != '/')
    1.72      {
    1.73        m_tempdir = tempdir + "/";
     2.1 --- a/test.py	Thu Nov 05 19:15:28 2009 -0800
     2.2 +++ b/test.py	Thu Nov 05 22:29:53 2009 -0800
     2.3 @@ -132,6 +132,7 @@
     2.4      ("tutorial/second", "True", "True"),
     2.5      ("tutorial/third", "True", "True"),
     2.6      ("tutorial/fourth", "True", "True"),
     2.7 +    ("tutorial/fifth", "True", "True"),
     2.8  
     2.9      ("udp/udp-echo", "True", "True"),
    2.10