Protocol test data stream expectations?

137 views
Skip to first unread message

Patrick Meenan

unread,
Dec 16, 2022, 8:46:53 PM12/16/22
to net-dev
Where are the expectations stored for the protocol-level unit tests in net (where it validates the byte streams on socket write)?

I'm adding support for quic prioritization that changes the packets but I've spent a few hours wandering through the test call stacks and flows to try to find where the expected_data is set so I figured I'd ask in case someone knew off the top of their head.

I have variations that test with the feature on and off so I can still test the existing behavior but I also need to update it to recognize the new flag in the priority frame/headers (highlighted below in the error).

Specifically, this is the quic priority data generated by GenerateHttp3PriorityData() in quic_test_packet_maker if it helps. Since different tests can have different priorities (and generate different packets) I assume there's a string or file somewhere that has what they are supposed to be.

Thanks,

-Pat

net_unit_tests output (actual change highlighted in yellow in "Actual raw write data"):

[ RUN      ] VersionIncludeStreamDependencySequence/QuicHttpStreamTest.Priority/draft29_Dependency_Incremental
../../net/socket/socket_test_util.cc:237: Failure
Value of: actual_data == expected_data
  Actual: false
Expected: true
Actual formatted write data:
OnPacket
OnUnauthenticatedPublicHeader: { destination_connection_id: 0000000000000002 (present), source_connection_id: 0 (absent), packet_number_length: 4, reset_flag: 0, version_flag: 0, packet_number: uninitialized }

OnUnauthenticatedHeader: { destination_connection_id: 0000000000000002 (present), source_connection_id: 0 (absent), packet_number_length: 1, reset_flag: 0, version_flag: 0, packet_number: 2 }
OnDecryptedPacket
OnPacketHeader
OnStreamFrame: { stream_id: 2, fin: 0, offset: 23, length: 12 }
         data: { 800F07000700753D312C2069 }
OnStreamFrame: { stream_id: 0, fin: 1, offset: 0, length: 21 }
         data: { 01130000D1508CF1E3C2E5F23A6BA0AB9EC9BFD7C1 }
OnPacketComplete


Expected formatted write data:
OnPacket
OnUnauthenticatedPublicHeader: { destination_connection_id: 0000000000000002 (present), source_connection_id: 0 (absent), packet_number_length: 4, reset_flag: 0, version_flag: 0, packet_number: uninitialized }

OnUnauthenticatedHeader: { destination_connection_id: 0000000000000002 (present), source_connection_id: 0 (absent), packet_number_length: 1, reset_flag: 0, version_flag: 0, packet_number: 2 }
OnDecryptedPacket
OnPacketHeader
OnStreamFrame: { stream_id: 2, fin: 0, offset: 23, length: 9 }
         data: { 800F07000400753D31 }
OnStreamFrame: { stream_id: 0, fin: 1, offset: 0, length: 21 }
         data: { 01130000D1508CF1E3C2E5F23A6BA0AB9EC9BFD7C1 }
OnPacketComplete


Actual raw write data:
0x0000:  4000 0000 0000 0000 0202 d1ca 5fe6 1e66  @..........._..f
0x0010:  ba18 faa5 ffdb 0e02 170c 800f 0700 0700  ................
0x0020:  753d 312c 2069 0900 0113 0000 d150 8cf1  u=1,.i.......P..
0x0030:  e3c2 e5f2 3a6b a0ab 9ec9 bfd7 c1         ....:k.......
Expected raw write data:
0x0000:  4000 0000 0000 0000 0202 e8cc 0a1e c7ba  @...............
0x0010:  93fa d609 68d5 0e02 1709 800f 0700 0400  ....h...........
0x0020:  753d 3109 0001 1300 00d1 508c f1e3 c2e5  u=1.......P.....
0x0030:  f23a 6ba0 ab9e c9bf d7c1                 .:k.......

Stack trace:
#0 0x5585a8f4c4d8 net::StaticSocketDataHelper::VerifyWriteData()
#1 0x5585a8f4d1fd net::StaticSocketDataProvider::OnWrite()
#2 0x5585a8f59294 net::MockUDPClientSocket::Write()
#3 0x5585a8dcf394 net::QuicChromiumPacketWriter::WritePacketToSocketImpl()
#4 0x5585a8dcf210 net::QuicChromiumPacketWriter::WritePacket()
#5 0x5585a94a585a quic::QuicConnection::WritePacket()
#6 0x5585a94a8ae9 quic::QuicConnection::OnSerializedPacket()
#7 0x5585a94ec08e quic::QuicPacketCreator::OnSerializedPacket()
#8 0x5585a94eb24a quic::QuicPacketCreator::FlushCurrentPacket()
#9 0x5585a94f21b5 quic::QuicPacketCreator::Flush()
#10 0x5585a94aba59 quic::QuicConnection::ScopedPacketFlusher::~ScopedPacketFlusher()
#11 0x5585a8ddd56f net::QuicHttpStream::DoLoop()
#12 0x5585a8dde287 net::QuicHttpStream::SendRequest()
#13 0x5585a6d89055 net::test::QuicHttpStreamTest_Priority_Test::TestBody()

Patrick Meenan

unread,
Dec 16, 2022, 8:47:00 PM12/16/22
to net-dev
Never mind (I think).  I didn't realize the packet helper was generating the expectations (instead of the raw data) and it is likely out of sync with the feature flag controlling the actual packet generation.  I think I know where to fix it.
Reply all
Reply to author
Forward
0 new messages