Add unit test for the lock management

- The idea behind this commit is to enable the unit test
for the lock management algorithm, and below are the unit
test cases that are written:

Testedby:

[----------] 20 tests from locktest
[ RUN      ] locktest.ValidationGoodTestCase
[       OK ] locktest.ValidationGoodTestCase (3 ms)
[ RUN      ] locktest.ValidationBadTestWithLocktype
[       OK ] locktest.ValidationBadTestWithLocktype (1 ms)
[ RUN      ] locktest.ValidationBadTestWithlockFlags
[       OK ] locktest.ValidationBadTestWithlockFlags (0 ms)
[ RUN      ] locktest.ValidationBadTestWithSegmentlength
[       OK ] locktest.ValidationBadTestWithSegmentlength (1 ms)
[ RUN      ] locktest.MultiRequestWithoutConflict
[       OK ] locktest.MultiRequestWithoutConflict (3 ms)
[ RUN      ] locktest.MultiRequestWithConflictduetoSameSegmentLength
[       OK ] locktest.MultiRequestWithConflictduetoSameSegmentLength (2 ms)
[ RUN      ] locktest.MultiRequestWithoutConflictduetoDifferentSegmentData
[       OK ] locktest.MultiRequestWithoutConflictduetoDifferentSegmentData (1 ms)
[ RUN      ] locktest.MultiRequestWithConflictduetoSameSegmentData
[       OK ] locktest.MultiRequestWithConflictduetoSameSegmentData (2 ms)
[ RUN      ] locktest.MultiRequestWithoutConflictduetoDifferentSegmentLength
[       OK ] locktest.MultiRequestWithoutConflictduetoDifferentSegmentLength (1 ms)
[ RUN      ] locktest.MultiRequestWithoutConflictduetoReadLocktype
[       OK ] locktest.MultiRequestWithoutConflictduetoReadLocktype (1 ms)
[ RUN      ] locktest.MultiRequestWithoutConflictduetoReadLocktypeAndLockall
[       OK ] locktest.MultiRequestWithoutConflictduetoReadLocktypeAndLockall (2 ms)
[ RUN      ] locktest.RequestConflictedWithLockTableEntries
[       OK ] locktest.RequestConflictedWithLockTableEntries (6 ms)
[ RUN      ] locktest.RequestNotConflictedWithLockTableEntries
[       OK ] locktest.RequestNotConflictedWithLockTableEntries (3 ms)
[ RUN      ] locktest.TestGenerateTransactionIDFunction
[       OK ] locktest.TestGenerateTransactionIDFunction (1 ms)
[ RUN      ] locktest.ValidateTransactionIDsGoodTestCase
[       OK ] locktest.ValidateTransactionIDsGoodTestCase (3 ms)
[ RUN      ] locktest.ValidateTransactionIDsBadTestCase
[       OK ] locktest.ValidateTransactionIDsBadTestCase (2 ms)
[ RUN      ] locktest.ValidateisItMyLockGoodTestCase
[       OK ] locktest.ValidateisItMyLockGoodTestCase (2 ms)
[ RUN      ] locktest.ValidateisItMyLockBadTestCase
[       OK ] locktest.ValidateisItMyLockBadTestCase (2 ms)
[ RUN      ] locktest.ValidateSessionIDForGetlocklistBadTestCase
[       OK ] locktest.ValidateSessionIDForGetlocklistBadTestCase (3 ms)
[ RUN      ] locktest.ValidateSessionIDForGetlocklistGoodTestCase
[       OK ] locktest.ValidateSessionIDForGetlocklistGoodTestCase (3 ms)
[----------] 20 tests from locktest (82 ms total)

Signed-off-by: manojkiraneda <manojkiran.eda@gmail.com>
Change-Id: Id274ee356adfa7ba03da02d83b609d37c8c99f8d
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9511cfd..ba52fad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -288,6 +288,12 @@
     link_directories (${CMAKE_BINARY_DIR}/sdbusplus-src/build)
 endif ()
 
+# Its an Out of tree build,enabling ibm management console for
+# unit-test purpose.
+if (NOT ${YOCTO_DEPENDENCIES})
+    add_definitions(-DBMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE)
+endif(NOT ${YOCTO_DEPENDENCIES})
+
 # Openssl
 find_package (OpenSSL REQUIRED)
 include_directories (SYSTEM ${OPENSSL_INCLUDE_DIR})
@@ -341,14 +347,10 @@
 file (COPY src/test_resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
 
 # Unit Tests
-if (${BMCWEB_BUILD_UT})
-    set (UT_FILES src/crow_test.cpp src/gtest_main.cpp
-         src/token_authorization_middleware_test.cpp
-         src/security_headers_middleware_test.cpp src/webassets_test.cpp
-         src/crow_getroutes_test.cpp src/ast_jpeg_decoder_test.cpp
-         src/kvm_websocket_test.cpp src/msan_test.cpp
-         src/ast_video_puller_test.cpp src/openbmc_jtag_rest_test.cpp
+if (NOT ${YOCTO_DEPENDENCIES})
+    set (UT_FILES src/gtest_main.cpp src/msan_test.cpp
          redfish-core/ut/privileges_test.cpp
+         redfish-core/ut/lock_test.cpp
          ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp) # big list of naughty
                                                       # strings
     add_custom_command (OUTPUT ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp
@@ -378,7 +380,7 @@
     target_link_libraries (webtest -lstdc++fs)
     add_test (webtest webtest "--gtest_output=xml:webtest.xml")
 
-endif (${BMCWEB_BUILD_UT})
+endif (NOT ${YOCTO_DEPENDENCIES})
 
 install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/static/ DESTINATION share/www)