From: Roland McGrath Date: Tue, 13 Dec 2005 23:24:37 +0000 (+0000) Subject: 2005-12-13 Roland McGrath X-Git-Tag: elfutils-0.120~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94d26ad7385888b46e75dc1949ff7e424288c00d;p=thirdparty%2Felfutils.git 2005-12-13 Roland McGrath * allregs.c (main): Fail if we find no registers. * run-native-test.sh: New file. * Makefile.am (TESTS, EXTRA_DIST): Add it. --- diff --git a/tests/ChangeLog b/tests/ChangeLog index d2e38759c..4cc42b85e 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,10 @@ +2005-12-13 Roland McGrath + + * allregs.c (main): Fail if we find no registers. + + * run-native-test.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + 2005-12-10 Ulrich Drepper %s register %s%s\n", regno, setname, prefix, regname); - return DWARF_CB_OK; + return DWARF_CB_ABORT; } @@ -131,9 +131,9 @@ main (int argc, char **argv) { struct state state = { NULL, 0 }; int result = dwfl_module_register_names (mod, &one_register, &state); - if (result != 0) + if (result != 0 || state.nregs == 0) error (EXIT_FAILURE, 0, "dwfl_module_register_names: %s", - dwfl_errmsg (-1)); + result ? dwfl_errmsg (-1) : "no backend registers known"); qsort (state.info, state.nregs, sizeof state.info[0], &compare); @@ -156,9 +156,9 @@ main (int argc, char **argv) const char *arg = argv[remaining++]; int regno = atoi (arg); int result = dwfl_module_register_names (mod, &match_register, ®no); - if (result != 0) + if (result != DWARF_CB_ABORT) error (EXIT_FAILURE, 0, "dwfl_module_register_names: %s", - dwfl_errmsg (-1)); + result ? dwfl_errmsg (-1) : "no backend registers known"); } while (remaining < argc); diff --git a/tests/run-native-test.sh b/tests/run-native-test.sh new file mode 100755 index 000000000..c9126c614 --- /dev/null +++ b/tests/run-native-test.sh @@ -0,0 +1,58 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# +# This program is Open Source software; you can redistribute it and/or +# modify it under the terms of the Open Software License version 1.0 as +# published by the Open Source Initiative. +# +# You should have received a copy of the Open Software License along +# with this program; if not, you may obtain a copy of the Open Software +# License version 1.0 from http://www.opensource.org/licenses/osl.php or +# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., +# 3001 King Ranch Road, Ukiah, CA 95482. + +. $srcdir/test-subr.sh + +# This tests all the miscellaneous components of backend support +# against whatever this build is running on. A platform will fail +# this test if it is missing parts of the backend implementation. +# +# As new backend code is added to satisfy the test, be sure to update +# the fixed test cases (run-allregs.sh et al) to test that backend +# in all builds. + +tempfiles native.c native +echo 'main () { while (1) pause (); }' > native.c + +native=0 +native_cleanup() +{ + test $native -eq 0 || kill -9 $native || : + rm -f $remove_files +} +trap native_cleanup 0 1 2 15 + +for cc in "$HOSTCC" "$HOST_CC" cc gcc "$CC"; do + test "x$cc" != x || continue + $cc -o native -g native.c > /dev/null 2>&1 && + ./native & native=$! && + sleep 1 && kill -0 $native 2> /dev/null && + break || + native=0 +done + +native_test() +{ + # Try the build against itself, i.e. $config_host. + testrun "$@" -e $1 > /dev/null + + # Try the build against a presumed native process, running this sh. + # For tests requiring debug information, this may not test anything. + testrun "$@" -p $$ > /dev/null + + # Try the build against the trivial native program we just built with -g. + test $native -eq 0 || testrun "$@" -p $native > /dev/null +} + +native_test ./allregs +native_test ./funcretval