void set_alarm()
{
- if (setitimer(ITIMER_VIRTUAL, &defualt_timer, NULL) == -1)
+ if (gdb_is_caller() == false)
{
- Error << "setitimer() failed";
+ if (setitimer(ITIMER_VIRTUAL, &defualt_timer, NULL) == -1)
+ {
+ Error << "setitimer() failed";
+ }
}
}
void set_alarm(long tv_sec, long tv_usec)
{
+ if (gdb_is_caller() == false)
+ {
#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
- struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) };
+ struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) };
#else
- struct timeval it_value= { tv_sec, tv_usec };
+ struct timeval it_value= { tv_sec, tv_usec };
#endif
- struct itimerval timer= { default_it_interval, it_value };
+ struct itimerval timer= { default_it_interval, it_value };
- if (setitimer(ITIMER_VIRTUAL, &timer, NULL) == -1)
- {
- Error << "setitimer() failed";
+ if (setitimer(ITIMER_VIRTUAL, &timer, NULL) == -1)
+ {
+ Error << "setitimer() failed";
+ }
}
}
void cancel_alarm()
{
- if (setitimer(ITIMER_VIRTUAL, &cancel_timer, NULL) == -1)
+ if (gdb_is_caller() == false)
{
- Error << "setitimer() failed";
+ if (setitimer(ITIMER_VIRTUAL, &cancel_timer, NULL) == -1)
+ {
+ Error << "setitimer() failed";
+ }
}
}
return true;
}
+ if (bool(getenv("LIBTEST_IN_GDB")))
+ {
+ return true;
+ }
+
return false;
}
MASSIF_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=massif
GDB_COMMAND= $(LIBTOOL_COMMAND) gdb -f -x libtest/run.gdb
PTRCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-ptrcheck --error-exitcode=1
+PAHOLE_COMMAND= $(LIBTOOL_COMMAND) --mode=execute pahole
export LIBTOOL_COMMAND
export VALGRIND_COMMAND
TESTS_LDADDS+= libmemcached/libmemcachedutil.la
TESTS_LDADDS+= libtest/libtest.la
-DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
-
-PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
-
EXTRA_DIST+= tests/cpp_example.cc
noinst_HEADERS+= tests/exist.h
@tests/failure
gdb-failure: tests/failure
- @$(DEBUG_COMMAND) tests/failure
+ @$(GDB_COMMAND) tests/failure
tests_testhashkit_SOURCES= tests/hashkit_functions.cc
@$(PAHOLE_COMMAND) tests/testapp
gdb-mem: tests/libmemcached-1.0/testapp
- @$(DEBUG_COMMAND) tests/libmemcached-1.0/testapp
+ @$(GDB_COMMAND) tests/libmemcached-1.0/testapp
gdb-atom: tests/atomsmasher
- @$(DEBUG_COMMAND) tests/atomsmasher
+ @$(GDB_COMMAND) tests/atomsmasher
gdb-hash: tests/testhashkit
- @$(DEBUG_COMMAND) tests/testhashkit
+ @$(GDB_COMMAND) tests/testhashkit
gdb-hashplus: tests/hash_plus
- @$(DEBUG_COMMAND) tests/hash_plus
+ @$(GDB_COMMAND) tests/hash_plus
gdb-cycle: tests/cycle
- @$(DEBUG_COMMAND) tests/cycle
+ @$(GDB_COMMAND) tests/cycle
valgrind-cycle: tests/cycle
$(VALGRIND_COMMAND) tests/cycle
@tests/libmemcached-1.0/testsocket
gdb-socket: tests/libmemcached-1.0/testsocket
- @$(DEBUG_COMMAND) tests/libmemcached-1.0/testsocket
+ @$(GDB_COMMAND) tests/libmemcached-1.0/testsocket
tests_libmemcached_1_0_sasl_SOURCES=
tests_libmemcached_1_0_sasl_DEPENDENCIES=
@tests/libmemcached-1.0/sasl
gdb-sasl: tests/libmemcached-1.0/sasl
- @$(DEBUG_COMMAND) tests/libmemcached-1.0/sasl
+ @$(GDB_COMMAND) tests/libmemcached-1.0/sasl
tests_atomsmasher_SOURCES=
tests_atomsmasher_DEPENDENCIES=
@tests/testplus
gdb-plus: tests/testplus
- $(DEBUG_COMMAND) tests/testplus
+ $(GDB_COMMAND) tests/testplus
valgrind-plus: tests/testplus
@$(VALGRIND_COMMAND) tests/testplus