Use external GoogleTest instead of bundling it (#655)

GoogleTest should be unbundled. Google changed their guidance a few years back and modern versions of google test cannot build the bundling code file.

This PR also updates to use C++14 as is required by modern GoogleTest versions.

Fixes Bug: #506
Fix By: Brad House (@bradh352)
pull/657/head
Brad House 12 months ago committed by GitHub
parent 23f98d5bcd
commit 49bdc5bb98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      .cirrus.yml
  2. 4
      .github/workflows/sonarcloud.yml
  3. 4
      .reuse/dep5
  4. 4
      CMakeLists.txt
  5. 122
      appveyor.yml
  6. 10
      configure.ac
  7. 15
      m4/ax_cxx_compile_stdcxx.m4
  8. 17
      m4/ax_cxx_compile_stdcxx_14.m4
  9. 275
      m4/pkg.m4
  10. 14
      test/CMakeLists.txt
  11. 17
      test/Makefile.am
  12. 23
      test/Makefile.m32
  13. 18
      test/Makefile.msvc
  14. 6
      test/configure.ac
  15. 9
      test/gmock-1.11.0/README.md
  16. 14465
      test/gmock-1.11.0/gmock-gtest-all.cc
  17. 11649
      test/gmock-1.11.0/gmock/gmock.h
  18. 12379
      test/gmock-1.11.0/gtest/gtest.h

@ -19,7 +19,7 @@ task:
BUILD_COVERAGE: "yes"
BUILD_ANALYZE: "yes"
container:
image: debian:11
image: debian:latest
- name: "Debian arm64"
env:
DIST: "DEBIAN-ARM"
@ -38,7 +38,7 @@ task:
MAKE: "gmake"
BUILD_ANALYZE: "yes"
freebsd_instance:
image_family: freebsd-13-1
image_family: freebsd-13-2
- name: "MacOS"
env:
DIST: "MACOS"
@ -116,7 +116,7 @@ task:
case "${DIST}" in
DEBIAN*)
apt-get update && \
apt-get install -y cmake ninja-build autoconf automake libtool g++ pip
apt-get install -y cmake ninja-build autoconf automake libtool g++ pip libgmock-dev pkg-config
case "${BUILD_TYPE}" in
asan|lsan|ubsan)
apt-get install -y clang
@ -129,13 +129,13 @@ task:
;;
coverage)
apt-get install -y lcov git
pip3 install --user cpp-coveralls
pip3 install --break-system-packages --user cpp-coveralls
;;
esac
;;
FREEBSD)
# pkg upgrade -y && \
pkg install -y cmake ninja
pkg install -y cmake ninja googletest pkgconf
case "${BUILD_TYPE}" in
asan|analyze|ubsan|lsan)
pkg install -y llvm autoconf automake libtool gmake
@ -147,7 +147,7 @@ task:
;;
MACOS|iOS)
brew update && \
brew install ninja cmake
brew install ninja cmake googletest
case "${BUILD_TYPE}" in
asan|ubsan|lsan|analyze)
brew install llvm autoconf automake libtool make

@ -19,6 +19,10 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgmock-dev
version: 1.0
- name: Run build-wrapper
run: |
mkdir build

@ -23,10 +23,10 @@ Files: m4/ax_pthread.m4
Copyright: see file
License: GPL-3.0-or-later WITH Autoconf-exception-3.0
Files: m4/ax_cxx_compile_stdcxx.m4 m4/ax_cxx_compile_stdcxx_11.m4 me/ax_require_defined.m4 m4/ax_check_gnu_make.m4 m4/ax_file_escapes.m4 m4/ax_require_defined.m4 m4/ax_ac_append_to_file.m4 m4/ax_ac_print_to_file.m4 m4/ax_add_am_macro_static.m4 m4/ax_file_escapes.m4 m4/ax_am_macros_static.m4 m4/ax_append_flag.m4 m4/ax_append_compile_flags.m4 m4/ax_check_compile_flag.m4
Files: m4/ax_cxx_compile_stdcxx.m4 m4/ax_cxx_compile_stdcxx_14.m4 me/ax_require_defined.m4 m4/ax_check_gnu_make.m4 m4/ax_file_escapes.m4 m4/ax_require_defined.m4 m4/ax_ac_append_to_file.m4 m4/ax_ac_print_to_file.m4 m4/ax_add_am_macro_static.m4 m4/ax_file_escapes.m4 m4/ax_am_macros_static.m4 m4/ax_append_flag.m4 m4/ax_append_compile_flags.m4 m4/ax_check_compile_flag.m4
Copyright: see files
License: FSFAP
Files: m4/ax_code_coverage.m4
Files: m4/ax_code_coverage.m4 m4/pkg.m4
Copyright: see file
License: LGPL-2.1-or-later

