diff options
-rw-r--r-- | tests/ChangeLog | 8 | ||||
-rw-r--r-- | tests/Makefile.am | 8 | ||||
-rw-r--r-- | tests/rdwrmmap.c | 29 | ||||
-rwxr-xr-x | tests/run-bug1-test.sh | 22 | ||||
-rw-r--r-- | tests/testfile28.bz2 | bin | 0 -> 171 bytes | |||
-rw-r--r-- | tests/testfile28.rdwr.bz2 | bin | 0 -> 172 bytes |
6 files changed, 64 insertions, 3 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index bccd736c..16b1491c 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +2006-04-04 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add rules to run run-bug1-test.sh. + * rdwrmmap.c: New file. + * run-bug1-test.sh: New file. + * testfile28.bz2: New file. + * testfile28.rdwr.bz2: New file. + 2006-03-09 Roland McGrath <roland@redhat.com> * Makefile.am (AM_LDFLAGS): Define to pass -rpath-link. diff --git a/tests/Makefile.am b/tests/Makefile.am index 92881094..a88836bd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -45,7 +45,7 @@ noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \ show-die-info get-files get-lines get-pubnames \ get-aranges allfcts line2addr addrscopes funcscopes \ show-abbrev hash newscn ecp dwflmodtest \ - find-prologues funcretval allregs + find-prologues funcretval allregs rdwrmmap # get-ciefde asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ asm-tst6 asm-tst7 asm-tst8 asm-tst9 @@ -62,7 +62,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ 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-native-test.sh + run-native-test.sh run-bug1-test.sh # run-show-ciefde.sh if !STANDALONE @@ -99,7 +99,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile21.bz2 testfile21.index.bz2 \ testfile22.bz2 testfile23.bz2 testfile24.bz2 testfile25.bz2 \ testfile26.bz2 testfile27.bz2 \ - coverage.sh test-subr.sh test-wrapper.sh run-readelf-test1.sh + coverage.sh test-subr.sh test-wrapper.sh run-readelf-test1.sh \ + run-bug1-test.sh testfile28.bz2 testfile28.rdwr.bz2 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \ bindir=$(DESTDIR)$(bindir) \ @@ -181,6 +182,7 @@ asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +rdwrmmap_LDADD = $(libelf) CLEANFILES = xxx *.gcno *.gcda *gconv diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c new file mode 100644 index 00000000..263be0fd --- /dev/null +++ b/tests/rdwrmmap.c @@ -0,0 +1,29 @@ +#include <errno.h> +#include <error.h> +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <libelf.h> + +int +main (int argc __attribute__ ((unused)), char *argv[]) +{ + int fd = open (argv[1], O_RDWR); + if (fd < 0) + error (2, errno, "open: %s", argv[1]); + + if (elf_version (EV_CURRENT) == EV_NONE) + error (1, 0, "libelf version mismatch"); + + Elf *elf = elf_begin (fd, ELF_C_RDWR_MMAP, NULL); + if (elf == NULL) + error (1, 0, "elf_begin: %s", elf_errmsg (-1)); + + if (elf_update (elf, ELF_C_WRITE) < 0) + error (1, 0, "elf_update: %s", elf_errmsg (-1)); + + elf_end (elf); + close (fd); + + return 0; +} diff --git a/tests/run-bug1-test.sh b/tests/run-bug1-test.sh new file mode 100755 index 00000000..4e12b77d --- /dev/null +++ b/tests/run-bug1-test.sh @@ -0,0 +1,22 @@ +#! /bin/sh +# Copyright (C) 2006 Red Hat, Inc. +# Written by Ulrich Drepper <drepper@redhat.com>, 2006. +# +# 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 + +testfiles testfile28 testfile28.rdwr + +testrun ./rdwrmmap testfile28 + +cmp testfile28 testfile28.rdwr + +exit 0 diff --git a/tests/testfile28.bz2 b/tests/testfile28.bz2 Binary files differnew file mode 100644 index 00000000..ca0dff3d --- /dev/null +++ b/tests/testfile28.bz2 diff --git a/tests/testfile28.rdwr.bz2 b/tests/testfile28.rdwr.bz2 Binary files differnew file mode 100644 index 00000000..4c658484 --- /dev/null +++ b/tests/testfile28.rdwr.bz2 |