diff --git a/build-tests.sh b/build-tests.sh index 5a7d4886..2cd0ed2c 100755 --- a/build-tests.sh +++ b/build-tests.sh @@ -8,4 +8,5 @@ set -e cd out ./tests/functests/FuncTests ./tests/unittests/UnitTests - ./FuncTests --gtest_filter=MultipleLogManagersTests.MultiProcessesLogManager & ./FuncTests --gtest_filter=MultipleLogManagersTests.MultiProcessesLogManager +./tests/unittests/UnitTests -gtest_filter=MultipleLogManagersTests.MultiProcessesLogManager \ + & ./tests/unittests/UnitTests --gtest_filter=MultipleLogManagersTests.MultiProcessesLogManager diff --git a/tests/functests/APITest.cpp b/tests/functests/APITest.cpp index 0275d48f..6f5d9ade 100644 --- a/tests/functests/APITest.cpp +++ b/tests/functests/APITest.cpp @@ -210,93 +210,6 @@ public: } }; - -/// -/// Create sample event of a given priority -/// -/// event name -/// priority -/// -EventProperties CreateSampleEvent(const char *name, EventPriority prio) -{ -#ifdef _WIN32 - /* Test for Win32 GUID type, specific to Windows only */ - GUID win_guid; - win_guid.Data1 = 0; - win_guid.Data2 = 1; - win_guid.Data3 = 2; - - for (uint8_t i = 0; i < 8; i++) - { - win_guid.Data4[i] = i; - } -#endif - - // GUID constructor from byte[16] - const uint8_t guid_b[16] = { - 0x03, 0x02, 0x01, 0x00, - 0x05, 0x04, - 0x07, 0x06, - 0x08, 0x09, - 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; - - GUID_t guid_c( - 0x00010203, - 0x0405, - 0x0607, - { 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F } - ); - - const GUID_t guid_d; - - // Prepare current time in UTC (seconds precision) - std::time_t t = std::time(nullptr); - std::gmtime(&t); - - /* ะก++11 constructor for Visual Studio 2015: this is the most JSON-lookalike syntax that makes use of C++11 initializer lists. */ - EventProperties props(name, - { - #ifdef _MSC_VER - { "_MSC_VER", _MSC_VER }, - #endif - { "piiKind.None", EventProperty("jackfrost", PiiKind_None) }, - { "piiKind.DistinguishedName", EventProperty("/CN=Jack Frost,OU=PIE,DC=REDMOND,DC=COM", PiiKind_DistinguishedName) }, - { "piiKind.GenericData", EventProperty("jackfrost", PiiKind_GenericData) }, - { "piiKind.IPv4Address", EventProperty("127.0.0.1", PiiKind_IPv4Address) }, - { "piiKind.IPv6Address", EventProperty("2001:0db8:85a3:0000:0000:8a2e:0370:7334", PiiKind_IPv6Address) }, - { "piiKind.MailSubject", EventProperty("RE: test", PiiKind_MailSubject) }, - { "piiKind.PhoneNumber", EventProperty("+1-613-866-6960", PiiKind_PhoneNumber) }, - { "piiKind.QueryString", EventProperty("a=1&b=2&c=3", PiiKind_QueryString) }, - { "piiKind.SipAddress", EventProperty("sip:jackfrost@microsoft.com", PiiKind_SipAddress) }, - { "piiKind.SmtpAddress", EventProperty("Jack Frost ", PiiKind_SmtpAddress) }, - { "piiKind.Identity", EventProperty("Jack Frost", PiiKind_Identity) }, - { "piiKind.Uri", EventProperty("http://www.microsoft.com", PiiKind_Uri) }, - { "piiKind.Fqdn", EventProperty("www.microsoft.com", PiiKind_Fqdn) }, - - { "strKey", "hello" }, - { "strKey2", "hello2" }, - { "int64Key", (int64_t)1L }, - { "dblKey", 3.14 }, - { "boolKey", false }, - - { "guidKey0", GUID_t("00000000-0000-0000-0000-000000000000") }, - { "guidKey1", GUID_t("00010203-0405-0607-0809-0A0B0C0D0E0F") }, - { "guidKey2", GUID_t(guid_b) }, - { "guidKey3", GUID_t("00010203-0405-0607-0809-0A0B0C0D0E0F") }, - { "guidKey4", GUID_t(guid_c) }, - - { "timeKey1", time_ticks_t((uint64_t)0) }, // ticks precision - { "timeKey2", time_ticks_t(&t) } // seconds precision - }); -#ifdef _WIN32 - props.SetProperty("win_guid", GUID_t(win_guid)); -#endif - props.SetPriority(prio); - props.SetLevel(DIAG_LEVEL_REQUIRED); - - return props; -} - /// /// Add all event listeners /// @@ -615,7 +528,7 @@ unsigned StressSingleThreaded(ILogConfiguration& config) size_t numIterations = MAX_ITERATIONS; while (numIterations--) { - EventProperties props = CreateSampleEvent("event_name", EventPriority_Normal); + EventProperties props = testing::CreateSampleEvent("event_name", EventPriority_Normal); result->LogEvent(props); } LogManager::FlushAndTeardown(); @@ -669,7 +582,7 @@ void StressUploadLockMultiThreaded(ILogConfiguration& config) t.detach(); } }; - EventProperties props = CreateSampleEvent("event_name", EventPriority_Normal); + EventProperties props = testing::CreateSampleEvent("event_name", EventPriority_Normal); result->LogEvent(props); LogManager::FlushAndTeardown(); }