[ARM] This patch fix some testsuite issues on ARM:
- Gtest-bt: like on x86/-64, the stack size passed to sigaltstack() is
too small for ARM thus causing segmentation fault due to stack
overflow.
- Gtest-dyn1: code size definition of dynamic function (template()) on
testcase is too big for ARM architecture so memcpy() reads invalid
memory causing random crashes (segmentation fault). A better
solution would be to compile the function in a separate binary,
mmap() it and memcpy() from it instead, so maximum size is known for
sure.
- check-name-space.in: fix some "bashisms", it causes the script to
fail to run on N8XX's busybox shell.
Signed-off-by: Anderson Lizardo <anderson.lizardo@indt.org.br>
Signed-off-by: Bruna Moreira <bruna.moreira@indt.org.br>
diff --git a/tests/Gtest-bt.c b/tests/Gtest-bt.c
index 1256512..8211f73 100644
--- a/tests/Gtest-bt.c
+++ b/tests/Gtest-bt.c
@@ -38,8 +38,8 @@
#include <unistd.h>
#include <libunwind.h>
-#if UNW_TARGET_X86 || UNW_TARGET_X86_64
-# define STACK_SIZE (128*1024) /* On x86/-64, SIGSTKSZ is too small */
+#if UNW_TARGET_X86 || UNW_TARGET_X86_64 || UNW_TARGET_ARM
+# define STACK_SIZE (128*1024) /* On x86/-64 and ARM, SIGSTKSZ is too small */
#else
# define STACK_SIZE SIGSTKSZ
#endif
diff --git a/tests/Gtest-dyn1.c b/tests/Gtest-dyn1.c
index 2faa1f7..039c086 100644
--- a/tests/Gtest-dyn1.c
+++ b/tests/Gtest-dyn1.c
@@ -34,7 +34,11 @@
#include <sys/mman.h>
+#if UNW_TARGET_ARM
+#define MAX_FUNC_SIZE 96 /* FIXME: arch/compiler dependent */
+#else
#define MAX_FUNC_SIZE 2048 /* max. size of cloned function */
+#endif
#define panic(args...) \
{ fprintf (stderr, args); exit (-1); }
diff --git a/tests/check-namespace.sh.in b/tests/check-namespace.sh.in
index 253f709..d6f5122 100644
--- a/tests/check-namespace.sh.in
+++ b/tests/check-namespace.sh.in
@@ -13,7 +13,7 @@
LIBUNWIND=../src/.libs/libunwind.so
LIBUNWIND_GENERIC=../src/.libs/libunwind-${plat}.so
-function fetch_symtab {
+fetch_symtab () {
filename=$1
if [ ! -r $filename ]; then
@@ -38,12 +38,12 @@
IFS="$saved_IFS"
}
-function ignore {
+ignore () {
sym=$1
symtab=`echo "$symtab" | grep -v " ${sym}\$"`
}
-function match {
+match () {
sym=$1
if `echo "$symtab" | grep -q " ${sym}\$"`; then
symtab=`echo "$symtab" | grep -v " ${sym}\$"`
@@ -57,7 +57,7 @@
# Filter out miscellaneous symbols that get defined by the
# linker for each shared object.
#
-function filter_misc {
+filter_misc () {
ignore _DYNAMIC
ignore _GLOBAL_OFFSET_TABLE_
ignore __bss_start
@@ -71,7 +71,7 @@
ignore ICRT.INTERNAL # ICC 8.x defines this
}
-function check_local_unw_abi {
+check_local_unw_abi () {
match _UL${plat}_create_addr_space
match _UL${plat}_destroy_addr_space
match _UL${plat}_get_fpreg
@@ -129,7 +129,7 @@
esac
}
-function check_generic_unw_abi {
+check_generic_unw_abi () {
match _U${plat}_create_addr_space
match _U${plat}_destroy_addr_space
match _U${plat}_flush_cache
@@ -186,7 +186,7 @@
esac
}
-function check_cxx_abi {
+check_cxx_abi () {
match _Unwind_Backtrace
match _Unwind_DeleteException
match _Unwind_FindEnclosingFunction
@@ -230,7 +230,7 @@
esac
}
-function check_empty {
+check_empty () {
if [ -n "$symtab" ]; then
echo -e " ERROR: Extraneous symbols:\n$symtab"
num_errors=`expr $num_errors + 1`
@@ -252,7 +252,7 @@
if [ $num_errors -gt 0 ]; then
echo "FAILURE: Detected $num_errors errors"
- exit -1
+ exit 1
fi
if $verbose; then