Merged PR 904184: Start building functional and unit tests for clang on Windows and Mac

Start building functional and unit tests for clang on Windows and Mac

Related work items: #1548039, #1548040
This commit is contained in:
Miguel Angel Casillas Maldonado 2019-02-01 09:08:09 +00:00 коммит произвёл Max Golovanov
Родитель 0d917965ed
Коммит 07ef4d24eb
31 изменённых файлов: 635 добавлений и 118 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -1,5 +1,5 @@
# Build artifacts
.buildtools
Debug/
Release/
*.VC.db
@ -19,7 +19,6 @@ staging.d/
sysroot/
skype-ant.zip
uap-cpp/
Win32/
Debug/
# Ignore auto-generated Version.hpp

Просмотреть файл

@ -65,6 +65,10 @@ if(GCC5_CXX11_ABI_WORKAROUND)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
endif()
if(PAL_IMPLEMENTATION STREQUAL "WIN32")
add_definitions(-DZLIB_WINAPI)
endif()
################################################################################################
# Build prefix and version
################################################################################################
@ -112,23 +116,34 @@ endif()
option(BUILD_HEADERS "Build API headers" YES)
option(BUILD_LIBRARY "Build library" YES)
option(BUILD_TEST_TOOL "Build console test tool" YES)
option(BUILD_UNIT_TESTS "Build unit tests" NO)
option(BUILD_FUNC_TESTS "Build functional tests" NO)
option(BUILD_UNIT_TESTS "Build unit tests" YES)
option(BUILD_FUNC_TESTS "Build functional tests" YES)
option(BUILD_JNI_WRAPPER "Build JNI wrapper" NO)
option(BUILD_PACKAGE "Build package" YES)
if(BUILD_UNIT_TESTS OR BUILD_FUNC_TESTS)
message("Adding gtest")
add_library(gtest STATIC IMPORTED GLOBAL)
message("Adding gmock")
add_library(gmock STATIC IMPORTED GLOBAL)
# message("Building libraries! - Path: ${CMAKE_CURRENT_SOURCE_DIR} ")
# message("Building gtest")
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/)
# message("Building gmock")
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest/googlemock/)
endif()
# Bond Lite subdirectories
include_directories(bondlite/include)
if(BUILD_UNIT_TESTS)
enable_testing()
add_subdirectory(bondlite/tests)
endif()
include_directories(lib/pal)
#if(BUILD_UNIT_TESTS)
# message("Adding bondlite tests")
# enable_testing()
# add_subdirectory(bondlite/tests)
#endif()
if(BUILD_HEADERS)
add_subdirectory(lib/include)
@ -140,6 +155,7 @@ if(BUILD_LIBRARY)
endif()
if(BUILD_UNIT_TESTS OR BUILD_FUNC_TESTS)
message("Building tests")
enable_testing()
add_subdirectory(tests)
endif()

Просмотреть файл