@ -45,9 +45,9 @@ OPTION (CARES_THREADS "Build with thread-safety support"
SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom")
# Tests require a C++ compiler
# Tests require a C++14 compiler
IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS FALSE)
enable_language(CXX)

@ -23,68 +23,47 @@ configuration:
# CMAKE_EXTRA_OPTIONS: -DOPENSSL_ROOT_DIR=C:/OpenSSL-Win32
environment:
matrix:
# MinGW clang ASAN via MSYS2 -- doesn't work due to some issue with clang itself
#- COMPILER: MINGW
# BUILDTOOL: MSYS2
# TESTTYPE: MSYS2
# MSYSTEM: CLANG64
# CMAKE_EXTRA_OPTIONS: -GNinja -DCMAKE_CXX_FLAGS=-fsanitize=address -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=address -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address
# CHERE_INVOKING: YES
# MinGW clang UBSAN via MSYS2
- COMPILER: MINGW
BUILDTOOL: MSYS2
TESTTYPE: MSYS2
MSYSTEM: CLANG64
CMAKE_EXTRA_OPTIONS: -GNinja -DCMAKE_CXX_FLAGS=-fsanitize=undefined -DCMAKE_C_FLAGS=-fsanitize=undefined -DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=undefined -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=undefined
CHERE_INVOKING: YES
# MinGW gcc via MSYS2 (latest version)
- COMPILER: MINGW
BUILDTOOL: MSYS2
TESTTYPE: MSYS2
MSYSTEM: MINGW64
CMAKE_EXTRA_OPTIONS: -GNinja
CHERE_INVOKING: YES
# MSVC 2022, UWP (cmake)
- COMPILER: MSVC
BUILDTOOL: CMAKE
TESTTYPE: NONE
MSVC_SETUP_ARG: x64 store
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat
CMAKE_EXTRA_OPTIONS: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -A x64
TESTDIRSUFFIX: Release\
# MSVC 2022, 32-bit x86 (cmake)
- COMPILER: MSVC
BUILDTOOL: CMAKE
TESTTYPE: CMAKE
MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat
CMAKE_EXTRA_OPTIONS: -GNinja
CMAKE_EXTRA_OPTIONS: -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL
BUILD_GOOGLETEST: yes
# MSVC 2022, 64-bit x86 (cmake)
# MSVC 2022, 64-bit x64 (cmake)
- COMPILER: MSVC
BUILDTOOL: CMAKE
TESTTYPE: CMAKE
MSVC_SETUP_ARG: x64
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat
CMAKE_EXTRA_OPTIONS: -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL
BUILD_GOOGLETEST: yes
# MinGW gcc via MSYS2 (latest version)
- COMPILER: MINGW
BUILDTOOL: MSYS2
TESTTYPE: MSYS2
MSYSTEM: MINGW64
CMAKE_EXTRA_OPTIONS: -GNinja
CHERE_INVOKING: YES
# MinGW, 32-bit x86 (cmake static only)
# MinGW clang UBSAN via MSYS2
- COMPILER: MINGW
BUILDTOOL: CMAKE
TESTTYPE: CMAKE
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%
CMAKE_EXTRA_OPTIONS: -DCARES_SHARED=OFF -GNinja
BUILDTOOL: MSYS2
TESTTYPE: MSYS2
MSYSTEM: CLANG64
CMAKE_EXTRA_OPTIONS: -GNinja -DCMAKE_CXX_FLAGS=-fsanitize=undefined -DCMAKE_C_FLAGS=-fsanitize=undefined -DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=undefined -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=undefined
CHERE_INVOKING: YES
# MSVC 2022, 32-bit x86 (nmake)
- COMPILER: MSVC
BUILDTOOL: NMAKE
TESTTYPE: NMAKE
MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat
# MinGW clang ASAN via MSYS2 -- doesn't work due to some issue with clang itself
#- COMPILER: MINGW
# BUILDTOOL: MSYS2
# TESTTYPE: MSYS2
# MSYSTEM: CLANG64
# CMAKE_EXTRA_OPTIONS: -GNinja -DCMAKE_CXX_FLAGS=-fsanitize=address -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=address -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address
# CHERE_INVOKING: YES
# MSVC 2022, 64-bit x86 (nmake)
- COMPILER: MSVC
@ -92,12 +71,39 @@ environment:
TESTTYPE: NMAKE
MSVC_SETUP_ARG: x64
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat
BUILD_GOOGLETEST: yes
# MSVC 2022, 32-bit x86 (nmake)
- COMPILER: MSVC
BUILDTOOL: NMAKE
TESTTYPE: NMAKE
MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat
BUILD_GOOGLETEST: yes
# MinGW, 32-bit x86 (makefiles)
- COMPILER: MINGW
BUILDTOOL: MAKE
TESTTYPE: MAKE
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%
BUILD_GOOGLETEST: yes
# MinGW, 32-bit x86 (cmake static only)
- COMPILER: MINGW
BUILDTOOL: CMAKE
TESTTYPE: CMAKE
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%
CMAKE_EXTRA_OPTIONS: -DCARES_SHARED=OFF -GNinja -DCARES_BUILD_TESTS=ON -DGTEST_ROOT=C:\projects\googletest
BUILD_GOOGLETEST: yes
# MSVC 2022, UWP (cmake)
- COMPILER: MSVC
BUILDTOOL: CMAKE
TESTTYPE: NONE
MSVC_SETUP_ARG: x64 store
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat
CMAKE_EXTRA_OPTIONS: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -A x64
TESTDIRSUFFIX: Release\
install:
- if "%COMPILER%" == "MINGW" rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
@ -107,17 +113,23 @@ before_build:
# -- Visual Studio --
- if "%COMPILER%" == "MSVC" call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG%
- if "%BUILDTOOL%" == "MSYS2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu"
- if "%BUILDTOOL%" == "MSYS2" if "%MSYSTEM%" == "MINGW64" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja"
- if "%BUILDTOOL%" == "MSYS2" if "%MSYSTEM%" == "CLANG64" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu git mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-clang-analyzer mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-ninja"
- if "%BUILDTOOL%" == "MSYS2" if "%MSYSTEM%" == "MINGW64" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gtest"
- if "%BUILDTOOL%" == "MSYS2" if "%MSYSTEM%" == "CLANG64" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu git mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-clang-analyzer mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-gtest"
- if "%BUILD_GOOGLETEST%" == "yes" git clone --depth=1 https://github.com/google/googletest googletest
- if "%BUILD_GOOGLETEST%" == "yes" cd googletest
- if "%BUILD_GOOGLETEST%" == "yes" cmake -DCMAKE_INSTALL_PREFIX=C:\projects\googletest -DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL -GNinja -Bbuild
- if "%BUILD_GOOGLETEST%" == "yes" cmake --build build --config Debug
- if "%BUILD_GOOGLETEST%" == "yes" cmake --install build --config Debug
- if "%BUILD_GOOGLETEST%" == "yes" cd ..
build_script:
- if "%BUILDTOOL%" == "MSYS2" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/projects/build-cares/test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON %CMAKE_EXTRA_OPTIONS% ."
- if "%BUILDTOOL%" == "MSYS2" C:\msys64\usr\bin\bash -lc "%ANALYZE_PREFIX% ninja -v install"
- if "%BUILDTOOL%" == "NMAKE" copy .\include\ares_build.h.dist .\include\ares_build.h
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc
- if "%BUILDTOOL%" == "CMAKE" cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:\projects\build-cares\test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON %CMAKE_EXTRA_OPTIONS% -Bbuild
- if "%BUILDTOOL%" == "CMAKE" cmake --build build --config Release
- if "%BUILDTOOL%" == "CMAKE" cmake --install build --config Release
- if "%BUILDTOOL%" == "CMAKE" cmake -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:\projects\build-cares\test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON %CMAKE_EXTRA_OPTIONS% -Bbuild
- if "%BUILDTOOL%" == "CMAKE" cmake --build build --config Debug
- if "%BUILDTOOL%" == "CMAKE" cmake --install build --config Debug
- if "%BUILDTOOL%" == "MAKE" copy .\include\ares_build.h.dist .\include\ares_build.h
- if "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32 demos
@ -127,12 +139,12 @@ test_script:
- if "%TESTTYPE%" == "MSYS2" C:\msys64\usr\bin\bash -lc "./bin/ahost.exe www.google.com"
- if "%TESTTYPE%" == "MSYS2" C:\msys64\usr\bin\bash -lc "./bin/arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*"
- if "%TESTTYPE%" == "NMAKE" cd test
- if "%TESTTYPE%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc vtest
- if "%TESTTYPE%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc aresfuzz aresfuzzname dnsdump
- if "%TESTTYPE%" == "NMAKE" nmake GTEST_ROOT=C:\projects\googletest /NOLOGO /f .\Makefile.msvc vtest
- if "%TESTTYPE%" == "NMAKE" nmake GTEST_ROOT=C:\projects\googletest /NOLOGO /f .\Makefile.msvc aresfuzz aresfuzzname dnsdump
- if "%TESTTYPE%" == "NMAKE" .\msvc\arestest\lib-debug\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa
- if "%TESTTYPE%" == "MAKE" cd test
- if "%TESTTYPE%" == "MAKE" mingw32-make.exe -f Makefile.m32
- if "%TESTTYPE%" == "MAKE" mingw32-make.exe -f Makefile.m32 aresfuzz.exe aresfuzzname.exe dnsdump.exe
- if "%TESTTYPE%" == "MAKE" mingw32-make.exe GTEST_ROOT=C:\projects\googletest -f Makefile.m32 vtest
- if "%TESTTYPE%" == "MAKE" mingw32-make.exe GTEST_ROOT=C:\projects\googletest -f Makefile.m32 aresfuzz.exe aresfuzzname.exe dnsdump.exe
- if "%TESTTYPE%" == "MAKE" .\dnsdump.exe fuzzinput\answer_a fuzzinput\answer_aaaa
- if "%TESTTYPE%" == "CMAKE" cd build\bin\%TESTDIRSUFFIX%
- if "%TESTTYPE%" == "CMAKE" .\adig.exe www.google.com

