Menu

2.1: TestErrorLogger test unit is failing

2020-08-20
2021-07-07
  • Tomasz Kłoczko

    Looks like it is not possible to create trac account and submitting issues over SF or github is blocked (why?) so I must write here

    cd /home/tkloczko/rpmbuild/BUILD/cppcheck-2.1/x86_64-redhat-linux-gnu/test && /usr/bin/ctest --output-on-failure -j 48 -C . --timeout 90
    Test project /home/tkloczko/rpmbuild/BUILD/cppcheck-2.1/x86_64-redhat-linux-gnu/test
          Start 25: TestIO
          Start 79: cfg-std_c
          Start 47: TestThreadExecutor
          Start 26: TestLeakAutoVar
          Start 50: TestTokenizer
          Start  1: TestSamples
          Start  2: Test64BitPortability
          Start  3: TestAssert
          Start  4: TestAstUtils
          Start  5: TestAutoVariables
          Start  6: TestBool
          Start  7: TestBoost
          Start  8: TestBufferOverrun
          Start  9: TestCharVar
          Start 10: TestClangImport
          Start 11: TestClass
          Start 12: TestCmdlineParser
          Start 13: TestCondition
          Start 14: TestConstructors
          Start 15: TestCppcheck
          Start 16: TestErrorLogger
          Start 17: TestExceptionSafety
          Start 18: TestExprEngine
          Start 19: TestFileLister
          Start 20: TestFunctions
          Start 21: TestGarbage
          Start 22: TestImportProject
          Start 23: TestIncompleteStatement
          Start 24: TestInternal
          Start 27: TestLibrary
          Start 28: TestMathLib
          Start 29: TestMemleak
          Start 30: TestNullPointer
          Start 31: TestOptions
          Start 32: TestOther
          Start 33: TestPath
          Start 34: TestPathMatch
          Start 35: TestPlatform
          Start 36: TestPostfixOperator
          Start 37: TestPreprocessor
          Start 38: TestSimplifyTemplate
          Start 39: TestSimplifyTokens
          Start 40: TestSimplifyTypedef
          Start 41: TestSimplifyUsing
          Start 42: TestSizeof
          Start 43: TestStl
          Start 44: TestString
          Start 45: TestSuppressions
     1/84 Test  #2: Test64BitPortability .............   Passed    0.06 sec
          Start 46: TestSymbolDatabase
     2/84 Test  #3: TestAssert .......................   Passed    0.06 sec
          Start 48: TestTimer
     3/84 Test  #4: TestAstUtils .....................   Passed    0.06 sec
          Start 49: TestToken
     4/84 Test  #6: TestBool .........................   Passed    0.06 sec
          Start 51: TestTokenList
     5/84 Test  #7: TestBoost ........................   Passed    0.06 sec
          Start 52: TestType
     6/84 Test  #9: TestCharVar ......................   Passed    0.06 sec
          Start 53: TestUninitVar
     7/84 Test #10: TestClangImport ..................   Passed    0.06 sec
          Start 54: TestUnusedFunctions
     8/84 Test #12: TestCmdlineParser ................   Passed    0.06 sec
          Start 55: TestUnusedPrivateFunction
     9/84 Test #15: TestCppcheck .....................   Passed    0.06 sec
          Start 56: TestUnusedVar
    10/84 Test #16: TestErrorLogger ..................***Failed    0.06 sec
    TestErrorLogger::PatternSearchReplace
    TestErrorLogger::FileLocationDefaults
    TestErrorLogger::FileLocationSetFile
    TestErrorLogger::ErrorMessageConstruct
    TestErrorLogger::ErrorMessageConstructLocations
    TestErrorLogger::ErrorMessageVerbose
    TestErrorLogger::ErrorMessageVerboseLocations
    TestErrorLogger::CustomFormat
    TestErrorLogger::CustomFormat2
    TestErrorLogger::CustomFormatLocations
    TestErrorLogger::ToXmlV2
    TestErrorLogger::ToXmlV2Locations
    TestErrorLogger::ToXmlV2Encoding
    TestErrorLogger::InconclusiveXml
    TestErrorLogger::SerializeInconclusiveMessage
    TestErrorLogger::DeserializeInvalidInput
    TestErrorLogger::SerializeSanitize
    TestErrorLogger::SerializeFileLocation
    TestErrorLogger::suppressUnmatchedSuppressions
    
    
    Testing Complete
    Number of tests: 19
    Number of todos: 0
    Tests failed: 4
    
    /home/tkloczko/rpmbuild/BUILD/cppcheck-2.1/test/testerrorlogger.cpp:196(TestErrorLogger::ToXmlV2): Assertion failed.
    Expected:
            <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Verbose error\">\n
                <location file=\"foo.cpp\" line=\"5\" column=\"1\"/>\n
            </error>
    
    Actual:
    <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Verbose error\">\n
                <location file=\"foo.cpp\" line=\"5\" column=\"1\"/>\n
            </error>
    
    _____
    /home/tkloczko/rpmbuild/BUILD/cppcheck-2.1/test/testerrorlogger.cpp:213(TestErrorLogger::ToXmlV2Locations): Assertion failed.
    Expected:
            <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Verbose error\">\n
                <location file=\"bar.cpp\" line=\"8\" column=\"1\" info=\"\303\244\"/>\n
                <location file=\"foo.cpp\" line=\"5\" column=\"1\"/>\n
            </error>
    
    Actual:
    <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Verbose error\">\n
                <location file=\"bar.cpp\" line=\"8\" column=\"1\" info=\"\303\244\"/>\n
                <location file=\"foo.cpp\" line=\"5\" column=\"1\"/>\n
            </error>
    
    _____
    /home/tkloczko/rpmbuild/BUILD/cppcheck-2.1/test/testerrorlogger.cpp:221(TestErrorLogger::ToXmlV2Encoding): Assertion failed.
    Expected:
            <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Comparing &quot;\203&quot; with &quot;\003&quot;\"/>
    
    Actual:
    <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Comparing &quot;\203&quot; with &quot;\003&quot;\"/>
    
    _____
    /home/tkloczko/rpmbuild/BUILD/cppcheck-2.1/test/testerrorlogger.cpp:242(TestErrorLogger::InconclusiveXml): Assertion failed.
    Expected:
            <error id=\"errorId\" severity=\"error\" msg=\"Programming error\" verbose=\"Programming error\" inconclusive=\"true\">\n
                <location file=\"foo.cpp\" line=\"5\" column=\"1\"/>\n
            </error>
    
    Actual:
    <error id=\"errorId\" severity=\"error\" msg=\"Programming error\" verbose=\"Programming error\" inconclusive=\"true\">\n
                <location file=\"foo.cpp\" line=\"5\" column=\"1\"/>\n
            </error>
    
    _____
    
          Start 57: TestUtils
    11/84 Test #17: TestExceptionSafety ..............   Passed    0.06 sec
          Start 58: TestVaarg
    12/84 Test #19: TestFileLister ...................   Passed    0.06 sec
          Start 59: TestValueFlow
    13/84 Test #22: TestImportProject ................   Passed    0.06 sec
          Start 60: TestVarID
    14/84 Test #23: TestIncompleteStatement ..........   Passed    0.06 sec
          Start 61: TestLeakAutoVarStrcpy
    15/84 Test #24: TestInternal .....................   Passed    0.06 sec
          Start 62: TestLeakAutoVarWindows
    16/84 Test #27: TestLibrary ......................   Passed    0.06 sec
          Start 63: TestMemleakInFunction
    17/84 Test #28: TestMathLib ......................   Passed    0.06 sec
          Start 64: TestMemleakInClass
    18/84 Test #29: TestMemleak ......................   Passed    0.06 sec
          Start 65: TestMemleakStructMember
    19/84 Test #31: TestOptions ......................   Passed    0.06 sec
          Start 66: TestMemleakNoVar
    20/84 Test #33: TestPath .........................   Passed    0.06 sec
          Start 67: cfg-boost_cpp
    21/84 Test #34: TestPathMatch ....................   Passed    0.06 sec
          Start 68: cfg-bsd_c
    22/84 Test #35: TestPlatform .....................   Passed    0.06 sec
          Start 69: cfg-gnu_c
    23/84 Test #20: TestFunctions ....................   Passed    0.08 sec
          Start 70: cfg-googletest_cpp
    24/84 Test #36: TestPostfixOperator ..............   Passed    0.06 sec
          Start 71: cfg-gtk_c
    25/84 Test #37: TestPreprocessor .................   Passed    0.07 sec
          Start 72: cfg-libcurl_c
    26/84 Test #40: TestSimplifyTypedef ..............   Passed    0.06 sec
          Start 73: cfg-lua_c
    27/84 Test #41: TestSimplifyUsing ................   Passed    0.06 sec
          Start 74: cfg-openmp_c
    28/84 Test #42: TestSizeof .......................   Passed    0.07 sec
          Start 75: cfg-posix_c
    29/84 Test #44: TestString .......................   Passed    0.06 sec
          Start 76: cfg-python_c
    30/84 Test #48: TestTimer ........................   Passed    0.06 sec
          Start 77: cfg-qt_cpp
    31/84 Test #49: TestToken ........................   Passed    0.06 sec
          Start 78: cfg-sqlite3_c
    32/84 Test #51: TestTokenList ....................   Passed    0.06 sec
          Start 80: cfg-std_cpp
    33/84 Test #54: TestUnusedFunctions ..............   Passed    0.05 sec
          Start 81: cfg-windows32A
    34/84 Test #55: TestUnusedPrivateFunction ........   Passed    0.05 sec
          Start 82: cfg-windows32W
    35/84 Test #57: TestUtils ........................   Passed    0.05 sec
          Start 83: cfg-windows64
    36/84 Test #14: TestConstructors .................   Passed    0.12 sec
          Start 84: cfg-wxwidgets_cpp
    37/84 Test #21: TestGarbage ......................   Passed    0.11 sec
    38/84 Test #45: TestSuppressions .................   Passed    0.08 sec
    39/84 Test #52: TestType .........................   Passed    0.06 sec
    40/84 Test #58: TestVaarg ........................   Passed    0.05 sec
    41/84 Test #61: TestLeakAutoVarStrcpy ............   Passed    0.05 sec
    42/84 Test #67: cfg-boost_cpp ....................   Passed    0.04 sec
    43/84 Test #68: cfg-bsd_c ........................   Passed    0.03 sec
    44/84 Test #62: TestLeakAutoVarWindows ...........   Passed    0.05 sec
    45/84 Test #70: cfg-googletest_cpp ...............   Passed    0.03 sec
    46/84 Test #72: cfg-libcurl_c ....................   Passed    0.02 sec
    47/84 Test #73: cfg-lua_c ........................   Passed    0.02 sec
    48/84 Test #64: TestMemleakInClass ...............   Passed    0.04 sec
    49/84 Test #66: TestMemleakNoVar .................   Passed    0.04 sec
    50/84 Test #74: cfg-openmp_c .....................   Passed    0.02 sec
    51/84 Test  #5: TestAutoVariables ................   Passed    0.13 sec
    52/84 Test #65: TestMemleakStructMember ..........   Passed    0.04 sec
    53/84 Test #76: cfg-python_c .....................   Passed    0.02 sec
    54/84 Test #60: TestVarID ........................   Passed    0.06 sec
    55/84 Test #63: TestMemleakInFunction ............   Passed    0.05 sec
    56/84 Test #78: cfg-sqlite3_c ....................   Passed    0.03 sec
    57/84 Test #69: cfg-gnu_c ........................   Passed    0.05 sec
    58/84 Test #77: cfg-qt_cpp .......................   Passed    0.03 sec
    59/84 Test #75: cfg-posix_c ......................   Passed    0.04 sec
    60/84 Test #38: TestSimplifyTemplate .............   Passed    0.11 sec
    61/84 Test  #8: TestBufferOverrun ................   Passed    0.16 sec
    62/84 Test #71: cfg-gtk_c ........................   Passed    0.06 sec
    63/84 Test #30: TestNullPointer ..................   Passed    0.16 sec
    64/84 Test #13: TestCondition ....................   Passed    0.19 sec
    65/84 Test  #1: TestSamples ......................   Passed    0.21 sec
    66/84 Test #56: TestUnusedVar ....................   Passed    0.13 sec
    67/84 Test #46: TestSymbolDatabase ...............   Passed    0.15 sec
    68/84 Test #11: TestClass ........................   Passed    0.21 sec
    69/84 Test #43: TestStl ..........................   Passed    0.17 sec
    70/84 Test #53: TestUninitVar ....................   Passed    0.15 sec
    71/84 Test #82: cfg-windows32W ...................   Passed    0.10 sec
    72/84 Test #83: cfg-windows64 ....................   Passed    0.10 sec
    73/84 Test #81: cfg-windows32A ...................   Passed    0.11 sec
    74/84 Test #39: TestSimplifyTokens ...............   Passed    0.22 sec
    75/84 Test #59: TestValueFlow ....................   Passed    0.23 sec
    76/84 Test #32: TestOther ........................   Passed    0.33 sec
    77/84 Test #84: cfg-wxwidgets_cpp ................   Passed    0.25 sec
    78/84 Test #80: cfg-std_cpp ......................   Passed    0.26 sec
    79/84 Test #47: TestThreadExecutor ...............   Passed    0.50 sec
    80/84 Test #18: TestExprEngine ...................   Passed    0.56 sec
    81/84 Test #50: TestTokenizer ....................   Passed    0.60 sec
    82/84 Test #26: TestLeakAutoVar ..................   Passed    0.68 sec
    83/84 Test #25: TestIO ...........................   Passed    1.11 sec
    84/84 Test #79: cfg-std_c ........................   Passed    1.19 sec
    
    99% tests passed, 1 tests failed out of 84
    
    Total Test time (real) =   1.19 sec
    
    The following tests FAILED:
             16 - TestErrorLogger (Failed)
    Errors while running CTest
    
     

    Last edit: Tomasz K&#322;oczko 2020-08-20
  • Tomasz K&#322;oczko

    FYI build of the 2.5 now fails

    make  -f cli/CMakeFiles/cli_objs.dir/build.make cli/CMakeFiles/cli_objs.dir/build
    make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/cppcheck-2.5/x86_64-redhat-linux-gnu'
    [ 41%] Building CXX object cli/CMakeFiles/cli_objs.dir/cppcheckexecutor.cpp.o
    cd /home/tkloczko/rpmbuild/BUILD/cppcheck-2.5/x86_64-redhat-linux-gnu/cli && /usr/bin/g++ -DFILESDIR=\"/usr/share/Cppcheck\" -DHAVE_RULES -DTIXML_USE_STL -DUSE_Z3 -I/home/tkloczko/rpmbuild/BUILD/cppcheck-2.5/x86_64-redhat-linux-gnu/cli -I/home/tkloczko/rpmbuild/BUILD/cppcheck-2.5/cli -I/home/tkloczko/rpmbuild/BUILD/cppcheck-2.5/cppcheck -I/home/tkloczko/rpmbuild/BUILD/cppcheck-2.5/lib -I/home/tkloczko/rpmbuild/BUILD/cppcheck-2.5/externals/simplecpp -isystem /usr/include/z3 -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -DNDEBUG -pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -Woverloaded-virtual -Wno-maybe-uninitialized -Wsuggest-attribute=noreturn -std=gnu++11 -MD -MT cli/CMakeFiles/cli_objs.dir/cppcheckexecutor.cpp.o -MF CMakeFiles/cli_objs.dir/cppcheckexecutor.cpp.o.d -o CMakeFiles/cli_objs.dir/cppcheckexecutor.cpp.o -c /home/tkloczko/rpmbuild/BUILD/cppcheck-2.5/cli/cppcheckexecutor.cpp
    /home/tkloczko/rpmbuild/BUILD/cppcheck-2.5/cli/cppcheckexecutor.cpp:338:22: error: size of array mytstack is not an integral constant-expression
      338 | static char mytstack[MYSTACKSIZE]= {0}; // alternative stack for signal handler
          |                      ^~~~~~~~~~~
    make[2]: *** [cli/CMakeFiles/cli_objs.dir/build.make:93: cli/CMakeFiles/cli_objs.dir/cppcheckexecutor.cpp.o] Error 1
    
     
    • Daniel Marjamäki

      hmm .. could you somehow debug that. It does work for me locally and all our CI also succeed ..
      the code is:

      static const size_t MYSTACKSIZE = 16*1024+SIGSTKSZ; // wild guess about a reasonable buffer
      static char mytstack[MYSTACKSIZE]= {0}; // alternative stack for signal handler
      

      and as far as I can tell MYSTACKSIZE should be known at compile time. would it help with a constexpr or #define ?

       
  • Daniel Marjamäki

    ouch!

     
  • Tomasz K&#322;oczko

    This is related to devel version of the glibc which is now used in Fedora.
    Semantics of the SIGSTKSZ changed and it no longer define.

     
  • Daniel Marjamäki

    hmm.. I have tried compiling in centos and that worked for me. It's not easy to reproduce.

    I imagine that if the NO_UNIX_SIGNAL_HANDLING is defined then you would be able to compile.

    Do you get a similar error with this command?

    g++ -fsyntax-only cli/cppcheckexecutor.cpp -Ilib -Iexternals/simplecpp
    

    Then will this work better?

    g++ -fsyntax-only -DNO_UNIX_SIGNAL_HANDLING cli/cppcheckexecutor.cpp -Ilib -Iexternals/simplecpp
    
     
  • Tomasz K&#322;oczko

    After add -DNO_UNIX_SIGNAL_HANDLING to $CXXFLAGS seems it compile now.
    Test suite is OK as well.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.