Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1173

BSON does not work on PPC64 BigEndian system

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.1, bson-4.2.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Running BSON test suite on Fedora PPC, it fails:

      + rspec -I~/build/BUILD/rubygem-bson-4.1.1/usr/lib64/gems/ruby/bson-4.1.1 spec
      ..............................................................F.F.F..F.F......F.F.....................FF.FF........................................................................................................................FF.............F.F.FFF......................................................................................................................FFFFFF......FF..........
      Failures:
        1) BSON::ByteBuffer#put_double appends the double to the buffer
           Failure/Error: expect(modified.to_s).to eq([ 1.2332 ].pack(Float::PACK))
             expected: "\xD0\xD5V\xEC/\xBB\xF3?"
                  got: "?\xF3\xBB/\xECV\xD5\xD0"
             (compared using ==)
           # ./spec/bson/byte_buffer_spec.rb:233:in `block (3 levels) in <top (required)>'
        2) BSON::ByteBuffer#put_int32 when the integer is 32 bit when the integer is positive appends the int32 to the byte buffer
           Failure/Error: expect(modified.to_s).to eq(expected)
             expected: "\xFE\xFF\xFF\x7F"
                  got: "\x7F\xFF\xFF\xFE"
             (compared using ==)
           # ./spec/bson/byte_buffer_spec.rb:260:in `block (5 levels) in <top (required)>'
        3) BSON::ByteBuffer#put_int32 when the integer is 32 bit when the integer is negative appends the int32 to the byte buffer
           Failure/Error: expect(modified.to_s).to eq(expected)
             expected: "\x01\x00\x00\x80"
                  got: "\x80\x00\x00\x01"
             (compared using ==)
           # ./spec/bson/byte_buffer_spec.rb:279:in `block (5 levels) in <top (required)>'
        4) BSON::ByteBuffer#put_int64 when the integer is 64 bit when the integer is positive appends the int64 to the byte buffer
           Failure/Error: expect(modified.to_s).to eq(expected)
             expected: "\xFE\xFF\xFF\xFF\xFF\xFF\xFF\x7F"
                  got: "\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFE"
             (compared using ==)
           # ./spec/bson/byte_buffer_spec.rb:317:in `block (5 levels) in <top (required)>'
        5) BSON::ByteBuffer#put_int64 when the integer is 64 bit when the integer is negative appends the int64 to the byte buffer
           Failure/Error: expect(modified.to_s).to eq(expected)
             expected: "\x01\x00\x00\x00\x00\x00\x00\x80"
                  got: "\x80\x00\x00\x00\x00\x00\x00\x01"
             (compared using ==)
           # ./spec/bson/byte_buffer_spec.rb:336:in `block (5 levels) in <top (required)>'
        6) BSON::ByteBuffer#put_string when the buffer needs to be expanded when bytes exist in the buffer appends the string to the byte buffer
           Failure/Error:
             expect(modified.to_s).to eq(
               "#{[ 4 ].pack(BSON::Int32::PACK)}#{(string.bytesize + 1).to_bson.to_s}#{string}#{BSON::NULL_BYTE}"
             )
             expected: "\u0004\u0000\u0000\u0000\u0000\u0000\u0003\u00170123456789101112131415161718192021222324252627282930...269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299\u0000"
                  got: "\x00\x00\x00\x04\x00\x00\x03\x1701234567891011121314151617181920212223242526272829303132333435363738...68269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299\x00"
             (compared using ==)
           # ./spec/bson/byte_buffer_spec.rb:411:in `block (5 levels) in <top (required)>'
        7) BSON::ByteBuffer#replace_int32 replaces the int32 at the location
           Failure/Error: expect(modified.to_s).to eq("#{exp_first}#{exp_second}")
             expected: "\u0005\u0000\u0000\u0000\u0004\u0000\u0000\u0000"
                  got: "\x00\x00\x00\x05\x00\x00\x00\x04"
             (compared using ==)
           # ./spec/bson/byte_buffer_spec.rb:442:in `block (3 levels) in <top (required)>'
        8) Date#to_bson when the date is post epoch behaves like a serializable bson element serializes to bson
           Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
             expected: "\x00\xD0\x90\x964\x01\x00\x00"
                  got: "\x00\x00\x014\x96\x90\xD0\x00"
             (compared using ==)
           Shared Example Group: "a serializable bson element" called from ./spec/bson/date_spec.rb:29
           # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        9) Date#to_bson when the date is pre epoch behaves like a serializable bson element serializes to bson
           Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
             expected: "\x00\xD4N\xA8\xF8\xFF\xFF\xFF"
                  got: "\xFF\xFF\xFF\xF8\xA8N\xD4\x00"
             (compared using ==)
           Shared Example Group: "a serializable bson element" called from ./spec/bson/date_spec.rb:38
           # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        10) DateTime#to_bson when the date time is post epoch behaves like a serializable bson element serializes to bson
            Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
              expected: "\x00\xD0\x90\x964\x01\x00\x00"
                   got: "\x00\x00\x014\x96\x90\xD0\x00"
              (compared using ==)
            Shared Example Group: "a serializable bson element" called from ./spec/bson/date_time_spec.rb:28
            # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        11) DateTime#to_bson when the date time is pre epoch behaves like a serializable bson element serializes to bson
            Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
              expected: "\x00\xD4N\xA8\xF8\xFF\xFF\xFF"
                   got: "\xFF\xFF\xFF\xF8\xA8N\xD4\x00"
              (compared using ==)
            Shared Example Group: "a serializable bson element" called from ./spec/bson/date_time_spec.rb:36
            # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        12) Float#to_bson/#from_bson behaves like a serializable bson element serializes to bson
            Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
              expected: "\xD0\xD5V\xEC/\xBB\xF3?"
                   got: "?\xF3\xBB/\xECV\xD5\xD0"
              (compared using ==)
            Shared Example Group: "a serializable bson element" called from ./spec/bson/float_spec.rb:26
            # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        13) Float#to_bson/#from_bson behaves like a deserializable bson element deserializes from bson
            Failure/Error: expect(result).to eq(obj)
              expected: 1.2332
                   got: -2.530252886341933e+81
              (compared using ==)
            Shared Example Group: "a deserializable bson element" called from ./spec/bson/float_spec.rb:27
            # ./spec/support/shared_examples.rb:57:in `block (2 levels) in <top (required)>'
        14) BSON::Int32#from_bson behaves like a deserializable bson element deserializes from bson
            Failure/Error: expect(result).to eq(obj)
              expected: 123
                   got: 2063597568
              (compared using ==)
            Shared Example Group: "a deserializable bson element" called from ./spec/bson/int32_spec.rb:26
            # ./spec/support/shared_examples.rb:57:in `block (2 levels) in <top (required)>'
        15) BSON::Int32 when the integer is negative decodes a -50 correctly
            Failure/Error: expect(BSON::Int32.from_bson(encoded_2)).to eq(decoded_2)
              expected: -50
                   got: -822083585
              (compared using ==)
            # ./spec/bson/int32_spec.rb:41:in `block (3 levels) in <top (required)>'
        16) BSON::Int64#from_bson behaves like a deserializable bson element deserializes from bson
            Failure/Error: expect(result).to eq(obj)
              expected: 1325376000000
                   got: 58705769947791360
              (compared using ==)
            Shared Example Group: "a deserializable bson element" called from ./spec/bson/int64_spec.rb:26
            # ./spec/support/shared_examples.rb:57:in `block (2 levels) in <top (required)>'
        17) Integer#to_bson when the integer is 32 bit behaves like a serializable bson element serializes to bson
            Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
              expected: "\xFE\xFF\xFF\x7F"
                   got: "\x7F\xFF\xFF\xFE"
              (compared using ==)
            Shared Example Group: "a serializable bson element" called from ./spec/bson/integer_spec.rb:27
            # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        18) Integer#to_bson when the integer is 64 bit behaves like a serializable bson element serializes to bson
            Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
              expected: "\xFE\xFF\xFF\xFF\xFF\xFF\xFF\x7F"
                   got: "\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFE"
              (compared using ==)
            Shared Example Group: "a serializable bson element" called from ./spec/bson/integer_spec.rb:36
            # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        19) Time#to_bson/#from_bson when the time is post epoch when the time has no microseconds behaves like a serializable bson element serializes to bson
            Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
              expected: "\x00\xD0\x90\x964\x01\x00\x00"
                   got: "\x00\x00\x014\x96\x90\xD0\x00"
              (compared using ==)
            Shared Example Group: "a serializable bson element" called from ./spec/bson/time_spec.rb:32
            # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        20) Time#to_bson/#from_bson when the time is post epoch when the time has no microseconds behaves like a deserializable bson element deserializes from bson
            Failure/Error: expect(result).to eq(obj)
              expected: 2012-01-01 00:00:00.000000000 +0000
                   got: 1862281-10-16 22:49:51.360000000 +0000
              (compared using ==)
              Diff:
              @@ -1,2 +1,2 @@
              -2012-01-01 00:00:00 UTC
              +1862281-10-16 22:49:51 UTC
            Shared Example Group: "a deserializable bson element" called from ./spec/bson/time_spec.rb:33
            # ./spec/support/shared_examples.rb:57:in `block (2 levels) in <top (required)>'
        21) Time#to_bson/#from_bson when the time is post epoch when the time has microseconds behaves like a serializable bson element serializes to bson
            Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
              expected: "a\xB2\xF7\xEAD\x01\x00\x00"
                   got: "\x00\x00\x01D\xEA\xF7\xB2a"
              (compared using ==)
            Shared Example Group: "a serializable bson element" called from ./spec/bson/time_spec.rb:41
            # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        22) Time#to_bson/#from_bson when the time is post epoch when the time has microseconds behaves like a deserializable bson element deserializes from bson
            Failure/Error: expect(result).to eq(obj)
              expected: 2014-03-22 18:05:05.505000000 +0000
                   got: 223089477-02-02 16:00:30.720000000 +0000
              (compared using ==)
              Diff:
              @@ -1,2 +1,2 @@
              -2014-03-22 18:05:05 UTC
              +223089477-02-02 16:00:30 UTC
            Shared Example Group: "a deserializable bson element" called from ./spec/bson/time_spec.rb:42
            # ./spec/support/shared_examples.rb:57:in `block (2 levels) in <top (required)>'
        23) Time#to_bson/#from_bson when the time is pre epoch behaves like a serializable bson element serializes to bson
            Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
              expected: "\x00\xD4N\xA8\xF8\xFF\xFF\xFF"
                   got: "\xFF\xFF\xFF\xF8\xA8N\xD4\x00"
              (compared using ==)
            Shared Example Group: "a serializable bson element" called from ./spec/bson/time_spec.rb:51
            # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        24) Time#to_bson/#from_bson when the time is pre epoch behaves like a deserializable bson element deserializes from bson
            Failure/Error: expect(result).to eq(obj)
              expected: 1969-01-01 00:00:00.000000000 +0000
                   got: 1895663-02-11 04:40:58.111000000 +0000
              (compared using ==)
              Diff:
              @@ -1,2 +1,2 @@
              -1969-01-01 00:00:00 UTC
              +1895663-02-11 04:40:58 UTC
            Shared Example Group: "a deserializable bson element" called from ./spec/bson/time_spec.rb:52
            # ./spec/support/shared_examples.rb:57:in `block (2 levels) in <top (required)>'
        25) BSON::Timestamp#to_bson/#from_bson behaves like a serializable bson element serializes to bson
            Failure/Error: expect(obj.to_bson.to_s).to eq(bson)
              expected: "\n\x00\x00\x00\x01\x00\x00\x00"
                   got: "\x00\x00\x00\n\x00\x00\x00\x01"
              (compared using ==)
              Diff:
              @@ -1,3 +1,3 @@
              -
              -������
              +���
              +���
            Shared Example Group: "a serializable bson element" called from ./spec/bson/timestamp_spec.rb:71
            # ./spec/support/shared_examples.rb:42:in `block (2 levels) in <top (required)>'
        26) BSON::Timestamp#to_bson/#from_bson behaves like a deserializable bson element deserializes from bson
            Failure/Error: expect(result).to eq(obj)
              expected: #<BSON::Timestamp:0x0001001ba4cb00 @seconds=1, @increment=10>
                   got: #<BSON::Timestamp:0x0001001ba4cb78 @seconds=16777216, @increment=167772160>
              (compared using ==)
              Diff:
              @@ -1,2 +1,2 @@
              -#<BSON::Timestamp:0x0001001ba4cb00 @increment=10, @seconds=1>
              +#<BSON::Timestamp:0x0001001ba4cb78 @increment=167772160, @seconds=16777216>
            Shared Example Group: "a deserializable bson element" called from ./spec/bson/timestamp_spec.rb:72
            # ./spec/support/shared_examples.rb:57:in `block (2 levels) in <top (required)>'
      Finished in 0.65311 seconds (files took 0.32649 seconds to load)
      391 examples, 26 failures
      

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            vo.x Vít Ondruch
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: