Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9114 for code/branches/testing


Ignore:
Timestamp:
Apr 22, 2012, 10:36:09 AM (13 years ago)
Author:
landauf
Message:

added tests for several classes and functions in util

Location:
code/branches/testing
Files:
9 added
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/testing/src/libraries/util/SignalHandler.cc

    r8858 r9114  
    2121 *
    2222 *   Author:
    23  *      Christoph Renner
     23 *      Christoph Renner (Linux implementation)
     24 *      Fabian 'x3n' Landau (Windows implementation)
    2425 *   Co-authors:
    2526 *      ...
     
    139140      orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Try to write backtrace to file orxonox_crash.log" << endl;
    140141
    141      
     142
    142143      // First start GDB which will be attached to this process later on
    143      
     144
    144145      int gdbIn[2];
    145146      int gdbOut[2];
    146147      int gdbErr[2];
    147      
     148
    148149      if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 )
    149150      {
     
    151152        exit(EXIT_FAILURE);
    152153      }
    153      
     154
    154155      int gdbPid = fork();
    155156      // this process will run gdb
    156      
     157
    157158      if ( gdbPid == -1 )
    158159      {
     
    160161        exit(EXIT_FAILURE);
    161162      }
    162      
     163
    163164      if ( gdbPid == 0 )
    164165      {
    165166        // start gdb
    166        
     167
    167168        close(gdbIn[1]);
    168169        close(gdbOut[0]);
    169170        close(gdbErr[0]);
    170        
     171
    171172        dup2( gdbIn[0], STDIN_FILENO );
    172173        dup2( gdbOut[1], STDOUT_FILENO );
    173174        dup2( gdbErr[1], STDERR_FILENO );
    174        
     175
    175176        execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(NULL));
    176177      }
    177      
    178      
     178
     179
    179180      // Now start a fork of this process on which GDB will be attached on
    180      
     181
    181182      int sigPipe[2];
    182183      if ( pipe(sigPipe) == -1 )
     
    202203      {
    203204        getInstance().dontCatch();
    204        
     205
    205206        // make sure gdb is allowed to attach to our PID even if there are some system restrictions
    206207#ifdef PR_SET_PTRACER
     
    208209          orxout(user_error) << "could not set proper permissions for GDB to attach to process..." << endl;
    209210#endif
    210        
     211
    211212        // wait for message from parent when it has attached gdb
    212213        int someData;
  • code/branches/testing/src/libraries/util/SignalHandler.h

    r8351 r9114  
    2121 *
    2222 *   Author:
    23  *      Christoph Renner
     23 *      Christoph Renner (Linux implementation)
     24 *      Fabian 'x3n' Landau (Windows implementation)
    2425 *   Co-authors:
    2526 *      ...
  • code/branches/testing/test/CMakeLists.txt

    • Property svn:eol-style set to native
  • code/branches/testing/test/CTestCustom.cmake

    • Property svn:eol-style set to native
  • code/branches/testing/test/util/CMakeLists.txt

    • Property svn:eol-style set to native
    r9025 r9114  
    33    EXCLUDE_FROM_ALL
    44    ${GMOCK_MAIN}
     5    ConvertTest.cc
    56    MathTest.cc
     7    mboolTest.cc
     8    ScopeTest.cc
     9    SharedPtrTest.cc
     10    SingletonTest.cc
     11    SmallObjectAllocatorTest.cc
     12    StringUtilsTest.cc
     13    SubStringTest.cc
     14    VA_NARGSTest.cc
    615)
    716TARGET_LINK_LIBRARIES(util_test util gmock_orxonox)
     
    918
    1019ADD_TEST(util_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/util_test)
     20
     21#-----------------
     22
     23IF(MSVC)
     24  IF(CMAKE_CL_64)
     25    SET(MSVC_PLATFORM "x64")
     26  ELSE()
     27    SET(MSVC_PLATFORM "Win32")
     28  ENDIF()
     29  IF(MSVC10)
     30    CONFIGURE_FILE("../../src/orxonox-main.vcxproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/util_test.vcxproj.user")
     31  ELSE()
     32    STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?).*$" "\\1"
     33           VISUAL_STUDIO_VERSION_SIMPLE "${CMAKE_GENERATOR}")
     34    CONFIGURE_FILE("../../src/orxonox-main.vcproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/util_test.vcproj.user")
     35  ENDIF()
     36ENDIF(MSVC)
  • code/branches/testing/test/util/MathTest.cc

    • Property svn:eol-style set to native
    r9026 r9114  
    324324    TEST(getUniqueNumber, Test)
    325325    {
    326         std::set<float> numbers;
     326        std::set<unsigned long> numbers;
    327327
    328328        const size_t iterations = 1000;
Note: See TracChangeset for help on using the changeset viewer.