derat/xsettingsd

CharStreamTest.Basic test failure

Apteryks opened this issue · 3 comments

Hi,

Building the latest release with CMake, I see the following test failure:

starting phase `check'                                                                                                                                                                                              
Running tests...                                                                                                                                                            
/gnu/store/j65q3aw414010gdfvmsynwpzfb2jyyd3-cmake-minimal-3.21.4/bin/ctest --force-new-ctest-process                                                                                                                
Test project /tmp/guix-build-xsettingsd-1.0.2.drv-0/build                                                                                                                                                           
      Start  1: CommonTest.SplitString                                                                                                                                                                              
 1/14 Test  #1: CommonTest.SplitString ................   Passed    0.01 sec                                                                                                                                        
      Start  2: CommonTest.GetPadding                                                                     lo                                                                                                        
 2/14 Test  #2: CommonTest.GetPadding .................   Passed    0.00 sec                                                                                                                                        
      Start  3: CommonTest.GetDefaultConfigFilePath                                                                                                                                                                 
 3/14 Test  #3: CommonTest.GetDefaultConfigFilePath ...   Passed    0.00 sec                                                                                                                                        
      Start  4: CharStreamTest.Basic                                                                                                                                                                                
 4/14 Test  #4: CharStreamTest.Basic ..................***Failed    0.00 sec                                                                                                                                        
Note: Google Test filter = CharStreamTest.Basic                                                                                                                                                                     
[==========] Running 1 test from 1 test suite.                                                            lo                                                                                                        
[----------] Global test environment set-up.                                                                                                                                                                        
[----------] 1 test from CharStreamTest                                                                                                                                                                             
[ RUN      ] CharStreamTest.Basic
/tmp/guix-build-xsettingsd-1.0.2.drv-0/source/config_parser_test.cc:25: Failure
Death test: stream.AtEOF()
    Result: failed to die.                                                                                de
 Error msg:
[  DEATH   ]                                                                                              ss
[  FAILED  ] CharStreamTest.Basic (0 ms)
[----------] 1 test from CharStreamTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)                                                   de
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:                                                                        ss
[  FAILED  ] CharStreamTest.Basic

 1 FAILED TEST

      Start  5: CharStreamTest.LineNumbers
 5/14 Test  #5: CharStreamTest.LineNumbers ............   Passed    0.00 sec
      Start  6: ConfigParserTest.ReadSettingName
 6/14 Test  #6: ConfigParserTest.ReadSettingName ......   Passed    0.00 sec
      Start  7: ConfigParserTest.ReadInteger
 7/14 Test  #7: ConfigParserTest.ReadInteger ..........   Passed    0.00 sec
      Start  8: ConfigParserTest.ReadString                                                               lo
 8/14 Test  #8: ConfigParserTest.ReadString ...........   Passed    0.00 sec
      Start  9: ConfigParserTest.ReadColor
 9/14 Test  #9: ConfigParserTest.ReadColor ............   Passed    0.00 sec
      Start 10: ConfigParserTest.Parse
10/14 Test #10: ConfigParserTest.Parse ................   Passed    0.00 sec
      Start 11: IntegerSettingTest.Write
11/14 Test #11: IntegerSettingTest.Write ..............   Passed    0.00 sec                              lo
      Start 12: StringSettingTest.Write
12/14 Test #12: StringSettingTest.Write ...............   Passed    0.00 sec
      Start 13: ColorSettingTest.Write
13/14 Test #13: ColorSettingTest.Write ................   Passed    0.00 sec
      Start 14: SettingTest.Serials
14/14 Test #14: SettingTest.Serials ...................   Passed    0.00 sec

93% tests passed, 1 tests failed out of 14

Total Test time (real) =   0.06 sec
                                                                                                          lo
The following tests FAILED:
          4 - CharStreamTest.Basic (Failed)
Errors while running CTest
make: *** [Makefile:117: test] Error 8

Test suite failed, dumping logs.
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("test" "-j" "4") exit-status: 2 term-signal: #f stolop-signal: #f> 
phase `check' failed after 0.2 seconds
command "make" "test" "-j" "4" failed with status 2

I've built the project with the -DBUILD_TESTING=ON CMake configure flag.

Thank you!

derat commented

Thanks for the report. I'm pretty sure that's an issue with gtest/GoogleTest's ASSERT_DEATH macro not working correctly. The test is trivial (to the point where I wouldn't have included it if I were writing this now), and the code hasn't changed in ~14 years. I think I remember the *_DEATH macros having various weird issues.

If you change the three ASSERT_DEATH calls in config_parser_test.cc to ASSERT_DEATH_IF_SUPPORTED, do those checks get skipped on your system (resulting in tests succeeding)?

Hi! Thanks for the info. I've tried with config_parser_test.cc modified to have:

  // We should die if we try to do anything before calling Init().
  ASSERT_DEATH_IF_SUPPORTED(stream.AtEOF(), "initialized");
  ASSERT_DEATH_IF_SUPPORTED(stream.GetChar(), "initialized");
  ASSERT_DEATH_IF_SUPPORTED(stream.UngetChar('0'), "initialized");

But I still reproduce the failure. The version of googletest used is 1.11.0, provided by the system.

Thanks!

derat commented

Hmm, interesting. I'm using the 1.10.0.20201025-1.1 Debian package -- I wonder if something's changed in the library. I've just deleted this useless checks.