+2018-01-08 Yao Qi <yao.qi@linaro.org>
+ Simon Marchi <simon.marchi@ericsson.com>
+
+ * Makefile.in (OBS): Remove selftest.o.
+ * configure.ac: Set srv_selftest_objs if $development is true.
+ (GDBSERVER_DEPFILES): Append $srv_selftest_objs.
+ * configure: Re-generated.
+ * server.c (captured_main): Wrap variable selftest_filter with
+ GDB_SELF_TEST.
+
2018-01-07 Simon Marchi <simon.marchi@polymtl.ca>
* server.c (parse_debug_format_options): Return std::string.
regcache.o \
remote-utils.o \
rsp-low.o \
- selftest.o \
server.o \
signals.o \
signals-state-save-restore.o \
if $development; then
+ srv_selftest_objs="selftest.o"
$as_echo "#define GDB_SELF_TEST 1" >>confdefs.h
done
fi
-GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles $srv_host_obs"
+GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles $srv_host_obs $srv_selftest_objs"
GDBSERVER_LIBS="$srv_libs"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports __sync_*_compare_and_swap" >&5
GDB_AC_LIBMCHECK(${libmcheck_default})
if $development; then
+ srv_selftest_objs="selftest.o"
AC_DEFINE(GDB_SELF_TEST, 1,
[Define if self-testing features should be enabled])
fi
done
fi
-GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles $srv_host_obs"
+GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles $srv_host_obs $srv_selftest_objs"
GDBSERVER_LIBS="$srv_libs"
dnl Check whether the target supports __sync_*_compare_and_swap.
volatile int attach = 0;
int was_running;
bool selftest = false;
+#if GDB_SELF_TEST
const char *selftest_filter = NULL;
+#endif
while (*next_arg != NULL && **next_arg == '-')
{
else if (startswith (*next_arg, "--selftest="))
{
selftest = true;
+#if GDB_SELF_TEST
selftest_filter = *next_arg + strlen ("--selftest=");
+#endif
}
else
{
if (selftest)
{
+#if GDB_SELF_TEST
selftests::run_tests (selftest_filter);
+#else
+ printf (_("Selftests are not available in a non-development build.\n"));
+#endif
throw_quit ("Quit");
}
+2018-01-08 Simon Marchi <simon.marchi@ericsson.com>
+
+ * gdb.server/unittest.exp: Match the output in non-development
+ mode.
+
2018-01-08 Simon Marchi <simon.marchi@ericsson.com>
* gdb.gdb/unittest.exp: Match output in non-development mode.
set server_spawn_id [remote_spawn target $gdbserver_command]
+set test "unit tests"
gdb_expect {
-i $server_spawn_id
- -re "Ran $decimal unit tests, 0 failed" {
- pass "unit tests"
+ -re "Ran ($decimal) unit tests, 0 failed" {
+ set num_ran $expect_out(1,string)
+ gdb_assert "$num_ran > 0" $test
}
+
+ -re "Selftests are not available in a non-development build.\r\n$" {
+ unsupported $test
+ }
+
default {
- fail "unit tests"
+ fail $test
}
}