Add a dyninst-testsuite package.

- Patch test2_4 to protect against running as root.
- Make dyninst-static require dyninst-devel.
This commit is contained in:
Josh Stone 2013-02-25 14:47:18 -08:00
parent 0892d34abc
commit 4d44e8495d
3 changed files with 359 additions and 6 deletions

View File

@ -0,0 +1,291 @@
commit 9987bb065a6949fa6a61982b90b102052a0b71a0
Author: Josh Stone <jistone@redhat.com>
Date: Mon Feb 25 12:28:59 2013 -0800
Hack the testsuite into shape for installation
* make.components: Fix a findstring call which block parseThat.
* parseThat/Makefile.in: Respect DESTDIR.
* testsuite/make.module.tmpl: Forgo rpath, and install all targets.
* testsuite/src/runTests-utils.C (setupVars): Don't complain about the
scripts dir, as it's not actually needed anyway.
* testsuite/src/test_driver.C(updateSearchPaths): fix a strcat->strcpy.
(getRTLibDir): Hack out the builddir path, and just use ../
* testsuite/src/dyninst/test1_18F_fortran.F: Backport a fix from master.
diff --git a/make.components b/make.components
index 159a44a..17f41c5 100644
--- a/make.components
+++ b/make.components
@@ -86,7 +86,7 @@ endif # StackwalkerAPI
endif # SymtabAPI
endif # default
-ifeq (findstring(dyninstAPI,$(fullSystem)),dyninstAPI)
+ifeq ($(findstring dyninstAPI,$(fullSystem)),dyninstAPI)
BUILD_PARSETHAT ?= true
endif
diff --git a/parseThat/Makefile.in b/parseThat/Makefile.in
index 6226a35..1dd1e08 100644
--- a/parseThat/Makefile.in
+++ b/parseThat/Makefile.in
@@ -23,6 +23,10 @@ vpath % @srcdir@/src
# -------------------------------------------
.PHONY: clean ready
+ifdef DESTDIR
+prefix := $(DESTDIR)$(prefix)
+endif
+
SRCS = parseThat.C \
config.C \
ipc.C \
diff --git a/testsuite/make.module.tmpl b/testsuite/make.module.tmpl
index fc03503..21d8da8 100644
--- a/testsuite/make.module.tmpl
+++ b/testsuite/make.module.tmpl
@@ -225,7 +225,7 @@ proccontrol_COMPONENT_LIB = $(LIBPROCCONTROLCOMP)
SPACE :=
SPACE +=
#COMPONENT_LDFLAGS += $(subst $(SPACE),,-Wl,--enable-new-dtags$(ALL_COMP_DIRS:%=,-rpath,%))
-COMPONENT_LDFLAGS += $(subst $(SPACE),,-Wl$(ALL_COMP_DIRS:%=,-rpath,%))
+#COMPONENT_LDFLAGS += $(subst $(SPACE),,-Wl$(ALL_COMP_DIRS:%=,-rpath,%))
all: default
@@ -244,8 +244,19 @@ full: test-full
### A list of all the targets we're building, for install purposes
#######################################################################
-ALL_TARGETS_DEST = $(addprefix $(TEST_DEST)/,$(ALL_TARGETS))
-LIBTESTSUITE_DEST = $(addprefix $(TEST_DEST)/,$(LIBTESTSUITE))
+TEST_DEST ?= $(LIBRARY_DEST)/testsuite
+
+ALL_TARGETS = $(LIBTESTSUITE) $(TESTLIBS)
+ALL_TARGETS += $(MUTATORS) $(MUTATEES_MINIMUM)
+ALL_TARGETS += $(DRIVERS) $(OUTPUT_DRIVERS) $(COMPONENTS)
+
+FULL_TARGETS = $(LIBTESTSUITE) $(TESTLIBS)
+FULL_TARGETS += $(MUTATORS) $(MUTATEES)
+FULL_TARGETS += $(DRIVERS) $(OUTPUT_DRIVERS) $(COMPONENTS)
+
+ALL_TARGETS_DEST = $(addprefix $(TEST_DEST)/,$(ALL_TARGETS))
+FULL_TARGETS_DEST = $(addprefix $(TEST_DEST)/,$(FULL_TARGETS))
+LIBTESTSUITE_DEST = $(addprefix $(TEST_DEST)/,$(LIBTESTSUITE))
#######################################################################
### Some pattern rules
@@ -272,13 +283,11 @@ include make.mutators.gen
include make.solo_mutatee.gen
-mutatees:
-
-mutators:
-
-components:
-
-testlibs:
+MUTATEES =
+MUTATEES_MINIMUM =
+MUTATORS =
+COMPONENTS =
+TESTLIBS =
#######################################################################
### Filter results, if needed
@@ -294,13 +303,13 @@ include $(TO_CORE)/make.components
ifneq ($(wildcard ../src/dyninst), )
ifneq ($(findstring dyninstAPI,$(fullSystem)),)
-mutatees: $(filter-out $(BUILD_FILTER), $(dyninst_SOLO_MUTATEES))
-mutatees_minimum: $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(dyninst_SOLO_MUTATEES)))
-mutators: $(dyninst_MUTATORS_SO)
-components: $(LIBDYNINSTCOMP)
-testlibs: $(DYNINST_TESTLIBS) $(DYNINST_STATIC_TESTLIBS)
+MUTATEES += $(filter-out $(BUILD_FILTER), $(dyninst_SOLO_MUTATEES))
+MUTATEES_MINIMUM += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(dyninst_SOLO_MUTATEES)))
+MUTATORS += $(dyninst_MUTATORS_SO)
+COMPONENTS += $(LIBDYNINSTCOMP)
+TESTLIBS += $(DYNINST_TESTLIBS) $(DYNINST_STATIC_TESTLIBS)
ifndef SKIP_BUILD_RTLIB_32
-testlibs: $(DYNINST_TESTLIBS_ABI) $(DYNINST_STATIC_TESTLIBS_ABI)
+TESTLIBS += $(DYNINST_TESTLIBS_ABI) $(DYNINST_STATIC_TESTLIBS_ABI)
dyninst_targs = $(DYNINST_TESTLIBS_ABI) $(DYNINST_STATIC_TESTLIBS_ABI)
endif
dyninst_targs += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(dyninst_SOLO_MUTATEES)))
@@ -310,11 +319,11 @@ endif
ifneq ($(wildcard ../src/symtab), )
ifneq ($(findstring symtabAPI,$(fullSystem)),)
-mutatees: $(filter-out $(BUILD_FILTER), $(symtab_SOLO_MUTATEES))
-mutatees_minimum: $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(symtab_SOLO_MUTATEES)))
-mutators: $(symtab_MUTATORS_SO)
-components: $(LIBSYMTABCOMP)
-testlibs: $(DYNINST_TESTLIBS) $(DYNINST_STATIC_TESTLIBS)
+MUTATEES += $(filter-out $(BUILD_FILTER), $(symtab_SOLO_MUTATEES))
+MUTATEES_MINIMUM += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(symtab_SOLO_MUTATEES)))
+MUTATORS += $(symtab_MUTATORS_SO)
+COMPONENTS += $(LIBSYMTABCOMP)
+TESTLIBS += $(DYNINST_TESTLIBS) $(DYNINST_STATIC_TESTLIBS)
symtab_targs = $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(symtab_SOLO_MUTATEES)))
symtab_targs = $(symtab_MUTATORS_SO) $(LIBSYMTABCOMP)
endif
@@ -322,12 +331,12 @@ endif
ifneq ($(wildcard ../src/instruction), )
ifneq ($(findstring instructionAPI,$(fullSystem)),)
-mutatees: $(filter-out $(BUILD_FILTER), $(instruction_SOLO_MUTATEES))
-mutatees_minimum: $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(instruction_SOLO_MUTATEES)))
-mutators: $(instruction_MUTATORS_SO)
+MUTATEES += $(filter-out $(BUILD_FILTER), $(instruction_SOLO_MUTATEES))
+MUTATEES_MINIMUM += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(instruction_SOLO_MUTATEES)))
+MUTATORS += $(instruction_MUTATORS_SO)
ifneq ($(instruction_MUTATORS_SO), )
-components: $(LIBINSTRUCTIONCOMP)
-testlibs:
+COMPONENTS += $(LIBINSTRUCTIONCOMP)
+TESTLIBS +=
instruction_targs = $(LIBINSTRUCTIONCOMP)
endif
instruction_targs += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(instruction_SOLO_MUTATEES)))
@@ -337,12 +346,12 @@ endif
ifneq ($(wildcard ../src/proccontrol), )
ifneq ($(findstring proccontrol,$(fullSystem)),)
-mutatees: $(filter-out $(BUILD_FILTER), $(proccontrol_SOLO_MUTATEES))
-mutatees_minimum: $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(proccontrol_SOLO_MUTATEES)))
-mutators: $(proccontrol_MUTATORS_SO)
+MUTATEES += $(filter-out $(BUILD_FILTER), $(proccontrol_SOLO_MUTATEES))
+MUTATEES_MINIMUM += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(proccontrol_SOLO_MUTATEES)))
+MUTATORS += $(proccontrol_MUTATORS_SO)
ifneq ($(proccontrol_MUTATORS_SO), )
-components: $(LIBPROCCONTROLCOMP)
-testlibs: $(PROCCONTROL_TESTLIBS) $(PROCCONTROL_TESTLIBS_ABI) $(DYNINST_TESTLIBS) $(DYNINST_TESTLIBS_ABI)
+COMPONENTS += $(LIBPROCCONTROLCOMP)
+TESTLIBS += $(PROCCONTROL_TESTLIBS) $(PROCCONTROL_TESTLIBS_ABI) $(DYNINST_TESTLIBS) $(DYNINST_TESTLIBS_ABI)
proccontrol_targs = $(LIBPROCCONTROLCOMP) $(PROCCONTROL_TESTLIBS) $(PROCCONTROL_TESTLIBS_ABI) $(DYNINST_TESTLIBS) $(DYNINST_TESTLIBS_ABI)
endif
proccontrol_targs += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(proccontrol_SOLO_MUTATEES)))
@@ -350,6 +359,16 @@ proccontrol_targs += $(proccontrol_MUTATORS_SO)
endif
endif
+mutatees: $(MUTATEES)
+
+mutatees_minimum: $(MUTATEES_MINIMUM)
+
+mutators: $(MUTATORS)
+
+components: $(COMPONENTS)
+
+testlibs: $(TESTLIBS)
+
common_infra: drivers output_drivers
dyninstAPI: common_infra $(dyninst_targs) $(symtab_targs) $(instruction_targs) $(proccontrol_targs)
@@ -360,7 +379,13 @@ instructionAPI: common_infra $(instruction_targs)
proccontrol: common_infra $(proccontrol_targs)
-install: default
+install: $(TEST_DEST)
+
+install-full: $(TEST_DEST)
+
+$(TEST_DEST)/%: %
+ @echo Installing $@
+ $(HIDE_COMP)$(INSTALL) -t $(TEST_DEST) $<
symlink: all
@@ -409,7 +434,8 @@ endif
testlibs: $(LIBTESTSUITE)
-drivers: test_driver runTests testdriver_wrapper
+DRIVERS = test_driver runTests testdriver_wrapper
+drivers: $(DRIVERS)
.PHONY: clean install distclean mutators mutatees testlibs gnu_mutatees native_mutatees echo all
@@ -563,7 +589,8 @@ endif
# Install directory
$(TEST_DEST):
- mkdir $(TEST_DEST)
+ @echo Installing $@
+ $(HIDE_COMP)$(INSTALL) -d $(TEST_DEST)
#######################################################################
### Generic Mutator build rule:
@@ -841,3 +868,6 @@ endif
endif
endif
endif
+
+install: $(ALL_TARGETS_DEST)
+install-full: $(FULL_TARGETS_DEST)
diff --git a/testsuite/src/dyninst/test1_18F_fortran.F b/testsuite/src/dyninst/test1_18F_fortran.F
index a33241b..9863fef 100644
--- a/testsuite/src/dyninst/test1_18F_fortran.F
+++ b/testsuite/src/dyninst/test1_18F_fortran.F
@@ -47,8 +47,6 @@
#define AND and
#define OR or
#endif
- DATA test1_18_globalVariable1/42/
- END
!------------------------------------------------------------------------------
SUBROUTINE test1_18f_init_globals
diff --git a/testsuite/src/runTests-utils.C b/testsuite/src/runTests-utils.C
index 0f54874..02bd505 100644
--- a/testsuite/src/runTests-utils.C
+++ b/testsuite/src/runTests-utils.C
@@ -403,12 +403,14 @@ void setupVars(bool useLog, string &logfile)
}
pdscrdir = base_dir + "/dyninst/scripts";
+#if 0
if ( ! isDir(pdscrdir) )
{
cerr << pdscrdir << " does not exist. Paradyn scripts dir required."
<< endl;
exit(1);
}
+#endif
// Determine Test log dir
char *pdtst = getenv("PDTST");
diff --git a/testsuite/src/test_driver.C b/testsuite/src/test_driver.C
index 02eec1a..31def33 100644
--- a/testsuite/src/test_driver.C
+++ b/testsuite/src/test_driver.C
@@ -755,7 +755,7 @@ void updateSearchPaths(const char *filename) {
// Add current directory to the search path
const char *pathenv = getenv("PATH");
char *newpath = (char *) malloc (strlen(pathenv)+3);
- strcat(newpath, pathenv);
+ strcpy(newpath, pathenv);
strcat(newpath, ":.");
execpath = searchPath(newpath, filename);
if(execpath == NULL) {
@@ -805,6 +805,8 @@ void updateSearchPaths(const char *filename) {
}
std::string getRTLibDir() {
+ return "../";
+#if 0
char *platform = getenv("PLATFORM");
char cwd[1024];
if (!platform) {
@@ -822,6 +824,7 @@ std::string getRTLibDir() {
std::string rtlib = "../../dyninstAPI_RT/";
rtlib += platform;
return rtlib;
+#endif
}
#if !defined(os_windows_test)

View File

@ -0,0 +1,25 @@
commit 3a6a6d980d345552ebb6c2dd27b874dbb9794e7d
Author: Andrew Bernat <bernat@cs.wisc.edu>
Date: Thu Feb 21 13:14:29 2013 -0600
Fix a system crash when running the test suite as root
diff --git a/testsuite/src/dyninst/test2_4.C b/testsuite/src/dyninst/test2_4.C
index 2920149..1cbb6a6 100644
--- a/testsuite/src/dyninst/test2_4.C
+++ b/testsuite/src/dyninst/test2_4.C
@@ -68,6 +68,14 @@ extern "C" DLLEXPORT TestMutator *test2_4_factory() {
// static int mutatorTest(BPatch *bpatch, bool useAttach)
test_results_t test2_4_Mutator::executeTest() {
// attach to an a protected pid
+
+#if !defined(os_windows_test)
+ if (getuid() == 0 || geteuid() == 0) {
+ // We're root, there _are_ no protected PIDs
+ return SKIPPED;
+ }
+#endif
+
clearError();
BPatch_process *ret = bpatch->processAttach(NULL, 1);
int gotError = getError();

View File

@ -2,7 +2,7 @@ Summary: An API for Run-time Code Generation
License: LGPLv2+ License: LGPLv2+
Name: dyninst Name: dyninst
Group: Development/Libraries Group: Development/Libraries
Release: 4%{?dist} Release: 5%{?dist}
URL: http://www.dyninst.org URL: http://www.dyninst.org
Version: 8.0 Version: 8.0
Exclusiveos: linux Exclusiveos: linux
@ -21,11 +21,23 @@ ExcludeArch: s390 s390x %{arm}
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
Source1: %{name}-docs-%{version}.tar.gz Source1: %{name}-docs-%{version}.tar.gz
Patch1: dyninst-rpm-build-flags.patch Patch1: dyninst-rpm-build-flags.patch
Patch2: dyninst-install-testsuite.patch
Patch3: dyninst-test2_4-kill-init.patch
Patch5: dyninst-unused_vars.patch Patch5: dyninst-unused_vars.patch
BuildRequires: libdwarf-devel >= 20111030 BuildRequires: libdwarf-devel >= 20111030
BuildRequires: elfutils-libelf-devel BuildRequires: elfutils-libelf-devel
BuildRequires: boost-devel BuildRequires: boost-devel
# Extra requires just for the testsuite
BuildRequires: gcc-gfortran glibc-static libstdc++-static nasm
# Testsuite files should not provide/require anything
%{?filter_setup:
%filter_provides_in %{_libdir}/dyninst/testsuite/
%filter_requires_in %{_libdir}/dyninst/testsuite/
%filter_setup
}
%description %description
Dyninst is an Application Program Interface (API) to permit the insertion of Dyninst is an Application Program Interface (API) to permit the insertion of
@ -55,17 +67,27 @@ that uses Dyninst.
%package static %package static
Summary: Static libraries for the compiling programs with Dyninst Summary: Static libraries for the compiling programs with Dyninst
Group: Development/System Group: Development/System
Requires: dyninst = %{version}-%{release} Requires: dyninst-devel = %{version}-%{release}
%description static %description static
dyninst-static includes the static versions of the library files for dyninst-static includes the static versions of the library files for
the dyninst user-space libraries and interfaces. the dyninst user-space libraries and interfaces.
%package testsuite
Summary: Programs for testing Dyninst
Group: Development/System
Requires: dyninst = %{version}-%{release}
%description testsuite
dyninst-testsuite includes the test harness and target programs for
making sure that dyninst works properly.
%prep %prep
%setup -q -n %{name}-%{version} -c %setup -q -n %{name}-%{version} -c
%setup -q -T -D -a 1 %setup -q -T -D -a 1
pushd dyninst pushd dyninst
%patch1 -p1 -b .buildflags %patch1 -p1 -b .buildflags
%patch2 -p1 -b .testsuite
%patch3 -p1 -b .kill-init
%patch5 -p1 -b .unused %patch5 -p1 -b .unused
popd popd
@ -73,7 +95,7 @@ popd
cd dyninst cd dyninst
%configure --disable-testsuite --includedir=%{_includedir}/dyninst --libdir=%{_libdir}/dyninst %configure --includedir=%{_includedir}/dyninst --libdir=%{_libdir}/dyninst
make %{?_smp_mflags} VERBOSE_COMPILATION=1 make %{?_smp_mflags} VERBOSE_COMPILATION=1
%install %install
@ -88,15 +110,18 @@ echo "%{_libdir}/dyninst" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf
chmod 644 %{buildroot}%{_includedir}/dyninst/* chmod 644 %{buildroot}%{_includedir}/dyninst/*
chmod 644 %{buildroot}%{_libdir}/dyninst/*.a chmod 644 %{buildroot}%{_libdir}/dyninst/*.a
# Uglier hack to mask testsuite files from debuginfo extraction. Running the
# testsuite requires debuginfo, so extraction is useless. However, debuginfo
# extraction is still nice for the main libraries, so we don't want to disable
# it package-wide. The permissions are restored by attr(755,-,-) in files.
chmod 644 %{buildroot}%{_libdir}/dyninst/testsuite/*
%post -p /sbin/ldconfig %post -p /sbin/ldconfig
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
# FIXME parseThat is not part of normal build
#%{_bindir}/parseThat
%dir %{_libdir}/dyninst %dir %{_libdir}/dyninst
%{_libdir}/dyninst/*.so.* %{_libdir}/dyninst/*.so.*
@ -125,7 +150,19 @@ chmod 644 %{buildroot}%{_libdir}/dyninst/*.a
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_libdir}/dyninst/*.a %{_libdir}/dyninst/*.a
%files testsuite
%defattr(-,root,root,-)
%{_bindir}/parseThat
%dir %{_libdir}/dyninst/testsuite/
# Restore the permissions that were hacked out above, during install.
%attr(755,-,-) %{_libdir}/dyninst/testsuite/*
%changelog %changelog
* Mon Feb 25 2013 Josh Stone <jistone@redhat.com> 8.0-5
- Add a dyninst-testsuite package.
- Patch test2_4 to protect against running as root.
- Make dyninst-static require dyninst-devel.
* Thu Feb 14 2013 Josh Stone <jistone@redhat.com> 8.0-4 * Thu Feb 14 2013 Josh Stone <jistone@redhat.com> 8.0-4
- Patch make.config to ensure rpm build flags are not discarded. - Patch make.config to ensure rpm build flags are not discarded.