summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2013-01-15 08:32:18 -0800
committerAnas Nashif <anas.nashif@intel.com>2013-01-15 08:32:18 -0800
commit689b9dbb8d7f88ab91e7741932ed000b6e49be9a (patch)
tree463f5a1df8b2d35644c260e7bf6c8e0a26198af1 /testsuite
parent59749d048d9e452f049f9151735b5256756919c3 (diff)
downloadltrace-689b9dbb8d7f88ab91e7741932ed000b6e49be9a.tar.gz
ltrace-689b9dbb8d7f88ab91e7741932ed000b6e49be9a.tar.bz2
ltrace-689b9dbb8d7f88ab91e7741932ed000b6e49be9a.zip
Imported Upstream version 0.7.2upstream/0.7.2
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/Makefile71
-rw-r--r--testsuite/Makefile.am (renamed from testsuite/ltrace.minor/Makefile)39
-rw-r--r--testsuite/Makefile.in654
-rw-r--r--testsuite/lib/ltrace.exp603
-rw-r--r--testsuite/ltrace.main/Makefile.am (renamed from testsuite/ltrace.main/Makefile)42
-rw-r--r--testsuite/ltrace.main/Makefile.in414
-rw-r--r--testsuite/ltrace.main/branch_func.c51
-rw-r--r--testsuite/ltrace.main/branch_func.exp57
-rw-r--r--testsuite/ltrace.main/filters.exp85
-rw-r--r--testsuite/ltrace.main/hello-vfork.c11
-rw-r--r--testsuite/ltrace.main/hello-vfork.exp35
-rw-r--r--testsuite/ltrace.main/main-internal-1.c8
-rw-r--r--testsuite/ltrace.main/main-internal.c19
-rw-r--r--testsuite/ltrace.main/main-internal.exp60
-rw-r--r--testsuite/ltrace.main/main-threaded.c29
-rw-r--r--testsuite/ltrace.main/main-threaded.exp39
-rw-r--r--testsuite/ltrace.main/main-vfork.c28
-rw-r--r--testsuite/ltrace.main/main-vfork.exp39
-rw-r--r--testsuite/ltrace.main/main.exp10
-rw-r--r--testsuite/ltrace.main/parameters-lib.c368
-rw-r--r--testsuite/ltrace.main/parameters.c257
-rw-r--r--testsuite/ltrace.main/parameters.conf58
-rw-r--r--testsuite/ltrace.main/parameters.exp212
-rw-r--r--testsuite/ltrace.main/parameters2.exp215
-rw-r--r--testsuite/ltrace.main/signals.exp6
-rw-r--r--testsuite/ltrace.main/system_calls.exp44
-rw-r--r--testsuite/ltrace.minor/Makefile.am46
-rw-r--r--testsuite/ltrace.minor/Makefile.in415
-rw-r--r--testsuite/ltrace.minor/attach-process.c16
-rw-r--r--testsuite/ltrace.minor/attach-process.exp67
-rw-r--r--testsuite/ltrace.minor/count-record.exp33
-rw-r--r--testsuite/ltrace.minor/demangle-lib.cpp2
-rw-r--r--testsuite/ltrace.minor/demangle.exp15
-rw-r--r--testsuite/ltrace.minor/libdl-simple-lib.c4
-rw-r--r--testsuite/ltrace.minor/libdl-simple.c24
-rw-r--r--testsuite/ltrace.minor/libdl-simple.exp36
-rw-r--r--testsuite/ltrace.minor/print-instruction-pointer.exp10
-rw-r--r--testsuite/ltrace.minor/time-record-T.exp8
-rw-r--r--testsuite/ltrace.minor/time-record-tt.exp8
-rw-r--r--testsuite/ltrace.minor/time-record-ttt.exp8
-rw-r--r--testsuite/ltrace.minor/trace-clone.c2
-rw-r--r--testsuite/ltrace.minor/trace-clone.exp18
-rw-r--r--testsuite/ltrace.minor/trace-exec.c8
-rw-r--r--testsuite/ltrace.minor/trace-exec.exp78
-rw-r--r--testsuite/ltrace.minor/trace-exec1.c6
-rw-r--r--testsuite/ltrace.minor/trace-fork.c2
-rw-r--r--testsuite/ltrace.minor/trace-fork.exp35
-rw-r--r--testsuite/ltrace.torture/Makefile.am (renamed from testsuite/ltrace.torture/Makefile)28
-rw-r--r--testsuite/ltrace.torture/Makefile.in400
-rw-r--r--testsuite/ltrace.torture/ppc-lwarx.c44
-rw-r--r--testsuite/ltrace.torture/ppc-lwarx.exp55
-rw-r--r--testsuite/ltrace.torture/signals.c2
-rw-r--r--testsuite/ltrace.torture/signals.exp6
-rw-r--r--testsuite/ltrace.torture/vfork-thread.c50
-rw-r--r--testsuite/ltrace.torture/vfork-thread.exp32
55 files changed, 4417 insertions, 495 deletions
diff --git a/testsuite/Makefile b/testsuite/Makefile
deleted file mode 100644
index b78807e..0000000
--- a/testsuite/Makefile
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright (C) 1992 - 2001 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 1, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-AUTOMAKE_OPTIONS = dejagnu
-EXPECT = expect
-RUNTEST = runtest
-CC = @CC@
-
-srcdir = .
-RUNTESTDEFAULTFLAGS = --srcdir $(srcdir)
-
-CLEANFILES = *.log *.sum site.bak setval.tmp site.exp
-
-SUBDIRS = ltrace.main ltrace.minor ltrace.torture
-
-#all: all-recursive
-
-.SUFFIXES:
-
-check-DEJAGNU: site.exp
- EXPECT=$(EXPECT); export EXPECT;
- @$(RUNTEST) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS);
-
-site.exp:
- @echo 'Making a new site.exp file...'
- @echo '## these variables are automatically generated by make ##' >site.tmp
- @echo '# Do not edit here. If you wish to override these values' >>site.tmp
- @echo '# edit the last section' >>site.tmp
- @echo 'set srcdir $(srcdir)' >>site.tmp
- @echo "set objdir `pwd`" >>site.tmp
- @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
- @test ! -f site.exp || \
- sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
- @-rm -f site.bak
- @test ! -f site.exp || mv site.exp site.bak
- @mv site.tmp site.exp
-
-check: check-DEJAGNU
-
-clean:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making clean in $$subdir"; \
- (cd $$subdir && $(MAKE) clean ) done;
-
- -rm -f $(CLEANFILES)
-
-distclean:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making clean in $$subdir"; \
- (cd $$subdir && $(MAKE) distclean ) done;
- -rm -f $(CLEANFILES)
-
-.PHONY: $(RECURSIVE_TARGETS) check clean distclean realclean
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/testsuite/ltrace.minor/Makefile b/testsuite/Makefile.am
index cd4914f..f9b6c0d 100644
--- a/testsuite/ltrace.minor/Makefile
+++ b/testsuite/Makefile.am
@@ -15,22 +15,31 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
-CLEANFILES = *.log *.sum site.bak setval.tmp site.exp
+AUTOMAKE_OPTIONS = dejagnu
-.SUFFIXES:
-clean:
- -rm -f demangle trace-fork trace-clone trace-exec trace-exec1
- -rm -f time-record-tt time-record-ttt time-record-T
- -rm -f attach-process count-record
- -rm -f print-instruction-pointer
- -rm -f *.o *.so
- -rm -f *.ltrace
- -rm -f $(CLEANFILES)
-distclean: clean
+if USE_VALGRIND
+valgrind_cmd="VALGRIND=valgrind -q --error-exitcode=1 --leak-check=full"
+endif
+RUNTESTDEFAULTFLAGS = --srcdir $(srcdir) $(valgrind_cmd)
-.PHONY: $(RECURSIVE_TARGETS) check clean distclean realclean
+SUBDIRS = ltrace.main ltrace.minor ltrace.torture
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
+EXTRA_DIST = \
+ README \
+ config/unix.exp \
+ lib/compiler.c \
+ lib/compiler.cc \
+ lib/ltrace.exp \
+ run-my-tests.sh
+
+BUILT_SOURCES = env.exp
+
+env.exp: Makefile
+ rm -f env.exp
+ echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> $@
+ echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> $@
+
+CLEANFILES = *.o *.so *.log *.sum *.ltrace site.bak setval.tmp site.exp env.exp
+
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
new file mode 100644
index 0000000..1c0ae49
--- /dev/null
+++ b/testsuite/Makefile.in
@@ -0,0 +1,654 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright (C) 1992 - 2001 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 1, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = testsuite
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/libtool.m4 \
+ $(top_srcdir)/config/m4/ltoptions.m4 \
+ $(top_srcdir)/config/m4/ltsugar.m4 \
+ $(top_srcdir)/config/m4/ltversion.m4 \
+ $(top_srcdir)/config/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DEJATOOL = $(PACKAGE)
+EXPECT = expect
+RUNTEST = runtest
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_VALGRIND = @HAVE_VALGRIND@
+HOST_CPU = @HOST_CPU@
+HOST_OS = @HOST_OS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libelf_LD_LIBRARY_PATH = @libelf_LD_LIBRARY_PATH@
+liberty_LIBS = @liberty_LIBS@
+libexecdir = @libexecdir@
+libstdcxx_LIBS = @libstdcxx_LIBS@
+libsupcxx_LIBS = @libsupcxx_LIBS@
+libunwind_LD_LIBRARY_PATH = @libunwind_LD_LIBRARY_PATH@
+libunwind_LIBS = @libunwind_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = dejagnu
+@USE_VALGRIND_TRUE@valgrind_cmd = "VALGRIND=valgrind -q --error-exitcode=1 --leak-check=full"
+RUNTESTDEFAULTFLAGS = --srcdir $(srcdir) $(valgrind_cmd)
+SUBDIRS = ltrace.main ltrace.minor ltrace.torture
+EXTRA_DIST = \
+ README \
+ config/unix.exp \
+ lib/compiler.c \
+ lib/compiler.cc \
+ lib/ltrace.exp \
+ run-my-tests.sh
+
+BUILT_SOURCES = env.exp
+CLEANFILES = *.o *.so *.log *.sum *.ltrace site.bak setval.tmp site.exp env.exp
+MAINTAINERCLEANFILES = Makefile.in
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign testsuite/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-DEJAGNU: site.exp
+ srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
+ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+ then :; else exit_status=1; fi; \
+ done; \
+ else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi; \
+ exit $$exit_status
+site.exp: Makefile
+ @echo 'Making a new site.exp file...'
+ @echo '## these variables are automatically generated by make ##' >site.tmp
+ @echo '# Do not edit here. If you wish to override these values' >>site.tmp
+ @echo '# edit the last section' >>site.tmp
+ @echo 'set srcdir $(srcdir)' >>site.tmp
+ @echo "set objdir `pwd`" >>site.tmp
+ @echo 'set build_alias "$(build_alias)"' >>site.tmp
+ @echo 'set build_triplet $(build_triplet)' >>site.tmp
+ @echo 'set host_alias "$(host_alias)"' >>site.tmp
+ @echo 'set host_triplet $(host_triplet)' >>site.tmp
+ @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
+ @test ! -f site.exp || \
+ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+ @-rm -f site.bak
+ @test ! -f site.exp || mv site.exp site.bak
+ @mv site.tmp site.exp
+
+distclean-DEJAGNU:
+ -rm -f site.exp site.bak
+ -l='$(DEJATOOL)'; for tool in $$l; do \
+ rm -f $$tool.sum $$tool.log; \
+ done
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-DEJAGNU distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
+ check-am ctags-recursive install install-am install-strip \
+ tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-DEJAGNU check-am clean clean-generic \
+ clean-libtool ctags ctags-recursive distclean \
+ distclean-DEJAGNU distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am
+
+
+env.exp: Makefile
+ rm -f env.exp
+ echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> $@
+ echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> $@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testsuite/lib/ltrace.exp b/testsuite/lib/ltrace.exp
index b56d50d..cbb5602 100644
--- a/testsuite/lib/ltrace.exp
+++ b/testsuite/lib/ltrace.exp
@@ -1,19 +1,42 @@
-# This file was written by Yao Qi. (qiyao@cn.ibm.com)
+# This file is part of ltrace.
+# Copyright (C) 2012 Petr Machata, Red Hat Inc.
+# Copyright (C) 2006 Yao Qi, IBM Corporation
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
# Generic ltrace test subroutines that should work for any target. If these
# need to be modified for any target, it can be done with a variable
# or by passing arguments.
+source $objdir/env.exp
-global LTRACE
if [info exists TOOL_EXECUTABLE] {
set LTRACE $TOOL_EXECUTABLE
} else {
set LTRACE $objdir/../ltrace
}
-global LTRACE_OPTIONS
-set LTRACE_OPTIONS "";
+if {[info exists VALGRIND] && ![string equal $VALGRIND {}]} {
+ verbose "Running under valgrind command: `$VALGRIND'"
+ set LTRACE "$VALGRIND $LTRACE"
+}
+
+set LTRACE_OPTIONS {}
+set LTRACE_ARGS {}
+set LTRACE_TEMP_FILES {}
# ltrace_compile SOURCE DEST TYPE OPTIONS
#
@@ -29,42 +52,50 @@ set LTRACE_OPTIONS "";
# OPTIONS is option to compiler in this compilation.
proc ltrace_compile {source dest type options} {
global LTRACE_TESTCASE_OPTIONS;
-
- # Add platform-specific options if a shared library was specified using
- # "shlib=librarypath" in OPTIONS.
- set new_options ""
- set shlib_found 0
-
- foreach opt $options {
- if [regexp {^shlib=(.*)} $opt dummy_var shlib_name] {
- if [test_compiler_info "xlc*"] {
- # IBM xlc compiler doesn't accept shared library named other
- # than .so: use "-Wl," to bypass this
- lappend source "-Wl,$shlib_name"
- } else {
- lappend source $shlib_name
- }
-
- if {$shlib_found == 0} {
- set shlib_found 1
-
- if { ([test_compiler_info "gcc-*"]&& ([istarget "powerpc*-*-aix*"]|| [istarget "rs6000*-*-aix*"] ))} {
- lappend options "additional_flags=-L${objdir}/${subdir}"
- } elseif { [istarget "mips-sgi-irix*"] } {
- lappend options "additional_flags=-rpath ${objdir}/${subdir}"
- }
- }
-
- } else {
- lappend new_options $opt
- }
- }
- #end of for loop
- set options $new_options
+
+ if {![string equal "object" $type]} {
+ # Add platform-specific options if a shared library was specified using
+ # "shlib=librarypath" in OPTIONS.
+ set new_options ""
+ set shlib_found 0
+
+ foreach opt $options {
+ if [regexp {^shlib=(.*)} $opt dummy_var shlib_name] {
+ if [test_compiler_info "xlc*"] {
+ # IBM xlc compiler doesn't accept shared library named other
+ # than .so: use "-Wl," to bypass this
+ lappend source "-Wl,$shlib_name"
+ } else {
+ lappend source $shlib_name
+ }
+
+ if {$shlib_found == 0} {
+ set shlib_found 1
+
+ if { ([test_compiler_info "gcc-*"]&& ([istarget "powerpc*-*-aix*"]|| [istarget "rs6000*-*-aix*"] ))} {
+ lappend options "additional_flags=-L${objdir}/${subdir}"
+ } elseif { [istarget "mips-sgi-irix*"] } {
+ lappend options "additional_flags=-rpath ${objdir}/${subdir}"
+ }
+ }
+
+ } else {
+ lappend new_options $opt
+ }
+ }
+
+ #end of for loop
+ set options $new_options
+ }
+
# dump some information for debug purpose.
verbose "options are $options"
verbose "source is $source $dest $type $options"
-
+
+ # Wipe the DEST file, so that we don't end up running an obsolete
+ # version of the binary.
+ exec rm -f $dest
+
set result [target_compile $source $dest $type $options];
verbose "result is $result"
regsub "\[\r\n\]*$" "$result" "" result;
@@ -128,11 +159,11 @@ proc get_compiler_info {binfile args} {
proc test_compiler_info { {compiler ""} } {
global compiler_info
- verbose "compiler_info=$compiler_info"
- # if no arg, return the compiler_info string
if [string match "" $compiler] {
if [info exists compiler_info] {
+ verbose "compiler_info=$compiler_info"
+ # if no arg, return the compiler_info string
return $compiler_info
} else {
perror "No compiler info found."
@@ -163,15 +194,9 @@ proc ltrace_compile_shlib {sources dest options} {
fail "Bad compiler!"
}
}
-
- set outdir [file dirname $dest]
- set objects ""
- foreach source $sources {
- set sourcebase [file tail $source]
- if {[ltrace_compile $source "${outdir}/${sourcebase}.o" object $obj_options] != ""} {
- return -1
- }
- lappend objects ${outdir}/${sourcebase}.o
+
+ if {![LtraceCompileObjects $sources $obj_options objects]} {
+ return -1
}
set link_options $options
@@ -183,6 +208,416 @@ proc ltrace_compile_shlib {sources dest options} {
if {[ltrace_compile "${objects}" "${dest}" executable $link_options] != ""} {
return -1
}
+
+ return
+}
+
+# WipeFiles --
+#
+# Delete each file in the list.
+#
+# Arguments:
+# files List of files to delete.
+# Results:
+# Each of the files is deleted. Returns nothing.
+
+proc WipeFiles {files} {
+ verbose "WipeFiles: $files\n"
+ foreach f $files {
+ file delete $f
+ }
+}
+
+# LtraceTmpDir --
+#
+# Guess what directory to use for temporary files.
+# This was adapted from http://wiki.tcl.tk/772
+#
+# Results:
+# A temporary directory to use. The current directory if no
+# other seems to be available.
+
+proc LtraceTmpDir {} {
+ set tmpdir [pwd]
+
+ if {[file exists "/tmp"]} {
+ set tmpdir "/tmp"
+ }
+
+ catch {set tmpdir $::env(TMP)}
+ catch {set tmpdir $::env(TEMP)}
+ catch {set tmpdir $::env(TMPDIR)}
+
+ return $tmpdir
+}
+
+set LTRACE_TEMP_DIR [LtraceTmpDir]
+
+# LtraceTempFile --
+#
+# Create a temporary file according to a pattern, and return its
+# name. This behaves similar to mktemp. We don't use mktemp
+# directly, because on older systems, mktemp requires that the
+# array of X's be at the very end of the string, while ltrace
+# temporary files need to have suffixes.
+#
+# Arguments:
+# pat Pattern to use. See mktemp for description of its format.
+#
+# Results:
+# Creates the temporary file and returns its name. The name is
+# also appended to LTRACE_TEMP_FILES.
+
+proc LtraceTempFile {pat} {
+ global LTRACE_TEMP_FILES
+ global LTRACE_TEMP_DIR
+
+ set letters "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+ set numLetters [string length $letters]
+
+ if {![regexp -indices {(X{3,})} $pat m]} {
+ send_error -- "Pattern $pat contains insufficient number of X's."
+ return {}
+ }
+
+ set start [lindex $m 0]
+ set end [lindex $m 1]
+ set len [expr {$end - $start + 1}]
+
+ for {set j 0} {$j < 10} {incr j} {
+
+ # First, generate a random name.
+
+ set randstr {}
+ for {set i 0} {$i < $len} {incr i} {
+ set r [expr {int(rand() * $numLetters)}]
+ append randstr [string index $letters $r]
+ }
+ set prefix [string range $pat 0 [expr {$start - 1}]]
+ set suffix [string range $pat [expr {$end + 1}] end]
+ set name [file join $LTRACE_TEMP_DIR "$prefix$randstr$suffix"]
+
+ # Now check that it's free. This is of course racy, but this
+ # is a test suite, not anything used in actual production.
+
+ if {[file exists $name]} {
+ continue
+ }
+
+ # We don't bother attempting to open the file. Downstream
+ # code can do it itself.
+
+ lappend LTRACE_TEMP_FILES $name
+ return $name
+ }
+
+ send_error -- "Couldn't create a temporary file for pattern $pat."
+ return
+}
+
+# ltraceSource --
+#
+# Create a temporary file with a given suffix and prime it with
+# contents given in text.
+#
+# Arguments:
+# suffix Suffix of the temp file to be created.
+#
+# text Contents of the new file.
+#
+# Results:
+# Returns file name of created file.
+
+proc ltraceSource {suffix text} {
+ set ret [LtraceTempFile "lt-XXXXXXXXXX.$suffix"]
+
+ set chan [open $ret w]
+ puts $chan $text
+ close $chan
+
+ return $ret
+}
+
+# LtraceCompileObjects --
+#
+# Compile each source file into an object file. ltrace_compile
+# is called to perform actual compilation.
+#
+# Arguments:
+# sources List of source files.
+#
+# options Options for ltrace_compile.
+#
+# retName Variable where the resulting list of object names is
+# to be placed.
+# Results:
+# Returns true or false depending on whether there were any
+# errors. If it returns true, then variable referenced by
+# retName contains list of object files, produced by compiling
+# files in sources list.
+
+proc LtraceCompileObjects {sources options retName} {
+ global LTRACE_TEMP_FILES
+ upvar $retName ret
+ set ret {}
+
+ foreach source $sources {
+ set sourcebase [file tail $source]
+ set dest $source.o
+ lappend LTRACE_TEMP_FILES $dest
+ verbose "LtraceCompileObjects: $source -> $dest"
+ if {[ltrace_compile $source $dest object $options] != ""} {
+ return false
+ }
+ lappend ret $dest
+ }
+
+ return true
+}
+
+# ltraceCompile --
+#
+# This attempts to compile a binary from sources given in ARGS.
+#
+# Arguments:
+# dest A binary to be produced. If this is called lib*.so, then
+# the resulting binary will be a library, if *.pie, it
+# will be a PIE, otherwise it will be an executable. In
+# theory this could also be *.o for "object" and *.i for
+# "preprocess" for cases with one source file, but that
+# is not supported at the moment. The binary will be
+# placed in $objdir/$subdir.
+#
+# args List of options and source files.
+#
+# Options are arguments that start with a dash. Options
+# (sans the dash) are passed to ltrace_compile.
+#
+# Source files named lib*.so are libraries. Those are
+# passed to ltrace_compile as options shlib=X. Source
+# files named *.o are objects. The remaining source
+# files are first compiled (by LtraceCompileObjects) and
+# then together with other objects passed to
+# ltrace_compile to produce resulting binary.
+#
+# Any argument that is empty string prompts the function
+# to fail. This is done so that errors caused by
+# ltraceSource (or similar) distribute naturally
+# upwards.
+#
+# Results:
+# This compiles given source files into a binary. Full file name
+# of that binary is returned. Empty string is returned in case
+# of a failure.
+
+proc ltraceCompile {dest args} {
+ global objdir
+ global subdir
+
+ get_compiler_info {} c
+ get_compiler_info {} c++
+
+ if {[string match "lib*.so" $dest]} {
+ set type "library"
+ set extraObjOptions "additional_flags=-fpic"
+ set extraOptions "additional_flags=-shared"
+ } elseif {[string match "*.pie" $dest]} {
+ set type "executable"
+ set extraObjOptions "additional_flags=-fpic"
+ set extraOptions "additional_flags=-pie"
+ } else {
+ set type "executable"
+ set extraObjOptions {}
+ set extraOptions {}
+ }
+
+ set options {}
+ set sources {}
+ set objects {}
+ foreach a $args {
+ if {[string match "-?*" $a]} {
+ lappend options [string range $a 1 end]
+ } elseif {[string match "*.so" $a]} {
+ lappend options "shlib=$a"
+ } elseif {[string match "*.o" $a]} {
+ lappend objects $a
+ } else {
+ lappend sources $a
+ }
+ }
+
+ if {[string equal $dest {}]} {
+ set dest [LtraceTempFile "exe-XXXXXXXXXX"]
+ } elseif {[string equal $dest ".pie"]} {
+ set dest [LtraceTempFile "pie-XXXXXXXXXX"]
+ } else {
+ set dest $objdir/$subdir/$dest
+ }
+
+ verbose "ltraceCompile: dest $dest"
+ verbose " : options $options"
+ verbose " : sources $sources"
+ verbose " : objects $objects"
+
+ if {![LtraceCompileObjects $sources \
+ [concat $options $extraObjOptions] newObjects]} {
+ return {}
+ }
+ set objects [concat $objects $newObjects]
+
+ verbose "ltraceCompile: objects $objects"
+
+ if {[ltrace_compile $objects $dest $type \
+ [concat $options $extraOptions]] != ""} {
+ return {}
+ }
+
+ return $dest
+}
+
+# ltraceRun --
+#
+# Invoke command identified by LTRACE global variable with given
+# ARGS. A logfile redirection is automatically ordered by
+# passing -o and a temporary file name.
+#
+# Arguments:
+# args Arguments to ltrace binary.
+#
+# Results:
+# Returns name of logfile. The "exec" command that it uses
+# under the hood fails loudly if the process exits with a
+# non-zero exit status, or uses stderr in any way.
+
+proc ltraceRun {args} {
+ global LTRACE
+ global objdir
+ global subdir
+
+ set LdPath [ld_library_path $objdir/$subdir]
+ set logfile [ltraceSource ltrace {}]
+
+ # Run ltrace. expect will show an error if this doesn't exit with
+ # zero exit status (i.e. ltrace fails, valgrind finds errors,
+ # etc.).
+
+ set command "exec env LD_LIBRARY_PATH=$LdPath $LTRACE -o $logfile $args"
+ verbose $command
+ if {[catch {eval $command}] } {
+ fail "test case execution failed"
+ send_error -- $command
+ send_error -- $::errorInfo
+ }
+
+ return $logfile
+}
+
+# ltraceDone --
+#
+# Wipes or dumps all temporary files after a test suite has
+# finished.
+#
+# Results:
+# Doesn't return anything. Wipes all files gathered in
+# LTRACE_TEMP_FILES. If SAVE_TEMPS is defined and true, the
+# temporary files are not wiped, but their names are dumped
+# instead. Contents of LTRACE_TEMP_FILES are deleted in any
+# case.
+
+proc ltraceDone {} {
+ global SAVE_TEMPS
+ global LTRACE_TEMP_FILES
+
+ if {[info exists SAVE_TEMPS] && $SAVE_TEMPS} {
+ foreach tmp $LTRACE_TEMP_FILES {
+ send_user "$tmp\n"
+ }
+ } else {
+ WipeFiles $LTRACE_TEMP_FILES
+ }
+
+ set LTRACE_TEMP_FILES {}
+ return
+}
+
+# Grep --
+#
+# Return number of lines in a given file, matching a given
+# regular expression.
+#
+# Arguments:
+# logfile File to search through.
+#
+# re Regular expression to match.
+#
+# Results:
+# Returns number of matching lines.
+
+proc Grep {logfile re} {
+ set count 0
+ set fp [open $logfile]
+ while {[gets $fp line] >= 0} {
+ if [regexp -- $re $line] {
+ incr count
+ }
+ }
+ close $fp
+ return $count
+}
+
+# ltraceMatch1 --
+#
+# Look for a pattern in a given logfile, comparing number of
+# occurences of the pattern with expectation.
+#
+# Arguments:
+# logfile The name of file where to look for patterns.
+#
+# pattern Regular expression pattern to look for.
+#
+# op Operator to compare number of occurences.
+#
+# expect Second operand to op, the first being number of
+# occurences of pattern.
+#
+# Results:
+# Doesn't return anything, but calls fail or pass depending on
+# whether the patterns matches expectation.
+
+proc ltraceMatch1 {logfile pattern {op ==} {expect 1}} {
+ set count [Grep $logfile $pattern]
+ set msgMain "$pattern appears in $logfile $count times"
+ set msgExpect ", expected $op $expect"
+
+ if {[eval expr $count $op $expect]} {
+ pass $msgMain
+ } else {
+ fail $msgMain$msgExpect
+ }
+ return
+}
+
+# ltraceMatch --
+#
+# Look for series of patterns in a given logfile, comparing
+# number of occurences of each pattern with expectations.
+#
+# Arguments:
+# logfile The name of file where to look for patterns.
+#
+# patterns List of patterns to look for. ltraceMatch1 is called
+# on each of these in turn.
+#
+# Results:
+#
+# Doesn't return anything, but calls fail or pass depending on
+# whether each of the patterns holds.
+
+proc ltraceMatch {logfile patterns} {
+ foreach pat $patterns {
+ eval ltraceMatch1 [linsert $pat 0 $logfile]
+ }
+ return
}
#
@@ -196,6 +631,37 @@ proc ltrace_options { args } {
}
#
+# ltrace_args ARGS_LIST
+# Pass ltrace'd program its own commandline options.
+#
+proc ltrace_args { args } {
+
+ global LTRACE_ARGS
+ set LTRACE_ARGS $args
+}
+
+#
+# handle run-time library paths
+#
+proc ld_library_path { args } {
+
+ set ALL_LIBRARY_PATHS { }
+ if [info exists LD_LIBRARY_PATH] {
+ lappend ALL_LIBRARY_PATHS $LD_LIBRARY_PATH
+ }
+ global libelf_LD_LIBRARY_PATH
+ if {[string length $libelf_LD_LIBRARY_PATH] > 0} {
+ lappend ALL_LIBRARY_PATHS $libelf_LD_LIBRARY_PATH
+ }
+ global libunwind_LD_LIBRARY_PATH
+ if {[string length $libunwind_LD_LIBRARY_PATH] > 0} {
+ lappend ALL_LIBRARY_PATHS $libunwind_LD_LIBRARY_PATH
+ }
+ lappend ALL_LIBRARY_PATHS $args
+ join $ALL_LIBRARY_PATHS ":"
+}
+
+#
# ltrace_runtest LD_LIBRARY_PATH BIN FILE
# Trace the execution of BIN and return result.
#
@@ -208,10 +674,11 @@ proc ltrace_runtest { args } {
global LTRACE
global LTRACE_OPTIONS
+ global LTRACE_ARGS
verbose "LTRACE = $LTRACE"
- set LD_LIBRARY_PATH_ [lindex $args 0]
+ set LD_LIBRARY_PATH_ [ld_library_path [lindex $args 0]]
set BIN [lindex $args 1]
# specify the output file, the default one is $BIN.ltrace
@@ -220,35 +687,29 @@ proc ltrace_runtest { args } {
} else {
set file $BIN.ltrace
}
+
+ # Remove the file first. If ltrace fails to overwrite it, we
+ # would be comparing output to an obsolete run.
+ exec rm -f $file
+
# append this option to LTRACE_OPTIONS.
lappend LTRACE_OPTIONS "-o"
lappend LTRACE_OPTIONS "$file"
verbose "LTRACE_OPTIONS = $LTRACE_OPTIONS"
+ set command "exec sh -c {export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_; \
+ $LTRACE $LTRACE_OPTIONS $BIN $LTRACE_ARGS;exit}"
#ltrace the PUT.
- catch "exec sh -c {export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_; $LTRACE $LTRACE_OPTIONS $BIN;exit}" output
-
+ if {[catch $command output]} {
+ fail "test case execution failed"
+ send_error -- $command
+ send_error -- $::errorInfo
+ }
+
# return output from ltrace.
return $output
}
#
-# ltrace_saveoutput OUTPUT FILE
-# Save OUTPUT from ltrace to file FILE.
-# OUTPUT is output from ltrace or return value of ltrace_runtest.
-# FILE is file save output.
-#
-proc ltrace_saveoutput { args } {
-
- set output [lindex $args 0]
- set file [lindex $args 1]
-
- set fd [open $file w]
- puts $fd $output
- close $fd
-}
-
-
-#
# ltrace_verify_output FILE_TO_SEARCH PATTERN MAX_LINE
# Verify the ltrace output by comparing the number of PATTERN in
# FILE_TO_SEARCH with INSTANCE_NO. Do not specify INSTANCE_NO if
@@ -257,10 +718,10 @@ proc ltrace_saveoutput { args } {
# 0 = number of PATTERN in FILE_TO_SEARCH inqual to INSTANCE_NO.
# 1 = number of PATTERN in FILE_TO_SEARCH qual to INSTANCE_NO.
#
-proc ltrace_verify_output { file_to_search pattern {instance_no 0}} {
+proc ltrace_verify_output { file_to_search pattern {instance_no 0} {grep_command "grep"}} {
# compute the number of PATTERN in FILE_TO_SEARCH by grep and wc.
- catch "exec sh -c {grep \"$pattern\" $file_to_search | wc -l ;exit}" output
+ catch "exec sh -c {$grep_command \"$pattern\" $file_to_search | wc -l ;exit}" output
verbose "output = $output"
if [ regexp "syntax error" $output ] then {
@@ -274,6 +735,6 @@ proc ltrace_verify_output { file_to_search pattern {instance_no 0}} {
} elseif { $output >= $instance_no } then {
pass "$pattern in $file_to_search for $output times"
} else {
- fail "$pattern in $file_to_search for $output times ,should be $instance_no"
+ fail "$pattern in $file_to_search for $output times, should be $instance_no"
}
}
diff --git a/testsuite/ltrace.main/Makefile b/testsuite/ltrace.main/Makefile.am
index 449214a..ade68d6 100644
--- a/testsuite/ltrace.main/Makefile
+++ b/testsuite/ltrace.main/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 1992 - 2001 Free Software Foundation, Inc.
+# Copyright (C) 1992 - 2001, 2012 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,19 +15,31 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
-CLEANFILES = *.log *.sum site.bak setval.tmp site.exp
+EXTRA_DIST = \
+ branch_func.c \
+ branch_func.exp \
+ filters.exp \
+ hello-vfork.c \
+ hello-vfork.exp \
+ main.c \
+ main.exp \
+ main-internal.exp \
+ main-lib.c \
+ main-threaded.c \
+ main-threaded.exp \
+ main-vfork.c \
+ main-vfork.exp \
+ parameters.c \
+ parameters.conf \
+ parameters.exp \
+ parameters-lib.c \
+ parameters2.exp \
+ signals.c \
+ signals.exp \
+ system_calls.c \
+ system_calls.exp
-.SUFFIXES:
-clean:
- -rm -f main main-internal system_calls signals parameters
- -rm -f *.o *.so
- -rm -f *.ltrace
- -rm -f $(CLEANFILES)
-distclean: clean
+CLEANFILES = *.o *.so *.log *.sum *.ltrace setval.tmp \
+ main main-internal parameters signals system_calls
-
-.PHONY: $(RECURSIVE_TARGETS) check clean distclean realclean
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/testsuite/ltrace.main/Makefile.in b/testsuite/ltrace.main/Makefile.in
new file mode 100644
index 0000000..6a490c8
--- /dev/null
+++ b/testsuite/ltrace.main/Makefile.in
@@ -0,0 +1,414 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright (C) 1992 - 2001, 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 1, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = testsuite/ltrace.main
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/libtool.m4 \
+ $(top_srcdir)/config/m4/ltoptions.m4 \
+ $(top_srcdir)/config/m4/ltsugar.m4 \
+ $(top_srcdir)/config/m4/ltversion.m4 \
+ $(top_srcdir)/config/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_VALGRIND = @HAVE_VALGRIND@
+HOST_CPU = @HOST_CPU@
+HOST_OS = @HOST_OS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libelf_LD_LIBRARY_PATH = @libelf_LD_LIBRARY_PATH@
+liberty_LIBS = @liberty_LIBS@
+libexecdir = @libexecdir@
+libstdcxx_LIBS = @libstdcxx_LIBS@
+libsupcxx_LIBS = @libsupcxx_LIBS@
+libunwind_LD_LIBRARY_PATH = @libunwind_LD_LIBRARY_PATH@
+libunwind_LIBS = @libunwind_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = \
+ branch_func.c \
+ branch_func.exp \
+ filters.exp \
+ hello-vfork.c \
+ hello-vfork.exp \
+ main.c \
+ main.exp \
+ main-internal.exp \
+ main-lib.c \
+ main-threaded.c \
+ main-threaded.exp \
+ main-vfork.c \
+ main-vfork.exp \
+ parameters.c \
+ parameters.conf \
+ parameters.exp \
+ parameters-lib.c \
+ parameters2.exp \
+ signals.c \
+ signals.exp \
+ system_calls.c \
+ system_calls.exp
+
+CLEANFILES = *.o *.so *.log *.sum *.ltrace setval.tmp \
+ main main-internal parameters signals system_calls
+
+MAINTAINERCLEANFILES = Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/ltrace.main/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign testsuite/ltrace.main/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testsuite/ltrace.main/branch_func.c b/testsuite/ltrace.main/branch_func.c
new file mode 100644
index 0000000..0ce311d
--- /dev/null
+++ b/testsuite/ltrace.main/branch_func.c
@@ -0,0 +1,51 @@
+/*
+ * This file is part of ltrace.
+ * Copyright (C) 2012 Petr Machata, Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+/* This is specially made to produce tail calls. We then trace them
+ * and see if ltrace handles it well, or whether its internal stack
+ * overflows. */
+
+__attribute__((noinline, optimize(3))) int
+func3(int i)
+{
+ return i + 1;
+}
+
+__attribute__((noinline, optimize(3))) int
+func2(int i)
+{
+ return func3(i * 3);
+}
+
+__attribute__((noinline, optimize(3))) int
+func1(int i)
+{
+ return func2(i + 2);
+}
+
+__attribute__((optimize(0))) int
+main(int argc, char **argv)
+{
+ int counter = 0;
+ int i;
+ for (i = 0; i < 100; ++i)
+ counter += func1(i);
+ return counter;
+}
diff --git a/testsuite/ltrace.main/branch_func.exp b/testsuite/ltrace.main/branch_func.exp
new file mode 100644
index 0000000..fec5700
--- /dev/null
+++ b/testsuite/ltrace.main/branch_func.exp
@@ -0,0 +1,57 @@
+# This file is part of ltrace.
+# Copyright (C) 2012 Petr Machata, Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+set testfile "branch_func"
+set srcfile ${testfile}.c
+set binfile ${testfile}
+
+if [get_compiler_info $binfile] {
+ return -1
+}
+
+verbose "compiling source file now....."
+if { [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable {debug} ] != "" } {
+ send_user "Testcase compile failed, so all tests in this file will automatically fail\n."
+}
+
+# set options for ltrace.
+ltrace_options "-x" "func1" "-x" "func2" "-x" "func3"
+
+# Run PUT for ltarce.
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
+
+# Check the output of this program.
+verbose "ltrace runtest output: $exec_output\n"
+if [regexp {ELF from incompatible architecture} $exec_output] {
+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
+ return
+} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
+ fail "Couldn't get .hash data!"
+ return
+}
+
+set pattern "func1(.*unfinished"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100
+set pattern "func2(.*unfinished"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100
+set pattern "func3(.*)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100
+set pattern "func2.resumed"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100
+set pattern "func1.resumed"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 100
diff --git a/testsuite/ltrace.main/filters.exp b/testsuite/ltrace.main/filters.exp
new file mode 100644
index 0000000..988346f
--- /dev/null
+++ b/testsuite/ltrace.main/filters.exp
@@ -0,0 +1,85 @@
+# This file is part of ltrace.
+# Copyright (C) 2012 Petr Machata, Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+set libfilt1 [ltraceCompile libfilt1.so [ltraceSource c {
+ void func2(void);
+ void func1(void) { func2(); }
+}]]
+
+set libfilt2 [ltraceCompile libfilt2.so [ltraceSource c {
+ void func2(void) { puts("func2"); }
+}]]
+
+foreach ext {{} .pie} {
+ set filt [ltraceCompile filt$ext $libfilt1 $libfilt2 [ltraceSource c {
+ void func1(void);
+ int main(int argc, char *argv[]) { func1(); return 0; }
+ }]]
+
+ ltraceMatch [ltraceRun -e* $filt] {
+ {{filt(\.pie)?->func1} == 1}
+ {{libfilt1.so->func2} == 1}
+ {{libfilt2.so->puts} == 1}
+ {{func2 resumed} == 1}
+ {{func1 resumed} == 1}
+ }
+
+ ltraceMatch1 [ltraceRun $filt] \
+ {^func1\(.*\)} == 1
+
+ ltraceMatch1 [ltraceRun -e@MAIN $filt] \
+ {filt(\.pie)?->func1\(.*\)} == 1
+
+ ltraceMatch1 [ltraceRun -e@libfilt1.so $filt] \
+ {libfilt1.so->func2\(.*\)} == 1
+
+ ltraceMatch1 [ltraceRun -e@libfilt2.so $filt] \
+ {libfilt2.so->puts\(.*\)} == 1
+
+ ltraceMatch [ltraceRun -e@libfilt* $filt] {
+ {{libfilt1.so->func2\(} == 1}
+ {{libfilt2.so->puts\(.*\)} == 1}
+ {{func2 resumed} == 1}
+ }
+
+ ltraceMatch [ltraceRun -efunc* $filt] {
+ {{filt(\.pie)?->func1\(} == 1}
+ {{libfilt1.so->func2\(.*\)} == 1}
+ {{func1 resumed} == 1}
+ }
+
+ # Check that we handle breakpoint on both PLT entry and entry point
+ ltraceMatch [ltraceRun -efunc1 -xfunc1 $filt] {
+ {{filt(\.pie)?->func1\(} == 1}
+ {{func1@libfilt1.so\(.*\)} == 1}
+ {{func1 resumed} == 1}
+ }
+
+ # Check that when given -l, we don't trace symbols from other
+ # libraries.
+ ltraceMatch1 [ltraceRun -llibfilt1.so -- $filt] \
+ {filt(\.pie)?->func1\(.*\)} == 1
+
+ ltraceMatch [ltraceRun -llibfilt1.so -llibfilt2.so $filt] {
+ {{filt(\.pie)?->func1\(} == 1}
+ {{libfilt1.so->func2\(.*\)} == 1}
+ {{func1 resumed} == 1}
+ }
+}
+
+ltraceDone
diff --git a/testsuite/ltrace.main/hello-vfork.c b/testsuite/ltrace.main/hello-vfork.c
new file mode 100644
index 0000000..81e426f
--- /dev/null
+++ b/testsuite/ltrace.main/hello-vfork.c
@@ -0,0 +1,11 @@
+/* Copyright (C) 2008, Red Hat, Inc.
+ * Written by Denys Vlasenko */
+#include <stdio.h>
+#include <unistd.h>
+
+int main() {
+ int r = vfork();
+ fprintf(stdout, "vfork():%d\n", r);
+ _exit(0);
+}
+
diff --git a/testsuite/ltrace.main/hello-vfork.exp b/testsuite/ltrace.main/hello-vfork.exp
new file mode 100644
index 0000000..12c9ca3
--- /dev/null
+++ b/testsuite/ltrace.main/hello-vfork.exp
@@ -0,0 +1,35 @@
+# This file was written by Yao Qi <qiyao@cn.ibm.com>.
+
+set testfile "hello-vfork"
+set srcfile ${testfile}.c
+set binfile ${testfile}
+
+
+if [get_compiler_info $binfile] {
+ return -1
+}
+
+verbose "compiling source file now....."
+if { [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable debug ] != ""} {
+ send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
+}
+
+# set options for ltrace.
+ltrace_options "-f"
+
+# Run PUT for ltarce.
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
+
+# Check the output of this program.
+verbose "ltrace runtest output: $exec_output\n"
+if [regexp {ELF from incompatible architecture} $exec_output] {
+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
+ return
+} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
+ fail "Couldn't get .hash data!"
+ return
+}
+
+# Verify the output by checking numbers of print in main-vfork.ltrace.
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace "_exit" 2
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace "vfork resumed" 2
diff --git a/testsuite/ltrace.main/main-internal-1.c b/testsuite/ltrace.main/main-internal-1.c
deleted file mode 100644
index 2a5cd0c..0000000
--- a/testsuite/ltrace.main/main-internal-1.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include<stdio.h>
-
-void
-display ( char* s )
-{
- printf("%s\n",s);
-}
-
diff --git a/testsuite/ltrace.main/main-internal.c b/testsuite/ltrace.main/main-internal.c
deleted file mode 100644
index 7508d06..0000000
--- a/testsuite/ltrace.main/main-internal.c
+++ /dev/null
@@ -1,19 +0,0 @@
- /* Ltrace Test : main-internal.c.
- Objectives : Verify that ltrace can trace call from main
- executable within it.
- This file was written by Yao Qi <qiyao@cn.ibm.com>. */
-#include<stdio.h>
-
-extern void display ( char* );
-
-#define DISPLAY_LOOP 12
-
-int
-main ()
-{
- int i;
- printf ("should not show up if '-X display' is used.\n");
- for (i=0; i< DISPLAY_LOOP; i++)
- display ("Function call within executable.");
-}
-
diff --git a/testsuite/ltrace.main/main-internal.exp b/testsuite/ltrace.main/main-internal.exp
index f3f0015..0ca5e14 100644
--- a/testsuite/ltrace.main/main-internal.exp
+++ b/testsuite/ltrace.main/main-internal.exp
@@ -1,33 +1,35 @@
-# This file was written by Yao Qi <qiyao@cn.ibm.com>.
+# This file is part of ltrace.
+# Copyright (C) 2012 Petr Machata, Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
-set testfile "main-internal"
-set srcfile ${testfile}.c
-set binfile ${testfile}
+set bin [ltraceCompile {} [ltraceSource c {
+ __attribute__((noinline)) void this(void) {}
+ __attribute__((noinline)) void that(void) {}
+ int main(int i) {
+ for (i = 0; i < 12; ++i) {
+ this();
+ that();
+ }
+ }
+}]]
-verbose "compiling source file now....."
-# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c ${srcdir}/${subdir}/${testfile}-1.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
- send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
+ltraceMatch [ltraceRun -L -xthis -- $bin] {
+ {{this\(.*\)} == 12}
+ {that == 0}
}
-# set options for ltrace.
-ltrace_options "-x" "display"
-
-# Run PUT for ltarce.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
-
-# Check the output of this program.
-verbose "ltrace runtest output: $exec_output\n"
-if [regexp {ELF from incompatible architecture} $exec_output] {
- fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
- return
-} elseif [ regexp {Couldn't do static plt2addr} $exec_output ] {
- fail "Couldn't do static plt2addr!"
- return
-} elseif [regexp {Couldn't get .hash data from} $exec_output ] {
- fail "Couldn't get .hash data!"
- return
-}
-
-set pattern "display"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 12
+ltraceDone
diff --git a/testsuite/ltrace.main/main-threaded.c b/testsuite/ltrace.main/main-threaded.c
new file mode 100644
index 0000000..a183966
--- /dev/null
+++ b/testsuite/ltrace.main/main-threaded.c
@@ -0,0 +1,29 @@
+#include <pthread.h>
+
+extern void print (char *);
+
+#define PRINT_LOOP 10
+
+void *
+th_main (void *arg)
+{
+ int i;
+ for (i=0; i<PRINT_LOOP; i++)
+ print (arg);
+}
+
+int
+main ()
+{
+ pthread_t thread1;
+ pthread_t thread2;
+ pthread_t thread3;
+ pthread_create (&thread1, NULL, th_main, "aaa");
+ pthread_create (&thread2, NULL, th_main, "bbb");
+ pthread_create (&thread3, NULL, th_main, "ccc");
+ pthread_join (thread1, NULL);
+ pthread_join (thread2, NULL);
+ pthread_join (thread3, NULL);
+ return 0;
+}
+
diff --git a/testsuite/ltrace.main/main-threaded.exp b/testsuite/ltrace.main/main-threaded.exp
new file mode 100644
index 0000000..4f6c25d
--- /dev/null
+++ b/testsuite/ltrace.main/main-threaded.exp
@@ -0,0 +1,39 @@
+# This file was written by Yao Qi <qiyao@cn.ibm.com>.
+
+set testfile "main-threaded"
+set srcfile ${testfile}.c
+set binfile ${testfile}
+set libfile "main-lib"
+set libsrc $srcdir/$subdir/$libfile.c
+set lib_sl $objdir/$subdir/lib$testfile.so
+
+
+if [get_compiler_info $binfile] {
+ return -1
+}
+
+verbose "compiling source file now....."
+if { [ltrace_compile_shlib $libsrc $lib_sl debug ] != ""
+ || [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug shlib=$lib_sl ldflags=-pthread] ] != ""} {
+ send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
+}
+
+# set options for ltrace.
+ltrace_options "-l" "lib$testfile.so" "-f"
+
+# Run PUT for ltarce.
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
+
+# Check the output of this program.
+verbose "ltrace runtest output: $exec_output\n"
+if [regexp {ELF from incompatible architecture} $exec_output] {
+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
+ return
+} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
+ fail "Couldn't get .hash data!"
+ return
+}
+
+# Verify the output by checking numbers of print in main-threaded.ltrace.
+set pattern "print"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 30
diff --git a/testsuite/ltrace.main/main-vfork.c b/testsuite/ltrace.main/main-vfork.c
new file mode 100644
index 0000000..a5f6c40
--- /dev/null
+++ b/testsuite/ltrace.main/main-vfork.c
@@ -0,0 +1,28 @@
+#include <unistd.h>
+
+extern void print (char *);
+
+#define PRINT_LOOP 10
+
+void
+th_main (char * arg)
+{
+ int i;
+ for (i=0; i<PRINT_LOOP; i++)
+ print (arg);
+}
+
+int main (int argc, char ** argv)
+{
+ if (argc != 1)
+ {
+ th_main ("aaa");
+ return 0;
+ }
+
+ if (!vfork ())
+ execlp (argv[0], argv[0], "", NULL);
+ th_main ("bbb");
+
+ return 0;
+}
diff --git a/testsuite/ltrace.main/main-vfork.exp b/testsuite/ltrace.main/main-vfork.exp
new file mode 100644
index 0000000..989012d
--- /dev/null
+++ b/testsuite/ltrace.main/main-vfork.exp
@@ -0,0 +1,39 @@
+# This file was written by Yao Qi <qiyao@cn.ibm.com>.
+
+set testfile "main-vfork"
+set srcfile ${testfile}.c
+set binfile ${testfile}
+set libfile "main-lib"
+set libsrc $srcdir/$subdir/$libfile.c
+set lib_sl $objdir/$subdir/lib$testfile.so
+
+
+if [get_compiler_info $binfile] {
+ return -1
+}
+
+verbose "compiling source file now....."
+if { [ltrace_compile_shlib $libsrc $lib_sl debug ] != ""
+ || [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug shlib=$lib_sl] ] != ""} {
+ send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
+}
+
+# set options for ltrace.
+ltrace_options "-l" "lib$testfile.so" "-f" "-evfork"
+
+# Run PUT for ltarce.
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
+
+# Check the output of this program.
+verbose "ltrace runtest output: $exec_output\n"
+if [regexp {ELF from incompatible architecture} $exec_output] {
+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
+ return
+} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
+ fail "Couldn't get .hash data!"
+ return
+}
+
+# Verify the output by checking numbers of print in main-vfork.ltrace.
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace "print" 20
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace "vfork resumed" 2
diff --git a/testsuite/ltrace.main/main.exp b/testsuite/ltrace.main/main.exp
index ca66deb..50c5353 100644
--- a/testsuite/ltrace.main/main.exp
+++ b/testsuite/ltrace.main/main.exp
@@ -5,7 +5,7 @@ set srcfile ${testfile}.c
set binfile ${testfile}
set libfile "main-lib"
set libsrc $srcdir/$subdir/$libfile.c
-set lib_sl $srcdir/$subdir/lib$testfile.so
+set lib_sl $objdir/$subdir/lib$testfile.so
if [get_compiler_info $binfile] {
@@ -14,15 +14,15 @@ if [get_compiler_info $binfile] {
verbose "compiling source file now....."
if { [ltrace_compile_shlib $libsrc $lib_sl debug ] != ""
- || [ltrace_compile $srcdir/$subdir/$srcfile $srcdir/$subdir/$binfile executable [list debug shlib=$lib_sl] ] != ""} {
+ || [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug shlib=$lib_sl] ] != ""} {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
# set options for ltrace.
-ltrace_options "-l" "$srcdir/$subdir/libmain.so"
+ltrace_options "-l" "libmain.so"
# Run PUT for ltarce.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
# Check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -36,4 +36,4 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
# Verify the output by checking numbers of print in main.ltrace.
set pattern "print"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 10
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 10
diff --git a/testsuite/ltrace.main/parameters-lib.c b/testsuite/ltrace.main/parameters-lib.c
index 26e4c3b..bf8cdfe 100644
--- a/testsuite/ltrace.main/parameters-lib.c
+++ b/testsuite/ltrace.main/parameters-lib.c
@@ -22,11 +22,22 @@ int func_strlen(char* p)
return strlen(p);
}
+int func_arg0(char *p)
+{
+ strcpy(p, "Hello another world!");
+ return strlen(p);
+}
+
void func_strfixed(char* p)
{
strcpy(p, "Hello world");
}
+void func_string(char* p)
+{
+ printf("%s\n", p);
+}
+
void func_ppp(int*** ppp)
{
printf("%d\n", ***ppp);
@@ -52,9 +63,16 @@ void func_ushort(unsigned short x1, unsigned short x2)
printf("ushort: %hu %hu\n", x1, x2);
}
-void func_float(float f1, float f2)
+float func_float(float f1, float f2)
+{
+ printf("%f %f\n", f1, f2);
+ return f1;
+}
+
+double func_double(double f1, double f2)
{
printf("%f %f\n", f1, f2);
+ return f2;
}
void func_typedef(int x)
@@ -115,3 +133,351 @@ void func_struct(struct test_struct* x)
buf[x->slen] = '\0';
printf("%s\n", buf);
}
+
+void func_work (char *x)
+{
+ *x = 'x';
+}
+
+void func_call (char *x, char* y, void (*cb) (char *))
+{
+ cb (y);
+ *x = (*y)++;
+}
+
+struct S2 {
+ float f;
+ char a;
+ char b;
+};
+
+struct S3 {
+ char a[6];
+ float f;
+};
+
+struct S2
+func_struct_2(int i, struct S3 s3, double d)
+{
+ return (struct S2){ s3.f, s3.a[1], s3.a[2] };
+}
+
+struct S4 {
+ long a;
+ long b;
+ long c;
+ long d;
+};
+
+struct S4
+func_struct_large(struct S4 a, struct S4 b)
+{
+ return (struct S4){ a.a + b.a, a.b + b.b, a.c + b.c, a.d + b.d };
+}
+
+struct S5 {
+ char a;
+ char b;
+ long c;
+ long d;
+};
+
+struct S5
+func_struct_large2(struct S5 a, struct S5 b)
+{
+ return (struct S5){ a.a + b.a, a.b + b.b, a.c + b.c, a.d + b.d };
+}
+
+struct S6 {
+ long a;
+ long b;
+ char c;
+ char d;
+};
+
+struct S6
+func_struct_large3(struct S6 a, struct S6 b)
+{
+ return (struct S6){ a.a + b.a, a.b + b.b, a.c + b.c, a.d + b.d };
+}
+
+void
+func_many_args(int a, int b, long c, double d, char e, int f, float g, char h,
+ int i, double j, int k, double l, char m, int n, short o, int p,
+ char q, float r, float s, double t, long u, float v, float w,
+ float x, float y)
+{
+}
+
+void
+func_lens(int a, long b, short c, long d)
+{
+}
+
+int
+func_bool(int a, int b)
+{
+ return !b;
+}
+
+void
+func_hide(int a, int b, int c, int d, int e, int f)
+{
+}
+
+struct func_hide_struct {
+ int a; int b; int c; int d; int e; int f; int g; int h;
+};
+
+void
+func_hide_struct(struct func_hide_struct s)
+{
+}
+
+long *
+func_short_enums(short values[])
+{
+ static long retvals[4];
+ retvals[0] = values[0];
+ retvals[1] = values[1];
+ retvals[2] = values[2];
+ retvals[3] = values[3];
+ return retvals;
+}
+
+long
+func_negative_enum(short a, unsigned short b, int c, unsigned d,
+ long e, unsigned long f)
+{
+ return -1;
+}
+
+void
+func_charp_string(char *p)
+{
+}
+
+struct dbl_eqv1 { double d; };
+struct dbl_eqv2 { struct dbl_eqv1 d; };
+struct dbl_eqv3 { struct dbl_eqv2 d; };
+struct dbl_eqv4 { struct dbl_eqv3 d; };
+
+struct flt_eqv1 { float d; };
+struct flt_eqv2 { struct flt_eqv1 d; };
+struct flt_eqv3 { struct flt_eqv2 d; };
+struct flt_eqv4 { struct flt_eqv3 d; };
+
+struct dbl_eqv1
+func_dbl_eqv(struct dbl_eqv1 a, struct dbl_eqv2 b,
+ struct dbl_eqv3 c, struct dbl_eqv4 d)
+{
+ return (struct dbl_eqv1){ a.d + b.d.d + c.d.d.d + d.d.d.d.d };
+}
+
+struct flt_eqv1
+func_flt_eqv(struct flt_eqv1 a, struct flt_eqv2 b,
+ struct flt_eqv3 c, struct flt_eqv4 d)
+{
+ return (struct flt_eqv1){ a.d + b.d.d + c.d.d.d + d.d.d.d.d };
+}
+
+struct struct_empty {};
+struct struct_size1 { char a; };
+struct struct_size2 { short a; };
+struct struct_size4 { int a; };
+struct struct_size8 { int a; int b; };
+
+struct struct_empty
+func_struct_empty(struct struct_empty e)
+{
+ return e;
+}
+
+struct struct_size1
+func_struct_size1(struct struct_size1 e)
+{
+ return e;
+}
+
+struct struct_size2
+func_struct_size2(struct struct_size2 e)
+{
+ return e;
+}
+
+struct struct_size4
+func_struct_size4(struct struct_size4 e)
+{
+ return e;
+}
+
+struct struct_size8
+func_struct_size8(struct struct_size8 e)
+{
+ return e;
+}
+
+struct struct_hfa_f2 { float a; struct flt_eqv1 b; };
+struct struct_hfa_f2
+func_hfa_f2(struct struct_hfa_f2 e)
+{
+ return e;
+}
+
+struct struct_hfa_f3 { float a; struct struct_hfa_f2 b; };
+struct struct_hfa_f3
+func_hfa_f3(struct struct_hfa_f3 e)
+{
+ return e;
+}
+
+struct struct_hfa_f4 { float a; struct struct_hfa_f3 b; };
+struct struct_hfa_f4
+func_hfa_f4(struct struct_hfa_f4 e)
+{
+ return e;
+}
+
+struct struct_hfa_f5 { float a; struct struct_hfa_f4 b; };
+struct struct_hfa_f5
+func_hfa_f5(struct struct_hfa_f5 e)
+{
+ return e;
+}
+
+struct struct_hfa_f6 { float a; struct struct_hfa_f5 b; };
+struct struct_hfa_f6
+func_hfa_f6(struct struct_hfa_f6 e)
+{
+ return e;
+}
+
+struct struct_hfa_f7 { float a; struct struct_hfa_f6 b; };
+struct struct_hfa_f7
+func_hfa_f7(struct struct_hfa_f7 e)
+{
+ return e;
+}
+
+struct struct_hfa_f8 { float a; struct struct_hfa_f7 b; };
+struct struct_hfa_f8
+func_hfa_f8(struct struct_hfa_f8 e)
+{
+ return e;
+}
+
+struct struct_hfa_f9 { float a; struct struct_hfa_f8 b; };
+struct struct_hfa_f9
+func_hfa_f9(struct struct_hfa_f9 e)
+{
+ return e;
+}
+
+struct struct_hfa_f10 { float a; struct struct_hfa_f9 b; };
+struct struct_hfa_f10
+func_hfa_f10(struct struct_hfa_f10 e)
+{
+ return e;
+}
+
+struct struct_hfa_f11 { float a; struct struct_hfa_f10 b; };
+struct struct_hfa_f11
+func_hfa_f11(struct struct_hfa_f11 e)
+{
+ return e;
+}
+
+struct struct_hfa_f12 { float a; struct struct_hfa_f11 b; };
+struct struct_hfa_f12
+func_hfa_f12(struct struct_hfa_f12 e)
+{
+ return e;
+}
+
+
+struct struct_hfa_d2 { double a; struct dbl_eqv1 b; };
+struct struct_hfa_d2
+func_hfa_d2(struct struct_hfa_d2 e)
+{
+ return e;
+}
+
+struct struct_hfa_d3 { double a; struct struct_hfa_d2 b; };
+struct struct_hfa_d3
+func_hfa_d3(struct struct_hfa_d3 e)
+{
+ return e;
+}
+
+struct struct_hfa_d4 { double a; struct struct_hfa_d3 b; };
+struct struct_hfa_d4
+func_hfa_d4(struct struct_hfa_d4 e)
+{
+ return e;
+}
+
+struct struct_hfa_d5 { double a; struct struct_hfa_d4 b; };
+struct struct_hfa_d5
+func_hfa_d5(struct struct_hfa_d5 e)
+{
+ return e;
+}
+
+struct struct_hfa_d6 { double a; struct struct_hfa_d5 b; };
+struct struct_hfa_d6
+func_hfa_d6(struct struct_hfa_d6 e)
+{
+ return e;
+}
+
+struct struct_hfa_d7 { double a; struct struct_hfa_d6 b; };
+struct struct_hfa_d7
+func_hfa_d7(struct struct_hfa_d7 e)
+{
+ return e;
+}
+
+struct struct_hfa_d8 { double a; struct struct_hfa_d7 b; };
+struct struct_hfa_d8
+func_hfa_d8(struct struct_hfa_d8 e)
+{
+ return e;
+}
+
+struct struct_hfa_d9 { double a; struct struct_hfa_d8 b; };
+struct struct_hfa_d9
+func_hfa_d9(struct struct_hfa_d9 e)
+{
+ return e;
+}
+
+struct struct_hfa_d10 { double a; struct struct_hfa_d9 b; };
+struct struct_hfa_d10
+func_hfa_d10(struct struct_hfa_d10 e)
+{
+ return e;
+}
+
+struct struct_hfa_d11 { double a; struct struct_hfa_d10 b; };
+struct struct_hfa_d11
+func_hfa_d11(struct struct_hfa_d11 e)
+{
+ return e;
+}
+
+struct struct_hfa_d12 { double a; struct struct_hfa_d11 b; };
+struct struct_hfa_d12
+func_hfa_d12(struct struct_hfa_d12 e)
+{
+ return e;
+}
+
+void
+func_printf(char *format, ...)
+{
+}
+
+void
+func_sprintf(char *str, char *format, ...)
+{
+}
diff --git a/testsuite/ltrace.main/parameters.c b/testsuite/ltrace.main/parameters.c
index dd63612..ff24a38 100644
--- a/testsuite/ltrace.main/parameters.c
+++ b/testsuite/ltrace.main/parameters.c
@@ -20,7 +20,8 @@ void func_ppp(int***);
void func_stringp(char**);
void func_short(short, short);
void func_ushort(unsigned short, unsigned short);
-void func_float(float, float);
+float func_float(float, float);
+double func_double(double, double);
void func_arrayi(int*, int);
void func_arrayf(float*, int);
void func_struct(void*);
@@ -35,7 +36,16 @@ typedef enum {
void func_enum(color_t);
void func_typedef(color_t);
-int
+void func_work(char *x);
+void func_call(char *x, char *y, void (*cb)(char *));
+
+void
+call_func_work (char *x)
+{
+ func_work(x);
+}
+
+int
main ()
{
int x = 17;
@@ -49,7 +59,12 @@ main ()
func_intptr_ret(&x);
+ func_string("zero\0xxxxxxxxxxxxxx");
func_strlen(buf);
+
+ extern int func_arg0(char *);
+ func_arg0(buf);
+
printf("%s\n", buf);
func_strfixed(buf);
@@ -68,7 +83,8 @@ main ()
func_short(-8, -9);
func_ushort(33, 34);
- func_float(3.4, -3.4);
+ float f = func_float(3.4, -3.4);
+ double d = func_double(3.4, -3.4);
func_typedef(BLUE);
@@ -116,5 +132,240 @@ main ()
func_struct(&x);
}
+ {
+ char x[10] = {};
+ char y[10] = {};
+ func_call(x, y, call_func_work);
+ }
+
+ struct S2 {
+ float f;
+ char a;
+ char b;
+ };
+ struct S3 {
+ char a[6];
+ float f;
+ };
+ struct S2 func_struct_2(int, struct S3 s3, double d);
+ func_struct_2(17, (struct S3){ "ABCDE", 0.25 }, 0.5);
+
+ struct S4 {
+ long a;
+ long b;
+ long c;
+ long d;
+ };
+ struct S4 func_struct_large(struct S4 a, struct S4 b);
+ func_struct_large((struct S4){ 1, 2, 3, 4 }, (struct S4){ 5, 6, 7, 8 });
+
+ struct S5 {
+ char a;
+ char b;
+ long c;
+ long d;
+ };
+ struct S5 func_struct_large2(struct S5 a, struct S5 b);
+ func_struct_large2((struct S5){ '0', '1', 3, 4 }, (struct S5){ '2', '3', 7, 8 });
+
+ struct S6 {
+ long a;
+ long b;
+ char c;
+ char d;
+ };
+ struct S6 func_struct_large3(struct S6 a, struct S6 b);
+ func_struct_large3((struct S6){ 3, 4, '0', '1' }, (struct S6){ 7, 8 ,'2', '3' });
+
+ void func_many_args(int a, int b, long c, double d, char e, int f, float g,
+ char h, int i, double j, int k, double l, char m, int n,
+ short o, int p, char q, float r, float s, double t,
+ long u, float v, float w, float x, float y);
+ func_many_args(1, 2, 3, 4.0, '5', 6, 7.0,
+ '8', 9, 10.0, 11, 12.0, 'A', 14,
+ 15, 16, 'B', 18.0, 19.0, 20.0,
+ 21, 22.0, 23.0, 24.0, 25.0);
+
+ void func_printf(char *format, ...);
+ func_printf("sotnuh %d %ld %g %c\n", 5, 6L, 1.5, 'X');
+ func_printf("sotnuh1 %d %ld %hd\n", 5, 6L, (short)7);
+ func_printf("sotnuh2 %s %10s %10s\n", "a string", "a trimmed string", "short");
+ func_printf("many_args"
+ "%d %d %ld %g %c %d %g "
+ "%c %d %g %d %g %c %d "
+ "%hd %d %c %g %g %g "
+ "%ld %g %g %g %g",
+ 1, 2, 3L, 4.0, '5', 6, 7.0,
+ '8', 9, 10.0, 11, 12.0, 'A', 14,
+ (short)15, 16, 'B', 18.0, 19.0, 20.0,
+ 21L, 22.0, 23.0, 24.0, 25.0);
+
+ func_printf("sotnuh3 %*s\n", 4, "a trimmed string");
+
+ void func_sprintf(char *str, char *format, ...);
+ func_sprintf(NULL, "test %d %d %d %d\n", 1, 2, 3, 4);
+
+ void func_lens(int, long, short, long);
+ func_lens(22, 23, 24, 25);
+
+ int func_bool(int a, int b);
+ func_bool(1, 10);
+ func_bool(2, 0);
+
+ void func_hide(int a, int b, int c, int d, int e, int f, int g, int h);
+ func_hide(1, 2, 3, 4, 5, 6, 7, 8);
+
+ struct func_hide_struct {
+ int a; int b; int c; int d; int e; int f; int g; int h;
+ };
+ void func_hide_struct(struct func_hide_struct hs);
+ func_hide_struct((struct func_hide_struct){1, 2, 3, 4, 5, 6, 7, 8});
+
+ enum ab { A, B };
+ long *func_short_enums(short abs[]);
+ func_short_enums((short[]){ A, B, A, A });
+
+ long func_negative_enum(short a, unsigned short b, int c, unsigned d,
+ long e, unsigned long f);
+ func_negative_enum(-1, -1, -1, -1, -1, -1);
+
+ void func_charp_string(char *p);
+ func_charp_string("null-terminated string");
+
+ struct dbl_eqv1 { double d; };
+ struct dbl_eqv2 { struct dbl_eqv1 d; };
+ struct dbl_eqv3 { struct dbl_eqv2 d; };
+ struct dbl_eqv4 { struct dbl_eqv3 d; };
+
+ struct flt_eqv1 { float d; };
+ struct flt_eqv2 { struct flt_eqv1 d; };
+ struct flt_eqv3 { struct flt_eqv2 d; };
+ struct flt_eqv4 { struct flt_eqv3 d; };
+
+ struct dbl_eqv1 func_dbl_eqv(struct dbl_eqv1 a, struct dbl_eqv2 b,
+ struct dbl_eqv3 c, struct dbl_eqv4 d);
+ func_dbl_eqv((struct dbl_eqv1){ 2.5 },
+ (struct dbl_eqv2){ { 1.5 } },
+ (struct dbl_eqv3){ { { 0.5 } } },
+ (struct dbl_eqv4){ { { { -0.5 } } } });
+
+ struct flt_eqv1 func_flt_eqv(struct flt_eqv1 a, struct flt_eqv2 b,
+ struct flt_eqv3 c, struct flt_eqv4 d);
+ func_flt_eqv((struct flt_eqv1){ 2.5 },
+ (struct flt_eqv2){ { 1.5 } },
+ (struct flt_eqv3){ { { 0.5 } } },
+ (struct flt_eqv4){ { { { -0.5 } } } });
+
+ struct struct_empty {};
+ struct struct_empty func_struct_empty(struct struct_empty e);
+ func_struct_empty((struct struct_empty) {});
+
+ struct struct_size1 { char a; };
+ struct struct_size1 func_struct_size1(struct struct_size1 e);
+ func_struct_size1((struct struct_size1){ '5' });
+
+ struct struct_size2 { short a; };
+ struct struct_size2 func_struct_size2(struct struct_size2 e);
+ func_struct_size2((struct struct_size2){ 5 });
+
+ struct struct_size4 { int a; };
+ struct struct_size4 func_struct_size4(struct struct_size4 e);
+ func_struct_size4((struct struct_size4){ 5 });
+
+ struct struct_size8 { int a; int b; };
+ struct struct_size8 func_struct_size8(struct struct_size8 e);
+ func_struct_size8((struct struct_size8){ 5, 6 });
+
+ /* Test Itanium Homogeneous Floating-point Aggregates. */
+
+ struct struct_hfa_f2 { float a; struct flt_eqv1 b; };
+ struct struct_hfa_f2 func_hfa_f2(struct struct_hfa_f2 e);
+ func_hfa_f2((struct struct_hfa_f2){ 1, { 2 } });
+
+ struct struct_hfa_f3 { float a; struct struct_hfa_f2 b; };
+ struct struct_hfa_f3 func_hfa_f3(struct struct_hfa_f3 e);
+ func_hfa_f3((struct struct_hfa_f3){ 3, { 1, { 2 } } });
+
+ struct struct_hfa_f4 { float a; struct struct_hfa_f3 b; };
+ struct struct_hfa_f4 func_hfa_f4(struct struct_hfa_f4 e);
+ func_hfa_f4((struct struct_hfa_f4){ 4, { 3, { 1, { 2 } } } });
+
+ struct struct_hfa_f5 { float a; struct struct_hfa_f4 b; };
+ struct struct_hfa_f5 func_hfa_f5(struct struct_hfa_f5 e);
+ func_hfa_f5((struct struct_hfa_f5){ 5, { 4, { 3, { 1, { 2 } } } } });
+
+ struct struct_hfa_f6 { float a; struct struct_hfa_f5 b; };
+ struct struct_hfa_f6 func_hfa_f6(struct struct_hfa_f6 e);
+ func_hfa_f6((struct struct_hfa_f6){ 6, { 5, { 4, { 3, { 1, { 2 } } } } } });
+
+ struct struct_hfa_f7 { float a; struct struct_hfa_f6 b; };
+ struct struct_hfa_f7 func_hfa_f7(struct struct_hfa_f7 e);
+ func_hfa_f7((struct struct_hfa_f7){ 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } });
+
+ struct struct_hfa_f8 { float a; struct struct_hfa_f7 b; };
+ struct struct_hfa_f8 func_hfa_f8(struct struct_hfa_f8 e);
+ func_hfa_f8((struct struct_hfa_f8){ 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } });
+
+ struct struct_hfa_f9 { float a; struct struct_hfa_f8 b; };
+ struct struct_hfa_f9 func_hfa_f9(struct struct_hfa_f9 e);
+ func_hfa_f9((struct struct_hfa_f9){ 9, { 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } } });
+
+ struct struct_hfa_f10 { float a; struct struct_hfa_f9 b; };
+ struct struct_hfa_f10 func_hfa_f10(struct struct_hfa_f10 e);
+ func_hfa_f10((struct struct_hfa_f10){ 10, { 9, { 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } } } });
+
+ struct struct_hfa_f11 { float a; struct struct_hfa_f10 b; };
+ struct struct_hfa_f11 func_hfa_f11(struct struct_hfa_f11 e);
+ func_hfa_f11((struct struct_hfa_f11){ 11, { 10, { 9, { 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } } } } });
+
+ struct struct_hfa_f12 { float a; struct struct_hfa_f11 b; };
+ struct struct_hfa_f12 func_hfa_f12(struct struct_hfa_f12 e);
+ func_hfa_f12((struct struct_hfa_f12){ 12, { 11, { 10, { 9, { 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } } } } } });
+
+
+ struct struct_hfa_d2 { double a; struct dbl_eqv1 b; };
+ struct struct_hfa_d2 func_hfa_d2(struct struct_hfa_d2 e);
+ func_hfa_d2((struct struct_hfa_d2){ 1, { 2 } });
+
+ struct struct_hfa_d3 { double a; struct struct_hfa_d2 b; };
+ struct struct_hfa_d3 func_hfa_d3(struct struct_hfa_d3 e);
+ func_hfa_d3((struct struct_hfa_d3){ 3, { 1, { 2 } } });
+
+ struct struct_hfa_d4 { double a; struct struct_hfa_d3 b; };
+ struct struct_hfa_d4 func_hfa_d4(struct struct_hfa_d4 e);
+ func_hfa_d4((struct struct_hfa_d4){ 4, { 3, { 1, { 2 } } } });
+
+ struct struct_hfa_d5 { double a; struct struct_hfa_d4 b; };
+ struct struct_hfa_d5 func_hfa_d5(struct struct_hfa_d5 e);
+ func_hfa_d5((struct struct_hfa_d5){ 5, { 4, { 3, { 1, { 2 } } } } });
+
+ struct struct_hfa_d6 { double a; struct struct_hfa_d5 b; };
+ struct struct_hfa_d6 func_hfa_d6(struct struct_hfa_d6 e);
+ func_hfa_d6((struct struct_hfa_d6){ 6, { 5, { 4, { 3, { 1, { 2 } } } } } });
+
+ struct struct_hfa_d7 { double a; struct struct_hfa_d6 b; };
+ struct struct_hfa_d7 func_hfa_d7(struct struct_hfa_d7 e);
+ func_hfa_d7((struct struct_hfa_d7){ 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } });
+
+ struct struct_hfa_d8 { double a; struct struct_hfa_d7 b; };
+ struct struct_hfa_d8 func_hfa_d8(struct struct_hfa_d8 e);
+ func_hfa_d8((struct struct_hfa_d8){ 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } });
+
+ struct struct_hfa_d9 { double a; struct struct_hfa_d8 b; };
+ struct struct_hfa_d9 func_hfa_d9(struct struct_hfa_d9 e);
+ func_hfa_d9((struct struct_hfa_d9){ 9, { 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } } });
+
+ struct struct_hfa_d10 { double a; struct struct_hfa_d9 b; };
+ struct struct_hfa_d10 func_hfa_d10(struct struct_hfa_d10 e);
+ func_hfa_d10((struct struct_hfa_d10){ 10, { 9, { 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } } } });
+
+ struct struct_hfa_d11 { double a; struct struct_hfa_d10 b; };
+ struct struct_hfa_d11 func_hfa_d11(struct struct_hfa_d11 e);
+ func_hfa_d11((struct struct_hfa_d11){ 11, { 10, { 9, { 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } } } } });
+
+ struct struct_hfa_d12 { double a; struct struct_hfa_d11 b; };
+ struct struct_hfa_d12 func_hfa_d12(struct struct_hfa_d12 e);
+ func_hfa_d12((struct struct_hfa_d12){ 12, { 11, { 10, { 9, { 8, { 7, { 6, { 5, { 4, { 3, { 1, { 2 } } } } } } } } } } } });
+
return 0;
}
diff --git a/testsuite/ltrace.main/parameters.conf b/testsuite/ltrace.main/parameters.conf
index 33c1a1e..066c012 100644
--- a/testsuite/ltrace.main/parameters.conf
+++ b/testsuite/ltrace.main/parameters.conf
@@ -1,15 +1,65 @@
void func_intptr(int*)
void func_intptr_ret(+int*)
+void func_string(string[10])
int func_strlen(+string[retval])
+int func_arg0(+string[arg0])
void func_strfixed(string[4])
-void func_ppp(int***)
+void func_ppp(int * **)
void func_stringp(string*)
void func_enum(enum (RED=0,GREEN=1,BLUE=2,CHARTREUSE=3,PETUNIA=4))
void func_short(short,short)
void func_ushort(ushort, ushort)
-void func_float(float,float)
+float func_float(float,float)
+double func_double(double,double)
typedef color = enum (RED=0,GREEN=1,BLUE=2,CHARTREUSE=3,PETUNIA=4)
void func_typedef(color)
-void func_arrayi(array(int,arg2)*,void)
-void func_arrayf(array(float,arg2)*,void)
+void func_arrayi(array(int,arg2)*,int)
+void func_arrayf(array(float,arg2)*,int)
void func_struct(struct(int,int,int,array(struct(int,int),elt2)*,array(struct(int,int),3),string[elt3])*)
+void func_work(+string);
+void func_call(+string, string);
+struct(float,char,char) func_struct_2(int, struct(string(array(char, 6)),float), double);
+struct(long,long,long,long) func_struct_large(struct(long,long,long,long), struct(long,long,long,long));
+struct(char,char,long,long) func_struct_large2(struct(char,char,long,long), struct(char,char,long,long));
+struct(long,long,char,char) func_struct_large3(struct(long,long,char,char), struct(long,long,char,char));
+void func_many_args(int, int, long, double, char, int, float, char, int, double, int, double, char, int, short, int, char, float, float, double, long, float, float, float, float);
+void func_printf(format);
+void func_sprintf(+string,format);
+void func_lens(octal, octal(long), hex(short), hex(long));
+bool(int) func_bool(int, bool(int));
+void func_hide(hide(int), int, hide(int), hide(int), int, hide(int), int, hide(int));
+void func_hide_struct(struct(hide(int), int, hide(int), hide(int), int, hide(int), int, hide(int)));
+array(enum[long](A,B), 4) *func_short_enums(array(enum[short](A,B), 4)*);
+enum[long](A=-1) func_negative_enum(enum[short](A=-1), enum[ushort](A=-1), enum[int](A=-1), enum[uint](A=-1), enum[long](A=-1), enum[ulong](A=-1));
+void func_charp_string(string(char *));
+struct(double) func_dbl_eqv(struct(double), struct(struct(double)), struct(struct(struct(double))), struct(struct(struct(struct(double)))));
+struct(float) func_flt_eqv(struct(float), struct(struct(float)), struct(struct(struct(float))), struct(struct(struct(struct(float)))));
+struct() func_struct_empty(struct());
+struct(char) func_struct_size1(struct(char));
+struct(short) func_struct_size2(struct(short));
+struct(int) func_struct_size4(struct(int));
+struct(int,int) func_struct_size8(struct(int,int));
+
+struct(float,struct(float)) func_hfa_f2(struct(float,struct(float)));
+struct(float,struct(float,struct(float))) func_hfa_f3(struct(float,struct(float,struct(float))));
+struct(float,struct(float,struct(float,struct(float)))) func_hfa_f4(struct(float,struct(float,struct(float,struct(float)))));
+struct(float,struct(float,struct(float,struct(float,struct(float))))) func_hfa_f5(struct(float,struct(float,struct(float,struct(float,struct(float))))));
+struct(float,struct(float,struct(float,struct(float,struct(float,struct(float)))))) func_hfa_f6(struct(float,struct(float,struct(float,struct(float,struct(float,struct(float)))))));
+struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float))))))) func_hfa_f7(struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float))))))));
+struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float)))))))) func_hfa_f8(struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float)))))))));
+struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float))))))))) func_hfa_f9(struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float))))))))));
+struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float)))))))))) func_hfa_f10(struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float)))))))))));
+struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float))))))))))) func_hfa_f11(struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float))))))))))));
+struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float)))))))))))) func_hfa_f12(struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float,struct(float)))))))))))));
+
+struct(double,struct(double)) func_hfa_d2(struct(double,struct(double)));
+struct(double,struct(double,struct(double))) func_hfa_d3(struct(double,struct(double,struct(double))));
+struct(double,struct(double,struct(double,struct(double)))) func_hfa_d4(struct(double,struct(double,struct(double,struct(double)))));
+struct(double,struct(double,struct(double,struct(double,struct(double))))) func_hfa_d5(struct(double,struct(double,struct(double,struct(double,struct(double))))));
+struct(double,struct(double,struct(double,struct(double,struct(double,struct(double)))))) func_hfa_d6(struct(double,struct(double,struct(double,struct(double,struct(double,struct(double)))))));
+struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double))))))) func_hfa_d7(struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double))))))));
+struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double)))))))) func_hfa_d8(struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double)))))))));
+struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double))))))))) func_hfa_d9(struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double))))))))));
+struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double)))))))))) func_hfa_d10(struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double)))))))))));
+struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double))))))))))) func_hfa_d11(struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double))))))))))));
+struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double)))))))))))) func_hfa_d12(struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double,struct(double)))))))))))));
diff --git a/testsuite/ltrace.main/parameters.exp b/testsuite/ltrace.main/parameters.exp
index bb55e03..e54086f 100644
--- a/testsuite/ltrace.main/parameters.exp
+++ b/testsuite/ltrace.main/parameters.exp
@@ -6,7 +6,7 @@ set srcfile ${testfile}.c
set binfile ${testfile}
set libfile "parameters-lib"
set libsrc $srcdir/$subdir/$libfile.c
-set lib_sl $srcdir/$subdir/lib$testfile.so
+set lib_sl $objdir/$subdir/lib$testfile.so
if [get_compiler_info $binfile] {
@@ -15,15 +15,15 @@ if [get_compiler_info $binfile] {
verbose "compiling source file now....."
if { [ltrace_compile_shlib $libsrc $lib_sl debug ] != ""
- || [ltrace_compile $srcdir/$subdir/$srcfile $srcdir/$subdir/$binfile executable [list debug shlib=$lib_sl] ] != ""} {
+ || [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug shlib=$lib_sl] ] != ""} {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
# set options for ltrace.
-ltrace_options "-l" "$srcdir/$subdir/libparameters.so" "-F" "$srcdir/$subdir/parameters.conf"
+ltrace_options "-l" "libparameters.so" "-F" "$srcdir/$subdir/parameters.conf"
# Run PUT for ltarce.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
# Check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -35,38 +35,198 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
return
}
+set xfail_spec {"arm*-*" }
+set xfail_spec_arm {"arm*-*"}
+
# Verify the output
set pattern "func_intptr(17)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_intptr_ret(42)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_strlen(\\\"Hello world\\\") *= *11"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_arg0(\\\"Hello another world!\\\") *= *20"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_strfixed(\\\"Hell\\\")"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_ppp(80)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_stringp(\\\"Dude\\\")"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_string(\\\"zero\\\")"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_enum(BLUE)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_short(-8, -9)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_ushort(33, 34)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
-set pattern "func_float(3.40*, -3.40*)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_float(3.40*, -3.40*).*= 3.40*"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+eval "setup_xfail $xfail_spec"
+set pattern "func_double(3.40*, -3.40*).*= -3.40*"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_typedef(BLUE)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
-set pattern "func_arrayi(. 10, 11, 12, 13\\.\\.\\. ., )"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
-set pattern "func_arrayi(. 10, 11 ., )"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
-set pattern "func_arrayf(. 10.10*, 11.10*, 12.10*, 13.10*\\.\\.\\. ., )"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
-set pattern "func_arrayf(. 10.10*, 11.10* ., )"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_arrayi(. 10, 11, 12, 13\\.\\.\\. ., 8)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_arrayi(. 10, 11 ., 2)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_arrayf(. 10.10*, 11.10*, 12.10*, 13.10*\\.\\.\\. ., 8)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_arrayf(. 10.10*, 11.10* ., 2)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "exited (status 0)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_struct({ 89, 2, 3, . { 1, 10 }, { 3, 30 } ., . { 4, 40 }, { 5, 50 }, { 6, 60 } ., \\\"123\\\" })"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_call( <unfinished ...>"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_work(\\\"x\\\")"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_struct_2(17, { \\\"ABCDE\\\\\\\\0\\\", 0.250* }, 0.50*).*= { 0.250*, 'B', 'C' }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+eval "setup_xfail $xfail_spec_arm"
+set pattern "<... func_call resumed> \\\"x\\\", \\\"y\\\")"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_struct_large({ 1, 2, 3, 4 }, { 5, 6, 7, 8 }).*= { 6, 8, 10, 12 }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_struct_large2({ '0', '1', 3, 4 }, { '2', '3', 7, 8 }).*= { 'b', 'd', 10, 12 }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_struct_large3({ 3, 4, '0', '1' }, { 7, 8, '2', '3' }).*= { 10, 12, 'b', 'd' }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_many_args(1, 2, 3, 4.00*, '5', 6, 7.00*, '8', 9, 10.00*, 11, 12.00*, 'A', 14, 15, 16, 'B', 18.00*, 19.00*, 20.00*, 21, 22.00*, 23.00*, 24.00*, 25.00*)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_printf(\\\"sotnuh %d %ld %g %c.n\\\", 5, 6, 1.500*, 'X')"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_printf(\\\"sotnuh1 %d %ld %hd.n\\\", 5, 6, 7)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_printf(\\\"sotnuh2 %s %10s %10s.n\\\", \\\"a string\\\", \\\"a trimmed \\\", \\\"short\\\")"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_printf(\\\"sotnuh3 %.s.n\\\", 4, \\\"a tr\\\")"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_printf(\\\"many_args%d %d %ld %g %c %d %g .*, 1, 2, 3, 4.00*, '5', 6, 7.00*, '8', 9, 10.00*, 11, 12.00*, 'A', 14, 15, 16, 'B', 18.00*, 19.00*, 20.00*, 21, 22.00*, 23.00*, 24.00*, 25.00*)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_sprintf(nil, \\\"test %d %d %d %d.n\\\", 1, 2, 3, 4)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_lens(026, 027, 0x18, 0x19)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_bool(1, true).*= false"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_bool(2, false).*= true"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hide(2, 5, 7)"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hide_struct({ 2, 5, 7 })"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_short_enums(. A, B, A, A .).*= . A, B, A, A ."
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_negative_enum(A, A, A, A, A, A).*= A"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_charp_string(\\\"null-terminated string\\\")"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_dbl_eqv({ 2.500* }, { { 1.50* } }, { { { 0.50* } } }, { { { { -0.50* } } } }).*= { 4.00* }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_flt_eqv({ 2.500* }, { { 1.50* } }, { { { 0.50* } } }, { { { { -0.50* } } } }).*= { 4.00* }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_struct_empty({ *}).*= { *}"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_struct_size1({ '5' }).*= { '5' }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_struct_size2({ 5 }).*= { 5 }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_struct_size4({ 5 }).*= { 5 }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_struct_size8({ 5, 6 }).*= { 5, 6 }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f2({ 1.000*, { 2.000* } }).*= { 1.000*, { 2.000* } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f3({ 3.000*, { 1.000*, { 2.000* } } }).*= { 3.000*, { 1.000*, { 2.000* } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f4({ 4.000*, { 3.000*, { 1.000*, { 2.000* } } } }).*= { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f5({ 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } }).*= { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f6({ 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } }).*= { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f7({ 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } }).*= { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f8({ 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } }).*= { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f9({ 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } }).*= { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f10({ 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } }).*= { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f11({ 11.000*, { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } } }).*= { 11.000*, { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_f12({ 12.000*, { 11.000*, { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } } } }).*= { 12.000*, { 11.000*, { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d2({ 1.000*, { 2.000* } }).*= { 1.000*, { 2.000* } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d3({ 3.000*, { 1.000*, { 2.000* } } }).*= { 3.000*, { 1.000*, { 2.000* } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d4({ 4.000*, { 3.000*, { 1.000*, { 2.000* } } } }).*= { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d5({ 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } }).*= { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d6({ 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } }).*= { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d7({ 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } }).*= { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d8({ 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } }).*= { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d9({ 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } }).*= { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d10({ 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } }).*= { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d11({ 11.000*, { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } } }).*= { 11.000*, { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern "func_hfa_d12({ 12.000*, { 11.000*, { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } } } }).*= { 12.000*, { 11.000*, { 10.000*, { 9.000*, { 8.000*, { 7.000*, { 6.000*, { 5.000*, { 4.000*, { 3.000*, { 1.000*, { 2.000* } } } } } } } } } } } }"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
diff --git a/testsuite/ltrace.main/parameters2.exp b/testsuite/ltrace.main/parameters2.exp
new file mode 100644
index 0000000..8443fb6
--- /dev/null
+++ b/testsuite/ltrace.main/parameters2.exp
@@ -0,0 +1,215 @@
+# This file is part of ltrace.
+# Copyright (C) 2012 Petr Machata, Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+set trivial [ltraceCompile {} [ltraceSource c {
+ int main(void) {}
+}]]
+
+ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
+ typedef aa = int;
+ typedef aaa = int;
+ typedef bbb = struct(aa);
+}] -- $trivial] "error" == 0
+
+ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
+ typedef aa = int;
+ typedef aa = int;
+}] -- $trivial] "error" != 0
+
+ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
+ typedef aa = struct;
+ typedef aa = int;
+}] -- $trivial] "error" != 0
+
+ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
+ typedef aa = struct;
+ typedef aa = struct(int);
+ typedef aa = struct(int);
+}] -- $trivial] "error" != 0
+
+ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
+ typedef aa = struct;
+ typedef aa = struct();
+ typedef aa = struct();
+}] -- $trivial] "error" != 0
+
+ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
+ typedef aa = struct(int, struct;);
+}] -- $trivial] "error" != 0
+
+set libll [ltraceCompile libll.so [ltraceSource c {
+ struct xxx;
+ void ll(struct xxx *xxx) {}
+}]]
+
+set conf [ltraceSource conf {
+ typedef xxx = struct;
+ typedef xxx = struct(int, xxx*);
+ void ll(xxx*);
+}]
+
+ltraceMatch [ltraceRun -F $conf -e ll [ltraceCompile {} $libll [ltraceSource c {
+ struct xxx {
+ int i;
+ struct xxx *next;
+ };
+
+ void ll (struct xxx *xxx);
+ int main (int argc, char *argv[])
+ {
+ struct xxx a = { 1, 0 };
+ struct xxx b = { 2, &a };
+ struct xxx c = { 3, &b };
+ struct xxx d = { 4, &c };
+ ll (&d);
+
+ struct xxx e = { 1, 0 };
+ struct xxx f = { 2, &e };
+ e.next = &f;
+ ll (&f);
+
+ struct xxx g = { 1, &g };
+ ll (&g);
+
+ return 0;
+ }
+}]]] {
+ {{->ll\({ 4, { 3, { 2, { 1, nil } } } }\) *= <void>} == 1}
+ {{->ll\({ 2, { 1, recurse\^ } }\) *= <void>} == 1}
+ {{->ll\({ 1, recurse }\) *= <void>} == 1}
+}
+
+ltraceMatch1 [ltraceRun -F $conf -e ll -A 5 \
+-- [ltraceCompile ll $libll [ltraceSource c {
+ #include <stdlib.h>
+ struct ble {
+ int i;
+ struct ble *next;
+ };
+
+ void ll (struct ble *ble);
+ int main (int argc, char *argv[])
+ {
+ struct ble *b = NULL;
+ int i;
+ for (i = 0; i < 10; ++i) {
+ struct ble *n = malloc(sizeof(*n));
+ n->i = i;
+ n->next = b;
+ b = n;
+ }
+ ll (b);
+
+ return 0;
+ }
+}]]] {->ll\({ 9, { 8, { 7, { 6, { 5, \.\.\. } } } } }\) *= <void>} == 1
+
+proc ltraceParamTest {conf cdecl libcode maincode match {params ""}} {
+ set conffile [ltraceSource conf $conf]
+ set lib [ltraceCompile liblib.so [ltraceSource c [concat $cdecl $libcode]]]
+ set bin [ltraceCompile {} $lib \
+ [ltraceSource c \
+ [concat $cdecl "int main(void) {" $maincode "}"]]]
+
+ set command [concat "ltraceRun -F $conffile " $params "-- $bin"]
+ return [ltraceMatch [eval $command] $match]
+}
+
+# Test using lens in typedef.
+
+ltraceParamTest {
+ typedef hexptr = hex(uint*);
+ void fun(hexptr);
+} {
+ void fun(unsigned *arg);
+} {
+ void fun(unsigned *arg) {}
+} {
+ unsigned u = 0x123;
+ fun(&u);
+} {
+ {{fun\(0x123\) *= <void>} == 1}
+}
+
+# Test support for bitvec lens.
+
+ltraceParamTest {
+ void fun(bitvec(uint));
+ void fun2(bitvec(array(char, 32)*));
+} {
+ void fun(unsigned i);
+ void fun2(unsigned char *arr);
+} {
+ void fun(unsigned i) {}
+ void fun2(unsigned char *arr) {}
+} {
+ fun(0);
+ fun(0x123);
+ fun(0xfffffffe);
+ fun(0xffffffff);
+
+ unsigned char bytes[32] = {0x00};
+ bytes[1] = 0xff;
+ bytes[31] = 0x80;
+ fun2(bytes);
+} {
+ {{fun\(<>\) *= <void>} == 1}
+ {{fun\(<0-1,5,8>\) *= <void>} == 1}
+ {{fun\(~<0>\) *= <void>} == 1}
+ {{fun\(~<>\) *= <void>} == 1}
+ {{fun2\(<8-15,255>\) *= <void>} == 1}
+}
+
+# Test support for hex(float), hex(double).
+
+ltraceParamTest {
+ hex(float) hex_float(hex(float));
+ hex(double) hex_double(hex(double));
+} {
+ float hex_float(float f);
+ double hex_double(double d);
+} {
+ float hex_float(float f) { return f + 1; }
+ double hex_double(double d) { return d + 1; }
+} {
+ hex_float(1.5);
+ hex_double(1.5);
+} {
+ {{hex_float\(0x1.8p\+0\) *= 0x1.4p\+1} == 1}
+ {{hex_double\(0x1.8p\+0\) *= 0x1.4p\+1} == 1}
+}
+
+# Test that -x fun can find "fun" prototype even if "fun" is in a
+# library.
+
+ltraceParamTest {
+ void fun();
+} {
+ void libfun(void);
+} {
+ void fun(void) {}
+ void libfun(void) { fun(); }
+} {
+ libfun();
+} {
+ {{fun@.*\(\)} == 1}
+} {
+ -L -x fun
+}
+
+ltraceDone
diff --git a/testsuite/ltrace.main/signals.exp b/testsuite/ltrace.main/signals.exp
index f0708e9..d812af6 100644
--- a/testsuite/ltrace.main/signals.exp
+++ b/testsuite/ltrace.main/signals.exp
@@ -7,7 +7,7 @@ set binfile ${testfile}
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail\n."
}
@@ -15,7 +15,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
ltrace_options "-L"
# Run PUT for ltarce.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
# Check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -36,4 +36,4 @@ close $fd
# Verify the output of ltrace by checking the number of SIGUSR1 in signal.ltrace
set pattern "SIGUSR1"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern $count
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern $count
diff --git a/testsuite/ltrace.main/system_calls.exp b/testsuite/ltrace.main/system_calls.exp
index b274db5..259ae25 100644
--- a/testsuite/ltrace.main/system_calls.exp
+++ b/testsuite/ltrace.main/system_calls.exp
@@ -7,7 +7,7 @@ set binfile ${testfile}
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
@@ -15,7 +15,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
ltrace_options "-S"
#Run PUT for ltarce.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
#check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -30,38 +30,38 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
set pattern "SYS_munmap"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 2
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 2
set pattern "SYS_write"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_unlink"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_brk"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_open"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
-set pattern "SYS_fstat"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
-set pattern "SYS_mmap"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "SYS_(new)?fstat"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1 egrep
+set pattern "SYS_(old_)?mmap"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1 egrep
set pattern "SYS_close"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_getcwd"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_chdir"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_symlink"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_unlink"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
-set pattern "SYS_stat"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "SYS_(new)?stat"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1 egrep
set pattern "SYS_access"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_rename"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_mkdir"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "SYS_rmdir"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
diff --git a/testsuite/ltrace.minor/Makefile.am b/testsuite/ltrace.minor/Makefile.am
new file mode 100644
index 0000000..af6cfde
--- /dev/null
+++ b/testsuite/ltrace.minor/Makefile.am
@@ -0,0 +1,46 @@
+# Copyright (C) 1992 - 2001, 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 1, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+EXTRA_DIST = \
+ attach-process.exp \
+ count-record.c \
+ count-record.exp \
+ demangle.cpp \
+ demangle.exp \
+ demangle.h \
+ demangle-lib.cpp \
+ libdl-simple.c \
+ libdl-simple.exp \
+ libdl-simple-lib.c \
+ print-instruction-pointer.c \
+ print-instruction-pointer.exp \
+ time-record.c \
+ time-record-T.exp \
+ time-record-tt.exp \
+ time-record-ttt.exp \
+ trace-clone.c \
+ trace-clone.exp \
+ trace-exec.exp \
+ trace-fork.c \
+ trace-fork.exp
+
+CLEANFILES = *.o *.so *.log *.sum *.ltrace setval.tmp \
+ attach-process count-record demangle print-instruction-pointer \
+ time-record-T time-record-tt time-record-ttt trace-clone \
+ trace-exec trace-exec1 trace-fork libdl-simple
+
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/testsuite/ltrace.minor/Makefile.in b/testsuite/ltrace.minor/Makefile.in
new file mode 100644
index 0000000..e6d7c03
--- /dev/null
+++ b/testsuite/ltrace.minor/Makefile.in
@@ -0,0 +1,415 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright (C) 1992 - 2001, 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 1, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = testsuite/ltrace.minor
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/libtool.m4 \
+ $(top_srcdir)/config/m4/ltoptions.m4 \
+ $(top_srcdir)/config/m4/ltsugar.m4 \
+ $(top_srcdir)/config/m4/ltversion.m4 \
+ $(top_srcdir)/config/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_VALGRIND = @HAVE_VALGRIND@
+HOST_CPU = @HOST_CPU@
+HOST_OS = @HOST_OS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libelf_LD_LIBRARY_PATH = @libelf_LD_LIBRARY_PATH@
+liberty_LIBS = @liberty_LIBS@
+libexecdir = @libexecdir@
+libstdcxx_LIBS = @libstdcxx_LIBS@
+libsupcxx_LIBS = @libsupcxx_LIBS@
+libunwind_LD_LIBRARY_PATH = @libunwind_LD_LIBRARY_PATH@
+libunwind_LIBS = @libunwind_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = \
+ attach-process.exp \
+ count-record.c \
+ count-record.exp \
+ demangle.cpp \
+ demangle.exp \
+ demangle.h \
+ demangle-lib.cpp \
+ libdl-simple.c \
+ libdl-simple.exp \
+ libdl-simple-lib.c \
+ print-instruction-pointer.c \
+ print-instruction-pointer.exp \
+ time-record.c \
+ time-record-T.exp \
+ time-record-tt.exp \
+ time-record-ttt.exp \
+ trace-clone.c \
+ trace-clone.exp \
+ trace-exec.exp \
+ trace-fork.c \
+ trace-fork.exp
+
+CLEANFILES = *.o *.so *.log *.sum *.ltrace setval.tmp \
+ attach-process count-record demangle print-instruction-pointer \
+ time-record-T time-record-tt time-record-ttt trace-clone \
+ trace-exec trace-exec1 trace-fork libdl-simple
+
+MAINTAINERCLEANFILES = Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/ltrace.minor/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign testsuite/ltrace.minor/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testsuite/ltrace.minor/attach-process.c b/testsuite/ltrace.minor/attach-process.c
deleted file mode 100644
index 4c00bce..0000000
--- a/testsuite/ltrace.minor/attach-process.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Ltrace Test : attach-process.c.
- Objectives : Verify that ltrace can attach to a running process
- by its PID.
-
- This file was written by Yao Qi <qiyao@cn.ibm.com>. */
-
-#include<unistd.h>
-#include <sys/types.h>
-
-int
-main ()
-{
- sleep (5);
- sleep (1);
- return 0;
-}
diff --git a/testsuite/ltrace.minor/attach-process.exp b/testsuite/ltrace.minor/attach-process.exp
index ab5460e..2c7d20c 100644
--- a/testsuite/ltrace.minor/attach-process.exp
+++ b/testsuite/ltrace.minor/attach-process.exp
@@ -1,38 +1,29 @@
-# This file was written by Yao Qi <qiyao@cn.ibm.com>.
-
-set testfile "attach-process"
-set srcfile ${testfile}.c
-set binfile ${testfile}
-
-verbose "compiling source file now....."
-# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
- send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
-}
-
-# Run the program and get PID of it.
-catch "exec $srcdir/$subdir/$binfile &" output
-
-# get PID from ps output.
-regexp {([0-9]+)} $output match PID
-verbose "PID = $PID"
-
-# Run PUT for ltrace.
-global LTRACE
-catch "exec $LTRACE -S -p $PID -o ${srcdir}/${subdir}/${testfile}.ltrace" exec_output
-
-# Check the output of this program.
-verbose "ltrace runtest output: $exec_output\n"
-if [regexp {ELF from incompatible architecture} $exec_output] {
- fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
- return
-} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
- fail "Couldn't get .hash data!"
- return
-}
-
-# Verify the output in attach-process.ltrace by checking the number
-# of sleep.
-set pattern "sleep"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
-
+# This file is part of ltrace.
+# Copyright (C) 2012 Petr Machata, Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+set bin [ltraceCompile {} [ltraceSource c {
+ #include <unistd.h>
+ int main(void) {
+ sleep(5);
+ sleep(1);
+ }
+}]]
+
+spawn $bin
+ltraceMatch1 [ltraceRun -S -p [exp_pid]] { sleep\(} == 1
+ltraceDone
diff --git a/testsuite/ltrace.minor/count-record.exp b/testsuite/ltrace.minor/count-record.exp
index f8c4923..fe96b4c 100644
--- a/testsuite/ltrace.minor/count-record.exp
+++ b/testsuite/ltrace.minor/count-record.exp
@@ -6,7 +6,7 @@ set binfile ${testfile}
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
@@ -14,7 +14,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
ltrace_options "-c"
# Run PUT for ltrace.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
# Check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -26,9 +26,6 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
return
}
-
-ltrace_saveoutput $exec_output $srcdir/$subdir/$binfile.ltrace
-
#
# This is a sample output and Verify the forth and fifth column.
#
@@ -49,29 +46,29 @@ ltrace_saveoutput $exec_output $srcdir/$subdir/$binfile.ltrace
#
set pattern " 1 rmdir"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 fopen"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 2 remove"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 mkdir"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 fseek"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 fwrite"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 fclose"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 rename"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 symlink"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 chdir"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 access"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 getcwd"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
set pattern " 1 fread"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern
diff --git a/testsuite/ltrace.minor/demangle-lib.cpp b/testsuite/ltrace.minor/demangle-lib.cpp
index 01ab18d..3091f31 100644
--- a/testsuite/ltrace.minor/demangle-lib.cpp
+++ b/testsuite/ltrace.minor/demangle-lib.cpp
@@ -1,6 +1,6 @@
#include<stddef.h>
#include<iostream>
-
+#include<cstdlib>
#include"demangle.h"
/* Number of arguments */
diff --git a/testsuite/ltrace.minor/demangle.exp b/testsuite/ltrace.minor/demangle.exp
index 5077ac0..9dd7694 100644
--- a/testsuite/ltrace.minor/demangle.exp
+++ b/testsuite/ltrace.minor/demangle.exp
@@ -5,7 +5,7 @@ set srcfile ${testfile}.cpp
set binfile ${testfile}
set libfile "demangle-lib"
set libsrc $srcdir/$subdir/$libfile.cpp
-set lib_sl $srcdir/$subdir/lib$testfile.so
+set lib_sl $objdir/$subdir/lib$testfile.so
verbose "compiling source file now....."
if [get_compiler_info $binfile "c++"] {
@@ -14,7 +14,7 @@ if [get_compiler_info $binfile "c++"] {
verbose "compiling source file now....."
if { [ltrace_compile_shlib $libsrc $lib_sl [list debug c++]] != ""
- || [ltrace_compile $srcdir/$subdir/$srcfile $srcdir/$subdir/$binfile executable [list debug shlib=$lib_sl c++] ] != ""} {
+ || [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug shlib=$lib_sl c++] ] != ""} {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
@@ -22,7 +22,7 @@ if { [ltrace_compile_shlib $libsrc $lib_sl [list debug c++]] != ""
ltrace_options "-C"
# Run PUT for ltrace.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
# Check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -32,13 +32,16 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
fail "Couldn't get .hash data!"
return
+} elseif [ regexp {invalid option} $exec_output ] {
+ unsupported "Demangle support not compiled in."
+ return
}
# read function declarations from demangle.cpp and verify them in demangle.ltrace.
set fd [ open $srcdir/$subdir/$srcfile r]
while { [gets $fd line] >= 0 } {
if [regexp {extern (double|float|void|char|int|short|long|void \*|void \*\*) ([^ ])\(} $line match type fun] {
- ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $fun
+ ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $fun
}
}
close $fd
@@ -53,10 +56,10 @@ while { [gets $fd line] >= 0 } {
# $fun = "myclass::operator delete" will confuse ltrace_verify_output if it
# was an argument to it.
if [regexp {(new|delete)} $fun match sub_fun] {
- ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $sub_fun
+ ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $sub_fun
} else {
# Verify class member functions without SPACE.
- ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $fun
+ ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $fun
}
}
}
diff --git a/testsuite/ltrace.minor/libdl-simple-lib.c b/testsuite/ltrace.minor/libdl-simple-lib.c
new file mode 100644
index 0000000..6340d9d
--- /dev/null
+++ b/testsuite/ltrace.minor/libdl-simple-lib.c
@@ -0,0 +1,4 @@
+int test_libdl(int x)
+{
+ return x * 1337;
+}
diff --git a/testsuite/ltrace.minor/libdl-simple.c b/testsuite/ltrace.minor/libdl-simple.c
new file mode 100644
index 0000000..0bef5cf
--- /dev/null
+++ b/testsuite/ltrace.minor/libdl-simple.c
@@ -0,0 +1,24 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+
+int main(int argc, char **argv) {
+ void *handle;
+ int (*test)(int);
+ char *error;
+
+ handle = dlopen ("liblibdl-simple.so", RTLD_LAZY);
+ if (!handle) {
+ fputs (dlerror(), stderr);
+ exit(1);
+ }
+
+ test = dlsym(handle, "test_libdl");
+ if ((error = dlerror()) != NULL) {
+ fputs(error, stderr);
+ exit(1);
+ }
+
+ printf("%d\n", test(5));
+ dlclose(handle);
+}
diff --git a/testsuite/ltrace.minor/libdl-simple.exp b/testsuite/ltrace.minor/libdl-simple.exp
new file mode 100644
index 0000000..bb1b826
--- /dev/null
+++ b/testsuite/ltrace.minor/libdl-simple.exp
@@ -0,0 +1,36 @@
+set testfile "libdl-simple"
+set srcfile ${testfile}.c
+set binfile ${testfile}
+set libfile "libdl-simple-lib"
+set libsrc $srcdir/$subdir/$libfile.c
+set lib_sl $objdir/$subdir/lib$testfile.so
+
+verbose "compiling source file now....."
+if [get_compiler_info $binfile ""] {
+ return -1
+}
+
+# Build the shared libraries this test case needs.
+if { [ltrace_compile_shlib $libsrc $lib_sl [debug]] != ""
+ || [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug shlib=-ldl} ] != "" } {
+ send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
+}
+
+# set options for ltrace.
+ltrace_options "-x" "test_libdl"
+
+# Run PUT for ltrace.
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
+verbose "ltrace runtest output: $exec_output\n"
+
+# Check the output of this program.
+if [regexp {ELF from incompatible architecture} $exec_output] {
+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
+ return
+} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
+ fail "Couldn't get .hash data!"
+ return
+}
+
+set pattern "test_libdl@liblibdl-simple.so"
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
diff --git a/testsuite/ltrace.minor/print-instruction-pointer.exp b/testsuite/ltrace.minor/print-instruction-pointer.exp
index 87cc8f7..039e906 100644
--- a/testsuite/ltrace.minor/print-instruction-pointer.exp
+++ b/testsuite/ltrace.minor/print-instruction-pointer.exp
@@ -7,14 +7,14 @@ set binfile ${testfile}
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ltrace_compile "${srcdir}/${subdir}/${srcfile}" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ltrace_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
# set options for ltrace.
ltrace_options "-i"
# Run PUT for ltrace.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
# Check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -27,7 +27,7 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
}
# Get the addrss by objdump and sed.
-catch "exec sh -c {objdump -d $srcdir/$subdir/$binfile | sed -n '/^\[0-9a-fA-F\]\[0-9a-fA-F\]* <main>/,/^\[0-9a-fA-F\]\[0-9a-fA-F\]* </p'| grep -A 1 'call\\|bl' }" output
+catch "exec sh -c {objdump -d $objdir/$subdir/$binfile | sed -n '/^\[0-9a-fA-F\]\[0-9a-fA-F\]* <main>/,/^\[0-9a-fA-F\]\[0-9a-fA-F\]* </p'| grep -A 1 'call\\|bl' }" output
#verbose "output=$output"
catch "exec sh -c {echo \"$output\" | sed -n '2p'| awk -F' ' '{print \$1}'|awk -F: '{print \$1}'}" addr1
catch "exec sh -c {echo \"$output\" | sed -n '5p'| awk -F' ' '{print \$1}'|awk -F: '{print \$1}'}" addr2
@@ -36,7 +36,7 @@ verbose "addr1 = $addr1"
verbose "addr2 = $addr2"
# Verify the output by checking numbers of print in main.ltrace.
set pattern "$addr1.*printf"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "$addr2.*printf"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
diff --git a/testsuite/ltrace.minor/time-record-T.exp b/testsuite/ltrace.minor/time-record-T.exp
index b411add..fc9a555 100644
--- a/testsuite/ltrace.minor/time-record-T.exp
+++ b/testsuite/ltrace.minor/time-record-T.exp
@@ -6,7 +6,7 @@ set binfile ${testfile}-T
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
@@ -14,7 +14,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
ltrace_options "-T"
# Run PUT for ltrace.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
verbose "ltrace runtest output: $exec_output\n"
# Check the output of this program.
@@ -37,7 +37,7 @@ close $fd
# Verify the time for calling sleep.
-set fd [ open $srcdir/$subdir/$binfile.ltrace r]
+set fd [ open $objdir/$subdir/$binfile.ltrace r]
set FOUND 0
while { [gets $fd line] >= 0 } {
# match the line with sleep and extract the spent time in sleep and sleep argument.
@@ -61,7 +61,7 @@ if {$FOUND != 1} then {
# Verify the time for calling nanosleep.
set FOUND 0
-set fd [ open $srcdir/$subdir/$binfile.ltrace r]
+set fd [ open $objdir/$subdir/$binfile.ltrace r]
while { [gets $fd line] >= 0 } {
# match the line with nanosleep and extract spent time and nanosleep argument.
if [ regexp {nanosleep.*<([0-9]+\.[0-9]+)>} $line match usec] then {
diff --git a/testsuite/ltrace.minor/time-record-tt.exp b/testsuite/ltrace.minor/time-record-tt.exp
index 332704a..6094164 100644
--- a/testsuite/ltrace.minor/time-record-tt.exp
+++ b/testsuite/ltrace.minor/time-record-tt.exp
@@ -6,7 +6,7 @@ set binfile ${testfile}-tt
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
@@ -14,7 +14,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
ltrace_options "-tt"
# Run PUT for ltrace.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
# Check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -27,7 +27,7 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
}
# Verify the time for calling sleep.
-set fd [ open $srcdir/$subdir/$binfile.ltrace r]
+set fd [ open $objdir/$subdir/$binfile.ltrace r]
set FOUND 0
while { [gets $fd line] >= 0 } {
# match the line with sleep and extract the strat time and sleep argument.
@@ -72,7 +72,7 @@ close $fd
# Verify the time for calling nanosleep.
set FOUND 0
-set fd [ open $srcdir/$subdir/$binfile.ltrace r]
+set fd [ open $objdir/$subdir/$binfile.ltrace r]
while { [gets $fd line] >= 0 } {
# match the line with sleep and extract the strat time and sleep argument.
if [ regexp {[0-9]+:[0-9]+:([0-9]+)\.([0-9][0-9][0-9]).* nanosleep} $line match start_sec start_usec ] then {
diff --git a/testsuite/ltrace.minor/time-record-ttt.exp b/testsuite/ltrace.minor/time-record-ttt.exp
index 2aee9d3..4271d0b 100644
--- a/testsuite/ltrace.minor/time-record-ttt.exp
+++ b/testsuite/ltrace.minor/time-record-ttt.exp
@@ -6,7 +6,7 @@ set binfile ${testfile}-ttt
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
@@ -14,7 +14,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
ltrace_options "-ttt"
# Run PUT for ltrace.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
# Check the output of this program.
@@ -28,7 +28,7 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
}
# Verify the time for calling sleep.
-set fd [ open $srcdir/$subdir/$binfile.ltrace r]
+set fd [ open $objdir/$subdir/$binfile.ltrace r]
set FOUND 0
while { [gets $fd line] >= 0 } {
# match the line with sleep and extract the strat time and sleep argument.
@@ -76,7 +76,7 @@ close $fd
# Verify the time for calling nanosleep.
set FOUND 0
-set fd [ open $srcdir/$subdir/$binfile.ltrace r]
+set fd [ open $objdir/$subdir/$binfile.ltrace r]
while { [gets $fd line] >= 0 } {
# match the line with sleep and extract the strat time and sleep argument.
if [ regexp {([0-9]+)\.([0-9][0-9][0-9]).* nanosleep} $line match start_sec start_usec ] then {
diff --git a/testsuite/ltrace.minor/trace-clone.c b/testsuite/ltrace.minor/trace-clone.c
index a1ccb22..db1936d 100644
--- a/testsuite/ltrace.minor/trace-clone.c
+++ b/testsuite/ltrace.minor/trace-clone.c
@@ -3,7 +3,7 @@
clone called.
This file was written by Yao Qi <qiyao@cn.ibm.com>. */
-
+#define _GNU_SOURCE
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
diff --git a/testsuite/ltrace.minor/trace-clone.exp b/testsuite/ltrace.minor/trace-clone.exp
index bda036f..3d0c8fe 100644
--- a/testsuite/ltrace.minor/trace-clone.exp
+++ b/testsuite/ltrace.minor/trace-clone.exp
@@ -7,22 +7,12 @@ set binfile ${testfile}
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
-global LTRACE
-#Run PUT for ltrace.
-spawn $LTRACE -f $srcdir/$subdir/$binfile
-set timeout 4
-expect timeout {
- fail "Time out! Maybe caused by ltrace segment fault or improper timeout value here!"
- return
-}
-
-catch "exec $LTRACE -f $srcdir/$subdir/$binfile" exec_output
-# Save the output
-ltrace_saveoutput "${exec_output}" ${srcdir}/${subdir}/${testfile}.ltrace
+ltrace_options "-f"
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
#check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -40,5 +30,5 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
set pattern "clone"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
diff --git a/testsuite/ltrace.minor/trace-exec.c b/testsuite/ltrace.minor/trace-exec.c
deleted file mode 100644
index e798cde..0000000
--- a/testsuite/ltrace.minor/trace-exec.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <unistd.h>
-#include <stdlib.h>
-
-int main (int argc, char ** argv)
-{
- execl (argv[1], argv[1], NULL);
- abort ();
-}
diff --git a/testsuite/ltrace.minor/trace-exec.exp b/testsuite/ltrace.minor/trace-exec.exp
index c9de6f3..7a953de 100644
--- a/testsuite/ltrace.minor/trace-exec.exp
+++ b/testsuite/ltrace.minor/trace-exec.exp
@@ -1,45 +1,37 @@
-set testfile "trace-exec"
-set srcfile ${testfile}.c
-set binfile ${testfile}
-
-verbose "compiling first source file now....."
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
- send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
-}
-
-verbose "compiling second source file now....."
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}1.c" "${srcdir}/${subdir}/${binfile}1" executable {debug} ] != "" } {
- send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
-}
-
-global LTRACE
-set exec_output ""
-
-#Run PUT for ltrace.
-spawn $LTRACE $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1
-set timeout 4
-expect timeout {
- fail "Time out! Maybe caused by ltrace segment fault or improper timeout value here!"
- return
+# This file is part of ltrace.
+# Copyright (C) 2012 Petr Machata, Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+ltraceMatch [ltraceRun -xmain -- [ltraceCompile {} [ltraceSource c {
+ #include <unistd.h>
+ #include <stdlib.h>
+ int main(int argc, char ** argv) {
+ execl(argv[1], argv[1], NULL);
+ abort();
+ }
+}]] [ltraceCompile {} [ltraceSource c {
+ #include <stdio.h>
+ int main(void) {
+ return puts("Hello, World.");
+ }
+}]]] {
+ {{^execl\(} == 1}
+ {{^puts\(.*\) .*= 14} == 1}
+ {{^main\(} == 2}
}
-catch "exec $LTRACE $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1" exec_output
-
-#check the output of this program.
-verbose "ltrace runtest output: $exec_output\n"
-if [regexp {ELF from incompatible architecture} $exec_output] {
- fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
- return
-} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
- fail "Couldn't get .hash data!"
- return
-}
-
-ltrace_saveoutput "${exec_output}" ${srcdir}/${subdir}/${testfile}.ltrace
-
-# execl from first binary
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace {"^execl"} 1
-# puts from second binary
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace {"^puts"} 1
-# assume glibc and see we really trace both binaries
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace {"^__libc_start_main"} 2
+ltraceDone
diff --git a/testsuite/ltrace.minor/trace-exec1.c b/testsuite/ltrace.minor/trace-exec1.c
deleted file mode 100644
index e234fa0..0000000
--- a/testsuite/ltrace.minor/trace-exec1.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdio.h>
-int main (void)
-{
- puts("Hello, World.");
- return 0;
-}
diff --git a/testsuite/ltrace.minor/trace-fork.c b/testsuite/ltrace.minor/trace-fork.c
index a2d8a56..c5f0c71 100644
--- a/testsuite/ltrace.minor/trace-fork.c
+++ b/testsuite/ltrace.minor/trace-fork.c
@@ -21,7 +21,7 @@ main ()
pid = fork ();
if (pid == -1)
- printf("fork failed!\n");
+ puts("fork failed!");
else if (pid == 0)
child();
else
diff --git a/testsuite/ltrace.minor/trace-fork.exp b/testsuite/ltrace.minor/trace-fork.exp
index 5f30061..70815f5 100644
--- a/testsuite/ltrace.minor/trace-fork.exp
+++ b/testsuite/ltrace.minor/trace-fork.exp
@@ -7,21 +7,12 @@ set binfile ${testfile}
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
}
-global LTRACE
-set exec_output ""
-
-#Run PUT for ltrace.
-spawn $LTRACE -f $srcdir/$subdir/$binfile
-set timeout 4
-expect timeout {
- fail "Time out! Maybe caused by ltrace segment fault or improper timeout value here!"
- return
-}
-catch "exec $LTRACE -f $srcdir/$subdir/$binfile" exec_output
+ltrace_options "-f"
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
#check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -33,8 +24,22 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
return
}
-ltrace_saveoutput "${exec_output}" ${srcdir}/${subdir}/${testfile}.ltrace
+if [ regexp {Cannot attach} $exec_output ] {
+ fail "Couldn't attach to forked process!"
+ return
+}
+
+set pattern {^[0-9]* fork}
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern {^[0-9]* printf}
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+
+set pattern {^[0-9]* puts}
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
-set pattern "fork"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern {^[0-9]* wait}
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern {^[0-9]* sleep}
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
diff --git a/testsuite/ltrace.torture/Makefile b/testsuite/ltrace.torture/Makefile.am
index bb4baa0..daa772f 100644
--- a/testsuite/ltrace.torture/Makefile
+++ b/testsuite/ltrace.torture/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 1992 - 2001 Free Software Foundation, Inc.
+# Copyright (C) 1992 - 2001, 2012 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,19 +15,17 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
-CLEANFILES = *.log *.sum site.bak setval.tmp site.exp
+EXTRA_DIST = \
+ ia64-sigill.exp \
+ ia64-sigill.s \
+ ppc-lwarx.c \
+ ppc-lwarx.exp \
+ signals.c \
+ signals.exp \
+ vfork-thread.c \
+ vfork-thread.exp
-.SUFFIXES:
-clean:
- -rm -f signals
- -rm -f *.o *.so
- -rm -f *.ltrace
- -rm -f $(CLEANFILES)
-distclean: clean
+CLEANFILES = *.o *.so *.log *.sum *.ltrace setval.tmp \
+ signals
-
-.PHONY: $(RECURSIVE_TARGETS) check clean distclean realclean
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/testsuite/ltrace.torture/Makefile.in b/testsuite/ltrace.torture/Makefile.in
new file mode 100644
index 0000000..b0ff505
--- /dev/null
+++ b/testsuite/ltrace.torture/Makefile.in
@@ -0,0 +1,400 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright (C) 1992 - 2001, 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 1, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = testsuite/ltrace.torture
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/libtool.m4 \
+ $(top_srcdir)/config/m4/ltoptions.m4 \
+ $(top_srcdir)/config/m4/ltsugar.m4 \
+ $(top_srcdir)/config/m4/ltversion.m4 \
+ $(top_srcdir)/config/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_VALGRIND = @HAVE_VALGRIND@
+HOST_CPU = @HOST_CPU@
+HOST_OS = @HOST_OS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libelf_LD_LIBRARY_PATH = @libelf_LD_LIBRARY_PATH@
+liberty_LIBS = @liberty_LIBS@
+libexecdir = @libexecdir@
+libstdcxx_LIBS = @libstdcxx_LIBS@
+libsupcxx_LIBS = @libsupcxx_LIBS@
+libunwind_LD_LIBRARY_PATH = @libunwind_LD_LIBRARY_PATH@
+libunwind_LIBS = @libunwind_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = \
+ ia64-sigill.exp \
+ ia64-sigill.s \
+ ppc-lwarx.c \
+ ppc-lwarx.exp \
+ signals.c \
+ signals.exp \
+ vfork-thread.c \
+ vfork-thread.exp
+
+CLEANFILES = *.o *.so *.log *.sum *.ltrace setval.tmp \
+ signals
+
+MAINTAINERCLEANFILES = Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/ltrace.torture/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign testsuite/ltrace.torture/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testsuite/ltrace.torture/ppc-lwarx.c b/testsuite/ltrace.torture/ppc-lwarx.c
new file mode 100644
index 0000000..0716407
--- /dev/null
+++ b/testsuite/ltrace.torture/ppc-lwarx.c
@@ -0,0 +1,44 @@
+/*
+ * This file is part of ltrace.
+ * Copyright (C) 2012 Petr Machata, Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <stdint.h>
+
+__attribute__((noinline, optimize(3))) void
+atomic_add(uint32_t *a, uint32_t b)
+{
+ __asm__ volatile("lwarx 9,0,%0\n"
+ "add 9,9,%2\n"
+ "stwcx. 9,0,%0\n"
+ "bne- atomic_add\n"
+ : "=r"(a)
+ : "0"(a), "r"(b)
+ : "%r9");
+}
+
+uint32_t a = 0;
+
+__attribute__((optimize(0))) int
+main(int argc, char **argv)
+{
+ atomic_add(&a, 5);
+ atomic_add(&a, 10);
+ atomic_add(&a, 15);
+ return a;
+}
diff --git a/testsuite/ltrace.torture/ppc-lwarx.exp b/testsuite/ltrace.torture/ppc-lwarx.exp
new file mode 100644
index 0000000..bc2eba4
--- /dev/null
+++ b/testsuite/ltrace.torture/ppc-lwarx.exp
@@ -0,0 +1,55 @@
+# This file is part of ltrace.
+# Copyright (C) 2012 Petr Machata, Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+set testfile "ppc-lwarx"
+set srcfile ${testfile}.c
+set binfile ${testfile}
+
+if [get_compiler_info $binfile] {
+ return -1
+}
+
+if { [istarget powerpc*-*] } then {
+ verbose "compiling source file now....."
+ if { [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable {debug} ] != "" } {
+ send_user "Testcase compile failed, so all tests in this file will automatically fail\n."
+ }
+
+ # set options for ltrace.
+ ltrace_options "-x" "atomic_add" "-e" "!atoi"
+
+ # Run PUT for ltarce.
+ set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
+
+ # Check the output of this program.
+ verbose "ltrace runtest output: $exec_output\n"
+ if [regexp {ELF from incompatible architecture} $exec_output] {
+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
+ return
+ } elseif [ regexp {Couldn't get .hash data} $exec_output ] {
+ fail "Couldn't get .hash data!"
+ return
+ }
+
+ set pattern "atomic_add(.*, 5,.*)"
+ ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+ set pattern "atomic_add(.*, 10,.*)"
+ ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+ set pattern "atomic_add(.*, 15,.*)"
+ ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
+}
diff --git a/testsuite/ltrace.torture/signals.c b/testsuite/ltrace.torture/signals.c
index 439aba1..b786c81 100644
--- a/testsuite/ltrace.torture/signals.c
+++ b/testsuite/ltrace.torture/signals.c
@@ -23,7 +23,7 @@ main ()
pid_t pid;
mysigval.sival_int=0;
- sig = 10;
+ sig = SIGUSR1;
pid=getpid();
sigemptyset(&act.sa_mask);
diff --git a/testsuite/ltrace.torture/signals.exp b/testsuite/ltrace.torture/signals.exp
index 56a2ec9..bf10bc9 100644
--- a/testsuite/ltrace.torture/signals.exp
+++ b/testsuite/ltrace.torture/signals.exp
@@ -7,7 +7,7 @@ set binfile ${testfile}
verbose "compiling source file now....."
# Build the shared libraries this test case needs.
-if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable {debug} ] != "" } {
send_user "Testcase compile failed, so all tests in this file will automatically fail\n."
}
@@ -15,7 +15,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
ltrace_options "-L"
# Run PUT for ltarce.
-set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
# Check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
@@ -33,5 +33,5 @@ while { [gets $fd line] >= 0 } {
regexp {define LOOP.*([0-9]+)} $line match count
}
set pattern "SIGUSR1"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern $count
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern $count
diff --git a/testsuite/ltrace.torture/vfork-thread.c b/testsuite/ltrace.torture/vfork-thread.c
new file mode 100644
index 0000000..f909bd3
--- /dev/null
+++ b/testsuite/ltrace.torture/vfork-thread.c
@@ -0,0 +1,50 @@
+#include <pthread.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <stdio.h>
+
+
+void *
+routine (void *data)
+{
+ int i;
+ for (i = 0; i < 6; ++i)
+ {
+ puts ("bleble");
+ sleep (1);
+ }
+}
+
+
+void *
+routine2 (void *data)
+{
+ pid_t child = vfork ();
+ if (child == 0)
+ {
+ int i, j;
+ puts ("vforked");
+ for (i = 0; i < 100000; ++i)
+ for (j = 0; j < 10000; ++j)
+ ;
+ puts ("vforked child exiting");
+ _exit (0);
+ }
+ puts ("parent continuing");
+ return NULL;
+}
+
+int
+main(int argc, char *argv[])
+{
+ pthread_t thread;
+ pthread_create (&thread, NULL, &routine, NULL);
+
+ sleep (1);
+
+ pthread_t thread2;
+ pthread_create (&thread2, NULL, &routine2, NULL);
+ pthread_join (thread2, NULL);
+ pthread_join (thread, NULL);
+ return 0;
+}
diff --git a/testsuite/ltrace.torture/vfork-thread.exp b/testsuite/ltrace.torture/vfork-thread.exp
new file mode 100644
index 0000000..bd01319
--- /dev/null
+++ b/testsuite/ltrace.torture/vfork-thread.exp
@@ -0,0 +1,32 @@
+# This file was written by Yao Qi <qiyao@cn.ibm.com>.
+
+set testfile "vfork-thread"
+set srcfile ${testfile}.c
+set binfile ${testfile}
+
+
+verbose "compiling source file now....."
+# Build the shared libraries this test case needs.
+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${objdir}/${subdir}/${binfile}" executable [list debug ldflags=-pthread] ] != "" } {
+ send_user "Testcase compile failed, so all tests in this file will automatically fail\n."
+}
+
+ltrace_options "-f"
+
+# Run PUT for ltarce.
+set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
+
+# Check the output of this program.
+verbose "ltrace runtest output: $exec_output\n"
+if [regexp {ELF from incompatible architecture} $exec_output] {
+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
+ return
+} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
+ fail "Couldn't get .hash data!"
+ return
+}
+
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace "puts" 9
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace "sleep" 7
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace "vfork resumed" 2
+ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace "_exit" 1