make check unit test failures and segmentation fault

571 views
Skip to first unread message

David Edge

unread,
Nov 14, 2016, 8:34:04 PM11/14/16
to Protocol Buffers
I have been trying to compile protobuf for soft float ARMv7. I am compiling on board rather than cross compiling, and am failing some unit tests when I run "make check". Most of the tests seem to be failing due to rounding error, and the segmentation fault seems to have occurred during an infinity input test, so I'm thinking I could fix these by using less aggressive optimization flags and turning off fastmath.

Any ideas?

I can't seem to attach the whole logfile, as it is over 200MB. I attached one of the longer failed unit tests and a few more interesting pieces below. Here is my console output:

./test-driver: line 107:  2847 Segmentation fault      "$@" > $log_file 2>&1
FAIL: protobuf-test
PASS: protobuf-lazy-descriptor-test
PASS: protobuf-lite-test
PASS: google/protobuf/compiler/zip_output_unittest.sh
PASS: google/protobuf/io/gzip_stream_unittest.sh
PASS: protobuf-lite-arena-test
PASS: no-warning-test
============================================================================
Testsuite summary for Protocol Buffers 3.1.0
============================================================================
# TOTAL: 7
# PASS:  6
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See src/test-suite.log
Please report to prot...@googlegroups.com
============================================================================
Makefile:7407: recipe for target 'test-suite.log' failed

And here are some of the failures from the log:
================================================
   Protocol Buffers 3.1.0: src/test-suite.log
================================================

# TOTAL: 7
# PASS:  6
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: protobuf-test
===================

google/protobuf/descriptor_unittest.cc:2312: Failure
Value of: message->field(5)->default_value_double()
  Actual: 1e+101
Expected: 10e100
Which is: inf
[  FAILED  ] MiscTest.DefaultValues (2 ms)

google/protobuf/descriptor_unittest.cc:2786: Failure
Value of: options->GetExtension(protobuf_unittest::double_opt)
  Actual: 1.2345678901234567
Expected: 1.234567890123456789
Which is: 1.2345678806304932
[  FAILED  ] CustomOptions.OptionTypes (0 ms)

[ RUN      ] TimeUtilTest.DurationOperators
google/protobuf/util/time_util_test.cc:276: Failure
Value of: TimeUtil::ToString(a * 0.5)
  Actual: "0s"
Expected: "0.999999999s"
google/protobuf/util/time_util_test.cc:277: Failure
Value of: TimeUtil::ToString(b * 0.5)
  Actual: "0s"
Expected: "-0.999999999s"
[  FAILED  ] TimeUtilTest.DurationOperators (1 ms)

[ RUN      ] JsonStreamParserTest.ArrayComplexValues
[libprotobuf INFO google/protobuf/util/internal/json_stream_parser_test.cc:111] Testing split: ><[[22, -127, 45.3, -1056.4, 11779497823553162765], {'key': true}]
unknown file: Failure

Unexpected mock function call - returning default value.
    Function call: RenderDouble({}, 45.3)
          Returns: NULL
Google Mock tried the following 2 expectations, but none matched:

./google/protobuf/util/internal/expecting_objectwriter.h:178: tried expectation #0: EXPECT_CALL(*mock_, RenderDouble(IsEmpty(), NanSensitiveDoubleEq(value)))...
  Expected arg #1: is approximately 45.299999237060547
           Actual: 45.3
         Expected: to be called once
           Actual: never called - unsatisfied and active
./google/protobuf/util/internal/expecting_objectwriter.h:178: tried expectation #1: EXPECT_CALL(*mock_, RenderDouble(IsEmpty(), NanSensitiveDoubleEq(value)))...
  Expected arg #1: is approximately -1056.4000244140625
           Actual: 45.3
         Expected: to be called once
           Actual: never called - unsatisfied and active
unknown file: Failure

Unexpected mock function call - returning default value.
    Function call: RenderDouble({}, -1056.4)
          Returns: NULL
Google Mock tried the following 2 expectations, but none matched:

