[1/3] i386/AArch64: Remove old xml tests
Commit Message
Both the i386, X86_64 and AArch64 builds of gdbserver include a bunch of legacy
xml files, dat files and auto generated C files, when building for unit test.
These tests exist back from when feature target descriptions were added to
prove that the new target descriptions were identical to the original
older versions. The old files are not used for anything other than these tests.
Now that this has been proven, we are not gaining anything by keeping the
original files and tests. Should new functionality be added, it would break
the tests, unless the functionality was backported to the xml. There is no
requirement that we must match the exact xml from N releases ago. It adds
obfuscation, where as the feature target descriptions were meant to simplify
the code.
In addition, there are a bunch of xml and dat files which are completely unused.
This patch removes the selftests and the target descriptions from gdbserver.
Update the unittest to allow 0 tests (note, this failed on other targets that
never had any tests).
2019-07-01 Alan Hayward <alan.hayward@arm.com>
* configure.srv: Remove legacy xml.
* linux-aarch64-low.c (initialize_low_arch): Remove
initialize_low_tdesc call.
* linux-aarch64-tdesc-selftest.c: Remove file.
* linux-aarch64-tdesc.h (initialize_low_tdesc): Remove.
* linux-x86-low.c (initialize_low_arch): Remove
initialize_low_tdesc call.
* linux-x86-tdesc-selftest.c: Remove file.
* linux-x86-tdesc.h (initialize_low_tdesc): Remove.
gdb/testsuite/ChangeLog:
2019-07-01 Alan Hayward <alan.hayward@arm.com>
* gdb.server/unittest.exp: Allow 0 unit tests to run.
---
gdb/gdbserver/configure.srv | 26 +--
gdb/gdbserver/linux-aarch64-low.c | 4 -
gdb/gdbserver/linux-aarch64-tdesc-selftest.c | 45 -----
gdb/gdbserver/linux-aarch64-tdesc.h | 4 -
gdb/gdbserver/linux-x86-low.c | 4 -
gdb/gdbserver/linux-x86-tdesc-selftest.c | 183 -------------------
gdb/gdbserver/linux-x86-tdesc.h | 2 -
gdb/testsuite/gdb.server/unittest.exp | 2 +-
8 files changed, 5 insertions(+), 265 deletions(-)
delete mode 100644 gdb/gdbserver/linux-aarch64-tdesc-selftest.c
delete mode 100644 gdb/gdbserver/linux-x86-tdesc-selftest.c
--
2.20.1 (Apple Git-117)
Comments
On Mon, 1 Jul 2019 11:15:56 +0000
Alan Hayward <Alan.Hayward@arm.com> wrote:
> Both the i386, X86_64 and AArch64 builds of gdbserver include a bunch of legacy
> xml files, dat files and auto generated C files, when building for unit test.
>
> These tests exist back from when feature target descriptions were added to
> prove that the new target descriptions were identical to the original
> older versions. The old files are not used for anything other than these tests.
>
> Now that this has been proven, we are not gaining anything by keeping the
> original files and tests. Should new functionality be added, it would break
> the tests, unless the functionality was backported to the xml. There is no
> requirement that we must match the exact xml from N releases ago. It adds
> obfuscation, where as the feature target descriptions were meant to simplify
> the code.
>
> In addition, there are a bunch of xml and dat files which are completely unused.
>
> This patch removes the selftests and the target descriptions from gdbserver.
>
> Update the unittest to allow 0 tests (note, this failed on other targets that
> never had any tests).
>
> 2019-07-01 Alan Hayward <alan.hayward@arm.com>
>
> * configure.srv: Remove legacy xml.
> * linux-aarch64-low.c (initialize_low_arch): Remove
> initialize_low_tdesc call.
> * linux-aarch64-tdesc-selftest.c: Remove file.
> * linux-aarch64-tdesc.h (initialize_low_tdesc): Remove.
> * linux-x86-low.c (initialize_low_arch): Remove
> initialize_low_tdesc call.
> * linux-x86-tdesc-selftest.c: Remove file.
> * linux-x86-tdesc.h (initialize_low_tdesc): Remove.
>
> gdb/testsuite/ChangeLog:
>
> 2019-07-01 Alan Hayward <alan.hayward@arm.com>
>
> * gdb.server/unittest.exp: Allow 0 unit tests to run.
This patch, and the follow on patches too, look good to me.
Kevin
> On 3 Jul 2019, at 20:53, Kevin Buettner <kevinb@redhat.com> wrote:
>
> On Mon, 1 Jul 2019 11:15:56 +0000
> Alan Hayward <Alan.Hayward@arm.com> wrote:
>
>> Both the i386, X86_64 and AArch64 builds of gdbserver include a bunch of legacy
>> xml files, dat files and auto generated C files, when building for unit test.
>>
>> These tests exist back from when feature target descriptions were added to
>> prove that the new target descriptions were identical to the original
>> older versions. The old files are not used for anything other than these tests.
>>
>> Now that this has been proven, we are not gaining anything by keeping the
>> original files and tests. Should new functionality be added, it would break
>> the tests, unless the functionality was backported to the xml. There is no
>> requirement that we must match the exact xml from N releases ago. It adds
>> obfuscation, where as the feature target descriptions were meant to simplify
>> the code.
>>
>> In addition, there are a bunch of xml and dat files which are completely unused.
>>
>> This patch removes the selftests and the target descriptions from gdbserver.
>>
>> Update the unittest to allow 0 tests (note, this failed on other targets that
>> never had any tests).
>>
>> 2019-07-01 Alan Hayward <alan.hayward@arm.com>
>>
>> * configure.srv: Remove legacy xml.
>> * linux-aarch64-low.c (initialize_low_arch): Remove
>> initialize_low_tdesc call.
>> * linux-aarch64-tdesc-selftest.c: Remove file.
>> * linux-aarch64-tdesc.h (initialize_low_tdesc): Remove.
>> * linux-x86-low.c (initialize_low_arch): Remove
>> initialize_low_tdesc call.
>> * linux-x86-tdesc-selftest.c: Remove file.
>> * linux-x86-tdesc.h (initialize_low_tdesc): Remove.
>>
>> gdb/testsuite/ChangeLog:
>>
>> 2019-07-01 Alan Hayward <alan.hayward@arm.com>
>>
>> * gdb.server/unittest.exp: Allow 0 unit tests to run.
>
> This patch, and the follow on patches too, look good to me.
>
> Kevin
Thanks! and pushed.
Alan.
@@ -24,14 +24,6 @@
# Default hostio_last_error implementation
srv_hostio_err_objs="hostio-errno.o"
-if $enable_unittests; 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
-
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-isa205-ppr-dscr-vsx32l-ipa.o powerpc-isa207-vsx32l-ipa.o powerpc-isa207-htm-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 powerpc-isa205-ppr-dscr-vsx64l-ipa.o powerpc-isa207-vsx64l-ipa.o powerpc-isa207-htm-vsx64l-ipa.o"
# Linux object files. This is so we don't have to repeat
@@ -41,12 +33,7 @@ srv_linux_obj="linux-low.o linux-osdata.o linux-procfs.o linux-ptrace.o linux-wa
# Input is taken from the "${target}" variable.
case "${target}" in
- aarch64*-*-linux*)
- srv_regobj="arm-with-neon.o"
- if $enable_unittests; then
- srv_regobj="${srv_regobj} aarch64.o"
- srv_regobj="${srv_regobj} linux-aarch64-tdesc-selftest.o"
- fi
+ aarch64*-*-linux*) srv_regobj="arm-with-neon.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"
@@ -110,12 +97,7 @@ case "${target}" in
srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
srv_tgtobj="${srv_tgtobj} arch/i386.o"
;;
- i[34567]86-*-linux*) srv_regobj="$srv_i386_linux_regobj"
- if test "$gdb_cv_i386_is_x86_64" = yes ; then
- srv_regobj="$srv_regobj $srv_amd64_linux_regobj"
- srv_tgtobj="amd64-linux-siginfo.o"
- fi
- srv_tgtobj="${srv_tgtobj} arch/i386.o"
+ i[34567]86-*-linux*) srv_tgtobj="${srv_tgtobj} arch/i386.o"
srv_tgtobj="${srv_tgtobj} $srv_linux_obj linux-x86-low.o x86-low.o x86-dregs.o i387-fp.o"
srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
@@ -382,8 +364,8 @@ case "${target}" in
srv_linux_usrregs=yes
srv_linux_thread_db=yes
;;
- x86_64-*-linux*) srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
- srv_tgtobj="$srv_linux_obj linux-x86-low.o x86-low.o x86-dregs.o i387-fp.o"
+ x86_64-*-linux*) srv_tgtobj="$srv_linux_obj linux-x86-low.o x86-low.o"
+ srv_tgtobj="${srv_tgtobj} x86-dregs.o i387-fp.o"
srv_tgtobj="${srv_tgtobj} arch/i386.o arch/amd64.o"
srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
@@ -3097,8 +3097,4 @@ 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
}
deleted file mode 100644
@@ -1,45 +0,0 @@
-/* Copyright (C) 2017-2019 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "server.h"
-#include "tdesc.h"
-#include "common/selftest.h"
-#include "linux-aarch64-tdesc.h"
-
-/* Defined in auto-generated file features/aarch64.c. */
-void init_registers_aarch64 (void);
-extern const struct target_desc *tdesc_aarch64;
-
-namespace selftests {
-namespace tdesc {
-static void
-aarch64_tdesc_test ()
-{
- const target_desc *tdesc = aarch64_linux_read_description (0, false);
- SELF_CHECK (*tdesc == *tdesc_aarch64);
-}
-}
-} // namespace selftests
-
-void
-initialize_low_tdesc ()
-{
- init_registers_aarch64 ();
-
- selftests::register_test ("aarch64-tdesc",
- selftests::tdesc::aarch64_tdesc_test);
-}
@@ -22,8 +22,4 @@
const target_desc * aarch64_linux_read_description (uint64_t vq, bool pauth_p);
-#if GDB_SELF_TEST
-void initialize_low_tdesc ();
-#endif
-
#endif /* GDBSERVER_LINUX_AARCH64_TDESC_H */
@@ -2911,10 +2911,6 @@ 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,
i386_linux_read_description (X86_XSTATE_SSE_MASK));
deleted file mode 100644
@@ -1,183 +0,0 @@
-/* Copyright (C) 2017-2019 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "server.h"
-#include "linux-x86-tdesc.h"
-#include "tdesc.h"
-#include "common/selftest.h"
-#include "common/x86-xstate.h"
-
-/* Defined in auto-generated file i386-linux.c. */
-void init_registers_i386_linux (void);
-extern const struct target_desc *tdesc_i386_linux;
-
-/* Defined in auto-generated file i386-mmx-linux.c. */
-void init_registers_i386_mmx_linux (void);
-extern const struct target_desc *tdesc_i386_mmx_linux;
-
-/* Defined in auto-generated file i386-avx-linux.c. */
-void init_registers_i386_avx_linux (void);
-extern const struct target_desc *tdesc_i386_avx_linux;
-
-/* Defined in auto-generated file i386-avx-mpx-linux.c. */
-void init_registers_i386_avx_mpx_linux (void);
-extern const struct target_desc *tdesc_i386_avx_mpx_linux;
-
-/* Defined in auto-generated file i386-avx-avx512-linux.c. */
-void init_registers_i386_avx_avx512_linux (void);
-extern const struct target_desc *tdesc_i386_avx_avx512_linux;
-
-/* Defined in auto-generated file i386-avx-mpx-avx512-linux.c. */
-void init_registers_i386_avx_mpx_avx512_pku_linux (void);
-extern const struct target_desc *tdesc_i386_avx_mpx_avx512_pku_linux;
-
-/* Defined in auto-generated file i386-mpx-linux.c. */
-void init_registers_i386_mpx_linux (void);
-extern const struct target_desc *tdesc_i386_mpx_linux;
-
-#ifdef __x86_64__
-
-/* Defined in auto-generated file amd64-linux.c. */
-void init_registers_amd64_linux (void);
-extern const struct target_desc *tdesc_amd64_linux;
-
-/* Defined in auto-generated file amd64-avx-linux.c. */
-void init_registers_amd64_avx_linux (void);
-extern const struct target_desc *tdesc_amd64_avx_linux;
-
-/* Defined in auto-generated file amd64-avx-avx512-linux.c. */
-void init_registers_amd64_avx_avx512_linux (void);
-extern const struct target_desc *tdesc_amd64_avx_avx512_linux;
-
-/* Defined in auto-generated file amd64-avx-mpx-avx512-pku-linux.c. */
-void init_registers_amd64_avx_mpx_avx512_pku_linux (void);
-extern const struct target_desc *tdesc_amd64_avx_mpx_avx512_pku_linux;
-
-/* Defined in auto-generated file amd64-avx-mpx-linux.c. */
-void init_registers_amd64_avx_mpx_linux (void);
-extern const struct target_desc *tdesc_amd64_avx_mpx_linux;
-
-/* Defined in auto-generated file amd64-mpx-linux.c. */
-void init_registers_amd64_mpx_linux (void);
-extern const struct target_desc *tdesc_amd64_mpx_linux;
-
-/* Defined in auto-generated file x32-linux.c. */
-void init_registers_x32_linux (void);
-extern const struct target_desc *tdesc_x32_linux;
-
-/* Defined in auto-generated file x32-avx-linux.c. */
-void init_registers_x32_avx_linux (void);
-extern const struct target_desc *tdesc_x32_avx_linux;
-
-/* Defined in auto-generated file x32-avx-avx512-linux.c. */
-void init_registers_x32_avx_avx512_linux (void);
-extern const struct target_desc *tdesc_x32_avx_avx512_linux;
-
-#endif
-
-namespace selftests {
-namespace tdesc {
-static void
-i386_tdesc_test ()
-{
- struct
- {
- unsigned int mask;
- const target_desc *tdesc;
- } tdesc_tests[] = {
- { X86_XSTATE_X87, tdesc_i386_mmx_linux },
- { X86_XSTATE_SSE_MASK, tdesc_i386_linux },
- { X86_XSTATE_AVX_MASK, tdesc_i386_avx_linux },
- { X86_XSTATE_MPX_MASK, tdesc_i386_mpx_linux },
- { X86_XSTATE_AVX_MPX_MASK, tdesc_i386_avx_mpx_linux },
- { X86_XSTATE_AVX_AVX512_MASK, tdesc_i386_avx_avx512_linux },
- { X86_XSTATE_AVX_MPX_AVX512_PKU_MASK, tdesc_i386_avx_mpx_avx512_pku_linux }
- };
-
- for (auto &elem : tdesc_tests)
- {
- const target_desc *tdesc = i386_linux_read_description (elem.mask);
-
- SELF_CHECK (*tdesc == *elem.tdesc);
- }
-}
-
-#ifdef __x86_64__
-
-static void
-amd64_tdesc_test ()
-{
- struct
- {
- unsigned int mask;
- const target_desc *tdesc[2];
- } tdesc_tests[] = {
- { X86_XSTATE_SSE_MASK, { tdesc_amd64_linux, tdesc_x32_linux } },
- { X86_XSTATE_AVX_MASK, { tdesc_amd64_avx_linux, tdesc_x32_avx_linux } },
- { X86_XSTATE_MPX_MASK, { tdesc_amd64_mpx_linux, tdesc_x32_avx_linux } },
- { X86_XSTATE_AVX_MPX_MASK, { tdesc_amd64_avx_mpx_linux,
- tdesc_x32_avx_linux } },
- { X86_XSTATE_AVX_AVX512_MASK, { tdesc_amd64_avx_avx512_linux,
- tdesc_x32_avx_avx512_linux } },
- { X86_XSTATE_AVX_MPX_AVX512_PKU_MASK,
- { tdesc_amd64_avx_mpx_avx512_pku_linux, tdesc_x32_avx_avx512_linux } },
- };
-
- for (auto &elem : tdesc_tests)
- {
- for (int i = 0; i < 2; i++)
- {
- const target_desc *tdesc = amd64_linux_read_description (elem.mask,
- i);
-
- SELF_CHECK (*tdesc == *elem.tdesc[i]);
- }
- }
-}
-
-#endif
-}
-} // namespace selftests
-
-void
-initialize_low_tdesc ()
-{
- init_registers_i386_linux ();
- init_registers_i386_mmx_linux ();
- init_registers_i386_avx_linux ();
- init_registers_i386_mpx_linux ();
- init_registers_i386_avx_mpx_linux ();
- init_registers_i386_avx_avx512_linux ();
- init_registers_i386_avx_mpx_avx512_pku_linux ();
-
- selftests::register_test ("i386-tdesc", selftests::tdesc::i386_tdesc_test);
-
-#ifdef __x86_64__
- init_registers_x32_linux ();
- init_registers_x32_avx_linux ();
- init_registers_x32_avx_avx512_linux ();
-
- init_registers_amd64_linux ();
- init_registers_amd64_avx_linux ();
- init_registers_amd64_mpx_linux ();
- init_registers_amd64_avx_mpx_linux ();
- init_registers_amd64_avx_avx512_linux ();
- init_registers_amd64_avx_mpx_avx512_pku_linux ();
-
- selftests::register_test ("amd64-tdesc", selftests::tdesc::amd64_tdesc_test);
-#endif
-}
@@ -53,6 +53,4 @@ const struct target_desc *amd64_linux_read_description (uint64_t xcr0,
const struct target_desc *i386_linux_read_description (uint64_t xcr0);
-void initialize_low_tdesc ();
-
#endif /* GDBSERVER_LINUX_X86_TDESC_H */
@@ -35,7 +35,7 @@ gdb_expect {
-i $server_spawn_id
-re "Ran ($decimal) unit tests, 0 failed" {
set num_ran $expect_out(1,string)
- gdb_assert "$num_ran > 0" $test
+ gdb_assert "$num_ran >= 0" $test
}
-re "Selftests have been disabled for this build.\r\n$" {