]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3487: http2_inspect: unit tests depending on REG_TEST
authorTom Peters (thopeter) <thopeter@cisco.com>
Tue, 28 Jun 2022 17:05:00 +0000 (17:05 +0000)
committerTom Peters (thopeter) <thopeter@cisco.com>
Tue, 28 Jun 2022 17:05:00 +0000 (17:05 +0000)
Merge in SNORT/snort3 from ~THOPETER/snort3:nhttp165 to master

Squashed commit of the following:

commit d3b038594dc5118c6114f29a998f8c71aa4518f1
Author: Tom Peters <thopeter@cisco.com>
Date:   Mon Jun 27 15:57:42 2022 -0400

    http2_inspect: unit tests depending on REG_TEST

src/service_inspectors/http2_inspect/test/http2_hpack_int_decode_test.cc
src/service_inspectors/http2_inspect/test/http2_hpack_string_decode_test.cc
src/utils/infractions.h

index 975a3c0905030bd2ac1acf7ec06e66f05ce7eff3..a0455f054392ad5ec9a35f9fd7b4c3bbe5c401c0 100644 (file)
@@ -51,7 +51,6 @@ TEST_GROUP(http2_hpack_int_decode_success)
     void teardown() override
     {
         CHECK(inf.none_found() == true);
-        CHECK(events.none_found() == true);
         delete decode;
     }
 };
@@ -319,7 +318,6 @@ TEST(http2_hpack_int_decode_leading_zeros, leading_zeros)
     CHECK(res == 31);
     CHECK(bytes_processed == 3);
     CHECK(local_inf.get_raw(0) == (1<<INF_INT_LEADING_ZEROS));
-    CHECK(local_events.get_raw(0) == (1<<(EVENT_INT_LEADING_ZEROS-1)));
 }
 
 TEST(http2_hpack_int_decode_leading_zeros, leading_0_byte_11)
@@ -341,7 +339,6 @@ TEST(http2_hpack_int_decode_leading_zeros, leading_0_byte_11)
     CHECK(res == 0x7FFFFFFFFFFFFFFF);
     CHECK(bytes_processed == 11);
     CHECK(local_inf.get_raw(0) == (1<<INF_INT_LEADING_ZEROS));
-    CHECK(local_events.get_raw(0) == (1<<(EVENT_INT_LEADING_ZEROS-1)));
 }
 
 int main(int argc, char** argv)
index 45ba8dc655aa766ecdd0635e7cad1394a6173b08..8e03fb9914f74e51ffc42c63a899a18a614dad28 100644 (file)
@@ -58,7 +58,6 @@ TEST_GROUP(http2_hpack_string_decode_success)
     void teardown() override
     {
         CHECK(inf.none_found() == true);
-        CHECK(events.none_found() == true);
         delete decode;
     }
 };
index 95039276b4e882c5e9ae71c6ee6faaf1eacffcbb..c20aeb570795f35e3c3383b506c2f6941451361c 100644 (file)
@@ -46,12 +46,10 @@ public:
     friend bool operator&(const Infractions& lhs, const Infractions& rhs)
         { return (lhs.infractions & rhs.infractions) != 0; }
 
-#ifdef REG_TEST
     bool none_found() const { return infractions == 0; }
 
     uint64_t get_raw(unsigned base) const { return
         ((infractions >> base) & std::bitset<MAX>(0xFFFFFFFFFFFFFFFF)).to_ulong(); }
-#endif
 
 private:
     std::bitset<MAX> infractions = 0;