* allregs.c (main): Fail if we find no registers.
* run-native-test.sh: New file.
* Makefile.am (TESTS, EXTRA_DIST): Add it.
+2005-12-13 Roland McGrath <roland@redhat.com>
+
+ * 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 <drepper@redhat.com
* run-readelf-test1.sh: New file.
run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \
run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \
run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \
- run-find-prologues.sh run-allregs.sh run-readelf-test1.sh
+ run-find-prologues.sh run-allregs.sh run-readelf-test1.sh \
+ run-native-test.sh
# run-show-ciefde.sh
if !STANDALONE
run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \
run-ranlib-test3.sh run-ranlib-test4.sh \
run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \
- run-find-prologues.sh run-allregs.sh \
+ run-find-prologues.sh run-allregs.sh run-native-test.sh \
testfile15.bz2 testfile15.debug.bz2 \
testfile16.bz2 testfile16.debug.bz2 \
testfile17.bz2 testfile17.debug.bz2 \
if (regno == *(int *) arg)
printf ("%5d => %s register %s%s\n", regno, setname, prefix, regname);
- return DWARF_CB_OK;
+ return DWARF_CB_ABORT;
}
{
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);
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);
--- /dev/null
+#! /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