utils/run-tests.cc
changeset 4531 14a102415139
parent 4235 c070d2fca46d
equal deleted inserted replaced
4530:a75eb3b66882 4531:14a102415139
    23 #include "ns3/random-variable.h"
    23 #include "ns3/random-variable.h"
    24 
    24 
    25 
    25 
    26 int main (int argc, char *argv[])
    26 int main (int argc, char *argv[])
    27 {
    27 {
       
    28   if (argc > 1)
       
    29     {
       
    30       if (std::string (argv[1]) == "--ListTests")
       
    31         {
    28 #ifdef RUN_SELF_TESTS
    32 #ifdef RUN_SELF_TESTS
    29   ns3::PacketMetadata::Enable ();
    33           ns3::TestManager::PrintTestNames (std::cout);
    30   ns3::TestManager::EnableVerbose ();
    34 #endif
    31   bool success = ns3::TestManager::RunTests ();
    35         }
    32   if (!success)
    36       else
    33     return 1;
    37         {
       
    38           // run the test named by argv[1]
       
    39 #ifdef RUN_SELF_TESTS
       
    40           bool success = ns3::TestManager::RunTest (argv[1]);
       
    41           if (!success)
       
    42             {
       
    43               return 1;
       
    44             }
       
    45 #else
       
    46           std::cerr << "Unit tests not enabled" << std::endl;
       
    47           return 1;
       
    48 #endif
       
    49         }      
       
    50     }
       
    51   else
       
    52     {
       
    53       // run all tests
       
    54 #ifdef RUN_SELF_TESTS
       
    55       ns3::PacketMetadata::Enable ();
       
    56       ns3::TestManager::EnableVerbose ();
       
    57       bool success = ns3::TestManager::RunTests ();
       
    58       if (!success)
       
    59         {
       
    60           return 1;
       
    61         }
    34 #endif /* RUN_SELF_TESTS */
    62 #endif /* RUN_SELF_TESTS */
    35 
    63     }
    36   return 0;
    64   return 0;
    37 }
    65 }
       
    66