diff --git a/.gitignore b/.gitignore index 7b8277a5e..7345204ce 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ stamp-h1 **/.deps/ **/.libs/ **/Makefile +aminclude_static.am # Executables # ############### @@ -66,3 +67,7 @@ sonic-db-cli/sonic-db-cli # Bazel Build System # /bazel-* + +# Unit test generated files # +############################# +ut_dump_file.txt diff --git a/common/events.cpp b/common/events.cpp index 7c4f4eddd..a1b11acef 100644 --- a/common/events.cpp +++ b/common/events.cpp @@ -365,7 +365,7 @@ EventSubscriber::init(bool use_cache, int recv_timeout, RET_ON_ERR(rc == 0, "Fails to set option rc=%d", rc); } else { - for (const auto e: *subs_sources) { + for (const auto &e: *subs_sources) { rc = zmq_setsockopt(sock, ZMQ_SUBSCRIBE, e.c_str(), e.size()); RET_ON_ERR(rc == 0, "Fails to set option rc=%d", rc); } diff --git a/tests/events_ut.cpp b/tests/events_ut.cpp index ae9c684bc..34d1e11d2 100644 --- a/tests/events_ut.cpp +++ b/tests/events_ut.cpp @@ -137,7 +137,7 @@ parse_read_evt(string &source, internal_event_t &evt, EXPECT_FALSE(source.empty()); EXPECT_EQ(4, evt.size()); - for (const auto e: evt) { + for (const auto &e: evt) { if (e.first == EVENT_STR_DATA) { EXPECT_EQ(0, convert_from_json(e.second, key, params)); // cout << "EVENT_STR_DATA: " << e.second << "\n"; @@ -344,6 +344,7 @@ internal_event_t create_ev(const test_data_t &data) event_data[EVENT_RUNTIME_ID] = data.rid; event_data[EVENT_SEQUENCE] = data.seq; + event_data[EVENT_EPOCH] = "1"; return event_data; } @@ -590,7 +591,8 @@ void do_test_subscribe(bool wrap) hsub = events_init_subscriber_wrap(true, 100); } else { - hsub = events_init_subscriber(true, 100); + std::vector sources = {""}; + hsub = events_init_subscriber(true, 100, &sources); } EXPECT_TRUE(NULL != hsub); EXPECT_EQ(last_svc_code, EVENT_CACHE_STOP); diff --git a/tests/stringutility_ut.cpp b/tests/stringutility_ut.cpp index 209392592..9f2a5a5b9 100644 --- a/tests/stringutility_ut.cpp +++ b/tests/stringutility_ut.cpp @@ -74,7 +74,7 @@ TEST(STRINGUTILITY, join) TEST(STRINGUTILITY, hex_to_binary) { - std::array a; + std::array a = {0}; EXPECT_TRUE(swss::hex_to_binary("01020aff05", a.data(), a.size())); EXPECT_EQ(a, (std::array{0x1, 0x2, 0x0a, 0xff, 0x5}));