@ -59,7 +59,7 @@ AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX_11])
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX_14])
CARES_CHECK_OPTION_DEBUG
CARES_CHECK_OPTION_OPTIMIZE
@ -127,7 +127,7 @@ dnl Get system canonical name
AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
XC_CHECK_PROG_CC
AX_CXX_COMPILE_STDCXX_11([noext],[optional])
AX_CXX_COMPILE_STDCXX_14([noext],[optional])
XC_AUTOMAKE
@ -1034,7 +1034,7 @@ AC_MSG_CHECKING([whether to build tests])
AC_ARG_ENABLE(tests,
AS_HELP_STRING([--enable-tests], [build test suite]),
[ build_tests="$enableval" ],
[ if test "x$HAVE_CXX11" = "x1" && test "x$cross_compiling" = "xno" ; then
[ if test "x$HAVE_CXX14" = "x1" && test "x$cross_compiling" = "xno" ; then
build_tests="yes"
else
build_tests="no"
@ -1043,8 +1043,8 @@ AC_ARG_ENABLE(tests,
)
if test "x$build_tests" = "xyes" ; then
if test "x$HAVE_CXX11" = "0" ; then
AC_MSG_ERROR([*** Building tests requires a CXX11 compiler])
if test "x$HAVE_CXX14" = "0" ; then
AC_MSG_ERROR([*** Building tests requires a CXX14 compiler])
fi
if test "x$cross_compiling" = "xyes" ; then
AC_MSG_ERROR([*** Tests not supported when cross compiling])

@ -43,7 +43,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 15
#serial 18
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
@ -104,9 +104,18 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
dnl HP's aCC needs +std=c++11 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
dnl Cray's crayCC needs "-h std=c++11"
dnl MSVC needs -std:c++NN for C++17 and later (default is C++14)
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do
if test x"$switch" = xMSVC; then
dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide
dnl with -std=c++17. We suffix the cache variable name with _MSVC to
dnl avoid this.
switch=-std:c++${alternative}
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC])
else
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
fi
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"

@ -1,19 +1,19 @@
# =============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html
# =============================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
# AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the C++11
# Check for baseline language coverage in the compiler for the C++14
# standard; if necessary, add switches to CXX and CXXCPP to enable
# support.
#
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
# macro with the version set to C++11. The two optional arguments are
# macro with the version set to C++14. The two optional arguments are
# forwarded literally as the second and third argument respectively.
# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
# more information. If you want to use this macro, you also need to
@ -21,11 +21,6 @@
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
#
# Copying and distribution of this file, with or without modification, are
@ -33,7 +28,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 18
#serial 5
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])])

