From b0577a2eac900ccb9ba62d8c8406e58404e5c2d5 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sun, 26 Jul 2015 19:44:31 +0300 Subject: [PATCH] Add "unfixable" ByteTagList test case This test case creates empty packet, removes last 50 bytes and adds them back. As packet is empty initially, no bytes are marked dirty. Therefore, Buffer::AddAtEnd returns false, indicating that added bytes were not used before. However, it does not know if they were tagged with byte tags. This bug is not so easy to fix as Buffer does not have enough information to return true in Buffer::AddAtEnd when it should. --- src/network/test/packet-test-suite.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/network/test/packet-test-suite.cc b/src/network/test/packet-test-suite.cc index 537e8d55f..831a83229 100644 --- a/src/network/test/packet-test-suite.cc +++ b/src/network/test/packet-test-suite.cc @@ -568,6 +568,20 @@ PacketTest::DoRun (void) tmp->AddPaddingAtEnd (50); CHECK (tmp, 1, E (25, 0, 50)); } + + /* Test reducing tagged packet size and increasing it back, + * now using padding bytes to avoid triggering dirty state + * in virtual buffer + */ + { + Ptr tmp = Create (100); + tmp->AddByteTag (ATestTag<25> ()); + CHECK (tmp, 1, E (25, 0, 100)); + tmp->RemoveAtEnd (50); + CHECK (tmp, 1, E (25, 0, 50)); + tmp->AddPaddingAtEnd (50); + CHECK (tmp, 1, E (25, 0, 50)); + } } //-------------------------------------- class PacketTagListTest : public TestCase