+2018-01-08 Yao Qi <yao.qi@linaro.org>
+ Simon Marchi <simon.marchi@ericsson.com>
+
+ * Makefile.in (COMMON_SFILES): Remove selftest-arch.c and
+ common/selftest.c.
+ (COMMON_OBS): Remove selftest.o.
+ * configure.ac: Append selftest-arch.c and common/selftest.c to
+ CONFIG_SRCS. Append selftest-arch.o and selftest.o to COMMON_OBS.
+ * configure: Re-generated.
+ * maint.c (maintenance_selftest): Wrap selftests::run_tests with
+ GDB_SELF_TEST.
+ (maintenance_info_selftests): Likewise.
+
2018-01-08 Xavier Roirand <roirand@adacore.com>
* ada-valprint.c (val_print_packed_array_elements): Use
remote-notif.c \
reverse.c \
rust-lang.c \
- selftest-arch.c \
sentinel-frame.c \
ser-event.c \
serial.c \
common/ptid.c \
common/rsp-low.c \
common/run-time-clock.c \
- common/selftest.c \
common/signals.c \
common/signals-state-save-restore.c \
common/vec.c \
ptid.o \
rsp-low.o \
run-time-clock.o \
- selftest.o \
signals.o \
signals-state-save-restore.o \
vec.o \
$as_echo "#define GDB_SELF_TEST 1" >>confdefs.h
- CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS)"
- CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS)"
+ CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) selftest.o selftest-arch.o"
+ CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) common/selftest.c selftest-arch.c"
fi
if $development; then
AC_DEFINE(GDB_SELF_TEST, 1,
[Define if self-testing features should be enabled])
- CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS)"
- CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS)"
+ CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) selftest.o selftest-arch.o"
+ CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) common/selftest.c selftest-arch.c"
fi
GDB_AC_TRANSFORM([gdb], [GDB_TRANSFORM_NAME])
static void
maintenance_selftest (const char *args, int from_tty)
{
+#if GDB_SELF_TEST
selftests::run_tests (args);
+#else
+ printf_filtered (_("\
+Selftests are not available in a non-development build.\n"));
+#endif
}
static void
maintenance_info_selftests (const char *arg, int from_tty)
{
+#if GDB_SELF_TEST
printf_filtered ("Registered selftests:\n");
selftests::for_each_selftest ([] (const std::string &name) {
printf_filtered (" - %s\n", name.c_str ());
});
+#else
+ printf_filtered (_("\
+Selftests are not available in a non-development build.\n"));
+#endif
}
\f
+2018-01-08 Simon Marchi <simon.marchi@ericsson.com>
+
+ * gdb.gdb/unittest.exp: Match output in non-development mode.
+
2018-01-08 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/access_tagged_param.exp: Relax expected output
set do_xml_test [expr ![gdb_skip_xml_test]]
gdb_start
-gdb_test "maintenance selftest" "Ran $decimal unit tests, 0 failed"
+
+set test "maintenance selftest"
+gdb_test_multiple $test $test {
+ -re "Ran ($decimal) unit tests, 0 failed\r\n$gdb_prompt $" {
+ 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$gdb_prompt $" {
+ unsupported $test
+ }
+}
if { ![is_remote host] && $do_xml_test } {
gdb_test "maintenance check xml-descriptions ${srcdir}/../features" \