[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
improve demo-hardcode (e.g. on Solaris)
From: |
Ralf Wildenhues |
Subject: |
improve demo-hardcode (e.g. on Solaris) |
Date: |
Mon, 4 Apr 2005 20:20:07 +0200 |
User-agent: |
Mutt/1.4.1i |
Several people (I Cc:ed a couple) have reported spurious failures of
demo-hardcode.test on some Solaris boxen. I believe they are all bogus
and caused by the compiler or putting the command line into the output
(or something similar).
Therefore, I propose a change to the hardcode test. I really don't
understand why we don't make use of platform-specific objdump-like tools
here, as they are bound to give much more correct answers than the ugly
test employed now. And for reference and fun, I have added a few more
tools to the chain.
Patch against branch-1-5, which makes hardcode PASS on the one Solaris
system I tested on (solaris2.8, Sun WorkShop 6 update 2).
Comments? Does anyone know more portable command line switches (maybe
because they have been supported for longer)? Should I just include
objdump and dumpstabs for safety?
Regards,
Ralf
* tests/hardcode.test: Use any of objdump, dumpstabs [solaris]
or dump [aix] if available.
--- tests/hardcode.test 2002-11-19 10:42:39.000000000 +0100
+++ tests/hardcode.test 2005-03-31 21:02:50.000000000 +0200
@@ -17,6 +17,10 @@
exit 77
fi
+: ${OBJDUMP=objdump}
+: ${DUMPSTABS=dumpstabs}
+: ${DUMP=dump}
+
# Unfortunately, we need access to libtool internals for this test.
objdir=NONE
eval `grep '^objdir=' ./libtool 2>/dev/null`
@@ -95,12 +99,30 @@
# Discover whether the objdir really was hardcoded.
hardcoded=no
+ if { $OBJDUMP -x $file; } >/dev/null 2>&1; then
+ if $OBJDUMP -x $file 2>/dev/null | $FGREP "$objdir" > /dev/null 2>&1; then
+ hardcoded=yes
+ else
+ hardcoded=no
+ fi
+ elif { $DUMPSTABS -d $file; } >/dev/null 2>&1; then
+ if $DUMPSTABS -d $file 2>/dev/null | $FGREP "$objdir" > /dev/null 2>&1;
then
+ hardcoded=yes
+ else
+ hardcoded=no
+ fi
+ elif { $DUMP -n $file; } >/dev/null 2>&1; then
+ if $DUMP -n $file 2>/dev/null | $FGREP "$objdir" > /dev/null 2>&1; then
+ hardcoded=yes
+ else
+ hardcoded=no
+ fi
# At least AIX fgrep doesn't work for binary files, and AIX also
# doesn't have strings(1), so we need this strange conversion
# (which only works on ASCII).
# AIX fgrep also has a limited line length, so we turn unprintable
# characters into newlines.
- if cat $file | (tr '\000-\037\200-\377' '\n' || cat) 2>/dev/null \
+ elif cat $file | (tr '\000-\037\200-\377' '\n' || cat) 2>/dev/null \
| $FGREP "$objdir" > /dev/null 2>&1; then
hardcoded=yes
elif $FGREP "$objdir" $file > /dev/null 2>&1; then
- improve demo-hardcode (e.g. on Solaris),
Ralf Wildenhues <=