./google/protobuf/util/internal/expecting_objectwriter.h:178: tried expectation #0: EXPECT_CALL(*mock_, RenderDouble(IsEmpty(), NanSensitiveDoubleEq(value)))...
  Expected arg #1: is approximately 45.299999237060547
           Actual: -1056.4
         Expected: to be called once
           Actual: never called - unsatisfied and active
./google/protobuf/util/internal/expecting_objectwriter.h:178: tried expectation #1: EXPECT_CALL(*mock_, RenderDouble(IsEmpty(), NanSensitiveDoubleEq(value)))...
  Expected arg #1: is approximately -1056.4000244140625
           Actual: -1056.4
         Expected: to be called once
           Actual: never called - unsatisfied and active
unknown file: Failure

Unexpected mock function call - returning default value.
    Function call: RenderUint64({}, 11779497823553162765)
          Returns: NULL
Google Mock tried the following 2 expectations, but none matched:

./google/protobuf/util/internal/expecting_objectwriter.h:167: tried expectation #0: EXPECT_CALL(*mock_, RenderUint64(IsEmpty(), TypedEq<uint64>(value)))...
         Expected: the expectation is active
           Actual: it is retired
         Expected: to be called once
           Actual: called once - saturated and retired
./google/protobuf/util/internal/expecting_objectwriter.h:167: tried expectation #1: EXPECT_CALL(*mock_, RenderUint64(IsEmpty(), TypedEq<uint64>(value)))...
         Expected: all pre-requisites are satisfied
           Actual: the following immediate pre-requisites are not satisfied:
./google/protobuf/util/internal/expecting_objectwriter.h:178: pre-requisite #0
                   (end of pre-requisites)
         Expected: to be called once
           Actual: never called - unsatisfied and active
unknown file: Failure

===
Snipped thousands of similar lines here.
====

./google/protobuf/util/internal/expecting_objectwriter.h:95: Failure
Actual function call count doesn't match EXPECT_CALL(*mock_, StartObject(IsEmpty()))...
         Expected: to be called once
           Actual: never called - unsatisfied and active
./google/protobuf/util/internal/expecting_objectwriter.h:96: Failure
Actual function call count doesn't match EXPECT_CALL(*mock_, StartObject(StrEq(name.ToString())))...
         Expected: to be called once
           Actual: never called - unsatisfied and active
[  FAILED  ] JsonStreamParserTest.ObjectValues (88792 ms)

[ RUN      ] JsonStreamParserTest.RejectNonUtf8WhenNotCoerced
[libprotobuf INFO google/protobuf/util/internal/json_stream_parser_test.cc:111] Testing split: ><{"address":ÿ"חרושת 23, ×¨×¢× × ×”, ×™×©×¨× ×œ"}

GMOCK WARNING:
Uninteresting mock function call - returning default value.
    Function call: StartObject({})
          Returns: NULL
Stack trace:
[libprotobuf INFO google/protobuf/util/internal/json_stream_parser_test.cc:111] Testing split: {><"address":ÿ"חרושת 23, ×¨×¢× × ×”, ×™×©×¨× ×œ"}

GMOCK WARNING:
Uninteresting mock function call - returning default value.
    Function call: StartObject({})
          Returns: NULL
Stack trace:
[libprotobuf INFO google/protobuf/util/internal/json_stream_parser_test.cc:111] Testing split: {"><address":ÿ"חרושת 23, ×¨×¢× × ×”, ×™×©×¨× ×œ"}

GMOCK WARNING:
Uninteresting mock function call - returning default value.
    Function call: StartObject({})
          Returns: NULL
Stack trace:
[libprotobuf INFO google/protobuf/util/internal/json_stream_parser_test.cc:111] Testing split: {"a><ddress":ÿ"חרושת 23, ×¨×¢× × ×”, ×™×©×¨× ×œ"}

GMOCK WARNING:
Uninteresting mock function call - returning default value.
    Function call: StartObject({})
          Returns: NULL