@ -0,0 +1,275 @@
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dnl 02111-1307, USA.
dnl
dnl As a special exception to the GNU General Public License, if you
dnl distribute this file as part of a program that contains a
dnl configuration script generated by Autoconf, you may include it under
dnl the same distribution terms that you use for the rest of that
dnl program.
dnl PKG_PREREQ(MIN-VERSION)
dnl -----------------------
dnl Since: 0.29
dnl
dnl Verify that the version of the pkg-config macros are at least
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
dnl installed version of pkg-config, this checks the developer's version
dnl of pkg.m4 when generating configure.
dnl
dnl To ensure that this macro is defined, also add:
dnl m4_ifndef([PKG_PREREQ],
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
dnl ----------------------------------
dnl Since: 0.16
dnl
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
dnl first found in the path. Checks that the version of pkg-config found
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
dnl used since that's the first version where most current features of
dnl pkg-config existed.
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])dnl PKG_PROG_PKG_CONFIG
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------------------------------
dnl Since: 0.18
dnl
dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
dnl only at the first occurence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
dnl ---------------------------------------------
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
dnl pkg_failed based on the result.
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])dnl _PKG_CONFIG
dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl ---------------------------
dnl Internal check to see if pkg-config supports short errors.
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl --------------------------------------------------------------
dnl Since: 0.4.0
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])dnl PKG_CHECK_MODULES
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl ---------------------------------------------------------------------
dnl Since: 0.29
dnl
dnl Checks for existence of MODULES and gathers its build flags with
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
dnl and VARIABLE-PREFIX_LIBS from --libs.
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
dnl configure.ac.
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
_save_PKG_CONFIG=$PKG_CONFIG
PKG_CONFIG="$PKG_CONFIG --static"
PKG_CHECK_MODULES($@)
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
])dnl PKG_CHECK_MODULES_STATIC
dnl PKG_INSTALLDIR([DIRECTORY])
dnl -------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable pkgconfigdir as the location where a module
dnl should install pkg-config .pc files. By default the directory is
dnl $libdir/pkgconfig, but the default can be changed by passing
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
dnl parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_INSTALLDIR
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
dnl --------------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
dnl module should install arch-independent pkg-config .pc files. By
dnl default the directory is $datadir/pkgconfig, but the default can be
dnl changed by passing DIRECTORY. The user can override through the
dnl --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_NOARCH_INSTALLDIR
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------
dnl Since: 0.28
dnl
dnl Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR

