view release on metacpan or search on metacpan
173174175176177178179180181182183184185186187188189190191192193libcares/install-sh
libcares/INSTALL.md
libcares/libcares.pc.cmake
libcares/libcares.pc.in
libcares/LICENSE.md
libcares/ltmain.sh
libcares/m4/ax_check_user_namespace.m4
libcares/m4/ax_check_uts_namespace.m4
libcares/m4/ax_code_coverage.m4
libcares/m4/ax_cxx_compile_stdcxx_11.m4
libcares/m4/ax_pthread.m4
libcares/m4/cares-compilers.m4
libcares/m4/cares-confopts.m4
libcares/m4/cares-functions.m4
libcares/m4/cares-
override
.m4
libcares/m4/cares-reentrant.m4
libcares/m4/libtool.m4
libcares/m4/ltoptions.m4
libcares/m4/ltsugar.m4
libcares/m4/ltversion.m4
libcares/m4/lt~obsolete.m4
libcares/CHANGES.0 view on Meta::CPAN
739740741742743744745746747748749750751752753754755756757758759760761
The patch can be tested by using the adig utility and using the
'-s'
option.
- Brad House added ares_save_options() and ares_destroy_options() that can be
used to keep options
for
later re-usal
when
ares_init_options() is used.
Problem: Calling ares_init()
for
each
lookup can be unnecessarily resource
intensive. On windows, it must LoadLibrary() or search the registry
on
each
call to ares_init(). On unix, it must
read
and parse
multiple files to obtain the necessary configuration information. In
a single-threaded environment, it would make sense to only
ares_init() once, but in a heavily multi-threaded environment, it is
undesirable to ares_init() and ares_destroy()
for
each
thread created
and track that.
Solution: Create ares_save_options() and ares_destroy_options() functions to
retrieve and free options obtained from an initialized channel. The
options populated can be used to pass back into ares_init_options(),
it should populate all needed fields and not retrieve any information
from the
system
. Probably wise to destroy the cache every minute or
so to prevent the data from becoming stale.
- Daniel S added ares_process_fd() to allow applications to ask
for
processing
libcares/CHANGES.0 view on Meta::CPAN
888889890891892893894895896897898899900901902903904905906907* November 25
- Yang Tse fixed some
send
() /
recv
() compiler warnings
* September 18
- Added constants that will be used by ares_getaddrinfo
is available to ensure it works properly in a threaded environment.
* September 10
- configure fix
for
detecting a member in the sockaddr_in6 struct which failed
on ipv6-enabled HP-UX 11.00
Version 1.3.0 (August 29, 2005)
* August 21
libcares/INSTALL.md view on Meta::CPAN
299300301302303304305306307308309310311312313314315316317318
- [KB94248](http://support.microsoft.com/kb/94248/en-us) - How To Use the C Run-Time
- [KB140584](http://support.microsoft.com/kb/140584/en-us) - How to
link
with
the correct C Run-Time (CRT) library
- [KB190799](http://msdn.microsoft.com/en-us/library/ms235460) - Potential Errors Passing CRT Objects Across DLL Boundaries
If your app is misbehaving in some strange way, or it is suffering
from memory corruption,
before
asking
for
further help, please
try
first to rebuild every single library your app uses as well as your
app using the debug multithreaded dynamic C runtime.
### MingW32
Make sure that MinGW32's bin dir is in the search path,
for
example:
set PATH=c:\mingw32\bin;
%PATH
%
then run
'make -f Makefile.m32'
in the root dir.
libcares/Makefile.netware view on Meta::CPAN
221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
@echo
$(DL)stack $(STACK)$(DL) >> $@
endif
ifdef SCREEN
@echo
$(DL)screenname
"$(SCREEN)"
$(DL) >> $@
else
@echo
$(DL)screenname
"DEFAULT"
$(DL) >> $@
endif
ifeq ($(DB),DEBUG)
@echo
$(DL)debug$(DL) >> $@
endif
@echo
$(DL)threadname
"$^"
$(DL) >> $@
ifdef XDCOPT
@echo
$(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
endif
ifeq ($(LDRING),0)
@echo
$(DL)flag_on 16$(DL) >> $@
endif
ifeq ($(LDRING),3)
@echo
$(DL)flag_on 512$(DL) >> $@
endif
ifeq ($(LIBARCH),CLIB)
@echo
$(DL)start _Prelude$(DL) >> $@
@echo
$(DL)
exit
_Stop$(DL) >> $@
@echo
$(DL)
import
@$(SDK_CLIB)/imports/clib.imp$(DL) >> $@
@echo
$(DL)
import
@$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
@echo
$(DL)
import
@$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
@echo
$(DL)
import
@$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
@echo
$(DL)module clib$(DL) >> $@
else
@echo
$(DL)flag_on 64$(DL) >> $@
@echo
$(DL)pseudopreemption$(DL) >> $@
@echo
$(DL)start _LibCPrelude$(DL) >> $@
@echo
$(DL)
exit
_LibCPostlude$(DL) >> $@
@echo
$(DL)check _LibCCheckUnload$(DL) >> $@
@echo
$(DL)
import
@$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
libcares/ares_config.h.cmake view on Meta::CPAN
9899100101102103104105106107108109110111112113114115116117118/* Define to 1
if
you have a working
fcntl
O_NONBLOCK function. */
#cmakedefine HAVE_FCNTL_O_NONBLOCK
/* Define to 1
if
you have the freeaddrinfo function. */
#cmakedefine HAVE_FREEADDRINFO
/* Define to 1
if
you have a working getaddrinfo function. */
#cmakedefine HAVE_GETADDRINFO
/* Define to 1
if
the getaddrinfo function is threadsafe. */
#cmakedefine HAVE_GETADDRINFO_THREADSAFE
/* Define to 1
if
you have the getenv function. */
#cmakedefine HAVE_GETENV
/* Define to 1
if
you have the
gethostbyaddr
function. */
#cmakedefine HAVE_GETHOSTBYADDR
/* Define to 1
if
you have the
gethostbyname
function. */
#cmakedefine HAVE_GETHOSTBYNAME
libcares/ares_config.h.in view on Meta::CPAN
101102103104105106107108109110111112113114115116117118119120121/* Define to 1
if
you have a working
fcntl
O_NONBLOCK function. */
#undef HAVE_FCNTL_O_NONBLOCK
/* Define to 1
if
you have the freeaddrinfo function. */
#undef HAVE_FREEADDRINFO
/* Define to 1
if
you have a working getaddrinfo function. */
#undef HAVE_GETADDRINFO
/* Define to 1
if
the getaddrinfo function is threadsafe. */
#undef HAVE_GETADDRINFO_THREADSAFE
/* Define to 1
if
you have the getenv function. */
#undef HAVE_GETENV
/* Define to 1
if
you have the
gethostbyaddr
function. */
#undef HAVE_GETHOSTBYADDR
/* Define to 1
if
you have the
gethostbyname
function. */
#undef HAVE_GETHOSTBYNAME
libcares/ares_library_cleanup.3 view on Meta::CPAN
404142434445464748495051525354555657585960616263646566.PP
This function must be called
when
the program using c-ares will
no
longer need any c-ares function. Once the program
has
called
\fIares_library_cleanup(3)\fP sufficiently often such that the
library is uninitialised, it shall not make any further call to any
c-ares function.
.PP
This function does not cancel any pending c-ares lookups or requests
previously done. Program must
use
\fIares_cancel(3)\fP
for
this purpose.
.PP
.B This function is not thread safe.
You have to call it once the program is about to terminate, but this call must
be done once the program
has
terminated every single thread that it could have
initiated. This is required to avoid potential race conditions in library
deinitialization, and also due to the fact that \fIares_library_cleanup(3)\fP
might call functions from other libraries that are thread unsafe, and could
conflict
with
any other thread that is already using these other libraries.
.PP
Win32/64 application DLLs shall not call \fIares_library_cleanup(3)\fP from
the DllMain function. Doing so will produce deadlocks and other problems.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.7.0 along
with
the
definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_CLEANUP\fP as an
indication of the availability of this function. Reference counting in
\fIares_library_init()\fP and \fIares_library_cleanup()\fP, which requires
calls to the former function to match calls to the latter, is present since
c-ares version 1.10.0.
libcares/ares_library_init.3 view on Meta::CPAN
5354555657585960616263646566676869707172737475767778ORing the
values
together. In normal operation you should specify
familiar
with
it and trying to control some internal c-ares feature.
.PP
The
.B ares_library_init_mem
function allows the
caller
to provide memory management functions that the
\fIrealloc(3)\fP.
.PP
.B This function is not thread safe.
You have to call it once the program
has
started, but this call must be done
before
the program starts any other thread. This is required to avoid
potential race conditions in library initialization, and also due to the fact
that \fIares_library_init(3)\fP might call functions from other libraries that
are thread unsafe, and could conflict
with
any other thread that is already
using these other libraries.
.PP
On Windows platforms, the library user should ensure that \fIWSAStartup()\fP
is called
before
the c-ares library is initialized and used.
.PP
Win32/64 application DLLs shall not call \fIares_library_init(3)\fP from the
DllMain function. Doing so will produce deadlocks and other problems.
.SH FLAGS
.TP 5
.B ARES_LIB_INIT_ALL
libcares/ares_library_init_android.3 view on Meta::CPAN
5455565758596061626364656667686970717273747576777879use
the Connectivty Manager registered using
\fIares_library_init_android(3)\fP. This must be call
before
\fIares_library_init_android(3)\fP.
The \fBares_library_android_initialized\fP function can be used to check
whether c-ares
has
been initalized
for
use
with
Android.
.SH RETURN VALUES
ARES_SUCCESS will be returned on success otherwise an error code will be
returned.
.SH THREAD SAFETY
.B These init functions are not thread safe.
You have to call it once the program
has
started, but this call must be done
before
the program starts any other thread. This is required to avoid
potential race conditions in library initialization, and also due to the fact
these might call functions from other libraries that
are thread unsafe, and could conflict
with
any other thread that is already
using these other libraries.
.SH JNI
Accesing the Connectivity Manager though Java:
Register the \fIares_library_android_init\fP.
.nf
static JNINativeMethod funcs[] = {
{
"initialize_native"
,
"(Landroid/net/ConnectivityManager;)I"
,
(void *)
&ares_library_init_android
}
};
libcares/configure view on Meta::CPAN
5726572757285729573057315732573357345735573657375738573957405741574257435744574557465747esac
STRIP=
$ac_ct_STRIP
fi
else
STRIP=
"$ac_cv_prog_STRIP"
fi
fi
INSTALL_STRIP_PROGRAM=
"\$(install_sh) -c -s"
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p"
>&5
$as_echo_n
"checking for a thread-safe mkdir -p... "
>&6; }
if
test -z
"$MKDIR_P"
; then
if
${ac_cv_path_mkdir+:} false; then :
$as_echo_n
"(cached) "
>&6
else
as_save_IFS=
$IFS
; IFS=
$PATH_SEPARATOR
for
as_dir in
$PATH
$PATH_SEPARATOR
/opt/sfw/bin
do
IFS=
$as_save_IFS
test -z
"$as_dir"
&& as_dir=.
for
ac_prog in
mkdir
gmkdir;
do
libcares/configure view on Meta::CPAN
64836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541
;
return
0;
}
_ACEOF
if
ac_fn_c_try_compile
"$LINENO"
; then :
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: yes"
>&5
$as_echo
"yes"
>&6; }
tmp_thread_safe_initially_defined=
"yes"
else
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: no"
>&5
$as_echo
"no"
>&6; }
tmp_thread_safe_initially_defined=
"no"
fi
rm -f core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
#
if
test
"$tmp_thread_safe_initially_defined"
=
"no"
; then
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is actually needed"
>&5
$as_echo_n
"checking if _THREAD_SAFE is actually needed... "
>&6; }
case
$host_os
in
aix[123].* | aix4.[012].*)
tmp_need_thread_safe=
"no"
;;
aix*)
tmp_need_thread_safe=
"yes"
;;
*)
tmp_need_thread_safe=
"no"
;;
esac
if
test
"$tmp_need_thread_safe"
=
"yes"
; then
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: yes"
>&5
$as_echo
"yes"
>&6; }
else
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: no"
>&5
$as_echo
"no"
>&6; }
fi
fi
#
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is onwards defined"
>&5
$as_echo_n
"checking if _THREAD_SAFE is onwards defined... "
>&6; }
if
test
"$tmp_thread_safe_initially_defined"
=
"yes"
||
test
"$tmp_need_thread_safe"
=
"yes"
; then
$as_echo
"#define NEED_THREAD_SAFE 1"
>>confdefs.h
cat >>confdefs.h <<_EOF
#ifndef _THREAD_SAFE
# define _THREAD_SAFE
#endif
_EOF
libcares/configure view on Meta::CPAN
126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_minus_L=
no
hardcode_shlibpath_var=unsupported
inherit_rpath=
no
link_all_deplibs=unknown
module_cmds=
module_expsym_cmds=
old_archive_from_new_cmds=
old_archive_from_expsyms_cmds=
thread_safe_flag_spec=
whole_archive_flag_spec=
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
include_expsyms=
# exclude_expsyms can be an extended regexp of symbols to exclude
# it will be wrapped by ' (' and ')$', so one must not match beginning or
# end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
# as well as any symbol that contains 'd'.
exclude_expsyms=
'_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
libcares/configure view on Meta::CPAN
204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488
;;
#
HP_UX_C)
#
tmp_CFLAGS=
"$tmp_CFLAGS -z"
tmp_CFLAGS=
"$tmp_CFLAGS +W 4227,4255"
;;
#
IBM_C)
#
tmp_CPPFLAGS=
"$tmp_CPPFLAGS -qthreaded"
tmp_CPPFLAGS=
"$tmp_CPPFLAGS -qnoansialias"
tmp_CPPFLAGS=
"$tmp_CPPFLAGS -qhalt=e"
;;
#
INTEL_UNIX_C)
#
tmp_CFLAGS=
"$tmp_CFLAGS -std=gnu89"
tmp_CPPFLAGS=
"$tmp_CPPFLAGS -we 140,147,165,266"
tmp_CPPFLAGS=
"$tmp_CPPFLAGS -wd 279,981,1469"
;;
libcares/configure view on Meta::CPAN
2648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506cat >>confdefs.h
<<_ACEOF
#define HAVE_GETADDRINFO 1
_ACEOF
ac_cv_func_getaddrinfo=
"yes"
else
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: no"
>&5
$as_echo
"no"
>&6; }
ac_cv_func_getaddrinfo=
"no"
ac_cv_func_getaddrinfo_threadsafe=
"no"
fi
#
if
test
"$ac_cv_func_getaddrinfo"
=
"yes"
; then
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is threadsafe"
>&5
$as_echo_n
"checking if getaddrinfo is threadsafe... "
>&6; }
case
$host_os
in
aix[1234].* | aix5.[01].*)
tst_tsafe_getaddrinfo=
"no"
;;
aix*)
tst_tsafe_getaddrinfo=
"yes"
;;
darwin[12345].*)
tst_tsafe_getaddrinfo=
"no"
;;
libcares/configure view on Meta::CPAN
2664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671
fi
fi
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: $tst_tsafe_getaddrinfo"
>&5
$as_echo
"$tst_tsafe_getaddrinfo"
>&6; }
if
test
"$tst_tsafe_getaddrinfo"
=
"yes"
; then
cat >>confdefs.h
<<_ACEOF
#define HAVE_GETADDRINFO_THREADSAFE 1
_ACEOF
ac_cv_func_getaddrinfo_threadsafe=
"yes"
else
ac_cv_func_getaddrinfo_threadsafe=
"no"
fi
fi
#
tst_links_getenv=
"unknown"
tst_proto_getenv=
"unknown"
tst_compi_getenv=
"unknown"
tst_allow_getenv=
"unknown"
#
libcares/configure.ac view on Meta::CPAN
458459460461462463464465466467468469470471472473474475476477478
;;
*) AC_MSG_RESULT(
no
)
;;
esac ],
AC_MSG_RESULT(
no
)
)
dnl Let's hope this
split
URL remains working:
dnl genprogc/thread_quick_ref.htm
dnl **********************************************************************
dnl Back to
"normal"
configuring
dnl **********************************************************************
dnl Checks
for
header files.
AC_HEADER_STDC
CURL_CHECK_HEADER_MALLOC
libcares/inet_net_pton.c view on Meta::CPAN
515253545556575859606162636465666768697071* accepts
hex
octets,
hex
strings, decimal octets, and /CIDR.
*
"size"
is in bytes and describes
"dst"
.
*
return
:
* number of bits, either imputed classfully or specified
with
/CIDR,
* or -1
if
some failure occurred (check errno). ENOENT means it was
* not an IPv4 network specification.
* note:
* network byte order assumed. this means 192.5.5.240/28
has
* 0b11110000 in its fourth octet.
* note:
* On Windows we store the error in the thread errno, not
* in the winsock error code. This is to avoid loosing the
* errno this funtion sets
when
returning (-1), not SOCKERRNO.
* author:
* Paul Vixie (ISC), June 1996
*/
static
int
inet_net_pton_ipv4(const char
*src
, unsigned char
*dst
, size_t size)
{
static const char xdigits[] =
"0123456789abcdef"
;
libcares/inet_net_pton.c view on Meta::CPAN
390391392393394395396397398399400401402403404405406407408409410*
int
* inet_net_pton(af, src, dst, size)
* convert network number from presentation to network
format
.
* accepts
hex
octets,
hex
strings, decimal octets, and /CIDR.
*
"size"
is in bytes and describes
"dst"
.
*
return
:
* number of bits, either imputed classfully or specified
with
/CIDR,
* or -1
if
some failure occurred (check errno). ENOENT means it was
* not a valid network specification.
* note:
* On Windows we store the error in the thread errno, not
* in the winsock error code. This is to avoid loosing the
* errno this funtion sets
when
returning (-1), not SOCKERRNO.
* author:
* Paul Vixie (ISC), June 1996
*/
int
ares_inet_net_pton(
int
af, const char
*src
, void
*dst
, size_t size)
{
switch (af) {
libcares/inet_ntop.c view on Meta::CPAN
444546474849505152535455565758596061626364static const char
*inet_ntop4
(const unsigned char
*src
, char
*dst
, size_t size);
static const char
*inet_ntop6
(const unsigned char
*src
, char
*dst
, size_t size);
/* char *
* inet_ntop(af, src, dst, size)
* convert a network
format
address to presentation
format
.
*
return
:
* pointer to presentation
format
address (`dst'), or NULL (see errno).
* note:
* On Windows we store the error in the thread errno, not
* in the winsock error code. This is to avoid loosing the
* errno this function sets
when
returning NULL, not SOCKERRNO.
* author:
* Paul Vixie, 1996.
*/
const char *
ares_inet_ntop(
int
af, const void
*src
, char
*dst
, ares_socklen_t size)
{
switch (af) {
libcares/ltmain.sh view on Meta::CPAN
654965506551655265536554655565566557655865596560656165626563656465656566656765686569precious_files_regex=
prefer_static_libs=
no
preload=false
prev=
prevarg=
release=
rpath=
xrpath=
perm_rpath=
temp_rpath=
thread_safe=
no
vinfo=
vinfo_number=
no
weak_libs=
single_module=
$wl
-single_module
func_infer_tag
$base_compile
# We need to know -static, to get the right output filenames.
for
arg
do
case
$arg
in
libcares/ltmain.sh view on Meta::CPAN
7026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C and math libraries are in the System framework
func_append deplibs
" System.ltframework"
continue
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
test X-
lc
=
"X$arg"
&&
continue
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
test X-
lc
=
"X$arg"
&&
continue
;;
esac
elif test X-lc_r =
"X$arg"
; then
case
$host
in
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
# Do not include libc_r directly, use -pthread flag.
continue
;;
esac
fi
func_append deplibs
" $arg"
continue
;;
-mllvm)
prev=mllvm
libcares/ltmain.sh view on Meta::CPAN
706370647065706670677068706970707071707270737074707570767077707870797080708170827083# classes, name mangling, and exception handling.
# Darwin uses the -arch flag to determine output architecture.
-model|-arch|-isysroot|--sysroot)
func_append compiler_flags
" $arg"
func_append compile_command
" $arg"
func_append finalize_command
" $arg"
prev=xcompiler
continue
;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
func_append compiler_flags
" $arg"
func_append compile_command
" $arg"
func_append finalize_command
" $arg"
case
"$new_inherited_linker_flags "
in
*
" $arg "
*) ;;
* ) func_append new_inherited_linker_flags
" $arg"
;;
esac
continue
;;
libcares/ltmain.sh view on Meta::CPAN
7176717771787179718071817182718371847185718671877188718971907191719271937194719571967197-static | -static-libtool-libs)
# The effects of -static are defined in a previous loop.
# We used to do the same as -all-static on platforms that
# didn't have a PIC flag, but the assumption that the effects
# would be equivalent was wrong. It would break on at least
# Digital Unix and AIX.
continue
;;
-thread-safe)
thread_safe=yes
continue
;;
-version-info)
prev=vinfo
continue
;;
-version-number)
prev=vinfo
libcares/ltmain.sh view on Meta::CPAN
7603760476057606760776087609761076117612761376147615761676177618761976207621762276237624if
test dlopen =
"$pass"
; then
# Collect dlpreopened libraries
save_deplibs=
$deplibs
deplibs=
fi
for
deplib in
$libs
;
do
lib=
found=false
case
$deplib
in
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
if
test prog,
link
=
"$linkmode,$pass"
; then
compile_deplibs=
"$deplib $compile_deplibs"
finalize_deplibs=
"$deplib $finalize_deplibs"
else
func_append compiler_flags
" $deplib"
if
test lib =
"$linkmode"
; then
case
"$new_inherited_linker_flags "
in
*
" $deplib "
*) ;;
* ) func_append new_inherited_linker_flags
" $deplib"
;;
esac
libcares/ltmain.sh view on Meta::CPAN
91319132913391349135913691379138913991409141914291439144914591469147914891499150
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;;
*)
# Add libc to deplibs on all other systems if necessary.
if
test yes =
"$build_libtool_need_lc"
; then
func_append deplibs
" -lc"
fi
;;
esac
fi
libcares/ltmain.sh view on Meta::CPAN
9764976597669767976897699770977197729773977497759776977797789779978097819782978397849785
else
gentop=
$output_objdir
/${outputname}x
func_append generated
" $gentop"
func_extract_archives
$gentop
$convenience
func_append libobjs
" $func_extract_archives_result"
test
"X$libobjs"
=
"X "
&& libobjs=
fi
fi
if
test yes =
"$thread_safe"
&& test -n
"$thread_safe_flag_spec"
; then
eval
flag=\"
$thread_safe_flag_spec
\"
func_append linker_flags
" $flag"
fi
# Make a backup of the uninstalled library when relinking
if
test relink =
"$opt_mode"
; then
$opt_dry_run
||
eval
'(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)'
||
exit
$?
fi
# Do each of the archive commands.
if
test yes =
"$module"
&& test -n
"$module_cmds"
; then
libcares/m4/ax_pthread.m4 view on Meta::CPAN
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758# ===========================================================================
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
libcares/m4/ax_pthread.m4 view on Meta::CPAN
81828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 21
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PUSH([C])
ax_pthread_ok=
no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if
test x
"$PTHREAD_LIBS$PTHREAD_CFLAGS"
!= x; then
save_CFLAGS=
"$CFLAGS"
CFLAGS=
"$CFLAGS $PTHREAD_CFLAGS"
save_LIBS=
"$LIBS"
LIBS=
"$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([
for
pthread_join in LIBS=
$PTHREAD_LIBS
with
CFLAGS=
$PTHREAD_CFLAGS
])
AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
AC_MSG_RESULT([
$ax_pthread_ok
])
if
test x
"$ax_pthread_ok"
= xno; then
PTHREAD_LIBS=
""
PTHREAD_CFLAGS=
""
fi
LIBS=
"$save_LIBS"
CFLAGS=
"$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags=
"pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
ax_pthread_flags=
"-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags=
"-pthread $ax_pthread_flags"
;;
esac
# Clang doesn't consider unrecognized options an error unless we specify
# -Werror. We throw in some extra Clang-specific options to ensure that
# this doesn't happen for GCC, which also accepts -Werror.
AC_MSG_CHECKING([
if
compiler needs -Werror to reject unknown flags])
save_CFLAGS=
"$CFLAGS"
ax_pthread_extra_flags=
"-Werror"
CFLAGS=
"$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
int
foo(void);],[foo()])],
[AC_MSG_RESULT([yes])],
[ax_pthread_extra_flags=
AC_MSG_RESULT([
no
])])
CFLAGS=
"$save_CFLAGS"
if
test x
"$ax_pthread_ok"
= xno; then
for
flag in
$ax_pthread_flags
;
do
case
$flag
in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work
with
$flag
])
PTHREAD_CFLAGS=
"$flag"
;;
pthread-config)
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [
no
])
if
test x
"$ax_pthread_config"
= xno; then
continue
; fi
PTHREAD_CFLAGS=
"`pthread-config --cflags`"
PTHREAD_LIBS=
"`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([
for
the pthreads library -l
$flag
])
PTHREAD_LIBS=
"-l$flag"
;;
esac
save_LIBS=
"$LIBS"
save_CFLAGS=
"$CFLAGS"
LIBS=
"$PTHREAD_LIBS $LIBS"
CFLAGS=
"$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <pthread.h>
static void routine(void
*a
) { a = 0; }
static void
*start_routine
(void
*a
) {
return
a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(
&th
, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(
&attr
);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
LIBS=
"$save_LIBS"
CFLAGS=
"$save_CFLAGS"
AC_MSG_RESULT([
$ax_pthread_ok
])
if
test
"x$ax_pthread_ok"
= xyes; then
break;
fi
PTHREAD_LIBS=
""
PTHREAD_CFLAGS=
""
done
fi
# Various other checks:
if
test
"x$ax_pthread_ok"
= xyes; then
save_LIBS=
"$LIBS"
LIBS=
"$PTHREAD_LIBS $LIBS"
save_CFLAGS=
"$CFLAGS"
CFLAGS=
"$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([
for
joinable pthread attribute])
attr_name=unknown
for
attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED;
do
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <pthread.h>],
[
int
attr =
$attr
;
return
attr /* ; */])],
[attr_name=
$attr
; break],
[])
done
AC_MSG_RESULT([
$attr_name
])
if
test
"$attr_name"
!= PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [
$attr_name
],
[Define to necessary symbol
if
this constant
uses a non-standard name on your
system
.])
fi
AC_MSG_CHECKING([
if
more special flags are required
for
pthreads])
flag=
no
case ${host_os} in
aix* | freebsd* | darwin*) flag=
"-D_THREAD_SAFE"
;;
osf* | hpux*) flag=
"-D_REENTRANT"
;;
solaris*)
if
test
"$GCC"
=
"yes"
; then
flag=
"-D_REENTRANT"
else
# TODO: What about Clang on Solaris?
flag=
"-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT([
$flag
])
if
test
"x$flag"
!= xno; then
PTHREAD_CFLAGS=
"$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([
for
PTHREAD_PRIO_INHERIT],
[ax_cv_PTHREAD_PRIO_INHERIT], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>]],
[[
int
i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=
no
])
])
AS_IF([test
"x$ax_cv_PTHREAD_PRIO_INHERIT"
=
"xyes"
],
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
LIBS=
"$save_LIBS"
CFLAGS=
"$save_CFLAGS"
libcares/m4/ax_pthread.m4 view on Meta::CPAN
314315316317318319320321322323324325326327328329330331332
fi
fi
test -n
"$PTHREAD_CC"
|| PTHREAD_CC=
"$CC"
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_CC])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if
test x
"$ax_pthread_ok"
= xyes; then
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define
if
you have POSIX threads libraries and header files.])],[$1])
:
else
ax_pthread_ok=
no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD
libcares/m4/cares-compilers.m4 view on Meta::CPAN
580581582583584585586587588589590591592593594595596597598599600601
dnl Disallow run-
time
dereferencing of null pointers
tmp_CFLAGS=
"$tmp_CFLAGS -z"
dnl Disable some remarks
dnl
#4227: padding struct with n bytes to align member
dnl
#4255: padding size of struct with n bytes to alignment boundary
tmp_CFLAGS=
"$tmp_CFLAGS +W 4227,4255"
;;
#
IBM_C)
#
dnl Ensure that compiler optimizations are always thread-safe.
tmp_CPPFLAGS=
"$tmp_CPPFLAGS -qthreaded"
dnl Disable type based strict aliasing optimizations, using worst
dnl case aliasing assumptions
when
compiling. Type based aliasing
dnl would restrict the lvalues that could be safely used to access
dnl a data object.
tmp_CPPFLAGS=
"$tmp_CPPFLAGS -qnoansialias"
dnl Force compiler to stop
after
the compilation phase, without
dnl generating an object code file
when
compilation
has
errors.
tmp_CPPFLAGS=
"$tmp_CPPFLAGS -qhalt=e"
;;
#
libcares/m4/cares-functions.m4 view on Meta::CPAN
867868869870871872873874875876877878879880881882883884885886887dnl CARES_CHECK_FUNC_GETADDRINFO
dnl -------------------------------------------------
dnl Verify
if
getaddrinfo is available, prototyped, can
dnl be compiled and seems to work. If all of these are
dnl true, and usage
has
not been previously disallowed
dnl
with
shell variable cares_disallow_getaddrinfo, then
dnl HAVE_GETADDRINFO will be
defined
. Additionally
when
dnl HAVE_GETADDRINFO gets
defined
this will also attempt
dnl to find out
if
getaddrinfo happens to be threadsafe,
dnl defining HAVE_GETADDRINFO_THREADSAFE
when
true.
AC_DEFUN([CARES_CHECK_FUNC_GETADDRINFO], [
AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl
AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
AC_REQUIRE([CARES_INCLUDES_STRING])dnl
AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
#
libcares/m4/cares-functions.m4 view on Meta::CPAN
99899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
test
"$tst_compi_getaddrinfo"
=
"yes"
&&
test
"$tst_allow_getaddrinfo"
=
"yes"
&&
test
"$tst_works_getaddrinfo"
!=
"no"
; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1,
[Define to 1
if
you have a working getaddrinfo function.])
ac_cv_func_getaddrinfo=
"yes"
else
AC_MSG_RESULT([
no
])
ac_cv_func_getaddrinfo=
"no"
ac_cv_func_getaddrinfo_threadsafe=
"no"
fi
#
if
test
"$ac_cv_func_getaddrinfo"
=
"yes"
; then
AC_MSG_CHECKING([
if
getaddrinfo is threadsafe])
case
$host_os
in
aix[[1234]].* | aix5.[[01]].*)
dnl aix 5.1 and older
tst_tsafe_getaddrinfo=
"no"
;;
aix*)
dnl aix 5.2 and newer
tst_tsafe_getaddrinfo=
"yes"
;;
darwin[[12345]].*)
libcares/m4/cares-functions.m4 view on Meta::CPAN
110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
test
"$tst_h_errno_modifiable_lvalue"
=
"no"
&&
test
"$tst_h_errno_sbs_issue_7"
=
"no"
; then
tst_tsafe_getaddrinfo=
"no"
else
tst_tsafe_getaddrinfo=
"yes"
fi
fi
AC_MSG_RESULT([
$tst_tsafe_getaddrinfo
])
if
test
"$tst_tsafe_getaddrinfo"
=
"yes"
; then
AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1,
[Define to 1
if
the getaddrinfo function is threadsafe.])
ac_cv_func_getaddrinfo_threadsafe=
"yes"
else
ac_cv_func_getaddrinfo_threadsafe=
"no"
fi
fi
])
dnl CARES_CHECK_FUNC_GETENV
dnl -------------------------------------------------
dnl Verify
if
getenv is available, prototyped, and
dnl can be compiled. If all of these are true, and
dnl usage
has
not been previously disallowed
with
libcares/m4/cares-reentrant.m4 view on Meta::CPAN
436437438439440441442443444445446447448449450451452453454455456457458459460461462463dnl CARES_CHECK_NEED_THREAD_SAFE_SYSTEM
dnl -------------------------------------------------
dnl Checks
if
the preprocessor _THREAD_SAFE definition
dnl must be unconditionally done
for
this platform.
dnl Internal macro
for
CARES_CONFIGURE_THREAD_SAFE.
AC_DEFUN([CARES_CHECK_NEED_THREAD_SAFE_SYSTEM], [
case
$host_os
in
aix[[123]].* | aix4.[[012]].*)
dnl aix 4.2 and older
tmp_need_thread_safe=
"no"
;;
aix*)
dnl AIX 4.3 and newer
tmp_need_thread_safe=
"yes"
;;
*)
tmp_need_thread_safe=
"no"
;;
esac
])
dnl CARES_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
dnl -------------------------------------------------
dnl This macro ensures that configuration tests done
dnl
after
this will execute
with
preprocessor symbol
dnl _REENTRANT
defined
. This macro also ensures that
libcares/m4/cares-reentrant.m4 view on Meta::CPAN
576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
AC_LANG_PROGRAM([[
]],[[
#ifdef _THREAD_SAFE
int
dummy=1;
#else
force compilation error
#endif
]])
],[
AC_MSG_RESULT([yes])
tmp_thread_safe_initially_defined=
"yes"
],[
AC_MSG_RESULT([
no
])
tmp_thread_safe_initially_defined=
"no"
])
#
if
test
"$tmp_thread_safe_initially_defined"
=
"no"
; then
AC_MSG_CHECKING([
if
_THREAD_SAFE is actually needed])
CARES_CHECK_NEED_THREAD_SAFE_SYSTEM
if
test
"$tmp_need_thread_safe"
=
"yes"
; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([
no
])
fi
fi
#
AC_MSG_CHECKING([
if
_THREAD_SAFE is onwards
defined
])
if
test
"$tmp_thread_safe_initially_defined"
=
"yes"
||
test
"$tmp_need_thread_safe"
=
"yes"
; then
CARES_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([
no
])
fi
#
])
libcares/m4/libtool.m4 view on Meta::CPAN
497049714972497349744975497649774978497949804981498249834984498549864987498849894990_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=
no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
_LT_TAGVAR(inherit_rpath, $1)=
no
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(old_archive_from_new_cmds, $1)=
_LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
_LT_TAGVAR(thread_safe_flag_spec, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
_LT_TAGVAR(include_expsyms, $1)=
# exclude_expsyms can be an extended regexp of symbols to exclude
# it will be wrapped by ' (' and ')$', so one must not match beginning or
# end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
# as well as any symbol that contains 'd'.
_LT_TAGVAR(exclude_expsyms, $1)=[
'_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
]
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
libcares/m4/libtool.m4 view on Meta::CPAN
6195619661976198619962006201620262036204620562066207620862096210621162126213621462156216
[Symbols that should not be listed in the preloaded symbols])
_LT_TAGDECL([], [include_expsyms], [1],
[Symbols that must always be exported])
_LT_TAGDECL([], [prelink_cmds], [2],
[Commands necessary
for
linking programs (against libraries)
with
templates])
_LT_TAGDECL([], [postlink_cmds], [2],
[Commands necessary
for
finishing linking programs])
_LT_TAGDECL([], [file_list_spec], [1],
[Specify filename containing input files])
dnl FIXME: Not yet implemented
dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
dnl [Compiler flag to generate thread safe objects])
])
# _LT_LINKER_SHLIBS
# _LT_LANG_C_CONFIG([TAG])
# ------------------------
# Ensure that the configuration variables for a C compiler are suitably
# defined. These variables are subsequently used by _LT_CONFIG to write
# the compiler configuration to 'libtool'.
m4_defun([_LT_LANG_C_CONFIG],
[m4_require([_LT_DECL_EGREP])dnl
libcares/mkinstalldirs view on Meta::CPAN
6263646566676869707172737475767778798081828384858687
shift
else
break
fi
done
case $
# in
0)
exit
0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case
$dirmode
in
''
)
if
mkdir
-p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo
"mkdir -p -- $*"
exec
mkdir
-p --
"$@"
else
# On NextStep and OpenStep, the 'mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because '.' already
# exists.
libcares/test/Makefile.in view on Meta::CPAN
919293949596979899100101102103104105106107108109110111host_triplet =
@host
@
TESTS = arestest$(EXEEXT) fuzzcheck.sh
noinst_PROGRAMS = arestest$(EXEEXT) aresfuzz$(EXEEXT) \
aresfuzzname$(EXEEXT) dnsdump$(EXEEXT)
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../m4/ax_check_user_namespace.m4 \
$(top_srcdir)/../m4/ax_check_uts_namespace.m4 \
$(top_srcdir)/../m4/ax_code_coverage.m4 \
$(top_srcdir)/../m4/ax_cxx_compile_stdcxx_11.m4 \
$(top_srcdir)/../m4/ax_pthread.m4 \
$(top_srcdir)/../m4/libtool.m4 \
$(top_srcdir)/../m4/ltoptions.m4 \
$(top_srcdir)/../m4/ltsugar.m4 \
$(top_srcdir)/../m4/ltversion.m4 \
$(top_srcdir)/../m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.
log
\
libcares/test/Makefile.in view on Meta::CPAN
548549550551552553554555556557558559560561562563564565566567568abs_top_srcdir =
@abs_top_srcdir
@
ac_ct_AR =
@ac_ct_AR
@
ac_ct_CC =
@ac_ct_CC
@
ac_ct_CXX =
@ac_ct_CXX
@
ac_ct_DUMPBIN =
@ac_ct_DUMPBIN
@
am__include =
@am__include
@
am__leading_dot =
@am__leading_dot
@
am__quote =
@am__quote
@
am__tar =
@am__tar
@
am__untar =
@am__untar
@
ax_pthread_config =
@ax_pthread_config
@
bindir =
@bindir
@
build =
@build
@
build_alias =
@build_alias
@
build_cpu =
@build_cpu
@
build_os =
@build_os
@
build_vendor =
@build_vendor
@
builddir =
@builddir
@
datadir =
@datadir
@
datarootdir =
@datarootdir
@
docdir =
@docdir
@
libcares/test/aclocal.m4 view on Meta::CPAN
1147114811491150115111521153115411551156115711581159116011611162
AC_MSG_RESULT([
$am_cv_prog_tar_
$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
])
# _AM_PROG_TAR
m4_include([../m4/ax_check_user_namespace.m4])
m4_include([../m4/ax_check_uts_namespace.m4])
m4_include([../m4/ax_code_coverage.m4])
m4_include([../m4/ax_cxx_compile_stdcxx_11.m4])
m4_include([../m4/ax_pthread.m4])
m4_include([../m4/libtool.m4])
m4_include([../m4/ltoptions.m4])
m4_include([../m4/ltsugar.m4])
m4_include([../m4/ltversion.m4])
m4_include([../m4/lt~obsolete.m4])
libcares/test/config.h.in view on Meta::CPAN
111213141516171819202122232425262728293031/* Define to 1
if
you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1
if
you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1
if
you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
/* Define
if
you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
/* Define to 1
if
you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1
if
you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
libcares/test/configure view on Meta::CPAN
640641642643644645646647648649650651652653654655656657658659660CODE_COVERAGE_CFLAGS
GENHTML
LCOV
GCOV
CODE_COVERAGE_ENABLED
CODE_COVERAGE_ENABLED_FALSE
CODE_COVERAGE_ENABLED_TRUE
PTHREAD_CFLAGS
PTHREAD_LIBS
PTHREAD_CC
ax_pthread_config
LIBTOOL_DEPS
CXXCPP
CPP
LT_SYS_LIBRARY_PATH
OTOOL64
OTOOL
LIPO
NMEDIT
DSYMUTIL
MANIFEST_TOOL
libcares/test/configure view on Meta::CPAN
2701270227032704270527062707270827092710271127122713271427152716271727182719272027212722esac
STRIP=
$ac_ct_STRIP
fi
else
STRIP=
"$ac_cv_prog_STRIP"
fi
fi
INSTALL_STRIP_PROGRAM=
"\$(install_sh) -c -s"
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p"
>&5
$as_echo_n
"checking for a thread-safe mkdir -p... "
>&6; }
if
test -z
"$MKDIR_P"
; then
if
${ac_cv_path_mkdir+:} false; then :
$as_echo_n
"(cached) "
>&6
else
as_save_IFS=
$IFS
; IFS=
$PATH_SEPARATOR
for
as_dir in
$PATH
$PATH_SEPARATOR
/opt/sfw/bin
do
IFS=
$as_save_IFS
test -z
"$as_dir"
&& as_dir=.
for
ac_prog in
mkdir
gmkdir;
do
libcares/test/configure view on Meta::CPAN
959395949595959695979598959996009601960296039604960596069607960896099610961196129613hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_minus_L=
no
hardcode_shlibpath_var=unsupported
inherit_rpath=
no
link_all_deplibs=unknown
module_cmds=
module_expsym_cmds=
old_archive_from_new_cmds=
old_archive_from_expsyms_cmds=
thread_safe_flag_spec=
whole_archive_flag_spec=
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
include_expsyms=
# exclude_expsyms can be an extended regexp of symbols to exclude
# it will be wrapped by ' (' and ')$', so one must not match beginning or
# end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
# as well as any symbol that contains 'd'.
exclude_expsyms=
'_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
libcares/test/configure view on Meta::CPAN
1603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321ac_ext=c
ac_cpp=
'$CPP $CPPFLAGS'
ac_compile=
'$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link=
'$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=
$ac_cv_c_compiler_gnu
ax_pthread_ok=
no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if
test x
"$PTHREAD_LIBS$PTHREAD_CFLAGS"
!= x; then
save_CFLAGS=
"$CFLAGS"
CFLAGS=
"$CFLAGS $PTHREAD_CFLAGS"
save_LIBS=
"$LIBS"
LIBS=
"$PTHREAD_LIBS $LIBS"
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS"
>&5
$as_echo_n
"checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... "
>&6; }
cat confdefs.h -
<<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pthread_join ();
int
main ()
{
return pthread_join ();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"$LINENO"
; then :
ax_pthread_ok=yes
fi
rm -f core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok"
>&5
$as_echo
"$ax_pthread_ok"
>&6; }
if
test x
"$ax_pthread_ok"
= xno; then
PTHREAD_LIBS=
""
PTHREAD_CFLAGS=
""
fi
LIBS=
"$save_LIBS"
CFLAGS=
"$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags=
"pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
ax_pthread_flags=
"-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags=
"-pthread $ax_pthread_flags"
;;
esac
# Clang doesn't consider unrecognized options an error unless we specify
# -Werror. We throw in some extra Clang-specific options to ensure that
# this doesn't happen for GCC, which also accepts -Werror.
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking if compiler needs -Werror to reject unknown flags"
>&5
$as_echo_n
"checking if compiler needs -Werror to reject unknown flags... "
>&6; }
save_CFLAGS=
"$CFLAGS"
ax_pthread_extra_flags=
"-Werror"
CFLAGS=
"$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
cat confdefs.h -
<<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo(void);
int
main ()
{
foo()
;
return 0;
}
_ACEOF
if
ac_fn_c_try_compile
"$LINENO"
; then :
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: yes"
>&5
$as_echo
"yes"
>&6; }
else
ax_pthread_extra_flags=
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: no"
>&5
$as_echo
"no"
>&6; }
fi
rm -f core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
CFLAGS=
"$save_CFLAGS"
if
test x
"$ax_pthread_ok"
= xno; then
for
flag in
$ax_pthread_flags
;
do
case
$flag
in
none)
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags"
>&5
$as_echo_n
"checking whether pthreads work without any flags... "
>&6; }
;;
-*)
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag"
>&5
$as_echo_n
"checking whether pthreads work with $flag... "
>&6; }
PTHREAD_CFLAGS=
"$flag"
;;
pthread-config)
# Extract the first word of "pthread-config", so it can be a program name with args.
set dummy pthread-config; ac_word=$2
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking for $ac_word"
>&5
$as_echo_n
"checking for $ac_word... "
>&6; }
if
${ac_cv_prog_ax_pthread_config+:} false; then :
$as_echo_n
"(cached) "
>&6
else
if
test -n
"$ax_pthread_config"
; then
ac_cv_prog_ax_pthread_config=
"$ax_pthread_config"
# Let the user override the test.
else
as_save_IFS=
$IFS
; IFS=
$PATH_SEPARATOR
for
as_dir in
$PATH
do
IFS=
$as_save_IFS
test -z
"$as_dir"
&& as_dir=.
for
ac_exec_ext in
''
$ac_executable_extensions
;
do
if
as_fn_executable_p
"$as_dir/$ac_word$ac_exec_ext"
; then
ac_cv_prog_ax_pthread_config=
"yes"
$as_echo
"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext"
>&5
break 2
fi
done
done
IFS=
$as_save_IFS
test -z
"$ac_cv_prog_ax_pthread_config"
&& ac_cv_prog_ax_pthread_config=
"no"
fi
fi
ax_pthread_config=
$ac_cv_prog_ax_pthread_config
if
test -n
"$ax_pthread_config"
; then
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config"
>&5
$as_echo
"$ax_pthread_config"
>&6; }
else
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: no"
>&5
$as_echo
"no"
>&6; }
fi
if
test x
"$ax_pthread_config"
= xno; then
continue
; fi
PTHREAD_CFLAGS=
"`pthread-config --cflags`"
PTHREAD_LIBS=
"`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag"
>&5
$as_echo_n
"checking for the pthreads library -l$flag... "
>&6; }
PTHREAD_LIBS=
"-l$flag"
;;
esac
save_LIBS=
"$LIBS"
save_CFLAGS=
"$CFLAGS"
LIBS=
"$PTHREAD_LIBS $LIBS"
CFLAGS=
"$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
cat confdefs.h -
<<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }
int
main ()
{
pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"$LINENO"
; then :
ax_pthread_ok=yes
fi
rm -f core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
LIBS=
"$save_LIBS"
CFLAGS=
"$save_CFLAGS"
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok"
>&5
$as_echo
"$ax_pthread_ok"
>&6; }
if
test
"x$ax_pthread_ok"
= xyes; then
break;
fi
PTHREAD_LIBS=
""
PTHREAD_CFLAGS=
""
done
fi
# Various other checks:
if
test
"x$ax_pthread_ok"
= xyes; then
save_LIBS=
"$LIBS"
LIBS=
"$PTHREAD_LIBS $LIBS"
save_CFLAGS=
"$CFLAGS"
CFLAGS=
"$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute"
>&5
$as_echo_n
"checking for joinable pthread attribute... "
>&6; }
attr_name=unknown
for
attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED;
do
cat confdefs.h -
<<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pthread.h>
int
main ()
{
int attr = $attr; return attr /* ; */
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"$LINENO"
; then :
attr_name=
$attr
; break
libcares/test/configure view on Meta::CPAN
16326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347
{
$as_echo
"$as_me:${as_lineno-$LINENO}: result: $attr_name"
>&5
$as_echo
"$attr_name"
>&6; }
if
test
"$attr_name"
!= PTHREAD_CREATE_JOINABLE; then
cat >>confdefs.h
<<_ACEOF
#define PTHREAD_CREATE_JOINABLE $attr_name
_ACEOF
fi
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads"
>&5
$as_echo_n
"checking if more special flags are required for pthreads... "
>&6; }
flag=
no
case ${host_os} in
aix* | freebsd* | darwin*) flag=
"-D_THREAD_SAFE"
;;
osf* | hpux*) flag=
"-D_REENTRANT"
;;
solaris*)
if
test
"$GCC"
=
"yes"
; then
flag=
"-D_REENTRANT"
else
# TODO: What about Clang on Solaris?
flag=
"-mt -D_REENTRANT"
libcares/test/configure view on Meta::CPAN
163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375
fi
{
$as_echo
"$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT"
>&5
$as_echo_n
"checking for PTHREAD_PRIO_INHERIT... "
>&6; }
if
${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then :
$as_echo_n
"(cached) "
>&6
else
cat confdefs.h -
<<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pthread.h>
int
main ()
{
int i = PTHREAD_PRIO_INHERIT;
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"$LINENO"
; then :
ax_cv_PTHREAD_PRIO_INHERIT=yes
libcares/test/configure view on Meta::CPAN
164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479
fi
fi
test -n
"$PTHREAD_CC"
|| PTHREAD_CC=
"$CC"
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if
test x
"$ax_pthread_ok"
= xyes; then
$as_echo
"#define HAVE_PTHREAD 1"
>>confdefs.h
:
else
ax_pthread_ok=
no
fi
ac_ext=c
ac_cpp=
'$CPP $CPPFLAGS'
ac_compile=
'$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link=
'$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=
$ac_cv_c_compiler_gnu
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146namespace testing {
// This helper class can be used to mock out Google Test failure reporting
// so that we can test Google Test or code that builds on Google Test.
//
// An object of this class appends a TestPartResult object to the
// TestPartResultArray object
given
in the constructor whenever a Google Test
// failure is reported. It can either intercept only failures that are
// generated in the same thread that created this object or it can intercept
// all generated failures. The scope of this mock object can be controlled
with
// the second argument to the two arguments constructor.
class GTEST_API_ ScopedFakeTestPartResultReporter
: public TestPartResultReporterInterface {
public:
// The two possible mocking modes of this object.
enum InterceptMode {
INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread
local
failures.
INTERCEPT_ALL_THREADS // Intercepts all failures.
};
// The c'tor sets this object as the test part result reporter used
// by Google Test. The
'result'
parameter specifies where to report the
// results. This reporter will only
catch
failures generated in the current
// thread. DEPRECATED
explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
// Same as above, but you can choose the interception scope of this object.
ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
TestPartResultArray* result);
// The d'tor restores the previous test part result reporter.
virtual ~ScopedFakeTestPartResultReporter();
// Appends the TestPartResult object to the TestPartResultArray
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
184185186187188189190191192193194195196197198199200201202203204205} // namespace internal
} // namespace testing
// A set of macros
for
testing Google Test assertions or code that's expected
// to generate Google Test fatal failures. It verifies that the
given
// statement will cause exactly one fatal Google Test failure
with
'https://metacpan.org/pod/substr">substr'
// being part of the failure message.
//
// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
// affects and considers failures generated in the current thread and
// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but
for
all threads.
//
// The verification of the assertion is done correctly even
when
the statement
// throws an exception or aborts the current function.
//
// Known restrictions:
// -
'statement'
cannot reference
local
non-static variables or
// non-static members of the current object.
// -
'statement'
cannot
return
a value.
// - You cannot stream a failure message to this macro.
//
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
241242243244245246247248249250251252253254255256257258259260261262
GTestExpectFatalFailureHelper::Execute();\
}\
}
while
(::testing::internal::AlwaysFalse())
// A macro
for
testing Google Test assertions or code that's expected to
// generate Google Test non-fatal failures. It asserts that the
given
// statement will cause exactly one non-fatal Google Test failure
with
'https://metacpan.org/pod/substr">substr'
// being part of the failure message.
//
// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
// affects and considers failures generated in the current thread and
// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but
for
all threads.
//
//
'statement'
is allowed to reference
local
variables and members of
// the current object.
//
// The verification of the assertion is done correctly even
when
the statement
// throws an exception or aborts the current function.
//
// Known restrictions:
// - You cannot stream a failure message to this macro.
//
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
520521522523524525526527528529530531532533534535536537538539540541GTEST_API_ TimeInMillis GetTimeInMillis();
GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
// Formats the
given
time
in milliseconds as seconds.
GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
// Converts the
given
time
in milliseconds to a date string in the ISO 8601
// non-reentrant
localtime
() function, this function is not thread safe. Do
GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);
// Parses a string
for
an Int32 flag, in the form of
"--flag=value"
.
//
// On success, stores the value of the flag in
*value
, and returns
// true. On failure, returns false without changing
*value
.
GTEST_API_ bool ParseInt32Flag(
const char* str, const char* flag, Int32* value);
// Returns a random seed in range [1, kMaxRandomSeed] based on the
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
876877878879880881882883884885886887888889890891892893894895896
// Implements the TestPartResultReporterInterface. Reports the test part
// result in the current test.
virtual void ReportTestPartResult(const TestPartResult& result);
private:
UnitTestImpl* const unit_test_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
};
// This is the
default
per thread test part result reporter used in
// UnitTestImpl. This class should only be used by UnitTestImpl.
class DefaultPerThreadTestPartResultReporter
: public TestPartResultReporterInterface {
public:
explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
// Implements the TestPartResultReporterInterface. The implementation just
// delegates to the current global test part result reporter of
*unit_test_
.
virtual void ReportTestPartResult(const TestPartResult& result);
private:
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938// the methods under a mutex, as this class is not accessible by a
// user and the UnitTest class that delegates work to this class does
// proper locking.
class GTEST_API_ UnitTestImpl {
public:
explicit UnitTestImpl(UnitTest* parent);
virtual ~UnitTestImpl();
// There are two different ways to register your own TestPartResultReporter.
// You can register your own repoter to
listen
either only
for
test results
// from the current thread or
for
results from all threads.
// By
default
,
each
per-thread test result repoter just passes a new
// TestPartResult to the global test result reporter, which registers the
// test part result
for
the currently running test.
// Returns the global test part result reporter.
TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
// Sets the global test part result reporter.
void SetGlobalTestPartResultReporter(
TestPartResultReporterInterface* reporter);
// Returns the test part result reporter
for
the current thread.
TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
// Sets the test part result reporter
for
the current thread.
void SetTestPartResultReporterForCurrentThread(
TestPartResultReporterInterface* reporter);
// Gets the number of successful test cases.
int
successful_test_case_count() const;
// Gets the number of failed test cases.
int
failed_test_case_count() const;
// Gets the number of all test cases.
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
104510461047104810491050105110521053105410551056105710581059106010611062106310641065// Adds a TestInfo to the unit test.
//
// Arguments:
//
// set_up_tc: pointer to the function that sets up the test case
// tear_down_tc: pointer to the function that tears down the test case
// test_info: the TestInfo object
void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc,
Test::TearDownTestCaseFunc tear_down_tc,
TestInfo* test_info) {
// In order to support thread-safe death tests, we need to
// remember the original working directory
when
the test program
// was first invoked. We cannot
do
this in RUN_ALL_TESTS(), as
// the user may have changed the current directory
before
calling
// RUN_ALL_TESTS(). Therefore we capture the current directory in
// AddTestInfo(), which is called to register a TEST or TEST_F
//
before
main() is reached.
if
(original_working_dir_.IsEmpty()) {
original_working_dir_.Set(FilePath::GetCurrentDir());
GTEST_CHECK_(!original_working_dir_.IsEmpty())
<<
"Failed to get the current working directory."
;
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
113811391140114111421143114411451146114711481149115011511152115311541155115611571158
void ListTestsMatchingFilter();
const TestCase* current_test_case() const {
return
current_test_case_; }
TestInfo* current_test_info() {
return
current_test_info_; }
const TestInfo* current_test_info() const {
return
current_test_info_; }
// Returns the vector of environments that need to be set-up/torn-down
//
before
/
after
the tests are run.
std::vector<Environment*>& environments() {
return
environments_; }
// Getters
for
the per-thread Google Test trace stack.
std::vector<TraceInfo>& gtest_trace_stack() {
return
*(gtest_trace_stack_.pointer());
}
const std::vector<TraceInfo>& gtest_trace_stack() const {
return
gtest_trace_stack_.get();
}
#if GTEST_HAS_DEATH_TEST
void InitDeathTestSubprocessControlInfo() {
internal_run_death_test_flag_.
reset
(ParseInternalRunDeathTestFlag());
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
1219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249// The UnitTest object that owns this implementation object.
UnitTest* const parent_;
// The working directory
when
the first TEST() or TEST_F() was
// executed.
internal::FilePath original_working_dir_;
// The
default
test part result reporters.
DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
DefaultPerThreadTestPartResultReporter
default_per_thread_test_part_result_reporter_;
// Points to (but doesn't own) the global test part result reporter.
TestPartResultReporterInterface* global_test_part_result_repoter_;
// Protects
read
and
write
access to global_test_part_result_reporter_.
internal::Mutex global_test_part_result_reporter_mutex_;
// Points to (but doesn't own) the per-thread test part result reporter.
internal::ThreadLocal<TestPartResultReporterInterface*>
per_thread_test_part_result_reporter_;
// The vector of environments that need to be set-up/torn-down
//
before
/
after
the tests are run.
std::vector<Environment*> environments_;
// The vector of TestCases in their original order. It owns the
// elements in the vector.
std::vector<TestCase*> test_cases_;
// Provides a level of indirection
for
the test case list to allow
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
131213131314131513161317131813191320132113221323132413251326132713281329133013311332
// How long the test took to run, in milliseconds.
TimeInMillis elapsed_time_;
#if GTEST_HAS_DEATH_TEST
// The decomposed components of the gtest_internal_run_death_test flag,
// parsed
when
RUN_ALL_TESTS is called.
internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
internal::scoped_ptr<internal::DeathTestFactory> death_test_factory_;
#endif // GTEST_HAS_DEATH_TEST
// A per-thread stack of traces created by the SCOPED_TRACE() macro.
internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_;
// The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests()
// starts.
bool catch_exceptions_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
}; // class UnitTestImpl
// Convenience function
for
accessing the global UnitTest
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
200020012002200320042005200620072008200920102011201220132014201520162017201820192020
should_handle = false;
return
should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
}
#endif // GTEST_HAS_SEH
} // namespace internal
// The c'tor sets this object as the test part result reporter used by
// Google Test. The
'result'
parameter specifies where to report the
// results. Intercepts only failures from the current thread.
ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
TestPartResultArray* result)
: intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),
result_(result) {
Init();
}
// The c'tor sets this object as the test part result reporter used by
// Google Test. The
'result'
parameter specifies where to report the
// results.
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184
return
global_test_part_result_repoter_;
}
// Sets the global test part result reporter.
void UnitTestImpl::SetGlobalTestPartResultReporter(
TestPartResultReporterInterface* reporter) {
internal::MutexLock
lock
(
&global_test_part_result_reporter_mutex_
);
global_test_part_result_repoter_ = reporter;
}
// Returns the test part result reporter
for
the current thread.
TestPartResultReporterInterface*
UnitTestImpl::GetTestPartResultReporterForCurrentThread() {
return
per_thread_test_part_result_reporter_.get();
}
// Sets the test part result reporter
for
the current thread.
void UnitTestImpl::SetTestPartResultReporterForCurrentThread(
TestPartResultReporterInterface* reporter) {
per_thread_test_part_result_reporter_.set(reporter);
}
// Gets the number of successful test cases.
int
UnitTestImpl::successful_test_case_count() const {
return
CountIf(test_cases_, TestCasePassed);
}
// Gets the number of failed test cases.
int
UnitTestImpl::failed_test_case_count() const {
return
CountIf(test_cases_, TestCaseFailed);
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
48854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907if
(output_dir.CreateDirectoriesRecursively()) {
xmlout = posix::FOpen(output_file_.c_str(),
"w"
);
}
if
(xmlout == NULL) {
// TODO(wan): report the reason of the failure.
//
// We don't
do
it
for
now as:
//
// 1. There is
no
urgent need
for
it.
// 2. It's a bit involved to make the errno variable thread-safe on
// all three operating systems (Linux, Windows, and Mac OS).
// 3. To interpret the meaning of errno in a thread-safe way,
// we need the strerror_r() function, which is not available on
// Windows.
fprintf(stderr,
"Unable to open file \"%s\"\n"
,
output_file_.c_str());
fflush(stderr);
exit
(EXIT_FAILURE);
}
std::stringstream stream;
PrintXmlUnitTest(
&stream
, unit_test);
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
49995000500150025003500450055006500750085009501050115012501350145015501650175018
::std::stringstream ss;
ss << (static_cast<double>(ms) * 1e-3);
return
ss.str();
}
static bool PortableLocaltime(time_t seconds, struct tm* out) {
#if defined(_MSC_VER)
return
localtime_s(out,
&seconds
) == 0;
#elif defined(__MINGW32__) || defined(__MINGW64__)
// MINGW <
time
.h> provides neither localtime_r nor localtime_s, but uses
// Windows'
localtime
(), which
has
a thread-
local
tm buffer.
struct tm* tm_ptr =
localtime
(
&seconds
); // NOLINT
if
(tm_ptr == NULL)
return
false;
*out
=
*tm_ptr
;
return
true;
#else
return
localtime_r(
&seconds
, out) != NULL;
#endif
}
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
526452655266526752685269527052715272527352745275527652775278527952805281528252835284
GTEST_LOG_(WARNING) <<
"stream_result_to: failed to connect to "
<< host_name_ <<
":"
<< port_num_;
}
}
// End of class Streaming Listener
#endif // GTEST_CAN_STREAM_RESULTS__
// Class ScopedTrace
// Pushes the
given
source file location and message onto a per-thread
// trace stack maintained by Google Test.
ScopedTrace::ScopedTrace(const char* file,
int
line, const Message& message)
GTEST_LOCK_EXCLUDED_(
&UnitTest::mutex_
) {
TraceInfo trace;
trace.file = file;
trace.line = line;
trace.message = message.GetString();
UnitTest::GetInstance()->PushGTestTrace(trace);
}
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
553255335534553555365537553855395540554155425543554455455546554755485549555055515552// Registers and returns a global test environment. When a test
// program is run, all global test environments will be set-up in the
// order they were registered. After all tests in the program have
// finished, all global test environments will be torn-down in the
//
*reverse
* order they were registered.
//
// The UnitTest object takes ownership of the
given
environment.
//
// We don't protect this under mutex_, as we only support calling it
// from the main thread.
Environment* UnitTest::AddEnvironment(Environment* env) {
if
(env == NULL) {
return
NULL;
}
impl_->environments().push_back(env);
return
env;
}
// Adds a TestPartResult to the current TestResult object. All Google Test
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
562256235624562556265627562856295630563156325633563456355636563756385639564056415642// the same key, the value will be updated.
void UnitTest::RecordProperty(const std::string& key,
const std::string& value) {
impl_->RecordProperty(TestProperty(key, value));
}
// Runs all tests in this UnitTest object and prints the result.
// Returns 0
if
successful, or 1 otherwise.
//
// We don't protect this under mutex_, as we only support calling it
// from the main thread.
int
UnitTest::Run() {
const bool in_death_test_child_process =
internal::GTEST_FLAG(internal_run_death_test).
length
() > 0;
// Google Test implements this protocol
for
catching that a test
// program exits
before
returning control to Google Test:
//
// 1. Upon start, Google Test creates a file whose absolute path
// is specified by the environment variable
// TEST_PREMATURE_EXIT_FILE.
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
57465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792// Creates an empty UnitTest.
UnitTest::UnitTest() {
impl_ = new internal::UnitTestImpl(this);
}
// Destructor of UnitTest.
UnitTest::~UnitTest() {
delete
impl_;
}
// Pushes a trace
defined
by SCOPED_TRACE() on to the per-thread
// Google Test trace stack.
void UnitTest::PushGTestTrace(const internal::TraceInfo& trace)
GTEST_LOCK_EXCLUDED_(mutex_) {
internal::MutexLock
lock
(
&mutex_
);
impl_->gtest_trace_stack().push_back(trace);
}
// Pops a trace from the per-thread Google Test trace stack.
void UnitTest::PopGTestTrace()
GTEST_LOCK_EXCLUDED_(mutex_) {
internal::MutexLock
lock
(
&mutex_
);
impl_->gtest_trace_stack().pop_back();
}
namespace internal {
UnitTestImpl::UnitTestImpl(UnitTest* parent)
: parent_(parent),
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */)
default_global_test_part_result_reporter_(this),
default_per_thread_test_part_result_reporter_(this),
GTEST_DISABLE_MSC_WARNINGS_POP_()
global_test_part_result_repoter_(
&default_global_test_part_result_reporter_
),
per_thread_test_part_result_reporter_(
&default_per_thread_test_part_result_reporter_
),
#if GTEST_HAS_PARAM_TEST
parameterized_test_registry_(),
parameterized_tests_registered_(false),
#endif // GTEST_HAS_PARAM_TEST
last_death_test_case_(-1),
current_test_case_(NULL),
current_test_info_(NULL),
ad_hoc_test_result_(),
os_stack_trace_getter_(NULL),
post_flag_parse_init_performed_(false),
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
601160126013601460156016601760186019602060216022602360246025602660276028602960306031
// Repeats the call to the post-flag parsing initialization in case the
// user didn't call InitGoogleTest.
PostFlagParsingInit();
// GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
// protocol.
internal::WriteToShardStatusFileIfNeeded();
// True iff we are in a subprocess
for
running a thread-safe-style
// death test.
bool in_subprocess_for_death_test = false;
#if GTEST_HAS_DEATH_TEST
in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
# if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
if
(in_subprocess_for_death_test) {
GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_();
}
# endif // defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_)
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
663866396640664166426643664466456646664766486649665066516652665366546655665666576658
GTEST_PATH_SEP_
"@Y|@G:@YFILE_PATH]@D\n"
" Generate an XML report in the given directory or with the given file\n"
" name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\n"
#if GTEST_CAN_STREAM_RESULTS_
" @G--"
GTEST_FLAG_PREFIX_
"stream_result_to=@YHOST@G:@YPORT@D\n"
" Stream test results to the given server.\n"
#endif // GTEST_CAN_STREAM_RESULTS_
"\n"
"Assertion Behavior:\n"
#if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
" @G--"
GTEST_FLAG_PREFIX_
"death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n"
" Set the default death test style.\n"
#endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
" @G--"
GTEST_FLAG_PREFIX_
"break_on_failure@D\n"
" Turn assertion failures into debugger break-points.\n"
" @G--"
GTEST_FLAG_PREFIX_
"throw_on_failure@D\n"
" Turn assertion failures into C++ exceptions.\n"
" @G--"
GTEST_FLAG_PREFIX_
"catch_exceptions=0@D\n"
" Do not report exceptions as test failures. Instead, allow them\n"
" to crash the program or throw a pop-up (on Windows).\n"
"\n"
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
691069116912691369146915691669176918691969206921692269236924692569266927692869296930// Constants.
// The
default
death test style.
static const char kDefaultDeathTestStyle[] =
"fast"
;
GTEST_DEFINE_string_(
death_test_style,
internal::StringFromGTestEnv(
"death_test_style"
, kDefaultDeathTestStyle),
"Indicates how to run a death test in a forked child process: "
"\"threadsafe\" (child process re-executes the test binary "
"from the beginning, running only the specific death test) or "
"\"fast\" (child process runs the death test immediately "
"after forking)."
);
GTEST_DEFINE_bool_(
death_test_use_fork,
internal::BoolFromGTestEnv(
"death_test_use_fork"
, false),
"Instructs to use fork()/_exit() instead of clone() in death tests. "
"Ignored and always uses fork() on POSIX systems where clone() is not "
"implemented. Useful when running under valgrind or similar tools if "
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
693469356936693769386939694069416942694369446945694669476948694969506951695269536954
"work in 99% of the cases. Once valgrind is fixed, this flag will "
"most likely be removed."
);
namespace internal {
GTEST_DEFINE_string_(
internal_run_death_test,
""
,
"Indicates the file, line number, temporal index of "
"the single death test to run, and a file descriptor to "
"which a success code may be sent, all separated by "
"the '|' characters. This flag is specified if and only if the current "
"process is a sub-process launched for running a thread-safe "
"death test. FOR INTERNAL USE ONLY."
);
} // namespace internal
#if GTEST_HAS_DEATH_TEST
namespace internal {
// Valid only
for
fast death tests. Indicates the code is running in the
// child process of a fast style death test.
# if !GTEST_OS_WINDOWS
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982# endif
// Returns a Boolean value indicating whether the
caller
is currently
// executing in the context of the death test child process. Tools such as
// Valgrind heap checkers may need this to modify their behavior in death
// tests. IMPORTANT: This is an internal utility. Using it may break the
bool InDeathTestChild() {
# if GTEST_OS_WINDOWS
// On Windows, death tests are thread-safe regardless of the value of the
// death_test_style flag.
return
!GTEST_FLAG(internal_run_death_test).empty();
# else
if
(GTEST_FLAG(death_test_style) ==
"threadsafe"
)
return
!GTEST_FLAG(internal_run_death_test).empty();
else
return
g_in_fast_death_test_child;
#endif
}
} // namespace internal
// ExitedWithCode constructor.
ExitedWithCode::ExitedWithCode(
int
exit_code) : exit_code_(exit_code) {
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074}
// Returns true
if
exit_status describes a process that was terminated
// by a signal, or exited normally
with
a nonzero
exit
code.
bool ExitedUnsuccessfully(
int
exit_status) {
return
!ExitedWithCode(0)(exit_status);
}
# if !GTEST_OS_WINDOWS
// Generates a textual failure message
when
a death test finds more than
// one thread running, or cannot determine the number of threads, prior
// to executing the
given
statement. It is the responsibility of the
//
caller
not to pass a thread_count of 1.
static std::string DeathTestThreadWarning(size_t thread_count) {
Message msg;
msg <<
"Death tests use fork(), which is unsafe particularly"
<<
" in a threaded context. For this test, "
<< GTEST_NAME_ <<
" "
;
if
(thread_count == 0)
msg <<
"couldn't detect the number of threads."
;
else
msg <<
"detected "
<< thread_count <<
" threads."
;
return
msg.GetString();
}
# endif // !GTEST_OS_WINDOWS
// Flag characters
for
reporting a death test that did not
die
.
static const char kDeathTestLived =
'L'
;
static const char kDeathTestReturned =
'R'
;
static const char kDeathTestThrew =
'T'
;
static const char kDeathTestInternalError =
'I'
;
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
708370847085708670877088708970907091709270937094709570967097709870997100710171027103// TODO(vladl
.com): Unify names and possibly
values
for
// AbortReason, DeathTestOutcome, and flag characters above.
enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
// Routine
for
aborting the program which is safe to call from an
//
exec
-style death test child process, in which case the error
// message is propagated back to the parent process. Otherwise, the
// message is simply printed to stderr. In either case, the program
// then exits
with
status 1.
void DeathTestAbort(const std::string& message) {
// On a POSIX
system
, this function may be called from a threadsafe-style
// death test child process, which operates on a very small stack. Use
// the heap
for
any additional non-minuscule memory requirements.
const InternalRunDeathTestFlag* const flag =
GetUnitTestImpl()->internal_run_death_test_flag();
if
(flag != NULL) {
FILE* parent = posix::FDOpen(flag->write_fd(),
"w"
);
fputc(kDeathTestInternalError, parent);
fprintf(parent,
"%s"
, message.c_str());
fflush(parent);
_exit(1);
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
74137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435
<<
"DeathTest::Passed somehow called before conclusion of test"
;
}
DeathTest::set_last_death_test_message(buffer.GetString());
return
success;
}
# if GTEST_OS_WINDOWS
// WindowsDeathTest implements death tests on Windows. Due to the
// specifics of starting new processes on Windows, death tests there are
// always threadsafe, and Google Test considers the
// --gtest_death_test_style=fast setting to be equivalent to
// --gtest_death_test_style=threadsafe there.
//
// A few implementation notes: Like the Linux version, the Windows
// implementation uses pipes
for
child-to-parent communication. But due to
// the specifics of pipes on Windows, some extra steps are required:
//
// 1. The parent creates a communication
pipe
and stores handles to both
// ends of it.
// 2. The parent starts the child and provides it
with
the information
// necessary to acquire the handle to the
write
end of the
pipe
.
// 3. The child acquires the
write
end of the
pipe
and signals the parent
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
759075917592759375947595759675977598759976007601760276037604760576067607760876097610startup_info.dwFlags = STARTF_USESTDHANDLES;
startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE);
startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);
startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);
PROCESS_INFORMATION process_info;
GTEST_DEATH_TEST_CHECK_(::CreateProcessA(
executable_path,
const_cast<char*>(command_line.c_str()),
NULL, // Retuned process handle is not inheritable.
NULL, // Retuned thread handle is not inheritable.
TRUE, // Child inherits all inheritable handles (
for
write_handle_).
0x0, // Default creation flags.
NULL, // Inherit the parent's environment.
UnitTest::GetInstance()->original_working_dir(),
&startup_info
,
&process_info
) != FALSE);
child_handle_.Reset(process_info.hProcess);
::CloseHandle(process_info.hThread);
set_spawned(true);
return
OVERSEE_TEST;
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
7654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690class NoExecDeathTest : public ForkingDeathTest {
public:
NoExecDeathTest(const char* a_statement, const RE* a_regex) :
ForkingDeathTest(a_statement, a_regex) { }
virtual TestRole AssumeRole();
};
// The AssumeRole process
for
a
fork
-and-run death test. It implements a
// straightforward
fork
,
with
a simple
pipe
to transmit the status byte.
DeathTest::TestRole NoExecDeathTest::AssumeRole() {
const size_t thread_count = GetThreadCount();
if
(thread_count != 1) {
GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count);
}
int
pipe_fd[2];
GTEST_DEATH_TEST_CHECK_(
pipe
(pipe_fd) != -1);
DeathTest::set_last_death_test_message(
""
);
CaptureStderr();
// When we
fork
the process below, the
log
file buffers are copied, but the
// file descriptors are shared. We flush all
log
files here so that closing
// the file descriptors in the child process doesn't throw off the
// synchronization between descriptors and buffers in the parent process.
// This is as
close
to the
fork
as possible to avoid a race condition in case
// there are multiple threads running
before
the death test, and another
// thread writes to the
log
file.
FlushInfoLog();
const pid_t child_pid =
fork
();
GTEST_DEATH_TEST_CHECK_(child_pid != -1);
set_child_pid(child_pid);
if
(child_pid == 0) {
GTEST_DEATH_TEST_CHECK_SYSCALL_(
close
(pipe_fd[0]));
set_write_fd(pipe_fd[1]);
// Redirects all logging to stderr in the child process to prevent
// concurrent writes to the
log
files. We capture stderr in the parent
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797
}
char* const* Argv() {
return
&args_
[0];
}
private:
std::vector<char*> args_;
};
// A struct that encompasses the arguments to the child process of a
// threadsafe-style death test process.
struct ExecDeathTestArgs {
char* const* argv; // Command-line arguments
for
the child's call to
exec
int
close_fd; // File descriptor to
close
; the
read
end of a
pipe
};
# if GTEST_OS_MAC
inline char** GetEnviron() {
// When Google Test is built as a framework on MacOS X, the environ variable
// is unavailable. Apple's documentation (man environ) recommends using
// _NSGetEnviron() instead.
return
*_NSGetEnviron
();
}
# else
// Some POSIX platforms expect you to declare environ. extern
"C"
makes
// it reside in the global namespace.
extern
"C"
char** environ;
inline char** GetEnviron() {
return
environ; }
# endif // GTEST_OS_MAC
# if !GTEST_OS_QNX
// The main function
for
a threadsafe-style death test child process.
// This function is called in a clone()-ed process and thus must avoid
// any potentially unsafe operations like malloc or libc functions.
static
int
ExecDeathTestChildMain(void* child_arg) {
ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);
GTEST_DEATH_TEST_CHECK_SYSCALL_(
close
(args->close_fd));
// We need to execute the test program in the same environment where
// it was originally invoked. Therefore we change to the original
// working directory first.
const char* const original_dir =
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857// Make sure AddressSanitizer does not tamper
with
the stack here.
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
bool StackGrowsDown() {
int
dummy;
bool result;
StackLowerThanAddress(
&dummy
,
&result
);
return
result;
}
// Spawns a child process
with
the same executable as the current process in
// a thread-safe manner and instructs it to run the death test. The
// implementation uses
fork
(2) +
exec
. On systems where clone(2) is
// available, it is used instead, being slightly more thread-safe. On QNX,
//
fork
supports only single-threaded environments, so this function uses
// spawn(2) there instead. The function dies
with
an error message
if
// anything goes wrong.
static pid_t ExecDeathTestSpawnChild(char* const* argv,
int
close_fd) {
ExecDeathTestArgs args = { argv, close_fd };
pid_t child_pid = -1;
# if GTEST_OS_QNX
// Obtains the current directory and sets it to be closed in the child
// process.
const
int
cwd_fd =
open
(
"."
, O_RDONLY);
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
8018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045
if
(!(flag->file() == file && flag->line() == line &&
flag->
index
() == death_test_index)) {
*test
= NULL;
return
true;
}
}
# if GTEST_OS_WINDOWS
if
(GTEST_FLAG(death_test_style) ==
"threadsafe"
||
GTEST_FLAG(death_test_style) ==
"fast"
) {
*test
= new WindowsDeathTest(statement, regex, file, line);
}
# else
if
(GTEST_FLAG(death_test_style) ==
"threadsafe"
) {
*test
= new ExecDeathTest(statement, regex, file, line);
}
else
if
(GTEST_FLAG(death_test_style) ==
"fast"
) {
*test
= new NoExecDeathTest(statement, regex);
}
# endif // GTEST_OS_WINDOWS
else
{ // NOLINT - this is more readable than unbalanced brackets inside
#if.
DeathTest::set_last_death_test_message(
"Unknown death test style \""
+ GTEST_FLAG(death_test_style)
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
8647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707
std::ifstream file(filename.c_str());
while
(field-- > 0) {
file >> dummy;
}
T output = 0;
file >> output;
return
output;
}
} // namespace
// Returns the number of active threads, or 0
when
there is an error.
size_t GetThreadCount() {
const string filename =
(Message() <<
"/proc/"
<< getpid() <<
"/stat"
).GetString();
return
ReadProcFileField<
int
>(filename, 19);
}
#elif GTEST_OS_MAC
size_t GetThreadCount() {
const task_t task = mach_task_self();
mach_msg_type_number_t thread_count;
thread_act_array_t thread_list;
const kern_return_t status = task_threads(task,
&thread_list
,
&thread_count
);
if
(status == KERN_SUCCESS) {
// task_threads allocates resources in thread_list and we need to free them
// to avoid leaks.
vm_deallocate(task,
reinterpret_cast<vm_address_t>(thread_list),
sizeof(thread_t) * thread_count);
return
static_cast<size_t>(thread_count);
}
else
{
return
0;
}
}
#elif GTEST_OS_QNX
// Returns the number of threads running in the process, or 0 to indicate that
// we cannot detect it.
size_t GetThreadCount() {
const
int
fd =
open
(
"/proc/self/as"
, O_RDONLY);
if
(fd < 0) {
return
0;
}
procfs_info process_info;
const
int
status =
devctl(fd, DCMD_PROC_INFO,
&process_info
, sizeof(process_info), NULL);
close
(fd);
if
(status == EOK) {
return
static_cast<size_t>(process_info.num_threads);
}
else
{
return
0;
}
}
#elif GTEST_OS_AIX
size_t GetThreadCount() {
struct procentry64 entry;
pid_t pid = getpid();
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
870987108711871287138714871587168717871887198720872187228723872487258726872787288729
if
(status == 1) {
return
entry.pi_thcount;
}
else
{
return
0;
}
}
#else
size_t GetThreadCount() {
// There's
no
portable way to detect the number of threads, so we just
//
return
0 to indicate that we cannot detect it.
return
0;
}
#endif // GTEST_OS_LINUX
#if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
void SleepMilliseconds(
int
n) {
::Sleep(n);
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
8778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114void Notification::Notify() {
GTEST_CHECK_(::SetEvent(event_.Get()) != FALSE);
}
void Notification::WaitForNotification() {
GTEST_CHECK_(
::WaitForSingleObject(event_.Get(), INFINITE) == WAIT_OBJECT_0);
}
Mutex::Mutex()
: owner_thread_id_(0),
type_(kDynamic),
critical_section_init_phase_(0),
critical_section_(new CRITICAL_SECTION) {
::InitializeCriticalSection(critical_section_);
}
Mutex::~Mutex() {
// Static mutexes are leaked intentionally. It is not thread-safe to
try
// to clean them up.
// TODO(yukawa): Switch to Slim Reader/Writer (SRW) Locks, which requires
// nothing to clean it up but is available only on Vista and later.
if
(type_ == kDynamic) {
::DeleteCriticalSection(critical_section_);
delete
critical_section_;
critical_section_ = NULL;
}
}
void Mutex::Lock() {
ThreadSafeLazyInit();
::EnterCriticalSection(critical_section_);
owner_thread_id_ = ::GetCurrentThreadId();
}
void Mutex::Unlock() {
ThreadSafeLazyInit();
// We don
't protect writing to owner_thread_id_ here, as it'
s the
//
caller
's responsibility to ensure that the current thread holds the
// mutex
when
this is called.
owner_thread_id_ = 0;
::LeaveCriticalSection(critical_section_);
}
// Does nothing
if
the current thread holds the mutex. Otherwise, crashes
//
with
high probability.
void Mutex::AssertHeld() {
ThreadSafeLazyInit();
GTEST_CHECK_(owner_thread_id_ == ::GetCurrentThreadId())
<<
"The current thread is not holding the mutex @"
<< this;
}
// Initializes owner_thread_id_ and critical_section_ in static mutexes.
void Mutex::ThreadSafeLazyInit() {
// Dynamic mutexes are initialized in the constructor.
if
(type_ == kStatic) {
switch (
::InterlockedCompareExchange(
&critical_section_init_phase_
, 1L, 0L)) {
case 0:
// If critical_section_init_phase_ was 0
before
the exchange, we
// are the first to test it and need to perform the initialization.
owner_thread_id_ = 0;
critical_section_ = new CRITICAL_SECTION;
::InitializeCriticalSection(critical_section_);
// Updates the critical_section_init_phase_ to 2 to signal
// initialization complete.
GTEST_CHECK_(::InterlockedCompareExchange(
&critical_section_init_phase_
, 2L, 1L) ==
1L);
break;
case 1:
// Somebody
else
is already initializing the mutex; spin
until
they
// are done.
while
(::InterlockedCompareExchange(
&critical_section_init_phase_
,
2L,
2L) != 2L) {
// Possibly yields the rest of the thread's
time
slice to other
// threads.
::Sleep(0);
}
break;
case 2:
break; // The mutex is already initialized and ready
for
use
.
default
:
GTEST_CHECK_(false)
<<
"Unexpected value of critical_section_init_phase_ "
<<
"while initializing a static mutex."
;
}
}
}
namespace {
class ThreadWithParamSupport : public ThreadWithParamBase {
public:
static HANDLE CreateThread(Runnable* runnable,
Notification* thread_can_start) {
ThreadMainParam* param = new ThreadMainParam(runnable, thread_can_start);
DWORD thread_id;
HANDLE thread_handle = ::CreateThread(
NULL, // Default security.
0, // Default stack size.
&ThreadWithParamSupport::ThreadMain
,
param, // Parameter to ThreadMainStatic
0x0, // Default creation flags.
&thread_id
); // Need a valid pointer
for
the call to work under Win98.
GTEST_CHECK_(thread_handle != NULL) <<
"CreateThread failed with error "
<< ::GetLastError() <<
"."
;
if
(thread_handle == NULL) {
delete
param;
}
return
thread_handle;
}
private:
struct ThreadMainParam {
ThreadMainParam(Runnable* runnable, Notification* thread_can_start)
: runnable_(runnable),
thread_can_start_(thread_can_start) {
}
scoped_ptr<Runnable> runnable_;
// Does not own.
Notification* thread_can_start_;
};
static DWORD WINAPI ThreadMain(void* ptr) {
// Transfers ownership.
scoped_ptr<ThreadMainParam> param(static_cast<ThreadMainParam*>(ptr));
if
(param->thread_can_start_ != NULL)
param->thread_can_start_->WaitForNotification();
param->runnable_->Run();
return
0;
}
// Prohibit instantiation.
ThreadWithParamSupport();
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParamSupport);
};
} // namespace
ThreadWithParamBase::ThreadWithParamBase(Runnable
*runnable
,
Notification* thread_can_start)
: thread_(ThreadWithParamSupport::CreateThread(runnable,
thread_can_start)) {
}
ThreadWithParamBase::~ThreadWithParamBase() {
Join();
}
void ThreadWithParamBase::Join() {
GTEST_CHECK_(::WaitForSingleObject(thread_.Get(), INFINITE) == WAIT_OBJECT_0)
<<
"Failed to join the thread with error "
<< ::GetLastError() <<
"."
;
}
// Maps a thread to a set of ThreadIdToThreadLocals that have
values
// instantiated on that thread and notifies them
when
the thread exits. A
// ThreadLocal instance is expected to persist
until
all threads it
has
//
values
on have terminated.
class ThreadLocalRegistryImpl {
public:
// Registers thread_local_instance as having value on the current thread.
// Returns a value that can be used to identify the thread from other threads.
static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
const ThreadLocalBase* thread_local_instance) {
DWORD current_thread = ::GetCurrentThreadId();
MutexLock
lock
(
&mutex_
);
ThreadIdToThreadLocals* const thread_to_thread_locals =
GetThreadLocalsMapLocked();
ThreadIdToThreadLocals::iterator thread_local_pos =
thread_to_thread_locals->find(current_thread);
if
(thread_local_pos == thread_to_thread_locals->end()) {
thread_local_pos = thread_to_thread_locals->insert(
std::make_pair(current_thread, ThreadLocalValues())).first;
StartWatcherThreadFor(current_thread);
}
ThreadLocalValues& thread_local_values = thread_local_pos->second;
ThreadLocalValues::iterator value_pos =
thread_local_values.find(thread_local_instance);
if
(value_pos == thread_local_values.end()) {
value_pos =
thread_local_values
.insert(std::make_pair(
thread_local_instance,
linked_ptr<ThreadLocalValueHolderBase>(
thread_local_instance->NewValueForCurrentThread())))
.first;
}
return
value_pos->second.get();
}
static void OnThreadLocalDestroyed(
const ThreadLocalBase* thread_local_instance) {
std::vector<linked_ptr<ThreadLocalValueHolderBase> > value_holders;
// Clean up the ThreadLocalValues data structure
while
holding the
lock
, but
// defer the destruction of the ThreadLocalValueHolderBases.
{
MutexLock
lock
(
&mutex_
);
ThreadIdToThreadLocals* const thread_to_thread_locals =
GetThreadLocalsMapLocked();
for
(ThreadIdToThreadLocals::iterator it =
thread_to_thread_locals->begin();
it != thread_to_thread_locals->end();
++it) {
ThreadLocalValues& thread_local_values = it->second;
ThreadLocalValues::iterator value_pos =
thread_local_values.find(thread_local_instance);
if
(value_pos != thread_local_values.end()) {
value_holders.push_back(value_pos->second);
thread_local_values.erase(value_pos);
// This
'if'
can only be successful at most once, so theoretically we
// could break out of the loop here, but we don't bother doing so.
}
}
}
// Outside the
lock
, let the destructor
for
'value_holders'
deallocate the
// ThreadLocalValueHolderBases.
}
static void OnThreadExit(DWORD thread_id) {
GTEST_CHECK_(thread_id != 0) << ::GetLastError();
std::vector<linked_ptr<ThreadLocalValueHolderBase> > value_holders;
// Clean up the ThreadIdToThreadLocals data structure
while
holding the
//
lock
, but defer the destruction of the ThreadLocalValueHolderBases.
{
MutexLock
lock
(
&mutex_
);
ThreadIdToThreadLocals* const thread_to_thread_locals =
GetThreadLocalsMapLocked();
ThreadIdToThreadLocals::iterator thread_local_pos =
thread_to_thread_locals->find(thread_id);
if
(thread_local_pos != thread_to_thread_locals->end()) {
ThreadLocalValues& thread_local_values = thread_local_pos->second;
for
(ThreadLocalValues::iterator value_pos =
thread_local_values.begin();
value_pos != thread_local_values.end();
++value_pos) {
value_holders.push_back(value_pos->second);
}
thread_to_thread_locals->erase(thread_local_pos);
}
}
// Outside the
lock
, let the destructor
for
'value_holders'
deallocate the
// ThreadLocalValueHolderBases.
}
private:
// In a particular thread, maps a ThreadLocal object to its value.
typedef std::
map
<const ThreadLocalBase*,
linked_ptr<ThreadLocalValueHolderBase> > ThreadLocalValues;
// Stores all ThreadIdToThreadLocals having
values
in a thread, indexed by
// thread's ID.
typedef std::
map
<DWORD, ThreadLocalValues> ThreadIdToThreadLocals;
// Holds the thread id and thread handle that we pass from
// StartWatcherThreadFor to WatcherThreadFunc.
typedef std::pair<DWORD, HANDLE> ThreadIdAndHandle;
static void StartWatcherThreadFor(DWORD thread_id) {
// The returned handle will be kept in thread_map and closed by
// watcher_thread in WatcherThreadFunc.
HANDLE thread = ::OpenThread(SYNCHRONIZE | THREAD_QUERY_INFORMATION,
FALSE,
thread_id);
GTEST_CHECK_(thread != NULL);
// We need to to pass a valid thread ID pointer into CreateThread
for
it
// to work correctly under Win98.
DWORD watcher_thread_id;
HANDLE watcher_thread = ::CreateThread(
NULL, // Default security.
0, // Default stack size
&ThreadLocalRegistryImpl::WatcherThreadFunc
,
reinterpret_cast<LPVOID>(new ThreadIdAndHandle(thread_id, thread)),
CREATE_SUSPENDED,
&watcher_thread_id
);
GTEST_CHECK_(watcher_thread != NULL);
// Give the watcher thread the same priority as ours to avoid being
// blocked by it.
::SetThreadPriority(watcher_thread,
::GetThreadPriority(::GetCurrentThread()));
::ResumeThread(watcher_thread);
::CloseHandle(watcher_thread);
}
// Monitors
exit
from a
given
thread and notifies those
// ThreadIdToThreadLocals about thread termination.
static DWORD WINAPI WatcherThreadFunc(LPVOID param) {
const ThreadIdAndHandle* tah =
reinterpret_cast<const ThreadIdAndHandle*>(param);
GTEST_CHECK_(
::WaitForSingleObject(tah->second, INFINITE) == WAIT_OBJECT_0);
OnThreadExit(tah->first);
::CloseHandle(tah->second);
delete
tah;
return
0;
}
// Returns
map
of thread
local
instances.
static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() {
mutex_.AssertHeld();
static ThreadIdToThreadLocals*
map
= new ThreadIdToThreadLocals;
return
map
;
}
// Protects access to GetThreadLocalsMapLocked() and its
return
value.
static Mutex mutex_;
// Protects access to GetThreadMapLocked() and its
return
value.
static Mutex thread_map_mutex_;
};
Mutex ThreadLocalRegistryImpl::mutex_(Mutex::kStaticMutex);
Mutex ThreadLocalRegistryImpl::thread_map_mutex_(Mutex::kStaticMutex);
ThreadLocalValueHolderBase* ThreadLocalRegistry::GetValueOnCurrentThread(
const ThreadLocalBase* thread_local_instance) {
return
ThreadLocalRegistryImpl::GetValueOnCurrentThread(
thread_local_instance);
}
void ThreadLocalRegistry::OnThreadLocalDestroyed(
const ThreadLocalBase* thread_local_instance) {
ThreadLocalRegistryImpl::OnThreadLocalDestroyed(thread_local_instance);
}
#endif // GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS
#if GTEST_USES_POSIX_RE
// Implements RE. Currently only needed
for
death tests.
RE::~RE() {
if
(is_valid_) {
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
1068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700
posix::Abort();
}
}
};
// Returns the global failure reporter. Will create a
// GoogleTestFailureReporter and
return
it the first
time
called.
GTEST_API_ FailureReporterInterface* GetFailureReporter() {
// Points to the global failure reporter used by Google Mock. gcc
// thread-safe. We may need to add additional synchronization to
// protect failure_reporter
if
we port Google Mock to other
// compilers.
static FailureReporterInterface* const failure_reporter =
new GoogleTestFailureReporter();
return
failure_reporter;
}
// Protects global resources (stdout in particular) used by Log().
static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex);
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741// stack_frames_to_skip frames. In opt mode, any positive
// stack_frames_to_skip is treated as 0, since we don't know which
// function calls will be inlined by the compiler and need to be
// conservative.
GTEST_API_ void Log(LogSeverity severity,
const string& message,
int
stack_frames_to_skip) {
if
(!LogIsVisible(severity))
return
;
// Ensures that logs from different threads don't interleave.
MutexLock l(
&g_log_mutex
);
//
"using ::std::cout;"
doesn
't work with Symbian'
s STLport, where cout is a
// macro.
if
(severity == kWarning) {
// Prints a GMOCK WARNING marker to make the warnings easily searchable.
std::cout <<
"\nGMOCK WARNING:"
;
}
// Pre-pends a new-line to message
if
it doesn't start
with
one.
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513
".Times() cannot appear after "
".InSequence(), .WillOnce(), .WillRepeatedly(), "
"or .RetiresOnSaturation()."
);
}
last_clause_ = kTimes;
SpecifyCardinality(a_cardinality);
}
// Points to the implicit sequence introduced by a living InSequence
// object (
if
any) in the current thread or NULL.
GTEST_API_ ThreadLocal<Sequence*> g_gmock_implicit_sequence;
// Reports an uninteresting call (whose description is in msg) in the
// manner specified by
'reaction'
.
void ReportUninterestingCall(CallReaction reaction, const string& msg) {
// Include a stack trace only
if
--gmock_verbose=info is specified.
const
int
stack_frames_to_skip =
GMOCK_FLAG(verbose) == kInfoVerbosity ? 3 : -1;
switch (reaction) {
case kAllow:
libcares/test/gmock-1.8.0/gmock-gtest-all.cc view on Meta::CPAN
115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596
Mock::Register(mock_obj, this);
}
// Sets the mock object this mock method belongs to, and sets the name
// of the mock function. Will be called upon
each
invocation of this
// mock function.
void UntypedFunctionMockerBase::SetOwnerAndName(const void* mock_obj,
const char* name)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
// We protect name_ under g_gmock_mutex in case this mock function
// is called from two threads concurrently.
MutexLock l(
&g_gmock_mutex
);
mock_obj_ = mock_obj;
name_ = name;
}
// Returns the name of the function being mocked. Must be called
//
after
RegisterOwner() or SetOwnerAndName()
has
been called.
const void* UntypedFunctionMockerBase::MockObject() const
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
const void* mock_obj;
{
// We protect mock_obj_ under g_gmock_mutex in case this mock
// function is called from two threads concurrently.
MutexLock l(
&g_gmock_mutex
);
Assert(mock_obj_ != NULL, __FILE__, __LINE__,
"MockObject() must not be called before RegisterOwner() or "
"SetOwnerAndName() has been called."
);
mock_obj = mock_obj_;
}
return
mock_obj;
}
// Returns the name of this mock method. Must be called
after
// SetOwnerAndName()
has
been called.
const char* UntypedFunctionMockerBase::Name() const
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
const char* name;
{
// We protect name_ under g_gmock_mutex in case this mock
// function is called from two threads concurrently.
MutexLock l(
&g_gmock_mutex
);
Assert(name_ != NULL, __FILE__, __LINE__,
"Name() must not be called before SetOwnerAndName() has "
"been called."
);
name = name_;
}
return
name;
}
// Calculates the result of invoking this mock function
with
the
given
libcares/test/gmock-1.8.0/gmock/gmock.h view on Meta::CPAN
92809281928292839284928592869287928892899290929192929293929492959296929792989299class ExpectationTester;
// Base class
for
function mockers.
template <typename F> class FunctionMockerBase;
// Protects the mock object registry (in class Mock), all function
// mockers, and all expectations.
//
// mock function Foo() is called, it needs to consult its expectations
// to see which one should be picked. If another thread is allowed to
// call a mock function (either Foo() or a different one) at the same
//
time
, it could affect the
"retired"
attributes of Foo()'s
// expectations
when
InSequence() is used, and thus affect which
// expectation gets picked. Therefore, we sequence all mock function
// calls to ensure the integrity of the mock objects' states.
GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex);
// Untyped base class
for
ActionResultHolder<R>.
class UntypedActionResultHolderBase;
libcares/test/gmock-1.8.0/gmock/gmock.h view on Meta::CPAN
938093819382938393849385938693879388938993909391939293939394939593969397939893999400const void* MockObject() const
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
// Returns the name of this mock method. Must be called
after
// SetOwnerAndName()
has
been called.
const char* Name() const
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
// Returns the result of invoking this mock function
with
the
given
// arguments. This function can be safely called from multiple
// threads concurrently. The
caller
is responsible
for
deleting the
// result.
UntypedActionResultHolderBase* UntypedInvokeWith(
const void* untyped_args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
protected:
typedef std::vector<const void*> UntypedOnCallSpecs;
typedef std::vector<internal::linked_ptr<ExpectationBase> >
UntypedExpectations;
libcares/test/gmock-1.8.0/gmock/gmock.h view on Meta::CPAN
97939794979597969797979897999800980198029803980498059806980798089809981098119812// Sequence objects are used by a user to specify the relative order
// in which the expectations should match. They are copyable (we rely
// on the compiler-
defined
copy constructor and assignment operator).
class GTEST_API_ Sequence {
public:
// Constructs an empty sequence.
Sequence() : last_expectation_(new Expectation) {}
// Adds an expectation to this sequence. The
caller
must ensure
// that
no
other thread is accessing this Sequence object.
void AddExpectation(const Expectation& expectation) const;
private:
// because Sequence objects are copyable and we want the copies to
// be aliases. The linked_ptr allows the copies to co-own and share
// the same Expectation object.
internal::linked_ptr<Expectation> last_expectation_;
}; // class Sequence
libcares/test/gmock-1.8.0/gmock/gmock.h view on Meta::CPAN
9822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861// {
// InSequence dummy; // The name of the object doesn't matter.
//
// // The following expectations must match in the order they appear.
// EXPECT_CALL(a, Bar())...;
// EXPECT_CALL(a, Baz())...;
// ...
// EXPECT_CALL(b, Xyz())...;
// }
//
// You can create InSequence objects in multiple threads, as long as
// they are used to affect different mock objects. The idea is that
//
each
thread can create and set up its own mocks as
if
it's the only
// thread. However,
for
clarity of your tests we recommend you to set
// up mocks in the main thread
unless
you have a good reason not to
do
// so.
class GTEST_API_ InSequence {
public:
InSequence();
~InSequence();
private:
bool sequence_created_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT
} GTEST_ATTRIBUTE_UNUSED_;
namespace internal {
// Points to the implicit sequence introduced by a living InSequence
// object (
if
any) in the current thread or NULL.
GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
// Base class
for
implementing expectations.
//
// There are two reasons
for
having a type-agnostic base class
for
// Expectation:
//
// 1. We need to store collections of expectations of different
// types (e.g. all pre-requisites of a particular expectation, all
// expectations in a sequence). Therefore these expectation objects
libcares/test/gmock-1.8.0/gmock/gmock.h view on Meta::CPAN
993399349935993699379938993999409941994299439944994599469947994899499950995199529953// using a .Times().
bool cardinality_specified() const {
return
cardinality_specified_; }
// Sets the cardinality of this expectation spec.
void set_cardinality(const Cardinality& a_cardinality) {
cardinality_ = a_cardinality;
}
// The following group of methods should only be called
after
the
// EXPECT_CALL() statement, and only
when
g_gmock_mutex is held by
// the current thread.
// Retires all pre-requisites of this expectation.
void RetireAllPreRequisites()
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
// Returns true iff this expectation is retired.
bool is_retired() const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld();
return
retired_;
libcares/test/gmock-1.8.0/gmock/gmock.h view on Meta::CPAN
102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269template <typename Function>
friend class FunctionMockerBase;
// Returns an Expectation object that references and co-owns this
// expectation.
virtual Expectation GetHandle() {
return
owner_->GetHandleOf(this);
}
// The following methods will be called only
after
the EXPECT_CALL()
// statement finishes and
when
the current thread holds
// g_gmock_mutex.
// Returns true iff this expectation matches the
given
arguments.
bool Matches(const ArgumentTuple& args) const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld();
return
TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
}
// Returns true iff this expectation should handle the
given
arguments.
libcares/test/gmock-1.8.0/gmock/gmock.h view on Meta::CPAN
107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769}
protected:
template <typename Function>
friend class MockSpec;
typedef ActionResultHolder<Result> ResultHolder;
// Returns the result of invoking this mock function
with
the
given
// arguments. This function can be safely called from multiple
// threads concurrently.
Result InvokeWith(const ArgumentTuple& args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
scoped_ptr<ResultHolder> holder(
DownCast_<ResultHolder*>(this->UntypedInvokeWith(
&args
)));
return
holder->Unwrap();
}
// Adds and returns a
default
action spec
for
this mock function.
OnCallSpec<F>& AddNewOnCallSpec(
const char* file,
int
line,
libcares/test/gmock-1.8.0/gmock/gmock.h view on Meta::CPAN
108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860// Returns the expectation that matches the
given
function arguments
// (or NULL is there's
no
match);
when
a match is found,
// untyped_action is set to point to the action that should be
// performed (or NULL
if
the action is
"do default"
), and
// is_excessive is modified to indicate whether the call exceeds the
// expected number.
//
// Critical section: We must find the matching expectation and the
// corresponding action that needs to be taken in an ATOMIC
// transaction. Otherwise another thread may call this mock
// method in the middle and mess up the state.
//
// However, performing the action
has
to be left out of the critical
// section. The reason is that we have
no
control on what the
// action does (it can invoke an arbitrary user function or even a
// mock function) and excessive locking could cause a dead
lock
.
virtual const ExpectationBase* UntypedFindMatchingExpectation(
const void* untyped_args,
const void** untyped_action, bool* is_excessive,
::std::ostream* what, ::std::ostream* why)
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
169170171172173174175176177178179180181182183184185186187188189// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
// are enabled.
// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
// is/isn't available (some systems define
// ::string, which is different to std::string).
// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
// is/isn't available (some systems define
// ::wstring, which is different to std::wstring).
// GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
// expressions are/aren't available.
// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
// is/isn't available.
// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
// enabled.
// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
// std::wstring does/doesn't work (Google Test can
// be used where std::wstring is unavailable).
// GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple
// is/isn't available.
// GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
// compiler supports Microsoft's "Structured
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
261262263264265266267268269270271272273274275276277278279280281//
#if GTEST_HAS_DEATH_TEST
// EXPECT_DEATH(DoSomethingDeadly());
//
#endif
//
// GTEST_HAS_COMBINE - the Combine() function (
for
value-parameterized
// tests)
// GTEST_HAS_DEATH_TEST - death tests
// GTEST_HAS_PARAM_TEST - value-parameterized tests
// GTEST_HAS_TYPED_TEST - typed tests
// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
// GTEST_IS_THREADSAFE - Google Test is thread-safe.
// GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse
with
// GTEST_HAS_POSIX_RE (see above) which users can
// define themselves.
// GTEST_USES_SIMPLE_RE -
our
own simple regex is used;
// the above two are mutually exclusive.
// GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
// Misc public macros
// ------------------
//
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876# endif // _MSC_VER
#endif // GTEST_HAS_RTTI
// It
's this header'
s responsibility to
#include <typeinfo> when RTTI
// is enabled.
#if GTEST_HAS_RTTI
# include <typeinfo>
#endif
#ifndef GTEST_HAS_PTHREAD
// The user didn't
tell
us explicitly, so we make reasonable assumptions about
// which platforms have pthreads support.
//
// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
// to your compiler flags.
# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
|| GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL)
#endif // GTEST_HAS_PTHREAD
#if GTEST_HAS_PTHREAD
// gtest-port.h guarantees to
#include <pthread.h> when GTEST_HAS_PTHREAD is
// true.
# include <pthread.h> // NOLINT
// For timespec and nanosleep, used below.
# include <time.h> // NOLINT
#endif
// Determines
if
hash_map/hash_set are available.
// Only used
for
testing against those containers.
#if !defined(GTEST_HAS_HASH_MAP_)
# if _MSC_VER
# define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
22432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268
__attribute__((no_sanitize_address))
# else
# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
# endif // __has_feature(address_sanitizer)
#else
# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
#endif // __clang__
// A function level attribute to disable ThreadSanitizer instrumentation.
#if defined(__clang__)
# if __has_feature(thread_sanitizer)
# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \
__attribute__((no_sanitize_thread))
# else
# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
# endif // __has_feature(thread_sanitizer)
#else
# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
#endif // __clang__
namespace testing {
class Message;
#if defined(GTEST_TUPLE_NAMESPACE_)
// Import tuple and friends into the ::testing namespace.
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795
};
nanosleep(
&time
, NULL);
}
# endif // GTEST_HAS_PTHREAD
# if GTEST_HAS_NOTIFICATION_
// Notification
has
already been imported into the namespace.
// Nothing to
do
here.
# elif GTEST_HAS_PTHREAD
// Allows a controller thread to pause execution of newly created
// threads
until
notified. Instances of this class must be created
// and destroyed in the controller thread.
//
// This class is only
for
testing Google Test's own constructs. Do not
class Notification {
public:
Notification() : notified_(false) {
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(
&mutex_
, NULL));
}
~Notification() {
pthread_mutex_destroy(
&mutex_
);
}
// Notifies all threads created
with
this notification to start. Must
// be called from the controller thread.
void Notify() {
pthread_mutex_lock(
&mutex_
);
notified_ = true;
pthread_mutex_unlock(
&mutex_
);
}
// Blocks
until
the controller thread notifies. Must be called from a test
// thread.
void WaitForNotification() {
for
(;;) {
pthread_mutex_lock(
&mutex_
);
const bool notified = notified_;
pthread_mutex_unlock(
&mutex_
);
if
(notified)
break;
SleepMilliseconds(10);
}
}
private:
pthread_mutex_t mutex_;
bool notified_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
};
# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
GTEST_API_ void SleepMilliseconds(
int
n);
// Provides leak-safe Windows kernel handle ownership.
// Used in death tests and in threading support.
class GTEST_API_ AutoHandle {
public:
// Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
// avoid including <windows.h> in this header file. Including <windows.h> is
// undesirable because it defines a lot of symbols and macros that tend to
// conflict
with
client code. This assumption is verified by
// WindowsTypesTest.HANDLEIsVoidStar.
typedef void* Handle;
AutoHandle();
explicit AutoHandle(Handle handle);
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
28022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917
private:
// Returns true iff the handle is a valid handle object that can be closed.
bool IsCloseable() const;
Handle handle_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
};
// Allows a controller thread to pause execution of newly created
// threads
until
notified. Instances of this class must be created
// and destroyed in the controller thread.
//
// This class is only
for
testing Google Test's own constructs. Do not
class GTEST_API_ Notification {
public:
Notification();
void Notify();
void WaitForNotification();
private:
AutoHandle event_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
};
# endif // GTEST_HAS_NOTIFICATION_
// On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
//
defined
, but we don
't want to use MinGW'
s pthreads implementation, which
//
has
conformance problems
with
some versions of the POSIX standard.
# if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
// Consequently, it cannot
select
a correct instantiation of ThreadWithParam
// in order to call its Run(). Introducing ThreadWithParamBase as a
// non-templated base class
for
ThreadWithParam allows us to bypass this
// problem.
class ThreadWithParamBase {
public:
virtual ~ThreadWithParamBase() {}
virtual void Run() = 0;
};
// pthread_create() accepts a pointer to a function type
with
the C linkage.
// According to the Standard (7.5/1), function types
with
different linkages
// are different even
if
they are otherwise identical. Some compilers (
for
// example, SunStudio) treat them as different types. Since class methods
// cannot be
defined
with
C-linkage we need to define a free C-function to
// pass into pthread_create().
extern
"C"
inline void* ThreadFuncWithCLinkage(void* thread) {
static_cast<ThreadWithParamBase*>(thread)->Run();
return
NULL;
}
// Helper class
for
testing Google Test's multi-threading constructs.
//
// void ThreadFunc(
int
param) { /* Do things
with
param */ }
// Notification thread_can_start;
// ...
// // The thread_can_start parameter is optional; you can supply NULL.
// ThreadWithParam<
int
> thread(
&ThreadFunc
, 5,
&thread_can_start
);
// thread_can_start.Notify();
//
// These classes are only
for
testing Google Test's own constructs. Do
template <typename T>
class ThreadWithParam : public ThreadWithParamBase {
public:
typedef void UserThreadFunc(T);
ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
: func_(func),
param_(param),
thread_can_start_(thread_can_start),
finished_(false) {
ThreadWithParamBase* const base = this;
// The thread can be created only
after
all fields except thread_
// have been initialized.
GTEST_CHECK_POSIX_SUCCESS_(
pthread_create(
&thread_
, 0,
&ThreadFuncWithCLinkage
, base));
}
~ThreadWithParam() { Join(); }
void Join() {
if
(!finished_) {
GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
finished_ = true;
}
}
virtual void Run() {
if
(thread_can_start_ != NULL)
thread_can_start_->WaitForNotification();
func_(param_);
}
private:
UserThreadFunc* const func_; // User-supplied thread function.
const T param_; // User-supplied parameter to the thread function.
// When non-NULL, used to block execution
until
the controller thread
// notifies.
Notification* const thread_can_start_;
bool finished_; // true iff we know that the thread function
has
finished.
pthread_t thread_; // The native thread object.
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
};
# endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
// GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
# if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
// Mutex and ThreadLocal have already been imported into the namespace.
// Nothing to
do
here.
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974
// ThreadSafeLazyInit() to lazily initialize the rest of the members.
explicit Mutex(StaticConstructorSelector /
*dummy
*/) {}
Mutex();
~Mutex();
void Lock();
void Unlock();
// Does nothing
if
the current thread holds the mutex. Otherwise, crashes
//
with
high probability.
void AssertHeld();
private:
// Initializes owner_thread_id_ and critical_section_ in static mutexes.
void ThreadSafeLazyInit();
// we assume that 0 is an invalid value
for
thread IDs.
unsigned
int
owner_thread_id_;
// For static mutexes, we rely on these members being initialized to zeros
// by the linker.
MutexType type_;
long critical_section_init_phase_; // NOLINT
_RTL_CRITICAL_SECTION* critical_section_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
};
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
2999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077typedef GTestMutexLock MutexLock;
// Base class
for
ValueHolder<T>. Allows a
caller
to hold and
delete
a value
// without knowing its type.
class ThreadLocalValueHolderBase {
public:
virtual ~ThreadLocalValueHolderBase() {}
};
// Provides a way
for
a thread to
send
notifications to a ThreadLocal
// regardless of its parameter type.
class ThreadLocalBase {
public:
// Creates a new ValueHolder<T> object holding a
default
value passed to
// this ThreadLocal<T>
's constructor and returns it. It is the caller'
s
// responsibility not to call this
when
the ThreadLocal<T> instance already
//
has
a value on the current thread.
virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
protected:
ThreadLocalBase() {}
virtual ~ThreadLocalBase() {}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase);
};
// Maps a thread to a set of ThreadLocals that have
values
instantiated on that
// thread and notifies them
when
the thread exits. A ThreadLocal instance is
// expected to persist
until
all threads it
has
values
on have terminated.
class GTEST_API_ ThreadLocalRegistry {
public:
// Registers thread_local_instance as having value on the current thread.
// Returns a value that can be used to identify the thread from other threads.
static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
const ThreadLocalBase* thread_local_instance);
// Invoked
when
a ThreadLocal instance is destroyed.
static void OnThreadLocalDestroyed(
const ThreadLocalBase* thread_local_instance);
};
class GTEST_API_ ThreadWithParamBase {
public:
void Join();
protected:
class Runnable {
public:
virtual ~Runnable() {}
virtual void Run() = 0;
};
ThreadWithParamBase(Runnable
*runnable
, Notification* thread_can_start);
virtual ~ThreadWithParamBase();
private:
AutoHandle thread_;
};
// Helper class
for
testing Google Test's multi-threading constructs.
template <typename T>
class ThreadWithParam : public ThreadWithParamBase {
public:
typedef void UserThreadFunc(T);
ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
: ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {
}
virtual ~ThreadWithParam() {}
private:
class RunnableImpl : public Runnable {
public:
RunnableImpl(UserThreadFunc* func, T param)
: func_(func),
param_(param) {
}
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127
private:
UserThreadFunc* const func_;
const T param_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl);
};
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
};
// Implements thread-
local
storage on Windows systems.
//
// // Thread 1
// ThreadLocal<
int
> tl(100); // 100 is the
default
value
for
each
thread.
//
// // Thread 2
// tl.set(150); // Changes the value
for
thread 2 only.
// EXPECT_EQ(150, tl.get());
//
// // Thread 1
// EXPECT_EQ(100, tl.get()); // In thread 1, tl
has
the original value.
// tl.set(200);
// EXPECT_EQ(200, tl.get());
//
// The template type argument T must have a public copy constructor.
// In addition, the
default
ThreadLocal constructor requires T to have
// a public
default
constructor.
//
// The users of a TheadLocal instance have to make sure that all but one
// threads (including the main one) using that instance have exited
before
// destroying it. Otherwise, the per-thread objects managed
for
them by the
// ThreadLocal instance are not guaranteed to be destroyed on all platforms.
//
// Google Test only uses global ThreadLocal objects. That means they
// will
die
after
main()
has
returned. Therefore,
no
per-thread
// object managed by Google Test will be leaked as long as all threads
// using Google Test have exited
when
main() returns.
template <typename T>
class ThreadLocal : public ThreadLocalBase {
public:
ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {}
explicit ThreadLocal(const T& value)
: default_factory_(new InstanceValueHolderFactory(value)) {}
~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); }
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
3176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269
};
class InstanceValueHolderFactory : public ValueHolderFactory {
public:
explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
virtual ValueHolder* MakeNewHolder() const {
return
new ValueHolder(value_);
}
private:
const T value_; // The value
for
each
thread.
GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
};
scoped_ptr<ValueHolderFactory> default_factory_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
};
# elif GTEST_HAS_PTHREAD
// MutexBase and Mutex implement mutex on pthreads-based platforms.
class MutexBase {
public:
// Acquires this mutex.
void Lock() {
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(
&mutex_
));
owner_ = pthread_self();
has_owner_ = true;
}
// Releases this mutex.
void Unlock() {
// Since the
lock
is being released the owner_ field should
no
longer be
// considered valid. We don
't protect writing to has_owner_ here, as it'
s
// the
caller
's responsibility to ensure that the current thread holds the
// mutex
when
this is called.
has_owner_ = false;
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(
&mutex_
));
}
// Does nothing
if
the current thread holds the mutex. Otherwise, crashes
//
with
high probability.
void AssertHeld() const {
GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
<<
"The current thread is not holding the mutex @"
<< this;
}
// A static mutex may be used
before
main() is entered. It may even
// be used
before
the dynamic initialization stage. Therefore we
// must be able to initialize a static mutex object at
link
time
.
// This means MutexBase
has
to be a POD and its member variables
// have to be public.
public:
pthread_mutex_t mutex_; // The underlying pthread mutex.
// has_owner_ indicates whether the owner_ field below contains a valid thread
// accesses to the owner_ field should be protected by a check of this field.
// An alternative might be to memset() owner_ to all zeros, but there's
no
// guarantee that a zero'd pthread_t is necessarily invalid or even different
// from pthread_self().
bool has_owner_;
pthread_t owner_; // The thread holding the mutex.
};
// Forward-declares a static mutex.
# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
extern ::testing::internal::MutexBase mutex
// Defines and statically (i.e. at
link
time
) initializes a static mutex.
# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, pthread_t() }
// The Mutex class can only be used
for
mutexes created at runtime. It
// shares its API
with
MutexBase otherwise.
class Mutex : public MutexBase {
public:
Mutex() {
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(
&mutex_
, NULL));
has_owner_ = false;
}
~Mutex() {
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(
&mutex_
));
}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
};
// We cannot name this class MutexLock because the ctor declaration would
// conflict
with
a macro named MutexLock, which is
defined
on some
// platforms. That macro is used as a defensive measure to prevent against
// inadvertent misuses of MutexLock like
"MutexLock(&mu)"
rather than
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
3278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329private:
MutexBase* const mutex_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
};
typedef GTestMutexLock MutexLock;
// Helpers
for
ThreadLocal.
// pthread_key_create() requires DeleteThreadLocalValue() to have
// C-linkage. Therefore it cannot be templatized to access
// ThreadLocal<T>. Hence the need
for
class
// ThreadLocalValueHolderBase.
class ThreadLocalValueHolderBase {
public:
virtual ~ThreadLocalValueHolderBase() {}
};
// Called by pthread to
delete
thread-
local
data stored by
// pthread_setspecific().
extern
"C"
inline void DeleteThreadLocalValue(void* value_holder) {
delete
static_cast<ThreadLocalValueHolderBase*>(value_holder);
}
// Implements thread-
local
storage on pthreads-based systems.
template <typename T>
class ThreadLocal {
public:
ThreadLocal()
: key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
explicit ThreadLocal(const T& value)
: key_(CreateKey()),
default_factory_(new InstanceValueHolderFactory(value)) {}
~ThreadLocal() {
// Destroys the managed object
for
the current thread,
if
any.
DeleteThreadLocalValue(pthread_getspecific(key_));
// Releases resources associated
with
the key. This will
*not
*
//
delete
managed objects
for
other threads.
GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
}
T* pointer() {
return
GetOrCreateValue(); }
const T* pointer() const {
return
GetOrCreateValue(); }
const T& get() const {
return
*pointer
(); }
void set(const T& value) {
*pointer
() = value; }
private:
// Holds a value of type T.
class ValueHolder : public ThreadLocalValueHolderBase {
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369
ValueHolder() : value_() {}
explicit ValueHolder(const T& value) : value_(value) {}
T* pointer() {
return
&value_
; }
private:
T value_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
};
static pthread_key_t CreateKey() {
pthread_key_t key;
// When a thread exits, DeleteThreadLocalValue() will be called on
// the object managed
for
that thread.
GTEST_CHECK_POSIX_SUCCESS_(
pthread_key_create(
&key
,
&DeleteThreadLocalValue
));
return
key;
}
T* GetOrCreateValue() const {
ThreadLocalValueHolderBase* const holder =
static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
if
(holder != NULL) {
return
CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
}
ValueHolder* const new_holder = default_factory_->MakeNewHolder();
ThreadLocalValueHolderBase* const holder_base = new_holder;
GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
return
new_holder->pointer();
}
class ValueHolderFactory {
public:
ValueHolderFactory() {}
virtual ~ValueHolderFactory() {}
virtual ValueHolder* MakeNewHolder() const = 0;
private:
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
33803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417
};
class InstanceValueHolderFactory : public ValueHolderFactory {
public:
explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
virtual ValueHolder* MakeNewHolder() const {
return
new ValueHolder(value_);
}
private:
const T value_; // The value
for
each
thread.
GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
};
// A key pthreads uses
for
looking up per-thread
values
.
const pthread_key_t key_;
scoped_ptr<ValueHolderFactory> default_factory_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
};
# endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
#else // GTEST_IS_THREADSAFE
// A dummy implementation of synchronization primitives (mutex,
lock
,
// and thread-
local
variable). Necessary
for
compiling Google Test where
// mutex is not supported - using Google Test in multiple threads is not
// supported on such platforms.
class Mutex {
public:
Mutex() {}
void Lock() {}
void Unlock() {}
void AssertHeld() const {}
};
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
344134423443344434453446344734483449345034513452345334543455345634573458345934603461
T* pointer() {
return
&value_
; }
const T* pointer() const {
return
&value_
; }
const T& get() const {
return
value_; }
void set(const T& value) { value_ = value; }
private:
T value_;
};
#endif // GTEST_IS_THREADSAFE
// Returns the number of threads running in the process, or 0 to indicate that
// we cannot detect it.
GTEST_API_ size_t GetThreadCount();
// Passing non-POD classes through ellipsis (...) crashes the ARM
// compiler and generates a warning in Sun Studio. The Nokia Symbian
// and the IBM XL C/C++ compiler
try
to instantiate a copy constructor
//
for
objects passed through ellipsis (...), failing
for
uncopyable
// objects. We define this to ensure that only POD is passed through
// ellipsis on these systems.
#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
893189328933893489358936893789388939894089418942894389448945894689478948894989508951
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if
(::testing::internal::AlwaysTrue()) { \
::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
if
(gtest_fatal_failure_checker.has_new_fatal_failure()) { \
goto
GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
} \
}
else
\
GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
fail(
"Expected: "
#statement " doesn't generate new fatal " \
"failures in the current thread.\n"
\
" Actual: it does."
)
// Expands to the name of the class that implements the
given
test.
#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
test_case_name
##_##test_name##_Test
// Helper macro
for
defining tests.
#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
public:\
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
93259326932793289329933093319332933393349335933693379338933993409341934293439344#endif // GTEST_HAS_DEATH_TEST
} // namespace internal
} // namespace testing
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
namespace testing {
// This flag controls the style of death tests. Valid
values
are
"threadsafe"
,
// meaning that the death test child process will re-execute the test binary
// from the start, running only a single death test, or
"fast"
,
// meaning that the child process will execute the test logic immediately
//
after
forking.
GTEST_DECLARE_string_(death_test_style);
#if GTEST_HAS_DEATH_TEST
namespace internal {
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
9351935293539354935593569357935893599360936193629363936493659366936793689369937093719372GTEST_API_ bool InDeathTestChild();
} // namespace internal
// The following macros are useful
for
writing death tests.
// Here's what happens
when
an ASSERT_DEATH* or EXPECT_DEATH* is
// executed:
//
// 1. It generates a warning
if
there is more than one active
// thread. This is because it's safe to
fork
() or clone() only
//
when
there is a single thread.
//
// 2. The parent process clone()s a
sub
-process and runs the death
// test in it; the
sub
-process exits
with
code 0 at the end of the
// death test,
if
it hasn't exited already.
//
// 3. The parent process waits
for
the
sub
-process to terminate.
//
// 4. The parent process checks the
exit
code and error message of
// the
sub
-process.
//
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
9433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463// case, please
try
to rewrite your regular expression within the
// above syntax.
//
// This implementation is
*not
* meant to be as highly tuned or robust
// as a compiled regex library, but should perform well enough
for
a
// death test, which already incurs significant overhead by launching
// a child process.
//
// Known caveats:
//
// A
"threadsafe"
style death test obtains the path to the test
// program from argv[0] and re-executes it in the
sub
-process. For
// simplicity, the current implementation doesn't search the PATH
//
when
launching the
sub
-process. This means that the user must
// invoke the test program via a path that contains at least one
// path separator (e.g. path/to/foo_test and
// /absolute/path/to/bar_test are fine, but foo_test is not). This
// is rarely a problem as people usually don't put the test binary
// directory in PATH.
//
// TODO(wan
.com): make thread-safe death tests search the PATH.
// Asserts that a
given
statement causes the program to
exit
,
with
an
// integer
exit
status that satisfies predicate, and emitting error output
// that matches regex.
# define ASSERT_EXIT(statement, predicate, regex) \
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
// Like ASSERT_EXIT, but continues on to successive tests in the
// test case,
if
any:
# define EXPECT_EXIT(statement, predicate, regex) \
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
986898699870987198729873987498759876987798789879988098819882988398849885988698879888// Other uses may not be as good.
//
//
*containing
* linked_ptr<> must have a constructor and destructor (even
//
if
they
do
nothing!).
//
//
// Thread Safety:
// Unlike other linked_ptr implementations, in this implementation
// a linked_ptr object is thread-safe in the sense that:
// - it's safe to copy linked_ptr objects concurrently,
// - it's safe to copy
*from
* a linked_ptr and
read
its underlying
// raw pointer (e.g. via get()) concurrently, and
// - it's safe to
write
to two linked_ptrs that point to the same
// shared object concurrently.
// TODO(wan
.com):
rename
this to safe_linked_ptr to avoid
// confusion
with
normal linked_ptr.
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
99249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961
// Join an existing circle.
void
join
(linked_ptr_internal const* ptr)
GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
MutexLock
lock
(
&g_linked_ptr_mutex
);
linked_ptr_internal const* p = ptr;
while
(p->next_ != ptr) {
assert(p->next_ != this &&
"Trying to join() a linked ring we are already in. "
"Is GMock thread safety enabled?"
);
p = p->next_;
}
p->next_ = this;
next_ = ptr;
}
// Leave whatever circle we're part of. Returns true
if
we were the
//
last
member of the circle. Once this is done, you can
join
() another.
bool depart()
GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
MutexLock
lock
(
&g_linked_ptr_mutex
);
if
(next_ == this)
return
true;
linked_ptr_internal const* p = next_;
while
(p->next_ != this) {
assert(p->next_ != next_ &&
"Trying to depart() a linked ring we are not in. "
"Is GMock thread safety enabled?"
);
p = p->next_;
}
p->next_ = next_;
return
false;
}
private:
mutable linked_ptr_internal const* next_;
};
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770};
// A UnitTest consists of a vector of TestCases.
//
// This is a singleton class. The only instance of UnitTest is
// created
when
UnitTest::GetInstance() is first called. This
// instance is never deleted.
//
// UnitTest is not copyable.
//
// This class is thread-safe as long as the methods are called
// according to their specification.
class GTEST_API_ UnitTest {
public:
// Gets the singleton UnitTest object. The first
time
this method
// is called, a UnitTest object is constructed and returned.
// Consecutive calls will
return
the same object.
static UnitTest* GetInstance();
// Runs all tests in this UnitTest object and prints the result.
// Returns 0
if
successful, or 1 otherwise.
//
// This method can only be called from the main thread.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
int
Run() GTEST_MUST_USE_RESULT_;
// Returns the working directory
when
the first TEST() or TEST_F()
// was executed. The UnitTest object owns the string.
const char* original_working_dir() const;
// Returns the TestCase object
for
the test that's currently running,
// or NULL
if
no
test is running.
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870private:
// Registers and returns a global test environment. When a test
// program is run, all global test environments will be set-up in
// the order they were registered. After all tests in the program
// have finished, all global test environments will be torn-down in
// the
*reverse
* order they were registered.
//
// The UnitTest object takes ownership of the
given
environment.
//
// This method can only be called from the main thread.
Environment* AddEnvironment(Environment* env);
// Adds a TestPartResult to the current TestResult object. All
// Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
// eventually call this to report their results. The user code
void AddTestPartResult(TestPartResult::Type result_type,
const char* file_name,
int
line_number,
const std::string& message,
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
1989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923friend void internal::ReportFailureInUnknownLocation(
TestPartResult::Type result_type,
const std::string& message);
// Creates an empty UnitTest.
UnitTest();
// D'tor
virtual ~UnitTest();
// Pushes a trace
defined
by SCOPED_TRACE() on to the per-thread
// Google Test trace stack.
void PushGTestTrace(const internal::TraceInfo& trace)
GTEST_LOCK_EXCLUDED_(mutex_);
// Pops a trace from the per-thread Google Test trace stack.
void PopGTestTrace()
GTEST_LOCK_EXCLUDED_(mutex_);
// Protects mutable state in
*impl_
. This is mutable as some const
// methods need to
lock
it too.
mutable internal::Mutex mutex_;
// Opaque implementation object. This field is never changed once
// the object is constructed. We don't mark it as const here, as
// doing so will cause a warning in the constructor of UnitTest.
libcares/test/gmock-1.8.0/gtest/gtest.h view on Meta::CPAN
210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056# define EXPECT_HRESULT_FAILED(expr) \
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
# define ASSERT_HRESULT_FAILED(expr) \
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
#endif // GTEST_OS_WINDOWS
// Macros that execute statement and check that it doesn't generate new fatal
// failures in the current thread.
//
// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
//
// Examples:
//
// EXPECT_NO_FATAL_FAILURE(Process());
// ASSERT_NO_FATAL_FAILURE(Process()) <<
"Process() failed"
;
//
#define ASSERT_NO_FATAL_FAILURE(statement) \
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)