Skip to content

Commit

Permalink
212 tree for scopes (#214)
Browse files Browse the repository at this point in the history
* Implemented saving config file. Commit for testing.

* Enabled build and run unit tests, removed forcing build examples.

* Update ScopeNodeBase.cpp

* Fixed requested changes. Fixed writing file in linux.

* checking the failure on ci/cd

* Update common.cmake

* upload failed ut

trying to upload failed unit tests

* another try to upload failed tests

another try to upload failed tests

* fixed value

fixed the value

* Update LogScopesTest.cpp

Set working directory

* Update LogScopesTest.cpp

* Fixing unit test for windows.

* Experimenting with gtest

* Fix unit test under windows

* assertion too small, experiment

* Experimenting to solve problem on github unit test run for windows.

* Temporary enable only unit tests with shared areg

Disabled all builds, except unit tests with shared library for all platform until find the solution for windows.

* Experimental file system unit tests.

* Areg File test to read and write.

* Added couple of more tests with areg

* search the bug, narrow the build.

* unit test of normalize path

* Fixing linux build

* Slightly increased the size of buffers.

* Analyze log start and stop bug

* Log bug

* Fixing log start stop

* Fixing paths

* Fixed the unit test file name

* Fixed linux build. Output test messages

* testing local time conversion

* TestLocalTimeWin32 is only for windows

* Fixed timezone info.

* add new unit test to check the buffer size

* Fixed unit test bug. There is still one left to check the time.

---------

Co-authored-by: aregtech <artak@aregtech.com>
Co-authored-by: Aregtech <49253642+aregtech@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 7, 2023
1 parent d4e250a commit 54f7e54
Show file tree
Hide file tree
Showing 69 changed files with 4,585 additions and 765 deletions.
303 changes: 271 additions & 32 deletions .github/workflows/cmake.yml

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ set(AREG_EXAMPLES "${AREG_SDK_ROOT}/examples")
set(AREG_TESTS "${AREG_SDK_ROOT}/tests")
set(AREG_THIRDPARTY "${AREG_SDK_ROOT}/thirdparty")

set(AREG_BUILD_EXAMPLES ON)

include(${AREG_CMAKE_CONFIG_DIR}/functions.cmake)
include(${AREG_CMAKE_CONFIG_DIR}/user.cmake)

Expand Down
2 changes: 1 addition & 1 deletion conf/cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ endif()
# The output directory
if (NOT DEFINED AREG_OUTPUT_DIR OR "${AREG_OUTPUT_DIR}" STREQUAL "")
# Relative path of the output folder for the builds
set(AREG_PRODUCT_PATH "build/${AREG_COMPILER_FAMILY}-${AREG_COMPILER_SHORT}/${AREG_OS}-${AREG_BITNESS}-${AREG_PROCESSOR}-${CMAKE_BUILD_TYPE}")
set(AREG_PRODUCT_PATH "build/${AREG_COMPILER_FAMILY}-${AREG_COMPILER_SHORT}/${AREG_OS}-${AREG_BITNESS}-${AREG_PROCESSOR}-${CMAKE_BUILD_TYPE}-${AREG_BINARY}")
string(TOLOWER "${AREG_PRODUCT_PATH}" AREG_PRODUCT_PATH)
# The absolute path of 'AREG_OUTPUT_DIR' for builds if it is not set.
set(AREG_OUTPUT_DIR "${AREG_BUILD_ROOT}/${AREG_PRODUCT_PATH}")
Expand Down
48 changes: 24 additions & 24 deletions conf/cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -203,39 +203,39 @@ function(findCompilerShortName compiler_path compiler_short_name_option)
set(FOUND_POS)
set(${compiler_short_name_option} "unknown" PARENT_SCOPE)

string(FIND "${compiler_path}" "gcc" FOUND_POS REVERSE)
string(FIND "${compiler_path}" "clang++" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_short_name_option} "gcc" PARENT_SCOPE)
set(${compiler_short_name_option} "clang++" PARENT_SCOPE)
return()
endif()

string(FIND "${compiler_path}" "g++" FOUND_POS REVERSE)
string(FIND "${compiler_path}" "clang" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_short_name_option} "g++" PARENT_SCOPE)
set(${compiler_short_name_option} "clang" PARENT_SCOPE)
return()
endif()

string(FIND "${compiler_path}" "c++" FOUND_POS REVERSE)
string(FIND "${compiler_path}" "gcc" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_short_name_option} "c++" PARENT_SCOPE)
set(${compiler_short_name_option} "gcc" PARENT_SCOPE)
return()
endif()

string(FIND "${compiler_path}" "cc" FOUND_POS REVERSE)
string(FIND "${compiler_path}" "g++" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_short_name_option} "cc" PARENT_SCOPE)
set(${compiler_short_name_option} "g++" PARENT_SCOPE)
return()
endif()

string(FIND "${compiler_path}" "clang++" FOUND_POS REVERSE)
string(FIND "${compiler_path}" "c++" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_short_name_option} "clang++" PARENT_SCOPE)
set(${compiler_short_name_option} "c++" PARENT_SCOPE)
return()
endif()

string(FIND "${compiler_path}" "clang" FOUND_POS REVERSE)
string(FIND "${compiler_path}" "cc" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_short_name_option} "clang" PARENT_SCOPE)
set(${compiler_short_name_option} "cc" PARENT_SCOPE)
return()
endif()

Expand All @@ -259,6 +259,18 @@ function(findCompilerFamilyName compiler_path compiler_family_option_name)

set(FOUND_POS)

string(FIND "${compiler_path}" "clang++" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_family_option_name} "clang" PARENT_SCOPE)
return()
endif()

string(FIND "${compiler_path}" "clang" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_family_option_name} "clang" PARENT_SCOPE)
return()
endif()

string(FIND "${compiler_path}" "gcc" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
if (CYGWIN)
Expand Down Expand Up @@ -299,18 +311,6 @@ function(findCompilerFamilyName compiler_path compiler_family_option_name)
return()
endif()

string(FIND "${compiler_path}" "clang++" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_family_option_name} "clang" PARENT_SCOPE)
return()
endif()

string(FIND "${compiler_path}" "clang" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_family_option_name} "clang" PARENT_SCOPE)
return()
endif()

string(FIND "${compiler_path}" "cl" FOUND_POS REVERSE)
if (${FOUND_POS} GREATER -1)
set(${compiler_family_option_name} "msvc" PARENT_SCOPE)
Expand Down
10 changes: 5 additions & 5 deletions conf/cmake/user.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# 12. AREG_OUTPUT_LIB -- Set the path to folder to output compiled static libraries.
#
# The default values are:
# 1. AREG_COMPILER_FAMILY = gnu (possible values: gnu, cygwin, llvm, msvc)
# 2. AREG_COMPILER = g++ (possible values: g++, gcc, c++, cc, clang++, clang, cl)
# 1. AREG_COMPILER_FAMILY = <default> (possible values: gnu, cygwin, llvm, msvc)
# 2. AREG_COMPILER = <default> (possible values: g++, gcc, c++, cc, clang++, clang, cl)
# 3. AREG_BINARY = shared (possible values: shared, static)
# 4. AREG_BUILD_TYPE = Release (possible values: Release, Debug
# 5. AREG_BUILD_TESTS = OFF (possible values: ON, OFF)
Expand Down Expand Up @@ -143,7 +143,7 @@ endif()

# Set build configuration. Set "Debug" for debug build, and "Release" for release build.
if (NOT DEFINED AREG_BUILD_TYPE OR NOT ${AREG_BUILD_TYPE} STREQUAL "Debug")
set(AREG_BUILD_TYPE "Release")
set(AREG_BUILD_TYPE "Debug")
endif()

# Set the AREG binary library type to compile. Set "shared" if not "static"
Expand All @@ -153,7 +153,7 @@ endif()

# Build tests. By default it is disabled. To enable, set ON
if (NOT DEFINED AREG_BUILD_TESTS)
option(AREG_BUILD_TESTS "Build unit tests" OFF)
option(AREG_BUILD_TESTS "Build unit tests" ON)
endif()

# Build examples. By default it is disabled. To enable, set ON
Expand All @@ -163,7 +163,7 @@ endif()

# Set AREG extended features enable or disable flag to compiler additional optional features. By default, it is disabled.
if (NOT DEFINED AREG_EXTENDED)
option(AREG_EXTENDED "Enable extensions" OFF)
option(AREG_EXTENDED "Enable extensions" ON)
endif()

# Modify 'AREG_LOGS' to enable or disable compilation with logs. By default, compile with logs
Expand Down
4 changes: 4 additions & 0 deletions framework/areg.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@
<ClCompile Include="areg\trace\private\LogConfiguration.cpp" />
<ClCompile Include="areg\trace\private\LogMessage.cpp" />
<ClCompile Include="areg\trace\private\NetTcpLogger.cpp" />
<ClCompile Include="areg\trace\private\ScopeNodeBase.cpp" />
<ClCompile Include="areg\trace\private\ScopeNodes.cpp" />
<ClCompile Include="areg\trace\private\TraceEventProcessor.cpp" />
<ClCompile Include="areg\trace\private\ScopeController.cpp" />
<ClCompile Include="areg\trace\private\TraceManager.cpp" />
Expand Down Expand Up @@ -372,6 +374,8 @@
<ClInclude Include="areg\trace\private\LogConfiguration.hpp" />
<ClInclude Include="areg\trace\private\NetTcpLogger.hpp" />
<ClInclude Include="areg\trace\private\ScopeController.hpp" />
<ClInclude Include="areg\trace\private\ScopeNodeBase.hpp" />
<ClInclude Include="areg\trace\private\ScopeNodes.hpp" />
<ClInclude Include="areg\trace\private\TraceEventProcessor.hpp" />
<ClInclude Include="areg\trace\TraceMessage.hpp" />
<ClInclude Include="areg\trace\TraceScope.hpp" />
Expand Down
12 changes: 12 additions & 0 deletions framework/areg.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,12 @@
<ClCompile Include="areg\trace\private\TraceEventProcessor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="areg\trace\private\ScopeNodeBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="areg\trace\private\ScopeNodes.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="system\windows\GEWindows.h">
Expand Down Expand Up @@ -1088,6 +1094,12 @@
<ClInclude Include="areg\trace\private\TraceEventProcessor.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="areg\trace\private\ScopeNodeBase.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="areg\trace\private\ScopeNodes.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="areg\resources\areg_post_build.bat">
Expand Down
2 changes: 1 addition & 1 deletion framework/areg/appbase/private/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ bool Application::tracerConfig( const char * configFile /*= nullptr*/ )

if ( NETrace::isStarted() == false )
{
if (NETrace::configureLoging(config))
if (NETrace::initializeLogging(config))
{
theApp.mConfigTracer = config;
result = true;
Expand Down
4 changes: 2 additions & 2 deletions framework/areg/appbase/private/posix/ApplicationPosix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace
{
if (fgets(buffer, File::MAXIMUM_PATH + 1, file) != nullptr)
{
NEString::CharPos pos = NEString::findLast<char>(File::getPathSeparator(), buffer);
NEString::CharPos pos = NEString::findLast<char>( File::PATH_SEPARATOR, buffer);
if (NEString::isPositionValid(pos))
{
char* name = buffer + pos + 1;
Expand Down Expand Up @@ -120,7 +120,7 @@ bool Application::_osStartRouterService( void )

String fileName = String::getEmptyString();
fileName.append(Process::getInstance().getPath())
.append(File::getPathSeparator())
.append( File::PATH_SEPARATOR )
.append(NEApplication::DEFAULT_ROUTER_SERVICE_NAME);

result = execl(fileName.getString(), fileName.getString(), argv0, nullptr) > 0;
Expand Down
18 changes: 8 additions & 10 deletions framework/areg/base/File.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "areg/base/Containers.hpp"

#include <string_view>
#include <filesystem>


/**
* \brief File class to work with files on File System. Supports data streaming
Expand Down Expand Up @@ -108,20 +110,16 @@ class AREG_API File : public FileBase
**/
static constexpr int MAXIMUM_PATH {1024};

/**
* \brief File::PATH_SEPARATOR
* The OS dependent path separator. On POSIX it is '/' and on Windows it is '\\'.
**/
static constexpr char PATH_SEPARATOR { std::filesystem::path::preferred_separator };

#if defined(_MSC_VER) && (_MSC_VER > 1200)
#pragma warning(default: 4251)
#endif // _MSC_VER

//////////////////////////////////////////////////////////////////////////
// Public static methods
//////////////////////////////////////////////////////////////////////////

/**
* \brief Returns path separator. The return character is OS dependent.
* For example, on POSIX it is '/' and on Windows it is '\\'.
**/
static const char getPathSeparator( void );

//////////////////////////////////////////////////////////////////////////
// Constructors / destructor
//////////////////////////////////////////////////////////////////////////
Expand Down
8 changes: 4 additions & 4 deletions framework/areg/base/FileBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,13 @@ class AREG_API FileBase : public IEIOStream
* \brief Move file pointer to the beginning of file
* File object must be opened before calling, otherwise will fail with assertion.
**/
inline bool moveToBegin( void );
inline bool moveToBegin( void ) const;

/**
* \brief Move file pointer to the end of file
* File object must be opened before calling, otherwise will fail with assertion.
**/
inline bool moveToEnd( void );
inline bool moveToEnd( void ) const;

/**
* \brief Returns the start position value.
Expand Down Expand Up @@ -975,13 +975,13 @@ inline bool FileBase::canRead( void ) const
return ( (getMode() & static_cast<int>(FOB_READ)) != 0 );
}

inline bool FileBase::moveToBegin( void )
inline bool FileBase::moveToBegin( void ) const
{
ASSERT(isOpened());
return IECursorPosition::moveToBegin();
}

inline bool FileBase::moveToEnd( void )
inline bool FileBase::moveToEnd( void ) const
{
ASSERT(isOpened());
return IECursorPosition::moveToEnd();
Expand Down
2 changes: 1 addition & 1 deletion framework/areg/base/GEMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
* \brief Returns the sign of given number
**/
#ifndef MACRO_SIGN_OF
#define MACRO_SIGN_OF( val ) ( (val) == 0 ? 0 : ((val) > 0 ? 1 : -1) )
#define MACRO_SIGN_OF( val ) ( static_cast<int>((val) > 0) - static_cast<int>((val) < 0) )
#endif // MACRO_SIGN_OF

/**
Expand Down
Loading

0 comments on commit 54f7e54

Please sign in to comment.