@ -7,6 +7,7 @@ IF (MSVC)
ENDIF ()
find_package(Threads)
find_package(GTest REQUIRED)
# create target to access and use internal cares library
add_library(caresinternal INTERFACE)
@ -26,17 +27,6 @@ ELSE ()
target_link_libraries(caresinternal INTERFACE ${PROJECT_NAME}::cares)
ENDIF ()
# Google Test and Mock
set(GMOCK_DIR gmock-1.11.0)
add_library(gmock STATIC
${GMOCK_DIR}/gmock-gtest-all.cc
${GMOCK_DIR}/gmock/gmock.h
${GMOCK_DIR}/gtest/gtest.h
)
target_include_directories(gmock PUBLIC SYSTEM ${GMOCK_DIR})
target_link_libraries(gmock PRIVATE ${CMAKE_THREAD_LIBS_INIT})
# test targets
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
@ -44,7 +34,7 @@ configure_file(${CARES_TOPLEVEL_DIR}/src/lib/ares_config.h.cmake config.h)
add_executable(arestest ${TESTSOURCES} ${TESTHEADERS})
target_include_directories(arestest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(arestest PRIVATE caresinternal gmock)
target_link_libraries(arestest PRIVATE caresinternal GTest::gmock)
IF (CARES_BUILD_CONTAINER_TESTS)
target_compile_definitions(arestest PRIVATE HAVE_USER_NAMESPACE HAVE_UTS_NAMESPACE)

17
test/Makefile.am vendored

@ -25,13 +25,11 @@ ARES_SRC_DIR = $(top_srcdir)/..
AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6
ACLOCAL_AMFLAGS = -I ../m4 --install
# Note use of -isystem to force use of local gMock/gTest even if there's an installed version.
CPPFLAGS += -I$(ARES_BLD_DIR)/include \
-I$(ARES_BLD_DIR)/src/lib \
-I$(ARES_SRC_DIR)/include \
-I$(ARES_SRC_DIR)/src/lib \
-I$(top_builddir) \
-isystem $(srcdir)/gmock-1.11.0
-I$(top_builddir)
CXXFLAGS += -Wall $(PTHREAD_CFLAGS)
# Makefile.inc provides the various *SOURCES and *HEADERS defines
@ -39,22 +37,13 @@ include Makefile.inc
TESTS = arestest fuzzcheck.sh
noinst_LTLIBRARIES = libgmock.la
libgmock_la_SOURCES = \
gmock-1.11.0/gmock-gtest-all.cc \
gmock-1.11.0/gmock/gmock.h \
gmock-1.11.0/gtest/gtest.h
libgmock_la_CPPFLAGS = -isystem $(srcdir)/gmock-1.11.0
noinst_PROGRAMS = arestest aresfuzz aresfuzzname dnsdump
EXTRA_DIST = fuzzcheck.sh CMakeLists.txt Makefile.m32 Makefile.msvc README.md buildconf $(srcdir)/fuzzinput/* $(srcdir)/fuzznames/*
arestest_SOURCES = $(TESTSOURCES) $(TESTHEADERS)
# Not interested in coverage of test code, but linking the test binary needs the coverage option
arestest_LDADD = libgmock.la $(ARES_BLD_DIR)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS)
arestest_CXXFLAGS = $(GMOCK_CFLAGS)
arestest_LDADD = $(GMOCK_LIBS) $(ARES_BLD_DIR)/src/lib/libcares.la $(PTHREAD_LIBS) $(CODE_COVERAGE_LIBS)
include $(top_srcdir)/aminclude_static.am

23
test/Makefile.m32 vendored

@ -3,21 +3,24 @@
# SPDX-License-Identifier: MIT
#
# Makefile for building arestest.exe with MingW32 (GCC-3.2)
# Use: make -f Makefile.m32
# Use: make -f Makefile.m32 GTEST_ROOT=....
#
########################################################
CXX = g++
CC = gcc
LD = g++
ifeq "$(GTEST_ROOT)" ""
$(error missing GTEST_ROOT)
endif
# Where to find the c-ares source code; needed because the tests use library-internal headers
ARES_SRC_DIR = ..
# Where to find the built c-ares static library
ARES_BLD_DIR = ..
ARESLIB = $(ARES_BLD_DIR)/src/lib/libcares.a
GMOCK_DIR = gmock-1.11.0
CPPFLAGS = -I$(ARES_SRC_DIR)/include -I$(ARES_SRC_DIR)/src/lib -I$(GMOCK_DIR) -DCARES_STATICLIB
CXXFLAGS = -Wall $(PTHREAD_CFLAGS) -std=gnu++11
CPPFLAGS = -I$(ARES_SRC_DIR)/include -I$(ARES_SRC_DIR)/src/lib -I$(GTEST_ROOT)/include -DCARES_STATICLIB
CXXFLAGS = -Wall $(PTHREAD_CFLAGS) -std=gnu++14
LDFLAGS =
LDLIBS = -lws2_32 -liphlpapi
@ -31,8 +34,8 @@ DNSDUMPOBJS := $(patsubst %.cc,%.o,$(strip $(DUMPSOURCES)))
all: arestest.exe aresfuzz.exe aresfuzzname.exe dnsdump.exe
arestest.exe: $(OBJS) gmock-gtest-all.o
$(LD) $(LDFLAGS) -o $@ $^ -L$(ARES_BLD_DIR)/src/lib -lcares $(LDLIBS)
arestest.exe: $(OBJS)
$(LD) $(LDFLAGS) -o $@ $^ -L$(ARES_BLD_DIR)/src/lib -lcares $(LDLIBS) -L$(GTEST_ROOT)/lib -lgmock -lgtest
aresfuzz.exe: $(FUZZOBJS)
$(LD) $(LDFLAGS) -o $@ $^ -L$(ARES_BLD_DIR)/src/lib -lcares $(LDLIBS)
@ -49,15 +52,13 @@ $(OBJS): $(TESTHEADERS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $<
.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
gmock-gtest-all.o: $(GMOCK_DIR)/gmock-gtest-all.cc
$(CXX) -I$(GMOCK_DIR) $(CPPFLAGS) $(CXXFLAGS) -c $<
test: arestest.exe
./arestest.exe
./arestest.exe --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*
vtest: arestest.exe
./arestest.exe -v
./arestest.exe -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*
clean:
$(RM) $(OBJS) gmock-gtest-all.o arestest.exe aresfuzz.exe aresfuzzname.exe dnsdump.exe
$(RM) $(OBJS) arestest.exe aresfuzz.exe aresfuzzname.exe dnsdump.exe

18
test/Makefile.msvc vendored

@ -109,7 +109,7 @@ VALID_CFGSET = TRUE
!IF "$(VALID_CFGSET)" == "FALSE"
! MESSAGE MSVC c-ares makefile
! MESSAGE
! MESSAGE Usage: nmake /f makefile.msvc CFG=<config> <target>
! MESSAGE Usage: nmake /f makefile.msvc CFG=<config> GTEST_ROOT=<google-test-install> <target>
! MESSAGE
! MESSAGE <config> can be one of: [ lib-release | lib-debug | dll-release | dll-debug }
! MESSAGE <target> can be one of: [ all | arestest | aresfuzz | aresfuzzname | dnsdump | clean }
@ -120,6 +120,10 @@ VALID_CFGSET = TRUE
! ERROR Choose a valid configuration.
!ENDIF
!IF "$(GTEST_ROOT)" == ""
! ERROR Missing GTEST_ROOT
!ENDIF
# --------------------------------------------------------
# Project subdirs independent of configuration being used
# --------------------------------------------------------
@ -127,8 +131,6 @@ VALID_CFGSET = TRUE
PROG_DIR = $(BASE_DIR)\arestest
LIB_DIR = $(LIB_BASE_DIR)\cares
GMOCK_DIR = gmock-1.11.0
# ---------------------------------------------------
# Subdirs which are configuration dependent are only
# defined when a valid configuration has been given.
@ -170,7 +172,7 @@ RT_ERROR_CHECKING = /RTCsu
CC_CMD_REL = cl.exe /nologo $(RTLIB) /DNDEBUG /O2 /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS
CC_CMD_DBG = cl.exe /nologo $(RTLIBD) /D_DEBUG /Od /Zi /D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS $(RT_ERROR_CHECKING)
CC_CFLAGS = $(CFLAGS) /I. /I../src/lib /I../include /I $(GMOCK_DIR) /W3 /EHsc /FD
CC_CFLAGS = $(CFLAGS) /I. /I../src/lib /I../include /I $(GTEST_ROOT)/include /W3 /EHsc /FD
RC_CMD_REL = rc.exe /l 0x409 /d "NDEBUG"
RC_CMD_DBG = rc.exe /l 0x409 /d "_DEBUG"
@ -280,8 +282,6 @@ FUZZNAME_OBJS = $(FUZZNAME_OBJS:.c=.obj)
!ENDIF
DNSDUMP_OBJS = $(DNSDUMP_OBJS:.cc=.obj)
GMOCK_GTEST_OBJ = $(PROG_OBJDIR)\gmock-gtest-all.obj
# --------------------------------
# Only our custom inference rules
# --------------------------------
@ -293,8 +293,6 @@ GMOCK_GTEST_OBJ = $(PROG_OBJDIR)\gmock-gtest-all.obj
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
{$(SRCDIR)}.c{$(PROG_OBJDIR)}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
{$(GMOCK_DIR)}.cc{$(PROG_OBJDIR)}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /I $(GMOCK_DIR) /Fo$@ /Fd$(@D)\ /c $<
# ---------------------------------------------------------------------
@ -309,8 +307,8 @@ test: arestest
vtest: arestest
$(PROG_OUTDIR)\arestest -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*
arestest: $(TESTSOURCES) $(PROG_OUTDIR) $(PROG_OBJDIR) $(PROG_OBJS) $(GMOCK_GTEST_OBJ)
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG_OUTDIR)\arestest.exe $(PROG_OBJS) $(GMOCK_GTEST_OBJ)
arestest: $(TESTSOURCES) $(PROG_OUTDIR) $(PROG_OBJDIR) $(PROG_OBJS)
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG_OUTDIR)\arestest.exe $(PROG_OBJS) $(GTEST_ROOT)/lib/gmock.lib
@if exist $(PROG_OUTDIR)\arestest.exe.manifest mt -nologo -manifest $(PROG_OUTDIR)\arestest.exe.manifest -outputresource:$(PROG_OUTDIR)\arestest.exe;1
aresfuzz: $(FUZZSOURCES) $(PROG_OUTDIR) $(PROG_OBJDIR) $(FUZZ_OBJS)

6
test/configure.ac vendored

@ -26,16 +26,18 @@ AC_CONFIG_MACRO_DIR([../m4])
AM_INIT_AUTOMAKE([no-define])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX_11])
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX_14])
AX_REQUIRE_DEFINED([AX_PTHREAD])
dnl Checks for programs.
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
AX_CXX_COMPILE_STDCXX_14([noext],[mandatory])
LT_INIT
AC_SUBST(LIBTOOL_DEPS)
AX_PTHREAD([ CARES_THREADS=yes ], [ CARES_THREADS=no ])
PKG_CHECK_MODULES([GMOCK], [gmock])
if test "${CARES_THREADS}" = "yes" ; then
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"

@ -1,9 +0,0 @@
Creating Combined gmock release
===============================
```
wget https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz && \
tar -zxvpf release-1.11.0.tar.gz && \
python3 ./googletest-release-1.11.0/googlemock/scripts/fuse_gmock_files.py ./googletest-release-1.11.0/googlemock gmock-1.11.0 && \
rm -rf googletest-release-1.11.0 release-1.11.0.tar.gz
```

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save