This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

A testcase for my DL patch


Hi,

This is the testcase for my DL patch. Just do

# make CC=gcc



-- 
H.J. Lu (hjl@gnu.org)
--
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1998-05-06 13:43 PDT by <hjl@ocean>.
# Source directory was `/home/hjl/bugs/glibc/static.1'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    393 -rw-r--r-- Makefile
#    515 -rw-r--r-- static.c
#     51 -rw-r--r-- foo.c
#     51 -rw-r--r-- bar.c
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh32211; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= Makefile ==============
if test -f 'Makefile' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'Makefile' '(file already exists)'
else
  $echo 'x -' extracting 'Makefile' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
CC=gcc-glibc2# -B./
CFLAGS=-O -g
X
SHLIBS=libfoo.so libbar.so
X
PROGS=static
X
all: $(SHLIBS) $(PROGS)
X	-for f in $(PROGS); do \
X	  if [ -x $$f ]; then $$f; echo $$?; fi; \
X	done
X
static: static.c
X	$(CC) -static $(CFLAGS) -o $@ $^ -ldl
X
lib%.so: %.c
X	$(CC) $(CFLAGS) -fPIC -o $@ $< -shared
X
clean:
X	$(RM) a.out core $(PROGS) *.o *.s lib*.so*
X
shar:
X	shar Makefile static.c foo.c bar.c > bug.shar
SHAR_EOF
  $shar_touch -am 0506134298 'Makefile' &&
  chmod 0644 'Makefile' ||
  $echo 'restore of' 'Makefile' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'Makefile:' 'MD5 check failed'
004e7ae36435a0c098b46834db83d6f9  Makefile
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
    test 393 -eq "$shar_count" ||
    $echo 'Makefile:' 'original size' '393,' 'current size' "$shar_count!"
  fi
fi
# ============= static.c ==============
if test -f 'static.c' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'static.c' '(file already exists)'
else
  $echo 'x -' extracting 'static.c' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'static.c' &&
#include <dlfcn.h>
X
main ()
{
X void *handle;
X void (*func) (const char *);
X
X handle = dlopen ("./libfoo.so", RTLD_NOW);
X if (!handle)
X   printf ("%s\n", dlerror ());
X func = dlsym (handle, "foo");
X if (!func)
X   printf ("%s\n", dlerror ());
X (*func) ("Hello world\n");
X dlclose (handle);
X
X handle = dlopen ("./libbar.so", RTLD_NOW);
X if (!handle)
X   printf ("%s\n", dlerror ());
X func = dlsym (handle, "bar");
X if (!func)
X   printf ("%s\n", dlerror ());
X (*func) ("Hello world\n");
X dlclose (handle);
X
X return 0;
}
SHAR_EOF
  $shar_touch -am 0506134298 'static.c' &&
  chmod 0644 'static.c' ||
  $echo 'restore of' 'static.c' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'static.c:' 'MD5 check failed'
ecf611b3b8f6c41bb1760bdd3245f2ee  static.c
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'static.c'`"
    test 515 -eq "$shar_count" ||
    $echo 'static.c:' 'original size' '515,' 'current size' "$shar_count!"
  fi
fi
# ============= foo.c ==============
if test -f 'foo.c' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'foo.c' '(file already exists)'
else
  $echo 'x -' extracting 'foo.c' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'foo.c' &&
foo (const char *s)
{
X  printf ("foo: %s\n", s);
}
SHAR_EOF
  $shar_touch -am 0506134298 'foo.c' &&
  chmod 0644 'foo.c' ||
  $echo 'restore of' 'foo.c' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'foo.c:' 'MD5 check failed'
a95dbdc29e9d561cd12e945da81b24f7  foo.c
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'foo.c'`"
    test 51 -eq "$shar_count" ||
    $echo 'foo.c:' 'original size' '51,' 'current size' "$shar_count!"
  fi
fi
# ============= bar.c ==============
if test -f 'bar.c' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'bar.c' '(file already exists)'
else
  $echo 'x -' extracting 'bar.c' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'bar.c' &&
bar (const char *s)
{
X  printf ("bar: %s\n", s);
}
SHAR_EOF
  $shar_touch -am 0506134298 'bar.c' &&
  chmod 0644 'bar.c' ||
  $echo 'restore of' 'bar.c' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'bar.c:' 'MD5 check failed'
c342bb3c07f25672fc64a50ee461317c  bar.c
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'bar.c'`"
    test 51 -eq "$shar_count" ||
    $echo 'bar.c:' 'original size' '51,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh32211
exit 0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]