@ -6,7 +6,7 @@ set ROOT=%~dp0
REM ********************************************************************
REM Use cmake
REM ********************************************************************
set PATH="C:\Program Files\CMake\bin\";%PATH%
set "PATH=C:\Program Files\CMake\bin\;%PATH%"
REM ********************************************************************
REM Use clang compiler
@ -24,7 +24,6 @@ if "%1" == "clean" (
@rmdir /s /q %OUTDIR%
)
if not exist "%OUTDIR%" mkdir %OUTDIR%
cd %OUTDIR%
REM ********************************************************************
REM Build all deps using MSVC - Visual Studio 2017 (15)
@ -33,12 +32,14 @@ if "%1" == "nodeps" goto NODEPS
call tools\build-deps.cmd
:NODEPS
cd %OUTDIR%
REM ********************************************************************
REM Invoke the build script
REM ********************************************************************
set CMAKE_PACKAGE_TYPE=tgz
for %%a in ( m32 m64 ) do (
for %%c in ( Debug Release ) do (
for %%c in ( Release ) do (
if "%%a"=="m32" (
set ARCH=Win32
set ARCH_GEN=

14
build-gtest.sh Executable file
Просмотреть файл

@ -0,0 +1,14 @@
#!/bin/bash
cd googletest
set -evx
env | sort
mkdir build || true
cd build
cmake -Dgtest_build_samples=ON \
-Dgmock_build_samples=ON \
-Dgtest_build_tests=ON \
-Dgmock_build_tests=ON \
-DCMAKE_CXX_FLAGS=$CXX_FLAGS \
..
make
CTEST_OUTPUT_ON_FAILURE=1 make test

Просмотреть файл

@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.1.0)
project(zlibtest)
include_directories( . ./include )
add_executable(zlibtest main.cpp)
find_package (Threads)
find_package( ZLIB REQUIRED )
if ( ZLIB_FOUND )
include_directories( ${ZLIB_INCLUDE_DIRS} )
target_link_libraries( zlibtest ${ZLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} dl)
endif( ZLIB_FOUND )

178
examples/zlibtest/Makefile Normal file
Просмотреть файл

@ -0,0 +1,178 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.12
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.12.4/bin/cmake
# The command to remove a file.
RM = /usr/local/Cellar/cmake/3.12.4/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /build/Aria.SDK.Cpp/examples/zlibtest
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /build/Aria.SDK.Cpp/examples/zlibtest
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/local/Cellar/cmake/3.12.4/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
/usr/local/Cellar/cmake/3.12.4/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /build/Aria.SDK.Cpp/examples/zlibtest/CMakeFiles /build/Aria.SDK.Cpp/examples/zlibtest/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /build/Aria.SDK.Cpp/examples/zlibtest/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named zlibtest
# Build rule for target.
zlibtest: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 zlibtest
.PHONY : zlibtest
# fast build rule for target.
zlibtest/fast:
$(MAKE) -f CMakeFiles/zlibtest.dir/build.make CMakeFiles/zlibtest.dir/build
.PHONY : zlibtest/fast
main.o: main.cpp.o
.PHONY : main.o
# target to build an object file
main.cpp.o:
$(MAKE) -f CMakeFiles/zlibtest.dir/build.make CMakeFiles/zlibtest.dir/main.cpp.o
.PHONY : main.cpp.o
main.i: main.cpp.i
.PHONY : main.i
# target to preprocess a source file
main.cpp.i:
$(MAKE) -f CMakeFiles/zlibtest.dir/build.make CMakeFiles/zlibtest.dir/main.cpp.i
.PHONY : main.cpp.i
main.s: main.cpp.s
.PHONY : main.s
# target to generate assembly for a file
main.cpp.s:
$(MAKE) -f CMakeFiles/zlibtest.dir/build.make CMakeFiles/zlibtest.dir/main.cpp.s
.PHONY : main.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... rebuild_cache"
@echo "... edit_cache"
@echo "... zlibtest"
@echo "... main.o"
@echo "... main.i"
@echo "... main.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

Просмотреть файл

@ -0,0 +1,44 @@
# Install script for directory: /build/Aria.SDK.Cpp/examples/zlibtest
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()
if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
endif()
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
file(WRITE "/build/Aria.SDK.Cpp/examples/zlibtest/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")

Просмотреть файл

@ -0,0 +1,15 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "zlib.h"
char *buff = "0123456789";
int main(int argc, char *argv[])
{
auto crc = crc32(0L, Z_NULL, 0);
crc = crc32(crc, (const Bytef *)buff, strlen(buff));
printf("%u\n", crc);
return 0;
}

Двоичные данные
examples/zlibtest/zlibtest Executable file

Двоичный файл не отображается.

Просмотреть файл

@ -37,19 +37,19 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -119,6 +119,9 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@ -132,6 +135,9 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
@ -145,6 +151,9 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@ -156,6 +165,9 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -167,6 +179,9 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
@ -178,6 +193,9 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\gmock-all.cc" />

Просмотреть файл

@ -97,7 +97,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
endif()
if(BUILD_SHARED_LIBS STREQUAL "ON")
message("-- Building shared library")
message("-- Building shared SDK library")
add_library(aria SHARED ${SRCS})
add_library(sqlite3 SHARED IMPORTED GLOBAL)
add_library(z SHARED IMPORTED GLOBAL)
@ -106,12 +106,17 @@ if(BUILD_SHARED_LIBS STREQUAL "ON")
# target_link_libraries(aria PUBLIC libsqlite3 libcurl.a libz.a libssl.a libcrypto.a "${SQLITE_LIBRARY}" "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" )
install(TARGETS aria EXPORT aria LIBRARY DESTINATION ${INSTALL_LIB_DIR})
else()
message("-- Building static library")
message("-- Building static SDK library")
add_library(aria STATIC ${SRCS})
add_library(sqlite3 STATIC IMPORTED GLOBAL)
add_library(z STATIC IMPORTED GLOBAL)
#target_link_libraries(aria PRIVATE libsqlite3.a PUBLIC libz.a ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" "${Tcmalloc_LIBRARIES}")
target_link_libraries(aria PRIVATE libsqlite3.a PUBLIC libz.a ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" )
if(PAL_IMPLEMENTATION STREQUAL "WIN32")
target_link_libraries(aria ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" )
else()
add_library(sqlite3 STATIC IMPORTED GLOBAL)
add_library(z STATIC IMPORTED GLOBAL)
#target_link_libraries(aria PRIVATE libsqlite3.a PUBLIC libz.a ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" "${Tcmalloc_LIBRARIES}")
target_link_libraries(aria PRIVATE libsqlite3.a PUBLIC libz.a ${LIBS} "${CMAKE_THREAD_LIBS_INIT}" "${CMAKE_DL_LIBS}" )
endif()
install(TARGETS aria EXPORT aria ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
endif()

Просмотреть файл

@ -2,8 +2,8 @@
// WARNING: DO NOT MODIFY THIS FILE!
// Copyright (c) Microsoft. All rights reserved.
// This file has been automatically generated, manual changes will be lost.
#define BUILD_VERSION_STR "3.1.18.1"
#define BUILD_VERSION 3,1,18,1
#define BUILD_VERSION_STR "3.1.24.0"
#define BUILD_VERSION 3,1,24,0
#ifndef RESOURCE_COMPILER_INVOKED
#include <stdint.h>
@ -24,26 +24,25 @@ namespace ARIASDK_NS_BEGIN {
uint64_t const Version =
((uint64_t)3 << 48) |
((uint64_t)1 << 32) |
((uint64_t)18 << 16) |
((uint64_t)1);
((uint64_t)24 << 16) |
((uint64_t)0);
// TODO: [MG] - move declaration of ARIA_SDK_UNUSED to separate include file
#ifdef ARIASDK_UNUSED
#elif defined(__GNUC__) || defined(__clang__)
# define ARIASDK_UNUSED(x) (x) /* __attribute__((unused)) */
#elif defined(__LCLINT__)
# define ARIASDK_UNUSED(x) /*@unused@*/ x
# define ARIASDK_UNUSED(x) /**/ x
#elif defined(__cplusplus)
# define ARIASDK_UNUSED(x)
#else
# define ARIASDK_UNUSED(x) x
#endif
# define ARIASDK_PAL_WIN32 1
# define ARIASDK_PAL_CPP11 1
} ARIASDK_NS_END
namespace PAL_NS_BEGIN { } PAL_NS_END
#endif // RESOURCE_COMPILER_INVOKED

Просмотреть файл

@ -1,32 +1,16 @@
include_directories(.)
include_directories(../lib)
include_directories(. ${CMAKE_CURRENT_SOURCE_DIR}/../googletest/googletest/include ${CMAKE_CURRENT_SOURCE_DIR}/../googletest/googlemock/include ${CMAKE_CURRENT_SOURCE_DIR}/../lib/include/public ${CMAKE_CURRENT_SOURCE_DIR}/../lib/include/aria ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite )
if(PAL_IMPLEMENTATION STREQUAL "Skype")
set(TESTS_COMMON_SKYPE_SRCS
../common/MockIEcsClient.hpp
)
endif()
include_directories(../lib)
set(TESTS_COMMON_SRCS
../common/Common.cpp
../common/Common.hpp
../common/HttpServer.hpp
../common/Mocks.cpp
../common/MockIHttpClient.hpp
../common/MockILogManagerInternal.hpp
../common/MockIOfflineStorage.hpp
../common/MockIOfflineStorageObserver.hpp
../common/MockIRuntimeConfig.hpp
../common/MockISemanticContext.hpp
../common/MockISqlite3Proxy.hpp
../common/SocketTools.hpp
${TESTS_COMMON_SKYPE_SRCS}
)
if(BUILD_UNIT_TESTS)
add_subdirectory(unittests)
endif()
if(BUILD_FUNC_TESTS)
add_subdirectory(functests)
endif()
if(BUILD_UNIT_TESTS)
add_subdirectory(unittests)
endif()

Просмотреть файл

@ -4,8 +4,10 @@
#include "sqlite3.h"
#include "offline/ISqlite3Proxy.hpp"
#include "pal\PAL_Win32.hpp"
#ifdef _WIN32
#include "pal\PAL_Win32.hpp"
#endif
namespace testing {

Просмотреть файл

@ -9,9 +9,9 @@
#include "MockISqlite3Proxy.hpp"
#include "MockITelemetrySystem.hpp"
#ifdef ARIASDK_PAL_SKYPE
#include "MockIEcsClient.hpp"
#endif
//#ifdef ARIASDK_PAL_SKYPE
//#include "MockIEcsClient.hpp"
//#endif
namespace testing {

Просмотреть файл

@ -35,14 +35,27 @@ namespace testing {
// For _beginthread() etc.
#include <process.h>
#else
#ifdef __linux__
#include <sys/epoll.h>
#else
#if __APPLE__
// Use kqueue on mac
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#endif
#endif
// Common POSIX headers for Linux and Mac OS X
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netdb.h>
#endif
#endif // end of network headers
// *INDENT-OFF*
@ -67,7 +80,7 @@ namespace testing {
{
sockaddr_in& inet4 = reinterpret_cast<sockaddr_in&>(m_data);
inet4.sin_family = AF_INET;
inet4.sin_port = htons(static_cast<USHORT>(port));
inet4.sin_port = htons(static_cast<unsigned short>(port));
inet4.sin_addr.s_addr = htonl(addr);
}
@ -255,7 +268,7 @@ namespace testing {
m_sock = Invalid;
}
int recv(_Out_bytecap_(size) void* buffer, unsigned size)
int recv(void* buffer, unsigned size)
{
assert(m_sock != Invalid);
return ::recv(m_sock, reinterpret_cast<char*>(buffer), size, 0);
@ -394,6 +407,7 @@ namespace testing {
//---
//#if defined(_WIN32) || defined(__linux__)
// Reactor for asynchronous watching of sockets
class Reactor : protected Thread
{
@ -430,23 +444,36 @@ namespace testing {
std::vector<SocketData> m_sockets;
#ifdef _WIN32
std::vector<WSAEVENT> m_events;
#else
#endif
#ifdef __linux__
int m_epollFd;
#endif
#ifdef __APPLE__
int kq;
#endif
public:
Reactor(Callback& callback)
: m_callback(callback)
{
#ifndef _WIN32
#ifdef __linux__
m_epollFd = ::epoll_create1(0);
#endif
#ifdef __APPLE__
kq = kqueue();
#endif
}
~Reactor()
{
#ifndef _WIN32
#ifdef __linux__
//#ifndef _WIN32
::close(m_epollFd);
#endif
#ifdef __APPLE__
close(kq);
#endif
}
@ -461,12 +488,21 @@ namespace testing {
LOG_TRACE("Reactor: Adding socket %d with flags %d", static_cast<int>(socket), flags);
#ifdef _WIN32
m_events.push_back(::WSACreateEvent());
#else
#endif
#ifdef __linux__
epoll_event event = {};
event.data.fd = socket;
event.events = 0;
::epoll_ctl(m_epollFd, EPOLL_CTL_ADD, socket, &event);
#endif
#ifdef __APPLE__
struct kevent event;
event.ident = socket;
#endif
// TODO: Mac OS X socket polling using kqueue
m_sockets.push_back(SocketData());
m_sockets.back().socket = socket;
m_sockets.back().flags = 0;
@ -494,7 +530,9 @@ namespace testing {
}
auto eventIt = m_events.begin() + std::distance(m_sockets.begin(), it);
::WSAEventSelect(socket, *eventIt, lNetworkEvents);
#else
#endif
#ifdef __linux__
int events = 0;
if (it->flags & Readable) {
events |= EPOLLIN;
@ -511,6 +549,8 @@ namespace testing {
event.events = events;
::epoll_ctl(m_epollFd, EPOLL_CTL_MOD, socket, &event);
#endif
// TODO: Mac OS X socket accepting implementation
}
}
}
@ -525,9 +565,12 @@ namespace testing {
::WSAEventSelect(it->socket, *eventIt, 0);
::WSACloseEvent(*eventIt);
m_events.erase(eventIt);
#else
#endif
#ifdef __linux__
::epoll_ctl(m_epollFd, EPOLL_CTL_DEL, socket, nullptr);
#endif
m_sockets.erase(it);
}
}
@ -547,7 +590,9 @@ namespace testing {
for (auto& hEvent : m_events) {
::WSACloseEvent(hEvent);
}
#else
#endif
#ifdef __linux__
for (auto& sd : m_sockets) {
::epoll_ctl(m_epollFd, EPOLL_CTL_DEL, sd.socket, nullptr);
}
@ -588,7 +633,10 @@ namespace testing {
if ((flags & Closed) && (ne.lNetworkEvents & FD_CLOSE)) {
m_callback.onSocketClosed(socket);
}
#else
#endif
#ifdef __linux__
epoll_event events[4];
int result = ::epoll_wait(m_epollFd, events, sizeof(events) / sizeof(events[0]), 500);
if (result == 0 || (result == -1 && errno == EINTR)) {
@ -618,10 +666,12 @@ namespace testing {
}
}
#endif
// TODO: provide Mac OS X polling implementation using kqueue
}
LOG_INFO("Reactor: Thread done");
}
};
} // namespace testing

Просмотреть файл

@ -1,7 +1,11 @@
#ifndef _CRT_SECURE_NO_WARNINGS
// #ifdef _WIN32
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#ifdef _MSC_VER
#pragma warning (disable : 4389)
#endif
//#include "gtest/gtest.h"
#include "common/Common.hpp"
@ -20,16 +24,30 @@ constexpr static const char* TEST_TOKEN2 = "0ae6cd22d8264818933f4857dd3c1472-eea
class TestDebugEventListener : public DebugEventListener {
public:
std::atomic<bool> netChanged = false;
std::atomic<unsigned> eps = 0;
std::atomic<unsigned> numLogged0 = 0;
std::atomic<unsigned> numLogged = 0;
std::atomic<unsigned> numSent = 0;
std::atomic<unsigned> numDropped = 0;
std::atomic<unsigned> numReject = 0;
std::atomic<unsigned> numCached = 0;
std::atomic<unsigned> logLatMin = 100;
std::atomic<unsigned> logLatMax = 0;
std::atomic<bool> netChanged;
std::atomic<unsigned> eps;
std::atomic<unsigned> numLogged0;
std::atomic<unsigned> numLogged;
std::atomic<unsigned> numSent;
std::atomic<unsigned> numDropped;
std::atomic<unsigned> numReject;
std::atomic<unsigned> numCached;
std::atomic<unsigned> logLatMin;
std::atomic<unsigned> logLatMax;
TestDebugEventListener() :
netChanged(false),
eps(0),
numLogged0(0),
numLogged(0),
numSent(0),
numDropped(0),
numReject(0),
numCached(0),
logLatMin(100),
logLatMax(0)
{
}
virtual void OnDebugEvent(DebugEvent &evt)
{
@ -104,6 +122,7 @@ public:
}
};
/// <summary>
/// Create sample event of a given priority
/// </summary>
@ -112,6 +131,8 @@ public:
/// <returns></returns>
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;
@ -121,6 +142,7 @@ EventProperties CreateSampleEvent(const char *name, EventPriority prio)
{
win_guid.Data4[i] = i;
}
#endif
// GUID constructor from byte[16]
const uint8_t guid_b[16] = {
@ -146,8 +168,9 @@ EventProperties CreateSampleEvent(const char *name, EventPriority prio)
/* С++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("maxgolov", PiiKind_None) },
{ "piiKind.DistinguishedName", EventProperty("/CN=Max Golovanov,OU=ARIA,DC=REDMOND,DC=COM", PiiKind_DistinguishedName) },
{ "piiKind.GenericData", EventProperty("maxgolov", PiiKind_GenericData) },
@ -164,19 +187,22 @@ EventProperties CreateSampleEvent(const char *name, EventPriority prio)
{ "strKey", "hello" },
{ "strKey2", "hello2" },
{ "int64Key", 1L },
{ "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);
return props;
@ -459,10 +485,15 @@ TEST(APITest, LogManager_BadStoragePath_Test)
std::vector<std::string> paths =
{
"invalid-path", // This would pass
#ifdef _WIN32
"T:\\invalid\\file\\path", // This fails - no offline storage
u8"C:\\неправильный\\каталог\\utf-8", // This fails - no offline storage
u8"C:\\Проверка-проверка 1 2 3\\файл.db" // This should pass if dir exists
#else
"/invalid/file/path",
u8"/неправильный/каталог/utf-8", // This fails - no offline storage
u8"/Проверка-проверка 1 2 3/файл.db" // This should pass if dir exists
#endif
};
for (const auto &path : paths)
@ -648,4 +679,6 @@ TEST(APITest, TracingAPI_FileSizeLimit)
}
#endif
// #endif
// TEST_PULL_ME_IN(APITest)

Просмотреть файл

@ -14,12 +14,12 @@
#include <LogManager.hpp>
#include <atomic>
#include <AriaDecoderV3.hpp>
//#include <AriaDecoderV3.hpp>
using namespace testing;
using namespace ARIASDK_NS;
LOGMANAGER_INSTANCE
// LOGMANAGER_INSTANCE
char const* const TEST_STORAGE_FILENAME = "BasicFuncTests.db";
@ -37,10 +37,14 @@ protected:
ILogger* logger;
ILogger* logger2;
std::atomic<bool> isSetup = false;
std::atomic<bool> isSetup;
public:
BasicFuncTests() :
isSetup(false)
{};
virtual void SetUp() override
{
if (isSetup.exchange(true))
@ -286,8 +290,8 @@ public:
EXPECT_THAT(temp.guidValue[0].size(), guid.size());
for (size_t index = 0; index < guid.size(); index++)
{
UINT8 val1 = temp.guidValue.at(0).at(index);
UINT8 val2 = guid[index];
uint8_t val1 = temp.guidValue.at(0).at(index);
uint8_t val2 = guid[index];
EXPECT_THAT(val1, val2);
}
break;
@ -349,8 +353,8 @@ public:
EXPECT_THAT(vectror.at(index).size(), guid.size());
for (size_t index1 = 0; index1 < guid.size(); index1++)
{
UINT8 val1 = vectror.at(index).at(index1);
UINT8 val2 = guid[index1];
uint8_t val1 = vectror.at(index).at(index1);
uint8_t val2 = guid[index1];
EXPECT_THAT(val1, val2);
}
}

Просмотреть файл

@ -1,20 +1,73 @@
if(PAL_IMPLEMENTATION STREQUAL "Skype")
set(PAL_SPECIFIC_SRCS
SkypeResourceManagerTests.cpp
)
endif()
include_directories(. ${CMAKE_CURRENT_SOURCE_DIR}/../googletest/googletest/include ${CMAKE_CURRENT_SOURCE_DIR}/../googletest/googlemock/include ${CMAKE_CURRENT_SOURCE_DIR}/../lib/include/public ${CMAKE_CURRENT_SOURCE_DIR}/../lib/include/aria ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite )
message("--- functests")
set(SRCS
APITest.cpp
BasicAfdFuncTests.cpp
BasicFuncTests.cpp
LoadTests.cpp
Main.cpp
MultipleLogManagersTests.cpp
${PAL_SPECIFIC_SRCS}
)
source_group(" " REGULAR_EXPRESSION "")
source_group("common" REGULAR_EXPRESSION "/tests/common/")
add_executable(FuncTests ${SRCS} ${TESTS_COMMON_SRCS})
target_link_libraries(FuncTests gtest gmock aria)
if(PAL_IMPLEMENTATION STREQUAL "WIN32")
# Link against prebuilt libraries on Windows
message("--- WIN32: Linking against prebuilt libraries")
message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gtest")
message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gmock")
message("--- WIN32: ... ${CMAKE_BINARY_DIR}/zlib")
message("--- WIN32: ... ${CMAKE_BINARY_DIR}/sqlite")
# link_directories(${CMAKE_BINARY_DIR}/gtest/ ${CMAKE_BINARY_DIR}/gmock/ ${CMAKE_BINARY_DIR}/zlib/ ${CMAKE_BINARY_DIR}/sqlite/)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../zlib )
target_link_libraries(FuncTests
aria
wininet.lib
${CMAKE_BINARY_DIR}/gtest/gtest.lib
${CMAKE_BINARY_DIR}/gmock/gmock.lib
${CMAKE_BINARY_DIR}/zlib/zlib.lib
${CMAKE_BINARY_DIR}/sqlite/sqlite.lib
)
else()
# Prefer linking to more recent local sqlite3
if(EXISTS "/usr/local/lib/libsqlite3.a")
set (SQLITE3_LIB "/usr/local/lib/libsqlite3.a")
elseif(EXISTS "/usr/local/opt/sqlite/lib/libsqlite3.a")
set (SQLITE3_LIB "/usr/local/opt/sqlite/lib/libsqlite3.a")
else()
set (SQLITE3_LIB "sqlite3")
endif()
# Find zlib
find_package( ZLIB REQUIRED )
include_directories( ${ZLIB_INCLUDE_DIRS} )
set (PLATFORM_LIBS "")
# Add flags for obtaining system UUID via IOKit
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set (PLATFORM_LIBS "-framework CoreFoundation -framework IOKit")
endif()
# Find libraries
message("--- Linking libraries! ")
message("Current Dir: ${CMAKE_CURRENT_SOURCE_DIR}")
message("Binary Dir: ${CMAKE_BINARY_DIR}")
target_link_libraries(FuncTests
${CMAKE_CURRENT_SOURCE_DIR}/../../googletest/build/googlemock/gtest/libgtest.a
${CMAKE_CURRENT_SOURCE_DIR}/../../googletest/build/googlemock/libgmock.a
aria
curl
${ZLIB_LIBRARIES}
${SQLITE3_LIB}
${PLATFORM_LIBS}
dl)
endif()
add_test(FuncTests FuncTests "--gtest_output=xml:${CMAKE_BINARY_DIR}/test-reports/FuncTests.xml")

Просмотреть файл

@ -25,8 +25,11 @@ class TestStatusLogger : public testing::EmptyTestEventListener {
}
};
#ifdef _MSC_VER
#pragma warning(suppress:4447) // 'main' signature found without threading model. Consider using 'int main(Platform::Array<Platform::String^>^ args)'.
int _cdecl main(int argc, char** argv)
#endif
int main(int argc, char** argv)
{
::testing::InitGoogleMock(&argc, argv);

Просмотреть файл

@ -2,7 +2,7 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#endif
#include "Common/Common.hpp"
#include "common/Common.hpp"
#include "common/HttpServer.hpp"
#include <api/LogManagerImpl.hpp>
#include <bond_lite/All.hpp>

Просмотреть файл

@ -1,39 +1,104 @@
if(PAL_IMPLEMENTATION STREQUAL "Skype")
set(CONFIG_SRCS
RuntimeConfigTests_ECS.cpp
)
endif()
message("--- unittests")
set(SRCS
BackoffTests_ExponentialWithJitter.cpp
BondSplicerTests.cpp
ContextFieldsProviderTests.cpp
ControlPlaneProviderTests.cpp
CorrelationVectorTests.cpp
Demo.cpp
DiskLocalStorageTests.cpp
EventFilterRegulatorTests.cpp
EventFilterTests.cpp
EventPropertiesStorageTests.cpp
EventPropertiesTests.cpp
BackoffTests_ExponentialWithJitter.cpp
HttpClientTests.cpp
FIFOOfflineStorageTests.cpp
GuidTests.cpp
HttpClientManagerTests.cpp
HttpClientTests.cpp
HttpDeflateCompressionTests.cpp
HttpRequestEncoderTests.cpp
HttpResponseDecoderTests.cpp
HttpServerTests.cpp
LoggerTests.cpp
Main.cpp
MemoryStorageTests.cpp
MetaStatsTests.cpp
OacrTests.cpp
OfflineStorageTests.cpp
OfflineStorageTests_SQLite.cpp
OfflineStorageTests_SQLiteWithMock.cpp
PackagerTests.cpp
PalTests.cpp
RouteTests.cpp
SingleControlPlaneTests.cpp
StringUtilsTests.cpp
TenantDataSerializerTests.cpp
TransmissionPolicyManagerTests.cpp
UtilsTests.cpp
${CONFIG_SRCS}
)
source_group(" " REGULAR_EXPRESSION "")
source_group("common" REGULAR_EXPRESSION "/tests/common/")
add_executable(UnitTests ${SRCS} ${TESTS_COMMON_SRCS})
target_link_libraries(UnitTests gtest gmock aria)
if(PAL_IMPLEMENTATION STREQUAL "WIN32")
# Link against prebuilt libraries on Windows
message("--- WIN32: Linking against prebuilt libraries")
message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gtest")
message("--- WIN32: ... ${CMAKE_BINARY_DIR}/gmock")
message("--- WIN32: ... ${CMAKE_BINARY_DIR}/zlib")
message("--- WIN32: ... ${CMAKE_BINARY_DIR}/sqlite")
# link_directories(${CMAKE_BINARY_DIR}/gtest/ ${CMAKE_BINARY_DIR}/gmock/ ${CMAKE_BINARY_DIR}/zlib/ ${CMAKE_BINARY_DIR}/sqlite/)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../zlib )
target_link_libraries(UnitTests
aria
wininet.lib
${CMAKE_BINARY_DIR}/gtest/gtest.lib
${CMAKE_BINARY_DIR}/gmock/gmock.lib
${CMAKE_BINARY_DIR}/zlib/zlib.lib
${CMAKE_BINARY_DIR}/sqlite/sqlite.lib
)
else()
# Prefer linking to more recent local sqlite3
if(EXISTS "/usr/local/lib/libsqlite3.a")
set (SQLITE3_LIB "/usr/local/lib/libsqlite3.a")
elseif(EXISTS "/usr/local/opt/sqlite/lib/libsqlite3.a")
set (SQLITE3_LIB "/usr/local/opt/sqlite/lib/libsqlite3.a")
else()
set (SQLITE3_LIB "sqlite3")
endif()
# Find zlib
find_package( ZLIB REQUIRED )
include_directories( ${ZLIB_INCLUDE_DIRS} )
set (PLATFORM_LIBS "")
# Add flags for obtaining system UUID via IOKit
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set (PLATFORM_LIBS "-framework CoreFoundation -framework IOKit")
endif()
# Find libraries
message("--- Linking libraries! ")
message("Current Dir: ${CMAKE_CURRENT_SOURCE_DIR}")
message("Binary Dir: ${CMAKE_BINARY_DIR}")
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/ )
target_link_libraries(UnitTests
${CMAKE_CURRENT_SOURCE_DIR}/../../googletest/build/googlemock/gtest/libgtest.a
${CMAKE_CURRENT_SOURCE_DIR}/../../googletest/build/googlemock/libgmock.a
aria
curl
${ZLIB_LIBRARIES}
${SQLITE3_LIB}
${PLATFORM_LIBS}
dl)
endif()
add_test(UnitTests UnitTests "--gtest_output=xml:${CMAKE_BINARY_DIR}/test-reports/UnitTests.xml")

Просмотреть файл

@ -1,3 +1,4 @@
#ifdef USE_EVENT_FILTER
// Copyright (c) Microsoft. All rights reserved.
#include "common/Common.hpp"
@ -220,4 +221,5 @@ TEST(EventFilterRegulatorTests, CallingSetExclusionFilterTwiceCreatesTwoFilterAn
delete regulator;
ASSERT_EQ(1, filter1.GetSimulatedDeleteCount());
ASSERT_EQ(1, filter2.GetSimulatedDeleteCount());
}
}
#endif

Просмотреть файл

@ -1,3 +1,4 @@
#ifdef USE_EVENT_FILTER
// Copyright (c) Microsoft. All rights reserved.
#include "common/Common.hpp"
@ -122,4 +123,5 @@ TEST(EventFilterTests, BadMatchBlocksNoEvents)
EXPECT_FALSE(filter.IsEventExcluded(event2));
EXPECT_FALSE(filter.IsEventExcluded(event3));
}
*/
*/
#endif

Просмотреть файл

@ -94,10 +94,10 @@ TEST(EventPropertiesTests, NumericProperties)
ep.SetProperty("char", static_cast<signed char>(-123));
ep.SetProperty("int", static_cast<int>(-123123));
ep.SetProperty("long", static_cast<long>(-123123123));
ep.SetProperty("int64_t", static_cast<int64_t>(-123123123));
ep.SetProperty("uint8", static_cast<uint8_t>(255));
ep.SetProperty("unsigned", static_cast<unsigned>(999999999));
ep.SetProperty("ull", static_cast<unsigned long long>(9999999999999999999ull));
ep.SetProperty("ull", (uint64_t)(9999999999999999999ull));
ep.SetProperty("float", static_cast<float>(1234.5f));
ep.SetProperty("double", static_cast<double>(-9876.543));
// ep.SetProperty("lodouble", static_cast<long double>(-98769876.5435431));
@ -106,10 +106,10 @@ TEST(EventPropertiesTests, NumericProperties)
EXPECT_THAT(ep.GetProperties(), SizeIs(10));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("char", EventProperty(-123))));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("int", EventProperty(-123123))));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("long", EventProperty(-123123123))));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("int64_t", EventProperty(-123123123))));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("uint8", EventProperty(255))));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("unsigned", 999999999)));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("ull", EventProperty(9999999999999999999))));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("ull", EventProperty((uint64_t)9999999999999999999))));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("float", EventProperty(1234.500000))));
EXPECT_THAT(ep.GetProperties(), Contains(Pair("double", EventProperty(-9876.543000))));
// EXPECT_THAT(ep.GetProperties(), Contains(Pair("lodouble", EventProperty("-98769876.543543"))));

