From 06799dbd3238a07dc6938942c682a3862aed9bcf Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 17 Jul 2024 15:15:55 +0200 Subject: [PATCH] CI Gating: Move the tests to fedoraproject.org --- plans/ci.fmf => ci.fmf | 2 + .../Sanity/smoke-test/dynamic-double/Makefile | 19 -- .../smoke-test/dynamic-double/mutatee.cpp | 49 ----- .../smoke-test/dynamic-double/mutator.cpp | 115 ---------- tests/Sanity/smoke-test/dynamic/Makefile | 17 -- tests/Sanity/smoke-test/dynamic/load_env.sh | 6 - tests/Sanity/smoke-test/dynamic/mutatee.cpp | 44 ---- tests/Sanity/smoke-test/dynamic/mutator.cpp | 73 ------ tests/Sanity/smoke-test/main.fmf | 16 -- tests/Sanity/smoke-test/runtest.sh | 207 ------------------ tests/Sanity/smoke-test/static/Makefile | 17 -- tests/Sanity/smoke-test/static/load_env.sh | 6 - tests/Sanity/smoke-test/static/mutatee.cpp | 32 --- tests/Sanity/smoke-test/static/mutator.cpp | 69 ------ tests/Sanity/testsuite/main.fmf | 19 -- tests/Sanity/testsuite/runtest.sh | 69 ------ 16 files changed, 2 insertions(+), 758 deletions(-) rename plans/ci.fmf => ci.fmf (53%) delete mode 100644 tests/Sanity/smoke-test/dynamic-double/Makefile delete mode 100644 tests/Sanity/smoke-test/dynamic-double/mutatee.cpp delete mode 100644 tests/Sanity/smoke-test/dynamic-double/mutator.cpp delete mode 100644 tests/Sanity/smoke-test/dynamic/Makefile delete mode 100644 tests/Sanity/smoke-test/dynamic/load_env.sh delete mode 100644 tests/Sanity/smoke-test/dynamic/mutatee.cpp delete mode 100644 tests/Sanity/smoke-test/dynamic/mutator.cpp delete mode 100644 tests/Sanity/smoke-test/main.fmf delete mode 100755 tests/Sanity/smoke-test/runtest.sh delete mode 100644 tests/Sanity/smoke-test/static/Makefile delete mode 100644 tests/Sanity/smoke-test/static/load_env.sh delete mode 100644 tests/Sanity/smoke-test/static/mutatee.cpp delete mode 100644 tests/Sanity/smoke-test/static/mutator.cpp delete mode 100644 tests/Sanity/testsuite/main.fmf delete mode 100755 tests/Sanity/testsuite/runtest.sh diff --git a/plans/ci.fmf b/ci.fmf similarity index 53% rename from plans/ci.fmf rename to ci.fmf index 85710d6..6e25cb9 100644 --- a/plans/ci.fmf +++ b/ci.fmf @@ -1,6 +1,8 @@ summary: CI Gating Plan discover: how: fmf + url: https://src.fedoraproject.org/tests/dyninst-gating.git + ref: main directory: tests execute: how: tmt diff --git a/tests/Sanity/smoke-test/dynamic-double/Makefile b/tests/Sanity/smoke-test/dynamic-double/Makefile deleted file mode 100644 index 22c77b3..0000000 --- a/tests/Sanity/smoke-test/dynamic-double/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -CPP=g++ -#DYNINST_ROOT=/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -LINK=-L/opt/rh/devtoolset-3/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-3/root/usr/lib$(BITS)/dyninst/lib -# -ldyninstAPI -ldynC -ldl -#LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldl - -INCLUDE=-I/opt/rh/devtoolset-3/root/usr/include/dyninst -LINK2=-ldyninstAPI -ldl -lboost_system - -all: mutatee mutator - -clean: - rm mutatee mutator - -mutatee: mutatee.cpp - $(CPP) -g -o mutatee mutatee.cpp - -mutator: mutator.cpp - $(CPP) -g -o mutator $(INCLUDE) $(LINK) $(LINK2) mutator.cpp diff --git a/tests/Sanity/smoke-test/dynamic-double/mutatee.cpp b/tests/Sanity/smoke-test/dynamic-double/mutatee.cpp deleted file mode 100644 index eead3bb..0000000 --- a/tests/Sanity/smoke-test/dynamic-double/mutatee.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include - -using namespace std; - -int a = 0; - -void incr(void) -{ - a++; -} - -void incr2(void) -{ - a += 100; -} - -int function_name(void) -{ - fprintf(stderr, "FUNCTION EXECUTED. VALUE = %i\n", a); -} - -int main(int argc, char **argv) -{ - int n = 10, i; - FILE *f = fopen("RESULT.log", "w"); - if(argc > 1) - { - if((n = atoi(argv[1])) <= 0) - n = 10; - } - else - n = 10; - - for(i = 0; i < n; i++) - { - function_name(); - sleep(3); - } - - if((a > 200) && (a % 100 > 0)) - fprintf(f, "MUTATION OK.\n"); - else - fprintf(f, "MUTATION FAILED.\n"); - - fclose(f); - return !a; -} diff --git a/tests/Sanity/smoke-test/dynamic-double/mutator.cpp b/tests/Sanity/smoke-test/dynamic-double/mutator.cpp deleted file mode 100644 index 550ccbe..0000000 --- a/tests/Sanity/smoke-test/dynamic-double/mutator.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include -#include - -// dyninst libraries - -#include "BPatch.h" -#include "BPatch_addressSpace.h" -#include "BPatch_process.h" -#include "BPatch_function.h" -#include "BPatch_point.h" -//#include "BPatch_flowGraph.h" - -using namespace std; - - - - -int main(int argc, char **argv) -{ - BPatch bpatch1, bpatch2; - int pid; - BPatch_process *app_proc; - BPatch_addressSpace *aspace; - BPatch_image *image; - - // check the options - if(argc != 2) - { - cerr << "ERROR ## Missing command line args. Use PID of the process you want to attach.\n"; - return 1; - } - - pid = atoi(argv[1]); - if(pid == 0) - { - cerr << "ERROR ## Wrong PID " << pid << ", please use another.\n"; - return 2; - } - - cerr << "TAKE1 A\n"; - // let's go... - app_proc = bpatch1.processAttach(NULL, pid); - cerr << "TAKE1 B\n"; - aspace = app_proc; - cerr << "TAKE1 C\n"; - image = aspace->getImage(); - cerr << "TAKE1 D\n"; - -/* BPatch_Set access_types; - access_types.insert(BPatch_opLoad); - access_types.insert(BPatch_opStore); -*/ - vector functions, incr_functions; - vector *points; - image->findFunction("function_name", functions); - cerr << "TAKE1 E\n"; - points = functions[0]->findPoint(BPatch_entry); - cerr << "TAKE1 F\n"; - - // create snippet - image->findFunction("incr", incr_functions); - cerr << "TAKE1 G\n"; - vector incr_args; - BPatch_funcCallExpr incr_call(*(incr_functions[0]), incr_args); - - aspace->insertSnippet(incr_call, *points); - cerr << "TAKE1 H\n"; - app_proc->continueExecution(); - cerr << "TAKE1 I\n"; - sleep(4); - app_proc->detach(true); - - cout << "FIRST MUTATION DONE. MUTATOR IS DOING THE SECOND ONE...\n"; - - sleep(4); - - cerr << "TAKE2 A\n"; - // let's go... - app_proc = bpatch2.processAttach(NULL, pid); - cerr << "TAKE2 B\n"; - aspace = app_proc; - cerr << "TAKE2 C\n"; - image = aspace->getImage(); - cerr << "TAKE2 D\n"; - -/* BPatch_Set access_types; - access_types.insert(BPatch_opLoad); - access_types.insert(BPatch_opStore); -*/ - vector functions2, incr_functions2; - vector *points2;; - image->findFunction("function_name", functions2); - cerr << "TAKE2 E\n"; - points2 = functions2[0]->findPoint(BPatch_exit); - cerr << "TAKE2 F\n"; - - // create snippet - image->findFunction("incr2", incr_functions2); - cerr << "TAKE2 G\n"; - vector incr_args2; - BPatch_funcCallExpr incr_call2(*(incr_functions2[0]), incr_args2); - - aspace->insertSnippet(incr_call2, *points2); - cerr << "TAKE2 H\n"; - app_proc->continueExecution(); - cerr << "TAKE2 I\n"; - app_proc->detach(true); - - cout << "SECOND MUTATION DONE. MUTATOR IS GOING...\n"; - - return 0; -} diff --git a/tests/Sanity/smoke-test/dynamic/Makefile b/tests/Sanity/smoke-test/dynamic/Makefile deleted file mode 100644 index aaecdd6..0000000 --- a/tests/Sanity/smoke-test/dynamic/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CPP=g++ -#DYNINST_ROOT=/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -##LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldynC -ldl -#LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldl -#INCLUDE=-I/opt/rh/devtoolset-2/root/usr/include/dyninst -LINK2=-ldyninstAPI -ldl -lboost_system - -all: mutatee mutator - -clean: - rm mutatee mutator - -mutatee: mutatee.cpp - $(CPP) -g -o mutatee mutatee.cpp - -mutator: mutator.cpp - $(CPP) -g -o mutator $(INCLUDE) $(LINK) $(LINK2) mutator.cpp diff --git a/tests/Sanity/smoke-test/dynamic/load_env.sh b/tests/Sanity/smoke-test/dynamic/load_env.sh deleted file mode 100644 index ce686f0..0000000 --- a/tests/Sanity/smoke-test/dynamic/load_env.sh +++ /dev/null @@ -1,6 +0,0 @@ -DYNINSTAPI_RT_LIB=/opt/rh/devtoolset-3/root/usr/lib64/dyninst/libdyninstAPI_RT.so -export DYNINSTAPI_RT_LIB -if [[ ! $LD_LIBRARY_PATH =~ .*dyninst.* ]]; then - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/dyninst -fi -export LD_LIBRARY_PATH diff --git a/tests/Sanity/smoke-test/dynamic/mutatee.cpp b/tests/Sanity/smoke-test/dynamic/mutatee.cpp deleted file mode 100644 index 111b0ab..0000000 --- a/tests/Sanity/smoke-test/dynamic/mutatee.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include - -using namespace std; - -int a = 0; - -void incr(void) -{ - a++; -} - -int function_name(void) -{ - fprintf(stderr, "FUNCTION EXECUTED. VALUE = %i\n", a); -} - -int main(int argc, char **argv) -{ - int n = 10, i; - FILE *f = fopen("RESULT.log", "w"); - if(argc > 1) - { - if((n = atoi(argv[1])) <= 0) - n = 10; - } - else - n = 10; - - for(i = 0; i < n; i++) - { - function_name(); - sleep(3); - } - - if(a) - fprintf(f, "MUTATION OK.\n"); - else - fprintf(f, "MUTATION FAILED.\n"); - - fclose(f); - return !a; -} diff --git a/tests/Sanity/smoke-test/dynamic/mutator.cpp b/tests/Sanity/smoke-test/dynamic/mutator.cpp deleted file mode 100644 index ed540f2..0000000 --- a/tests/Sanity/smoke-test/dynamic/mutator.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include -#include -#include - -// dyninst libraries - -#include "BPatch.h" -#include "BPatch_addressSpace.h" -#include "BPatch_process.h" -#include "BPatch_function.h" -#include "BPatch_point.h" -//#include "BPatch_flowGraph.h" - -using namespace std; - - -BPatch bpatch; - - -int main(int argc, char **argv) -{ - int pid; - BPatch_process *app_proc; - BPatch_addressSpace *aspace; - BPatch_image *image; - - // check the options - if(argc != 2) - { - cerr << "ERROR ## Missing command line args. Use PID of the process you want to attach.\n"; - return 1; - } - - pid = atoi(argv[1]); - if(pid == 0) - { - cerr << "ERROR ## Wrong PID " << pid << ", please use another.\n"; - return 2; - } - - // let's go... - app_proc = bpatch.processAttach(NULL, pid); - aspace = app_proc; - image = aspace->getImage(); - -/* BPatch_Set access_types; - access_types.insert(BPatch_opLoad); - access_types.insert(BPatch_opStore); -*/ - vector functions, incr_functions; - vector *points; - image->findFunction("function_name", functions); - points = functions[0]->findPoint(BPatch_entry); - - // create snippet - image->findFunction("incr", incr_functions); - vector incr_args; - BPatch_funcCallExpr incr_call(*(incr_functions[0]), incr_args); - - aspace->insertSnippet(incr_call, *points); - app_proc->continueExecution(); -#ifdef __PPC__ - // PPC detach removes snippets, so wait - bpatch.waitForStatusChange(); -#endif - app_proc->detach(true); - - cout << "MUTATION DONE. MUTATOR IS GOING...\n"; - - return 0; -} diff --git a/tests/Sanity/smoke-test/main.fmf b/tests/Sanity/smoke-test/main.fmf deleted file mode 100644 index 0670d38..0000000 --- a/tests/Sanity/smoke-test/main.fmf +++ /dev/null @@ -1,16 +0,0 @@ -summary: The test does basic instrumentation on binaries. -description: '' -contact: -- Michael Petlan -component: -- dyninst -test: ./runtest.sh -framework: beakerlib -recommend: -- dyninst -- dyninst-devel -- gcc -- gcc-c++ -duration: 12m -extra-summary: /tools/dyninst/Sanity/smoke-test -extra-task: /tools/dyninst/Sanity/smoke-test diff --git a/tests/Sanity/smoke-test/runtest.sh b/tests/Sanity/smoke-test/runtest.sh deleted file mode 100755 index 88792a4..0000000 --- a/tests/Sanity/smoke-test/runtest.sh +++ /dev/null @@ -1,207 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /tools/dyninst/Sanity/smoke-test -# Description: The test does basic instrumentation on binaries. -# Author: Michael Petlan -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 Red Hat, Inc. All rights reserved. -# -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. -# -# 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 Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="dyninst" - -rlJournalStart - rlPhaseStartSetup - rlRun "TMPD=$(mktemp -d)" - rlRun "cp -r dynamic dynamic-double static $TMPD/" - rlRun "pushd $TMPD" - # load the proper environment - set the variables - # When using dyninst, we have to have LD_LIBRARY_PATH set to dyninst's directory - # and DYNINSTAPI_RT_LIB should keep the path of libdyninstAPI_RT.so.8.0 shared library. - # After having this set properly, an application what uses dyninst, can be compiled and run. - - test -e "/usr/lib64" && BITS="64" || BITS="" - ARCH=`rlGetPrimaryArch` - - rlAssertRpm $PACKAGE - DYNINST_ROOT="/usr/lib$BITS/dyninst" - INCLUDE="-I/usr/include/dyninst" - LINK="-L/usr/lib$BITS/dyninst -L/usr/lib$BITS/dyninst/lib" - echo $LD_LIBRARY_PATH | grep "$DYNINST_ROOT" - if [ $? -ne 0 ]; then - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DYNINST_ROOT" - fi - - # the API runtime library path should be available from rpmquery - if [ `rpmquery -l $PACKAGE.$ARCH | grep API_RT | wc -l` -eq 1 ]; then - # if there's only one file, we may accept that - DYNINSTAPI_RT_LIB=`rpmquery -l $PACKAGE.$ARCH | grep API_RT` - else - # sometimes there're many links to the API_RT lib, so we have to choose the proper file - for rtlib in `rpmquery -l $PACKAGE.$ARCH | grep API_RT`; do - test -L $rtlib || DYNINSTAPI_RT_LIB="$rtlib" - done - fi - export DYNINSTAPI_RT_LIB - if [[ ! $LD_LIBRARY_PATH =~ .*dyninst.* ]]; then - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/dyninst - fi - export LD_LIBRARY_PATH - - # compile both static and dynamic test - for TC in static dynamic dynamic-double; do - cd $TC - rlRun "make BITS=\"$BITS\" DYNINST_ROOT=\"$DYNINST_ROOT\" INCLUDE=\"$INCLUDE\" LINK=\"$LINK\"" 0 "Compiling $TC dyninst example." - cd .. - done - - # IMPORTANT: We have to make sure, that some SELinux bools are set right (see dyninst docs) - # - # We need: - # allow_execmod --> on - # allow_execstack --> on - # deny_ptrace --> off - # - # Note: The bool deny_ptrace is not present in RHEL yet. - # - SELINUX_STATUS=`sestatus | grep "SELinux status" | awk '{ print $3; }'` - if [[ "$SELINUX_STATUS" == "enabled" ]]; then - rlLog "SELINUX IS ENABLED." - SEBOOL_ALLOW_EXECMOD=`getsebool allow_execmod` - SEBOOL_ALLOW_EXECSTACK=`getsebool allow_execstack` - SEBOOL_DENY_PTRACE=`getsebool deny_ptrace` - if [[ "$SEBOOL_ALLOW_EXECMOD" =~ "> off" ]]; then - rlLog "SELINUX: We need to set allow_execmod to on." - setsebool allow_execmod on - SEBOOL_ALLOW_EXECMOD="off" - else - rlLog "SELINUX: $SEBOOL_ALLOW_EXECMOD -- already OK." - fi - if [[ "$SEBOOL_ALLOW_EXECSTACK" =~ "> off" ]]; then - rlLog "SELINUX: We need to set allow_execstack to on." - setsebool allow_execstack on - SEBOOL_ALLOW_EXECSTACK="off" - else - rlLog "SELINUX: $SEBOOL_ALLOW_EXECSTACK -- already OK." - fi - if [[ "$SEBOOL_DENY_PTRACE" =~ "> on" ]]; then - rlLog "SELINUX: We need to set deny_ptrace to off." - setsebool deny_ptrace off - SEBOOL_DENY_PTRACE="on" - else - if [ -z "$SEBOOL_DENY_PTRACE" ]; then - rlLog "SELINUX: deny_ptrace does not exist -- OK." - else - rlLog "SELINUX: $SEBOOL_DENY_PTRACE -- already OK." - fi - fi - else - rlLog "SELINUX IS DISABLED. We do not have to change anything." - fi - - # Checking for lahf instruction support (bz1134843 workaround) - ARCH=`uname -i` - if [[ "$ARCH" =~ "86" ]]; then - IS_LAHF_SUPPORTED=`cat /proc/cpuinfo | grep lahf` - if [ -z "$IS_LAHF_SUPPORTED" ]; then - rlLogWarning "The CPU does not support needed LAHF instruction." - fi - fi - rlPhaseEnd - - rlPhaseStartTest "Testing static instrumentation" - cd static - rlRun "./mutator" - rlAssertExists "mutated" - RESULT=`./mutated` - if [[ "$RESULT" == "MUTATION OK." ]]; then - rlPass "Instrumentation PASSed." - else - rlFail "Instrumentation FAILed." - fi - cd .. - rlPhaseEnd - - rlPhaseStartTest "Testing dynamic instrumentation" - cd dynamic - ./mutatee 10 & - PID=$! - # export DYNINST_DEBUG_STARTUP=1 - # export DYNINST_DEBUG_RTLIB=1 - # export DYNINST_DEBUG_CRASH=1 - # export DYNINST_DEBUG_BPATCH=1 - ./mutator $PID - sleep 50 - RESULT=`cat RESULT.log` - if [[ "$RESULT" == "MUTATION OK." ]]; then - rlPass "Instrumentation PASSed." - else - rlFail "Instrumentation FAILed." - fi - cd .. - rlPhaseEnd - - rlPhaseStartTest "Testing dynamic double instrumentation" - # This case needs to have the DYNINSTAPI_RT_LIB variable pointing to a regular file - # not to symlink. So it has to be hacked a little - export DYNINSTAPI_RT_LIB=`readlink -fn $DYNINSTAPI_RT_LIB` - - cd dynamic-double - ./mutatee 10 & - PID=$! - # export DYNINST_DEBUG_STARTUP=1 - # export DYNINST_DEBUG_RTLIB=1 - # export DYNINST_DEBUG_CRASH=1 - # export DYNINST_DEBUG_BPATCH=1 - ./mutator $PID - sleep 50 - RESULT=`cat RESULT.log` - if [[ "$RESULT" == "MUTATION OK." ]]; then - rlPass "Instrumentation PASSed." - else - rlFail "Instrumentation FAILed." - fi - cd .. - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TMPD" - - # restore the SELinux bools, if they were changed - if [[ "$SEBOOL_ALLOW_EXECMOD" == "off" ]]; then - rlLog "Restoring SELinux bool allow_execmod to $SEBOOL_ALLOW_EXECMOD." - setsebool allow_execmod $SEBOOL_ALLOW_EXECMOD - fi - if [[ "$SEBOOL_ALLOW_EXECSTACK" == "off" ]]; then - rlLog "Restoring SELinux bool allow_execstack to $SEBOOL_ALLOW_EXECSTACK." - setsebool allow_execstack $SEBOOL_ALLOW_EXECSTACK - fi - if [[ "$SEBOOL_DENY_PTRACE" == "on" ]]; then - rlLog "Restoring SELinux bool deny_ptrace to $SEBOOL_DENY_PTRACE." - setsebool deny_ptrace $SEBOOL_DENY_PTRACE - fi - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Sanity/smoke-test/static/Makefile b/tests/Sanity/smoke-test/static/Makefile deleted file mode 100644 index 2277c20..0000000 --- a/tests/Sanity/smoke-test/static/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CPP=g++ -#DYNINST_ROOT=/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -##LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldynC -ldl -#LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldl -#INCLUDE=-I/opt/rh/devtoolset-2/root/usr/include/dyninst -LINK2=-ldyninstAPI -ldl -lboost_system - -all: mutatee mutator - -clean: - rm mutatee mutator mutated - -mutatee: mutatee.cpp - $(CPP) -g -o mutatee mutatee.cpp - -mutator: mutator.cpp - $(CPP) -g -o mutator $(INCLUDE) $(LINK) $(LINK2) mutator.cpp diff --git a/tests/Sanity/smoke-test/static/load_env.sh b/tests/Sanity/smoke-test/static/load_env.sh deleted file mode 100644 index ce686f0..0000000 --- a/tests/Sanity/smoke-test/static/load_env.sh +++ /dev/null @@ -1,6 +0,0 @@ -DYNINSTAPI_RT_LIB=/opt/rh/devtoolset-3/root/usr/lib64/dyninst/libdyninstAPI_RT.so -export DYNINSTAPI_RT_LIB -if [[ ! $LD_LIBRARY_PATH =~ .*dyninst.* ]]; then - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/dyninst -fi -export LD_LIBRARY_PATH diff --git a/tests/Sanity/smoke-test/static/mutatee.cpp b/tests/Sanity/smoke-test/static/mutatee.cpp deleted file mode 100644 index 6c3b215..0000000 --- a/tests/Sanity/smoke-test/static/mutatee.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include - -using namespace std; - -int a = 0; - -void incr(void) -{ - a++; -} - -int function_name(void) -{ - int i; - - sleep(3); - - if(a) - printf("MUTATION OK.\n"); - else - printf("MUTATION FAILED.\n"); - - return a; -} - -int main(int argc, char **argv) -{ - function_name(); -} diff --git a/tests/Sanity/smoke-test/static/mutator.cpp b/tests/Sanity/smoke-test/static/mutator.cpp deleted file mode 100644 index e7358db..0000000 --- a/tests/Sanity/smoke-test/static/mutator.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -#include -#include -#include - -// dyninst libraries - -#include "BPatch.h" -#include "BPatch_addressSpace.h" -#include "BPatch_process.h" -#include "BPatch_function.h" -#include "BPatch_point.h" -//#include "BPatch_flowGraph.h" - -using namespace std; - - -BPatch bpatch; - - -int main(int argc, char **argv) -{ - int pid; - BPatch_binaryEdit *app_bin; - BPatch_addressSpace *aspace; - BPatch_image *image; - -/* // check the options - if(argc != 2) - { - cerr << "ERROR ## Missing command line args. Use PID of the process you want to attach.\n"; - return 1; - } - - pid = atoi(argv[1]); - if(pid == 0) - { - cerr << "ERROR ## Wrong PID " << pid << ", please use another.\n"; - return 2; - } -*/ - // let's go... - app_bin = bpatch.openBinary("mutatee"); - aspace = app_bin; - image = aspace->getImage(); - -/* BPatch_Set access_types; - access_types.insert(BPatch_opLoad); - access_types.insert(BPatch_opStore); -*/ - vector functions, incr_functions; - vector *points; - image->findFunction("function_name", functions); - points = functions[0]->findPoint(BPatch_entry); - - // create snippet - image->findFunction("incr", incr_functions); - vector incr_args; - BPatch_funcCallExpr incr_call(*(incr_functions[0]), incr_args); - - aspace->insertSnippet(incr_call, *points); - app_bin->writeFile("mutated"); - - - cout << "MUTATION DONE. MUTATOR IS GOING...\n"; - - return 0; -} diff --git a/tests/Sanity/testsuite/main.fmf b/tests/Sanity/testsuite/main.fmf deleted file mode 100644 index 63be86c..0000000 --- a/tests/Sanity/testsuite/main.fmf +++ /dev/null @@ -1,19 +0,0 @@ -summary: Dyninst upstream testsuite wrapper -description: '' -contact: Martin Cermak -component: -- dyninst -test: ./runtest.sh -framework: beakerlib -recommend: -- dyninst -- dyninst-devel -- dyninst-testsuite -- boost -- boost-devel -- elfutils-libelf-devel -- libdwarf-devel -- gcc-c++ -duration: 360m -extra-summary: /tools/dyninst/Sanity/testsuite -extra-task: /tools/dyninst/Sanity/testsuite diff --git a/tests/Sanity/testsuite/runtest.sh b/tests/Sanity/testsuite/runtest.sh deleted file mode 100755 index cc7aeea..0000000 --- a/tests/Sanity/testsuite/runtest.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /tools/dyninst/Sanity/testsuite -# Description: Basic functionality covering testsuite -# Author: Michael Petlan -# Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 Red Hat, Inc. All rights reserved. -# -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. -# -# 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 Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE=${PACKAGE:-dyninst} -TESTDIR=${TESTDIR:-/usr/lib64/dyninst/testsuite} - -# Tests known to fail -SKIPLIST=test_thread_2,pc_thread,pc_tls,test_reloc,test_thread_3,\ -test_thread_5,test_thread_6,test_thread_8 - - -rlJournalStart - rlPhaseStartSetup - rlRun "rpm -q $PACKAGE $PACKAGE-testsuite" - - DYNINSTAPI_RT_LIB=$(rpm -ql $PACKAGE | fgrep libdyninstAPI_RT.so | sort | tail -1) - - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR" - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(dirname $DYNINSTAPI_RT_LIB)" - LD_LIBRARY_PATH=${LD_LIBRARY_PATH#:} - - export DYNINSTAPI_RT_LIB - export LD_LIBRARY_PATH - - rlRun "setsebool allow_execmod on" - rlRun "setsebool allow_execstack on" - rlRun "setsebool deny_ptrace off" - - rlRun "pushd $TESTDIR" - rlPhaseEnd - - rlPhaseStartTest - rlRun "./runTests -v++ -allmode -allcompilers -allopt -exclude $SKIPLIST" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd