This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/PATCH] Don't disable selftests in a non-development build


On Tuesday, August 14 2018, I wrote:

> This is an idea I mentioned a few days ago in our IRC channel, and
> Simon said he'd be open to it, so I'm send this RFC/PATCH to see what
> others think.

Hm, the patch fails on Aarch64 (sorry, took a while for the builders to
notify about this).  I'll rework them and resubmit, but the idea stays
the same, so feel free to comment on it.

Thanks.

> Due to the many racy testcases and random failures we see when running
> the GDB testsuite, it is unfortunately not possible to perform a full
> test when one is building a downstream package.  As the Fedora GDB
> maintainer and one of the Debian GDB uploaders, I feel like this
> situation could be improved by, at least, executing our selftests
> after the package has been built.  However, we currently (for some
> reason that is not clear by reading the archives, but see more below)
> disable selftests on non-development builds.  Therefore, this patch
> aims to leave them enabled all the time, for everyone (including the
> end users).
>
> I understand that disabling the selftests in a non-development build
> brings a few advantages.  For example, we ship less code (even though
> the final difference may be small enough that it doesn't really have
> any real benefit).  Another thing to consider is that we disable
> portions of the codebase that could have latent bugs, making GDB a bit
> safer.  I don't really have an argument to compete with this;
> nonetheless, I think the benefit of having "batteries included" when
> it comes to testing is a huge thing.  With our selftests, the user
> doesn't need to install any external
> programs/libraries (dejagnu/tcl/etc.), and they're stable enough that
> we know that they don't suffer from the racyness present in our
> current testsuite.
>
> Anyway, here's my take at the problem.  The patches are mostly
> mechanical (getting rid of the "GDB_SELF_TEST" define, which becomes
> useless now that selftests are always present); the ones that aren't
> deal with the configure/Makefile machinery to always compile the
> selftests source files.
>
> I've tested this patch on BuildBot, without regressions.  I'm taking
> the liberty to Cc Joel, who is our release manager and might have
> opinions about this.
>
> OK?
>
> gdb/ChangeLog:
> 2018-08-14  Sergio Durigan Junior  <sergiodj@redhat.com>
>
> 	* Makefile.in (COMMON_SFILES): Add 'common/selftest.c'
> 	and 'selftest-arch.c'.
> 	(SFILES): Add '$(SUBDIR_UNITTESTS_SRCS)'.
> 	(HFILES_NO_SRCDIR): Add 'common/selftest.h'.
> 	(COMMON_OBS): Add '$(SUBDIR_UNITTESTS_OBS)'.
> 	* aarch64-tdep.c: Remove '#if GDB_SELF_TEST' guards.
> 	* amd64-linux-tdep.c: Likewise.
> 	* amd64-tdep.c: Likewise.
> 	* arm-tdep.c: Likewise.
> 	* config.in: Regenerate.
> 	* configure: Regenerate.
> 	* configure.ac: Don't define 'GDB_SELF_TEST'; remove setting
> 	of 'CONFIG_OBS' and 'CONFIG_SRCS' with selftests
> 	objects/sources.
> 	* cp-support.c: Remove '#if GDB_SELF_TEST' guards.
> 	* disasm-selftests.c: Likewise.
> 	* dwarf-index-cache.c: Likewise.
> 	* dwarf2-frame.c: Likewise.
> 	* dwarf2loc.c: Likewise.
> 	* dwarf2read.c: Likewise.
> 	* findvar.c: Likewise.
> 	* gdbarch-selftests.c: Likewise.
> 	* i386-linux-tdep.c: Likewise.
> 	* i386-tdep.c: Likewise.
> 	* maint.c: Likewise.
> 	(maintenance_selftest): Remove unneded message about selftests
> 	not available in a non-development build.
> 	(maintenance_info_selftests): Likewise.
> 	* producer.c: Remove '#if GDB_SELF_TEST' guards.
> 	* regcache.c: Likewise.
> 	* rust-exp.y: Likewise.
> 	* selftest-arch.c: Likewise.
> 	* symfile.c: Likewise.
> 	* target-descriptions.c: Likewise.
> 	* target-descriptions.h: Likewise.
> 	* target.c: Likewise.
> 	* target.h: Likewise.
> 	* utils.c: Likewise.
> 	* value.c: Likewise.
>
> gdb/gdbserver/ChangeLog:
> 2018-08-14  Sergio Durigan Junior  <sergiodj@redhat.com>
>
> 	* Makefile.in (SFILES): Add '$(srcdir)/common/selftest.c'.
> 	(OBS): Add 'common/selftest.o'.
> 	* config.in: Regenerate.
> 	* configure: Regenerate.
> 	* configure.ac: Don't define 'GDB_SELF_TEST'.  Don't add
> 	'$srv_selftest_obs' to 'GDBSERVER_DEPFILES'.
> 	* configure.srv: Always set 'srv_i386_linux_regobj' and
> 	'srv_amd64_linux_regobj' with selftest-related objects.
> 	Always set 'srv_regobj' with selftest-related objects.
> 	* linux-aarch64-low.c: Remove '#if GDB_SELF_TEST' guards.
> 	* linux-aarch64-tdesc.h: Likewise.
> 	* linux-tic6x-low.c: Likewise.
> 	* linux-x86-low.c: Likewise.
> 	* server.c: Likewise.
> 	(captured_main): Remove unneded message about selftests not
> 	available in a non-development build.
> 	*
>
> gdb/testsuite/ChangeLog:
> 2018-08-14  Sergio Durigan Junior  <sergiodj@redhat.com>
>
> 	* gdb.gdb/unittest.exp: Remove match for "Selftests are not
> 	available in a non-development build."
> 	* gdb.server/unittest.exp: Likewise.
> ---
>  gdb/Makefile.in                       |  9 +++++++--
>  gdb/aarch64-tdep.c                    |  8 --------
>  gdb/amd64-linux-tdep.c                |  2 --
>  gdb/amd64-tdep.c                      |  2 --
>  gdb/arm-tdep.c                        |  8 --------
>  gdb/config.in                         |  3 ---
>  gdb/configure                         |  8 --------
>  gdb/configure.ac                      |  7 -------
>  gdb/cp-support.c                      |  5 -----
>  gdb/disasm-selftests.c                |  4 ----
>  gdb/dwarf-index-cache.c               |  8 +++++---
>  gdb/dwarf2-frame.c                    |  6 ------
>  gdb/dwarf2loc.c                       |  4 ----
>  gdb/dwarf2read.c                      |  4 ----
>  gdb/findvar.c                         |  4 ----
>  gdb/gdbarch-selftests.c               |  4 ----
>  gdb/gdbserver/Makefile.in             |  2 ++
>  gdb/gdbserver/config.in               |  3 ---
>  gdb/gdbserver/configure               |  7 -------
>  gdb/gdbserver/configure.ac            |  8 +-------
>  gdb/gdbserver/configure.srv           | 25 +++++++------------------
>  gdb/gdbserver/linux-aarch64-low.c     |  2 --
>  gdb/gdbserver/linux-aarch64-tdesc.h   |  2 --
>  gdb/gdbserver/linux-tic6x-low.c       |  4 ----
>  gdb/gdbserver/linux-x86-low.c         |  2 --
>  gdb/gdbserver/server.c                | 10 ----------
>  gdb/i386-linux-tdep.c                 |  2 --
>  gdb/i386-tdep.c                       |  2 --
>  gdb/maint.c                           | 10 ----------
>  gdb/producer.c                        |  4 ----
>  gdb/regcache.c                        |  4 ----
>  gdb/rust-exp.y                        |  4 ----
>  gdb/selftest-arch.c                   |  2 --
>  gdb/symfile.c                         |  4 ----
>  gdb/target-descriptions.c             |  2 --
>  gdb/target-descriptions.h             |  2 --
>  gdb/target.c                          |  2 --
>  gdb/target.h                          |  2 --
>  gdb/testsuite/gdb.gdb/unittest.exp    |  4 ----
>  gdb/testsuite/gdb.server/unittest.exp |  4 ----
>  gdb/utils.c                           |  4 ----
>  gdb/value.c                           |  4 ----
>  42 files changed, 22 insertions(+), 185 deletions(-)
>
> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
> index 118c3c8062..8c8c23fd6a 100644
> --- a/gdb/Makefile.in
> +++ b/gdb/Makefile.in
> @@ -966,6 +966,7 @@ COMMON_SFILES = \
>  	common/rsp-low.c \
>  	common/run-time-clock.c \
>  	common/scoped_mmap.c \
> +	common/selftest.c \
>  	common/signals.c \
>  	common/signals-state-save-restore.c \
>  	common/tdesc.c \
> @@ -1092,6 +1093,7 @@ COMMON_SFILES = \
>  	remote-notif.c \
>  	reverse.c \
>  	rust-lang.c \
> +	selftest-arch.c \
>  	sentinel-frame.c \
>  	ser-event.c \
>  	serial.c \
> @@ -1162,7 +1164,8 @@ SFILES = \
>  	$(SUBDIR_CLI_SRCS) \
>  	$(SUBDIR_TARGET_SRCS) \
>  	$(COMMON_SFILES) \
> -	$(SUBDIR_GCC_COMPILE_SRCS)
> +	$(SUBDIR_GCC_COMPILE_SRCS) \
> +	$(SUBDIR_UNITTESTS_SRCS)
>  
>  # Header files that need to have srcdir added.  Note that in the cases
>  # where we use a macro like $(gdbcmd_h), things are carefully arranged
> @@ -1452,6 +1455,7 @@ HFILES_NO_SRCDIR = \
>  	common/queue.h \
>  	common/rsp-low.h \
>  	common/run-time-clock.h \
> +	common/selftest.h \
>  	common/signals-state-save-restore.h \
>  	common/symbol.h \
>  	common/tdesc.h \
> @@ -1566,7 +1570,8 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
>  	$(patsubst %.c,%.o,$(COMMON_SFILES)) \
>  	$(SUBDIR_CLI_OBS) \
>  	$(SUBDIR_TARGET_OBS) \
> -	$(SUBDIR_GCC_COMPILE_OBS)
> +	$(SUBDIR_GCC_COMPILE_OBS) \
> +	$(SUBDIR_UNITTESTS_OBS)
>  
>  SUBDIRS = doc @subdirs@ data-directory $(GNULIB_BUILDDIR)
>  CLEANDIRS = $(SUBDIRS)
> diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
> index 5c6eb98545..00f9456954 100644
> --- a/gdb/aarch64-tdep.c
> +++ b/gdb/aarch64-tdep.c
> @@ -516,7 +516,6 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
>  				   reader);
>  }
>  
> -#if GDB_SELF_TEST
>  
>  namespace selftests {
>  
> @@ -640,7 +639,6 @@ aarch64_analyze_prologue_test (void)
>    }
>  }
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
>  
>  /* Implement the "skip_prologue" gdbarch method.  */
>  
> @@ -3154,12 +3152,10 @@ aarch64_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
>  		      paddress (gdbarch, tdep->lowest_pc));
>  }
>  
> -#if GDB_SELF_TEST
>  namespace selftests
>  {
>  static void aarch64_process_record_test (void);
>  }
> -#endif
>  
>  void
>  _initialize_aarch64_tdep (void)
> @@ -3176,14 +3172,12 @@ When on, AArch64 specific debugging is enabled."),
>  			    show_aarch64_debug,
>  			    &setdebuglist, &showdebuglist);
>  
> -#if GDB_SELF_TEST
>    selftests::register_test ("aarch64-analyze-prologue",
>  			    selftests::aarch64_analyze_prologue_test);
>    selftests::register_test ("aarch64-process-record",
>  			    selftests::aarch64_process_record_test);
>    selftests::record_xml_tdesc ("aarch64.xml",
>  			       aarch64_create_target_description (0));
> -#endif
>  }
>  
>  /* AArch64 process record-replay related structures, defines etc.  */
> @@ -4085,7 +4079,6 @@ deallocate_reg_mem (insn_decode_record *record)
>    xfree (record->aarch64_mems);
>  }
>  
> -#if GDB_SELF_TEST
>  namespace selftests {
>  
>  static void
> @@ -4118,7 +4111,6 @@ aarch64_process_record_test (void)
>  }
>  
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
>  
>  /* Parse the current instruction and record the values of the registers and
>     memory that will be changed in current instruction to record_arch_list
> diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
> index 7ab43897ab..19432b3fda 100644
> --- a/gdb/amd64-linux-tdep.c
> +++ b/gdb/amd64-linux-tdep.c
> @@ -2280,7 +2280,6 @@ _initialize_amd64_linux_tdep (void)
>    gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32,
>  			  GDB_OSABI_LINUX, amd64_x32_linux_init_abi);
>  
> -#if GDB_SELF_TEST
>    struct
>    {
>      const char *xml;
> @@ -2306,5 +2305,4 @@ _initialize_amd64_linux_tdep (void)
>  
>        selftests::record_xml_tdesc (a.xml, tdesc);
>      }
> -#endif /* GDB_SELF_TEST */
>  }
> diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
> index 088542d72b..4c88ce66ca 100644
> --- a/gdb/amd64-tdep.c
> +++ b/gdb/amd64-tdep.c
> @@ -3300,7 +3300,6 @@ _initialize_amd64_tdep (void)
>    gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32, GDB_OSABI_NONE,
>   			  amd64_x32_none_init_abi);
>  
> -#if GDB_SELF_TEST
>    struct
>    {
>      const char *xml;
> @@ -3321,7 +3320,6 @@ _initialize_amd64_tdep (void)
>  
>        selftests::record_xml_tdesc (a.xml, tdesc);
>      }
> -#endif /* GDB_SELF_TEST */
>  }
>  
>  
> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> index c3280ee211..ac63594e5f 100644
> --- a/gdb/arm-tdep.c
> +++ b/gdb/arm-tdep.c
> @@ -69,9 +69,7 @@
>  #include "features/arm/arm-with-vfpv3.c"
>  #include "features/arm/arm-with-neon.c"
>  
> -#if GDB_SELF_TEST
>  #include "selftest.h"
> -#endif
>  
>  static int arm_debug;
>  
> @@ -9523,12 +9521,10 @@ arm_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
>  		      (unsigned long) tdep->lowest_pc);
>  }
>  
> -#if GDB_SELF_TEST
>  namespace selftests
>  {
>  static void arm_record_test (void);
>  }
> -#endif
>  
>  void
>  _initialize_arm_tdep (void)
> @@ -9664,9 +9660,7 @@ vfp - VFP co-processor."),
>  			   NULL, /* FIXME: i18n: "ARM debugging is %s.  */
>  			   &setdebuglist, &showdebuglist);
>  
> -#if GDB_SELF_TEST
>    selftests::register_test ("arm-record", selftests::arm_record_test);
> -#endif
>  
>  }
>  
> @@ -13199,7 +13193,6 @@ decode_insn (abstract_memory_reader &reader, insn_decode_record *arm_record,
>    return ret;
>  }
>  
> -#if GDB_SELF_TEST
>  namespace selftests {
>  
>  /* Provide both 16-bit and 32-bit thumb instructions.  */
> @@ -13303,7 +13296,6 @@ arm_record_test (void)
>    }
>  }
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
>  
>  /* Cleans up local record registers and memory allocations.  */
>  
> diff --git a/gdb/config.in b/gdb/config.in
> index 01acda124b..75c1dd2930 100644
> --- a/gdb/config.in
> +++ b/gdb/config.in
> @@ -65,9 +65,6 @@
>  /* Define to the default OS ABI for this configuration. */
>  #undef GDB_OSABI_DEFAULT
>  
> -/* Define if self-testing features should be enabled */
> -#undef GDB_SELF_TEST
> -
>  /* Define to 1 if you have `alloca', as a function or macro. */
>  #undef HAVE_ALLOCA
>  
> diff --git a/gdb/configure b/gdb/configure
> index 9cd0036848..e30e67034b 100755
> --- a/gdb/configure
> +++ b/gdb/configure
> @@ -17740,14 +17740,6 @@ ac_config_links="$ac_config_links $ac_config_links_1"
>  $as_echo "#define GDB_DEFAULT_HOST_CHARSET \"UTF-8\"" >>confdefs.h
>  
>  
> -if $development; then
> -
> -$as_echo "#define GDB_SELF_TEST 1" >>confdefs.h
> -
> -  CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) common/selftest.o selftest-arch.o"
> -  CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) common/selftest.c selftest-arch.c"
> -fi
> -
>  
>    gdb_ac_transform=`echo "$program_transform_name" | sed -e 's/\\$\\$/\\$/g'`
>    GDB_TRANSFORM_NAME=`echo gdb | sed -e "$gdb_ac_transform"`
> diff --git a/gdb/configure.ac b/gdb/configure.ac
> index 13bc5f9a8f..ac41b4595b 100644
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -2279,13 +2279,6 @@ dnl  At the moment, we just assume it's UTF-8.
>  AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
>            [Define to be a string naming the default host character set.])
>  
> -if $development; then
> -  AC_DEFINE(GDB_SELF_TEST, 1,
> -            [Define if self-testing features should be enabled])
> -  CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) common/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])
>  GDB_AC_TRANSFORM([gcore], [GCORE_TRANSFORM_NAME])
>  AC_CONFIG_FILES([gcore], [chmod +x gcore])
> diff --git a/gdb/cp-support.c b/gdb/cp-support.c
> index 3ce5f60b12..074bc44263 100644
> --- a/gdb/cp-support.c
> +++ b/gdb/cp-support.c
> @@ -1801,7 +1801,6 @@ cp_get_symbol_name_matcher (const lookup_name_info &lookup_name)
>    gdb_assert_not_reached ("");
>  }
>  
> -#if GDB_SELF_TEST
>  
>  namespace selftests {
>  
> @@ -2114,8 +2113,6 @@ test_cp_remove_params ()
>  
>  } // namespace selftests
>  
> -#endif /* GDB_SELF_CHECK */
> -
>  /* Don't allow just "maintenance cplus".  */
>  
>  static  void
> @@ -2199,10 +2196,8 @@ display the offending symbol."),
>  			   &maintenance_show_cmdlist);
>  #endif
>  
> -#if GDB_SELF_TEST
>    selftests::register_test ("cp_symbol_name_matches",
>  			    selftests::test_cp_symbol_name_matches);
>    selftests::register_test ("cp_remove_params",
>  			    selftests::test_cp_remove_params);
> -#endif
>  }
> diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c
> index f7d0ecca0e..38a5e16e7e 100644
> --- a/gdb/disasm-selftests.c
> +++ b/gdb/disasm-selftests.c
> @@ -20,7 +20,6 @@
>  #include "defs.h"
>  #include "disasm.h"
>  
> -#if GDB_SELF_TEST
>  #include "selftest.h"
>  #include "selftest-arch.h"
>  
> @@ -205,15 +204,12 @@ memory_error_test (struct gdbarch *gdbarch)
>  }
>  
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
>  
>  void
>  _initialize_disasm_selftests (void)
>  {
> -#if GDB_SELF_TEST
>    selftests::register_test_foreach_arch ("print_one_insn",
>  					 selftests::print_one_insn_test);
>    selftests::register_test_foreach_arch ("memory_error",
>  					 selftests::memory_error_test);
> -#endif
>  }
> diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c
> index 966630b60c..07ddf4f466 100644
> --- a/gdb/dwarf-index-cache.c
> +++ b/gdb/dwarf-index-cache.c
> @@ -346,7 +346,8 @@ show_index_cache_stats_command (const char *arg, int from_tty)
>  		     indent, global_index_cache.n_misses ());
>  }
>  
> -#if GDB_SELF_TEST && defined (HAVE_MKDTEMP)
> +#if defined (HAVE_MKDTEMP)
> +
>  namespace selftests
>  {
>  
> @@ -400,7 +401,8 @@ test_mkdir_recursive ()
>    SELF_CHECK (create_dir_and_check (dir.c_str ()));
>  }
>  }
> -#endif /*  GDB_SELF_TEST && defined (HAVE_MKDTEMP) */
> +
> +#endif /* defined (HAVE_MKDTEMP) */
>  
>  void
>  _initialize_index_cache ()
> @@ -457,7 +459,7 @@ When non-zero, debugging output for the index cache is displayed."),
>  			    NULL, NULL,
>  			    &setdebuglist, &showdebuglist);
>  
> -#if GDB_SELF_TEST && defined (HAVE_MKDTEMP)
> +#if defined (HAVE_MKDTEMP)
>    selftests::register_test ("mkdir_recursive", selftests::test_mkdir_recursive);
>  #endif
>  }
> diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
> index 58f1ba4f2f..f648962fec 100644
> --- a/gdb/dwarf2-frame.c
> +++ b/gdb/dwarf2-frame.c
> @@ -39,10 +39,8 @@
>  #include "ax.h"
>  #include "dwarf2loc.h"
>  #include "dwarf2-frame-tailcall.h"
> -#if GDB_SELF_TEST
>  #include "selftest.h"
>  #include "selftest-arch.h"
> -#endif
>  
>  struct comp_unit;
>  
> @@ -607,7 +605,6 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
>    return insn_ptr;
>  }
>  
> -#if GDB_SELF_TEST
>  
>  namespace selftests {
>  
> @@ -665,7 +662,6 @@ execute_cfa_program_test (struct gdbarch *gdbarch)
>  }
>  
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
>  
>  
>  
> @@ -2431,8 +2427,6 @@ architecture that doesn't support them will have no effect."),
>  			   &set_dwarf_cmdlist,
>  			   &show_dwarf_cmdlist);
>  
> -#if GDB_SELF_TEST
>    selftests::register_test_foreach_arch ("execute_cfa_program",
>  					 selftests::execute_cfa_program_test);
> -#endif
>  }
> diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
> index a98b676b30..df5f0059f6 100644
> --- a/gdb/dwarf2loc.c
> +++ b/gdb/dwarf2loc.c
> @@ -1612,7 +1612,6 @@ copy_bitwise (gdb_byte *dest, ULONGEST dest_offset,
>      }
>  }
>  
> -#if GDB_SELF_TEST
>  
>  namespace selftests {
>  
> @@ -1745,7 +1744,6 @@ copy_bitwise_tests (void)
>  
>  } /* namespace selftests */
>  
> -#endif /* GDB_SELF_TEST */
>  
>  /* Return the number of bytes overlapping a contiguous chunk of N_BITS
>     bits whose first bit is located at bit offset START.  */
> @@ -4681,7 +4679,5 @@ _initialize_dwarf2loc (void)
>  			     show_entry_values_debug,
>  			     &setdebuglist, &showdebuglist);
>  
> -#if GDB_SELF_TEST
>    selftests::register_test ("copy_bitwise", selftests::copy_bitwise_tests);
> -#endif
>  }
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 81a0087c26..55391cbd4a 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -4566,7 +4566,6 @@ dw2_expand_symtabs_matching_symbol
>    static_assert (sizeof (prev) > sizeof (offset_type), "");
>  }
>  
> -#if GDB_SELF_TEST
>  
>  namespace selftests { namespace dw2_expand_symtabs_matching {
>  
> @@ -4989,7 +4988,6 @@ run_test ()
>  
>  }} // namespace selftests::dw2_expand_symtabs_matching
>  
> -#endif /* GDB_SELF_TEST */
>  
>  /* If FILE_MATCHER is NULL or if PER_CU has
>     dwarf2_per_cu_quick_data::MARK set (see
> @@ -25593,8 +25591,6 @@ Warning: This option must be enabled before gdb reads the file."),
>    dwarf2_loclist_block_index = register_symbol_block_impl (LOC_BLOCK,
>  					&dwarf2_block_frame_base_loclist_funcs);
>  
> -#if GDB_SELF_TEST
>    selftests::register_test ("dw2_expand_symtabs_matching",
>  			    selftests::dw2_expand_symtabs_matching::run_test);
> -#endif
>  }
> diff --git a/gdb/findvar.c b/gdb/findvar.c
> index ebaff923a1..74df206660 100644
> --- a/gdb/findvar.c
> +++ b/gdb/findvar.c
> @@ -1010,7 +1010,6 @@ address_from_register (int regnum, struct frame_info *frame)
>    return result;
>  }
>  
> -#if GDB_SELF_TEST
>  namespace selftests {
>  namespace findvar_tests {
>  
> @@ -1089,14 +1088,11 @@ copy_integer_to_size_test ()
>  } // namespace findvar_test
>  } // namespace selftests
>  
> -#endif
>  
>  void
>  _initialize_findvar (void)
>  {
> -#if GDB_SELF_TEST
>    selftests::register_test
>      ("copy_integer_to_size",
>       selftests::findvar_tests::copy_integer_to_size_test);
> -#endif
>  }
> diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c
> index 73a31244b4..317cfa3b2f 100644
> --- a/gdb/gdbarch-selftests.c
> +++ b/gdb/gdbarch-selftests.c
> @@ -18,7 +18,6 @@
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  
>  #include "defs.h"
> -#if GDB_SELF_TEST
>  #include "selftest.h"
>  #include "selftest-arch.h"
>  #include "inferior.h"
> @@ -168,13 +167,10 @@ register_to_value_test (struct gdbarch *gdbarch)
>  }
>  
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
>  
>  void
>  _initialize_gdbarch_selftests (void)
>  {
> -#if GDB_SELF_TEST
>    selftests::register_test_foreach_arch ("register_to_value",
>  					 selftests::register_to_value_test);
> -#endif
>  }
> diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
> index f2f8a084bd..fcda9e725d 100644
> --- a/gdb/gdbserver/Makefile.in
> +++ b/gdb/gdbserver/Makefile.in
> @@ -217,6 +217,7 @@ SFILES = \
>  	$(srcdir)/common/print-utils.c \
>  	$(srcdir)/common/ptid.c \
>  	$(srcdir)/common/rsp-low.c \
> +	$(srcdir)/common/selftest.c \
>  	$(srcdir)/common/tdesc.c \
>  	$(srcdir)/common/vec.c \
>  	$(srcdir)/common/xml-utils.c \
> @@ -261,6 +262,7 @@ OBS = \
>  	common/print-utils.o \
>  	common/ptid.o \
>  	common/rsp-low.o \
> +	common/selftest.o \
>  	common/signals.o \
>  	common/signals-state-save-restore.o \
>  	common/tdesc.o \
> diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
> index 05537df81e..ac404afd04 100644
> --- a/gdb/gdbserver/config.in
> +++ b/gdb/gdbserver/config.in
> @@ -8,9 +8,6 @@
>  /* Define to 1 if using `alloca.c'. */
>  #undef C_ALLOCA
>  
> -/* Define if self-testing features should be enabled */
> -#undef GDB_SELF_TEST
> -
>  /* Define to 1 if you have `alloca', as a function or macro. */
>  #undef HAVE_ALLOCA
>  
> diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
> index 043bc216e4..fbd59d7268 100755
> --- a/gdb/gdbserver/configure
> +++ b/gdb/gdbserver/configure
> @@ -5889,13 +5889,6 @@ fi
>    fi
>  
>  
> -if $development; then
> -  srv_selftest_objs="common/selftest.o"
> -
> -$as_echo "#define GDB_SELF_TEST 1" >>confdefs.h
> -
> -fi
> -
>   case ${build_alias} in
>    "") build_noncanonical=${build} ;;
>    *) build_noncanonical=${build_alias} ;;
> diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
> index 99bc46221c..6fc3cc1fa2 100644
> --- a/gdb/gdbserver/configure.ac
> +++ b/gdb/gdbserver/configure.ac
> @@ -54,12 +54,6 @@ else
>  fi
>  GDB_AC_LIBMCHECK(${libmcheck_default})
>  
> -if $development; then
> -  srv_selftest_objs="common/selftest.o"
> -  AC_DEFINE(GDB_SELF_TEST, 1,
> -            [Define if self-testing features should be enabled])
> -fi
> -
>  ACX_NONCANONICAL_TARGET
>  ACX_NONCANONICAL_HOST
>  
> @@ -410,7 +404,7 @@ if test "$srv_xmlfiles" != ""; then
>    done
>  fi
>  
> -GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles $srv_host_obs $srv_selftest_objs"
> +GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles $srv_host_obs"
>  GDBSERVER_LIBS="$srv_libs"
>  
>  dnl Check whether the target supports __sync_*_compare_and_swap.
> diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
> index 72e6a0d87f..46ea3ff142 100644
> --- a/gdb/gdbserver/configure.srv
> +++ b/gdb/gdbserver/configure.srv
> @@ -24,13 +24,8 @@
>  # Default hostio_last_error implementation
>  srv_hostio_err_objs="hostio-errno.o"
>  
> -if $development; then
> -   srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-avx-avx512-linux.o i386-avx-mpx-avx512-pku-linux.o i386-mpx-linux.o i386-avx-mpx-linux.o i386-mmx-linux.o linux-x86-tdesc-selftest.o"
> -   srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o amd64-avx-avx512-linux.o amd64-avx-mpx-avx512-pku-linux.o amd64-mpx-linux.o amd64-avx-mpx-linux.o x32-linux.o x32-avx-linux.o x32-avx-avx512-linux.o"
> -else
> -   srv_i386_linux_regobj=""
> -   srv_amd64_linux_regobj=""
> -fi
> +srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-avx-avx512-linux.o i386-avx-mpx-avx512-pku-linux.o i386-mpx-linux.o i386-avx-mpx-linux.o i386-mmx-linux.o linux-x86-tdesc-selftest.o"
> +srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o amd64-avx-avx512-linux.o amd64-avx-mpx-avx512-pku-linux.o amd64-mpx-linux.o amd64-avx-mpx-linux.o x32-linux.o x32-avx-linux.o x32-avx-avx512-linux.o"
>  
>  ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-cell32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-cell64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o"
>  
> @@ -43,10 +38,8 @@ srv_linux_obj="linux-low.o linux-osdata.o linux-procfs.o linux-ptrace.o linux-wa
>  case "${target}" in
>    aarch64*-*-linux*)
>  			srv_regobj="arm-with-neon.o"
> -			if $development; then
> -			  srv_regobj="${srv_regobj} aarch64.o"
> -			  srv_regobj="${srv_regobj} linux-aarch64-tdesc-selftest.o"
> -                        fi
> +			srv_regobj="${srv_regobj} aarch64.o"
> +			srv_regobj="${srv_regobj} linux-aarch64-tdesc-selftest.o"
>  			srv_tgtobj="linux-aarch64-low.o aarch64-linux-hw-point.o"
>  			srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
>  			srv_tgtobj="${srv_tgtobj} arch/arm.o"
> @@ -343,13 +336,9 @@ case "${target}" in
>    spu*-*-*)		srv_regobj=reg-spu.o
>  			srv_tgtobj="spu-low.o fork-child.o fork-inferior.o"
>  			;;
> -  tic6x-*-uclinux)	if $development; then
> -			  srv_regobj="tic6x-c64xp-linux.o"
> -			  srv_regobj="${srv_regobj} tic6x-c64x-linux.o"
> -			  srv_regobj="${srv_regobj} tic6x-c62x-linux.o"
> -                        else
> -			  srv_regobj=""
> -                        fi
> +  tic6x-*-uclinux)	srv_regobj="tic6x-c64xp-linux.o"
> +			srv_regobj="${srv_regobj} tic6x-c64x-linux.o"
> +			srv_regobj="${srv_regobj} tic6x-c62x-linux.o"
>  			srv_tgtobj="$srv_linux_obj linux-tic6x-low.o"
>  			srv_tgtobj="${srv_tgtobj} arch/tic6x.o"
>  			srv_linux_regsets=yes
> diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
> index 1d34e319df..b77e18d2f3 100644
> --- a/gdb/gdbserver/linux-aarch64-low.c
> +++ b/gdb/gdbserver/linux-aarch64-low.c
> @@ -3085,7 +3085,5 @@ initialize_low_arch (void)
>    initialize_regsets_info (&aarch64_regsets_info);
>    initialize_regsets_info (&aarch64_sve_regsets_info);
>  
> -#if GDB_SELF_TEST
>    initialize_low_tdesc ();
> -#endif
>  }
> diff --git a/gdb/gdbserver/linux-aarch64-tdesc.h b/gdb/gdbserver/linux-aarch64-tdesc.h
> index 4d2b883b55..51bc08bd2c 100644
> --- a/gdb/gdbserver/linux-aarch64-tdesc.h
> +++ b/gdb/gdbserver/linux-aarch64-tdesc.h
> @@ -19,6 +19,4 @@
>  
>  const target_desc * aarch64_linux_read_description (uint64_t vq);
>  
> -#if GDB_SELF_TEST
>  void initialize_low_tdesc ();
> -#endif
> diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
> index d90bbcfe51..99f2f8cad0 100644
> --- a/gdb/gdbserver/linux-tic6x-low.c
> +++ b/gdb/gdbserver/linux-tic6x-low.c
> @@ -423,7 +423,6 @@ struct linux_target_ops the_low_target = {
>    tic6x_supports_hardware_single_step,
>  };
>  
> -#if GDB_SELF_TEST
>  #include "common/selftest.h"
>  
>  namespace selftests {
> @@ -437,19 +436,16 @@ tic6x_tdesc_test ()
>  }
>  }
>  }
> -#endif
>  
>  void
>  initialize_low_arch (void)
>  {
> -#if GDB_SELF_TEST
>    /* Initialize the Linux target descriptions.  */
>    init_registers_tic6x_c64xp_linux ();
>    init_registers_tic6x_c64x_linux ();
>    init_registers_tic6x_c62x_linux ();
>  
>    selftests::register_test ("tic6x-tdesc", selftests::tdesc::tic6x_tdesc_test);
> -#endif
>  
>    initialize_regsets_info (&tic6x_regsets_info);
>  }
> diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
> index 80b43802c7..daa603398a 100644
> --- a/gdb/gdbserver/linux-x86-low.c
> +++ b/gdb/gdbserver/linux-x86-low.c
> @@ -2897,9 +2897,7 @@ initialize_low_arch (void)
>    tdesc_amd64_linux_no_xml->xmltarget = xmltarget_amd64_linux_no_xml;
>  #endif
>  
> -#if GDB_SELF_TEST
>    initialize_low_tdesc ();
> -#endif
>  
>    tdesc_i386_linux_no_xml = allocate_target_description ();
>    copy_target_description (tdesc_i386_linux_no_xml,
> diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
> index a491ae0257..8bc51c8e3c 100644
> --- a/gdb/gdbserver/server.c
> +++ b/gdb/gdbserver/server.c
> @@ -3573,9 +3573,7 @@ captured_main (int argc, char *argv[])
>    volatile int attach = 0;
>    int was_running;
>    bool selftest = false;
> -#if GDB_SELF_TEST
>    const char *selftest_filter = NULL;
> -#endif
>  
>    current_directory = getcwd (NULL, 0);
>    client_state &cs = get_client_state ();
> @@ -3708,9 +3706,7 @@ captured_main (int argc, char *argv[])
>        else if (startswith (*next_arg, "--selftest="))
>  	{
>  	  selftest = true;
> -#if GDB_SELF_TEST
>  	  selftest_filter = *next_arg + strlen ("--selftest=");
> -#endif
>  	}
>        else
>  	{
> @@ -3787,11 +3783,7 @@ captured_main (int argc, char *argv[])
>  
>    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");
>      }
>  
> @@ -4495,7 +4487,6 @@ handle_target_event (int err, gdb_client_data client_data)
>    return 0;
>  }
>  
> -#if GDB_SELF_TEST
>  namespace selftests
>  {
>  
> @@ -4504,4 +4495,3 @@ reset ()
>  {}
>  
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
> diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
> index 802c41fe72..efb9b1a7a1 100644
> --- a/gdb/i386-linux-tdep.c
> +++ b/gdb/i386-linux-tdep.c
> @@ -1083,7 +1083,6 @@ _initialize_i386_linux_tdep (void)
>    gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX,
>  			  i386_linux_init_abi);
>  
> -#if GDB_SELF_TEST
>    struct
>    {
>      const char *xml;
> @@ -1105,5 +1104,4 @@ _initialize_i386_linux_tdep (void)
>  
>        selftests::record_xml_tdesc (a.xml, tdesc);
>      }
> -#endif /* GDB_SELF_TEST */
>  }
> diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
> index a6994aaf12..4e8bd9caa4 100644
> --- a/gdb/i386-tdep.c
> +++ b/gdb/i386-tdep.c
> @@ -9053,7 +9053,6 @@ Show Intel Memory Protection Extensions specific variables."),
>    /* Tell remote stub that we support XML target description.  */
>    register_remote_support_xml ("i386");
>  
> -#if GDB_SELF_TEST
>    struct
>    {
>      const char *xml;
> @@ -9075,5 +9074,4 @@ Show Intel Memory Protection Extensions specific variables."),
>  
>        selftests::record_xml_tdesc (a.xml, tdesc);
>      }
> -#endif /* GDB_SELF_TEST */
>  }
> diff --git a/gdb/maint.c b/gdb/maint.c
> index 5d4701cfac..446047227b 100644
> --- a/gdb/maint.c
> +++ b/gdb/maint.c
> @@ -939,26 +939,16 @@ show_per_command_cmd (const char *args, int from_tty)
>  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
>  }
>  
>  
> diff --git a/gdb/producer.c b/gdb/producer.c
> index f21aae93ac..459ced494c 100644
> --- a/gdb/producer.c
> +++ b/gdb/producer.c
> @@ -125,7 +125,6 @@ producer_is_icc (const char *producer, int *major, int *minor)
>    return false;
>  }
>  
> -#if defined GDB_SELF_TEST
>  namespace selftests {
>  namespace producer {
>  
> @@ -206,13 +205,10 @@ Version 18.0 Beta";
>  }
>  }
>  }
> -#endif
>  
>  void
>  _initialize_producer ()
>  {
> -#if defined GDB_SELF_TEST
>    selftests::register_test
>      ("producer-parser", selftests::producer::producer_parsing_tests);
> -#endif
>  }
> diff --git a/gdb/regcache.c b/gdb/regcache.c
> index f3f845aad6..91561ad3fc 100644
> --- a/gdb/regcache.c
> +++ b/gdb/regcache.c
> @@ -1419,7 +1419,6 @@ register_dump::dump (ui_file *file)
>  			footnote_register_type_name_null);
>  }
>  
> -#if GDB_SELF_TEST
>  #include "selftest.h"
>  #include "selftest-arch.h"
>  #include "gdbthread.h"
> @@ -1846,7 +1845,6 @@ cooked_write_test (struct gdbarch *gdbarch)
>  }
>  
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
>  
>  void
>  _initialize_regcache (void)
> @@ -1861,12 +1859,10 @@ _initialize_regcache (void)
>    add_com ("flushregs", class_maintenance, reg_flush_command,
>  	   _("Force gdb to flush its register cache (maintainer command)"));
>  
> -#if GDB_SELF_TEST
>    selftests::register_test ("current_regcache", selftests::current_regcache_test);
>  
>    selftests::register_test_foreach_arch ("regcache::cooked_read_test",
>  					 selftests::cooked_read_test);
>    selftests::register_test_foreach_arch ("regcache::cooked_write_test",
>  					 selftests::cooked_write_test);
> -#endif
>  }
> diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
> index 248e558a54..70a8acf9ae 100644
> --- a/gdb/rust-exp.y
> +++ b/gdb/rust-exp.y
> @@ -2545,7 +2545,6 @@ rustyyerror (rust_parser *parser, const char *msg)
>  
>  
>  
> -#if GDB_SELF_TEST
>  
>  /* Initialize the lexer for testing.  */
>  
> @@ -2803,7 +2802,6 @@ rust_lex_tests (void)
>    rust_lex_test_push_back (&parser);
>  }
>  
> -#endif /* GDB_SELF_TEST */
>  
>  void
>  _initialize_rust_exp (void)
> @@ -2813,7 +2811,5 @@ _initialize_rust_exp (void)
>       error.  */
>    gdb_assert (code == 0);
>  
> -#if GDB_SELF_TEST
>    selftests::register_test ("rust-lex", rust_lex_tests);
> -#endif
>  }
> diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c
> index 7045c45660..835145c939 100644
> --- a/gdb/selftest-arch.c
> +++ b/gdb/selftest-arch.c
> @@ -18,7 +18,6 @@
>  
>  #include "defs.h"
>  
> -#if GDB_SELF_TEST
>  #include "selftest.h"
>  #include "selftest-arch.h"
>  #include "arch-utils.h"
> @@ -104,4 +103,3 @@ reset ()
>    reinit_frame_cache ();
>  }
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 20697d9dca..c61a6890ad 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -3791,7 +3791,6 @@ map_symbol_filenames (symbol_filename_ftype *fun, void *data,
>    }
>  }
>  
> -#if GDB_SELF_TEST
>  
>  namespace selftests {
>  namespace filename_language {
> @@ -3848,7 +3847,6 @@ test_set_ext_lang_command ()
>  } /* namespace filename_language */
>  } /* namespace selftests */
>  
> -#endif /* GDB_SELF_TEST */
>  
>  void
>  _initialize_symfile (void)
> @@ -3975,11 +3973,9 @@ Show printing of separate debug info file search debug."), _("\
>  When on, GDB prints the searched locations while looking for separate debug \
>  info files."), NULL, NULL, &setdebuglist, &showdebuglist);
>  
> -#if GDB_SELF_TEST
>    selftests::register_test
>      ("filename_language", selftests::filename_language::test_filename_language);
>    selftests::register_test
>      ("set_ext_lang_command",
>       selftests::filename_language::test_set_ext_lang_command);
> -#endif
>  }
> diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
> index 087de141f7..10f2f34eb8 100644
> --- a/gdb/target-descriptions.c
> +++ b/gdb/target-descriptions.c
> @@ -1748,7 +1748,6 @@ struct xml_test_tdesc
>  
>  static std::vector<xml_test_tdesc> xml_tdesc;
>  
> -#if GDB_SELF_TEST
>  
>  /* See target-descritpions.h.  */
>  
> @@ -1757,7 +1756,6 @@ record_xml_tdesc (const char *xml_file, const struct target_desc *tdesc)
>  {
>    xml_tdesc.emplace_back (xml_file, std::unique_ptr<const target_desc> (tdesc));
>  }
> -#endif
>  
>  }
>  
> diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
> index 96290b7d97..1aa8f5c79c 100644
> --- a/gdb/target-descriptions.h
> +++ b/gdb/target-descriptions.h
> @@ -210,7 +210,6 @@ void set_tdesc_property (struct target_desc *,
>  void tdesc_add_compatible (struct target_desc *,
>  			   const struct bfd_arch_info *);
>  
> -#if GDB_SELF_TEST
>  namespace selftests {
>  
>  /* Record that XML_FILE should generate a target description that equals
> @@ -220,6 +219,5 @@ namespace selftests {
>  void record_xml_tdesc (const char *xml_file,
>  		       const struct target_desc *tdesc);
>  }
> -#endif
>  
>  #endif /* TARGET_DESCRIPTIONS_H */
> diff --git a/gdb/target.c b/gdb/target.c
> index 2d98954b54..6f46575a19 100644
> --- a/gdb/target.c
> +++ b/gdb/target.c
> @@ -192,7 +192,6 @@ target_command (const char *arg, int from_tty)
>  		  gdb_stdout);
>  }
>  
> -#if GDB_SELF_TEST
>  namespace selftests {
>  
>  /* A mock process_stratum target_ops that doesn't read/write registers
> @@ -211,7 +210,6 @@ test_target_ops::info () const
>  }
>  
>  } /* namespace selftests */
> -#endif /* GDB_SELF_TEST */
>  
>  /* Default target_has_* methods for process_stratum targets.  */
>  
> diff --git a/gdb/target.h b/gdb/target.h
> index 39aa8c3c73..9c2cb38279 100644
> --- a/gdb/target.h
> +++ b/gdb/target.h
> @@ -2543,7 +2543,6 @@ extern void target_prepare_to_generate_core (void);
>  /* See to_done_generating_core.  */
>  extern void target_done_generating_core (void);
>  
> -#if GDB_SELF_TEST
>  namespace selftests {
>  
>  /* A mock process_stratum target_ops that doesn't read/write registers
> @@ -2586,6 +2585,5 @@ public:
>  
>  
>  } // namespace selftests
> -#endif /* GDB_SELF_TEST */
>  
>  #endif /* !defined (TARGET_H) */
> diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp
> index 1c835850b8..c962964284 100644
> --- a/gdb/testsuite/gdb.gdb/unittest.exp
> +++ b/gdb/testsuite/gdb.gdb/unittest.exp
> @@ -23,10 +23,6 @@ gdb_test_multiple $test $test {
>  	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 } {
> diff --git a/gdb/testsuite/gdb.server/unittest.exp b/gdb/testsuite/gdb.server/unittest.exp
> index e947ff2c30..c050989416 100644
> --- a/gdb/testsuite/gdb.server/unittest.exp
> +++ b/gdb/testsuite/gdb.server/unittest.exp
> @@ -38,10 +38,6 @@ gdb_expect {
>  	gdb_assert "$num_ran > 0" $test
>      }
>  
> -    -re "Selftests are not available in a non-development build.\r\n$" {
> -	unsupported $test
> -    }
> -
>      default {
>  	fail $test
>      }
> diff --git a/gdb/utils.c b/gdb/utils.c
> index 7a8c80c64e..67850c93e7 100644
> --- a/gdb/utils.c
> +++ b/gdb/utils.c
> @@ -2809,7 +2809,6 @@ string_to_core_addr (const char *my_string)
>    return addr;
>  }
>  
> -#if GDB_SELF_TEST
>  
>  static void
>  gdb_realpath_check_trailer (const char *input, const char *trailer)
> @@ -2843,7 +2842,6 @@ gdb_realpath_tests ()
>    gdb_realpath_check_trailer ("", "");
>  }
>  
> -#endif /* GDB_SELF_TEST */
>  
>  /* Allocation function for the libiberty hash table which uses an
>     obstack.  The obstack is passed as DATA.  */
> @@ -3239,7 +3237,5 @@ _initialize_utils (void)
>    add_internal_problem_command (&internal_warning_problem);
>    add_internal_problem_command (&demangler_warning_problem);
>  
> -#if GDB_SELF_TEST
>    selftests::register_test ("gdb_realpath", gdb_realpath_tests);
> -#endif
>  }
> diff --git a/gdb/value.c b/gdb/value.c
> index b0f22f1117..0d2307ebdb 100644
> --- a/gdb/value.c
> +++ b/gdb/value.c
> @@ -3921,7 +3921,6 @@ isvoid_internal_fn (struct gdbarch *gdbarch,
>    return value_from_longest (builtin_type (gdbarch)->builtin_int, ret);
>  }
>  
> -#if GDB_SELF_TEST
>  namespace selftests
>  {
>  
> @@ -4061,7 +4060,6 @@ test_insert_into_bit_range_vector ()
>  }
>  
>  } /* namespace selftests */
> -#endif /* GDB_SELF_TEST */
>  
>  void
>  _initialize_values (void)
> @@ -4114,9 +4112,7 @@ prevents future values, larger than this size, from being allocated."),
>  			    set_max_value_size,
>  			    show_max_value_size,
>  			    &setlist, &showlist);
> -#if GDB_SELF_TEST
>    selftests::register_test ("ranges_contain", selftests::test_ranges_contain);
>    selftests::register_test ("insert_into_bit_range_vector",
>  			    selftests::test_insert_into_bit_range_vector);
> -#endif
>  }
> -- 
> 2.17.1

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]