Просмотреть файл

@ -1,3 +1,5 @@
#ifdef ENABLE_FIFO_TESTS
// Copyright (c) Microsoft. All rights reserved .
#include "common/Common.hpp"
@ -933,7 +935,7 @@ TEST_F(FIFOOfflineStorageTests, OfflineStorageOverwriteOldestItemUnitTest)
// Save items in newest to oldest order
for (size_t itemIndex = 1; itemIndex <= writeCount; itemIndex++)
{
sprintf_s(data, "Data Item %d", static_cast<int>(itemIndex));
sprintf(data, "Data Item %d", static_cast<int>(itemIndex));
StorageItemKey fileItemInfo = {};
fileItemInfo.Time = itemIndex;
@ -964,7 +966,7 @@ TEST_F(FIFOOfflineStorageTests, OfflineStorageOverwriteOldestItemUnitTest)
int itemIndex = static_cast<int>(writeCount - (blockCount - i));
printf("Item Index %d", itemIndex);
sprintf_s(data, "Data Item %d", itemIndex);
sprintf(data, "Data Item %d", itemIndex);
EXPECT_EQ(1u, findItemInfo.Key.Priority);
EXPECT_EQ(strlen(data), findItemInfo.ItemSize);
@ -977,3 +979,5 @@ TEST_F(FIFOOfflineStorageTests, OfflineStorageOverwriteOldestItemUnitTest)
storeFile.Close();
storeFile.DeleteFileLocal(filename);
}
#endif

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
#include "common/Common.hpp"
#include "utils/utils.hpp"
#include "utils/Utils.hpp"
#ifdef ARIASDK_PAL_SKYPE
#include <auf/auf_log2_utils.hpp>
@ -25,9 +25,11 @@ class TestStatusLogger : public testing::EmptyTestEventListener {
LOG_INFO("=== %s.%s [%s]", test.test_case_name(), test.name(), test.result()->Passed() ? "OK" : "FAILED");
}
};
#ifdef _MSC_VER
#pragma warning(suppress:4447) // 'main' signature found without threading model. Consider using 'int main(Platform::Array<Platform::String^>^ args)'.
int _cdecl main(int argc, char** argv)
#endif
int main(int argc, char** argv)
{
::testing::InitGoogleMock(&argc, argv);

Просмотреть файл

@ -9,7 +9,10 @@
#include <stdio.h>
#include <regex>
#ifdef _WIN32
#include "pal/PAL_Win32.hpp"
#endif
#include <set>
#include <memory>
@ -245,7 +248,7 @@ constexpr size_t MAX_STRESS_THREADS = 20;
TEST(MemoryStorageTests, MultiThreadPerfTest)
{
MemoryStorage storage(testLogManager, testConfig);
std::atomic<size_t> totalRecords = 0;
std::atomic<size_t> totalRecords(0);
std::vector<std::thread> workers;
std::thread t[MAX_STRESS_THREADS];

Просмотреть файл

@ -1,5 +1,5 @@
// Copyright (c) Microsoft. All rights reserved.
#ifdef _WIN32
#include "common/Common.hpp"
using namespace testing;
@ -34,3 +34,4 @@ TEST(OacrTests, BuildMachineOnly_VerifyThisBuildHasNoOacrErrors)
free(buildNumber);
}
}
#endif

Просмотреть файл

@ -11,6 +11,13 @@ set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=
set SOLUTION=%ROOT%\Solutions\AriaSDK.sln
REM Build gmock and gtest
msbuild %SOLUTION% /target:Tests\gmock,Tests\gtest /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=Win32
msbuild %SOLUTION% /target:Tests\gmock,Tests\gtest /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=Win32
msbuild %SOLUTION% /target:Tests\gmock,Tests\gtest /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=x64
msbuild %SOLUTION% /target:Tests\gmock,Tests\gtest /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=x64
REM DLL and static /MD build
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=Win32
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=Win32

Просмотреть файл

@ -65,3 +65,6 @@ tar -xvf /tmp/sqlite-snapshot.tar.gz
cd $SQLITE_PKG
./configure && make && make install
cd ..
## Build Google Test framework
./build-gtest.sh