Stack trace:
[libprotobuf INFO google/protobuf/util/internal/json_stream_parser_test.cc:111] Testing split: {"ad><dress":ÿ"חרושת 23, ×¨×¢× × ×”, ×™×©×¨× ×œ"}

=====
snipped similar lines
=====

GMOCK WARNING:
Uninteresting mock function call - returning default value.
    Function call: StartList({})
          Returns: NULL
Stack trace:
[libprotobuf INFO google/protobuf/util/internal/json_stream_parser_test.cc:111] Testing split: ["\ud83d\ud83d"><]

GMOCK WARNING:
Uninteresting mock function call - returning default value.
    Function call: StartList({})
          Returns: NULL
Stack trace:
[libprotobuf INFO google/protobuf/util/internal/json_stream_parser_test.cc:97] Testing split every char: ["\ud83d\ud83d"]

GMOCK WARNING:
Uninteresting mock function call - returning default value.
    Function call: StartList({})
          Returns: NULL
Stack trace:
[       OK ] JsonStreamParserTest.UnicodeEscapingMissingLowSurrogateWhenNotCoerced (7 ms)

This seems to be where the segfault occurs:

[----------] 45 tests from DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.EmptyObject/0
[       OK ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.EmptyObject/0 (33 ms)
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.SimpleObject/0
[       OK ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.SimpleObject/0 (1 ms)
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.SimpleMessage/0
[       OK ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.SimpleMessage/0 (4 ms)
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.CustomJsonName/0
[       OK ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.CustomJsonName/0 (0 ms)
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.IntEnumValuesAreAccepted/0
[       OK ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.IntEnumValuesAreAccepted/0 (1 ms)
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.EnumValuesWithoutUnderscoreAreAccepted/0
[       OK ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.EnumValuesWithoutUnderscoreAreAccepted/0 (1 ms)
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.EnumValuesInCamelCaseAreAccepted/0
[       OK ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.EnumValuesInCamelCaseAreAccepted/0 (0 ms)
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.EnumValuesInCamelCaseWithNameNotUppercaseAreAccepted/0
[       OK ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.EnumValuesInCamelCaseWithNameNotUppercaseAreAccepted/0 (1 ms)
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.PrimitiveFromStringConversion/0
[       OK ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.PrimitiveFromStringConversion/0 (1 ms)
[ RUN      ] DifferentTypeInfoSourceTest/ProtoStreamObjectWriterTest.InfinityInputTest/0
FAIL protobuf-test (exit status: 139)


pieceOf.log

Adam Cozzette

unread,
Nov 15, 2016, 5:18:05 PM11/15/16
to David Edge, Protocol Buffers
Interestingly it kind of looks like your compiler is treating floating-point literals as single-precision floats instead of doubles. Judging from this snippet you posted for example:

Expected: 1.234567890123456789
Which is: 1.2345678806304932

The first number is the original text from the source file, but the second number is the compiler's interpretation of it and seems to be downgraded to a 32-bit float.

I'm not sure of the exact link between that and the segfault, but I suspect they're related because the failing test (InfinityInputTest) involves setting float and double fields to infinity. If you could figure out which line in that test triggers the segfault that would be useful to know, too.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

David Edge

unread,
Nov 15, 2016, 6:54:09 PM11/15/16
to Protocol Buffers, edge...@gmail.com
I will try and figure out where the segfault is happening and get back to you.

My compiler options included the following flag: -fsingle-precision-constant

Turning off this option got rid of all the precision errors. Every test now passes prior to the segfault. However I still segfault at the infinity test.

Now I am wondering if it has to do with the fact that I am compiling for softfp. Perhaps I need to try doing all floating point in software.

Best,
David
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.

Adam Cozzette

unread,
Nov 17, 2016, 10:34:53 AM11/17/16
to David Edge, Protocol Buffers
Another interesting thing is that someone else reported what looks like the same segfault, but this time with MSYS2: https://github.com/google/protobuf/issues/2380

To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages