Compare commits

..

No commits in common. "rawhide" and "f35" have entirely different histories.

43 changed files with 181 additions and 1230 deletions

1
.gitignore vendored
View file

@ -4,4 +4,3 @@ ltrace-*/
/ltrace-0.7.0.tar.bz2
/ltrace-0.7.2.tar.bz2
/ltrace-0.7.91.tar.bz2
/ltrace-0.8.1.tar.bz2

View file

@ -1,13 +0,0 @@
diff -rup a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
--- a/sysdeps/linux-gnu/ppc/plt.c 2022-01-27 20:40:52.956980433 -0500
+++ b/sysdeps/linux-gnu/ppc/plt.c 2022-01-27 20:41:37.031599771 -0500
@@ -687,8 +687,8 @@ arch_elf_add_func_entry(struct process *
if (libsym == NULL
|| library_symbol_init(libsym, addr, full_name, 1,
LS_TOPLT_NONE) < 0) {
- free(libsym);
delete_symbol_chain(libsym);
+ free(libsym);
libsym = NULL;
fprintf(stderr, "Couldn't add symbol %s"
"for tracing.\n", name);

View file

@ -1,11 +1,11 @@
Summary: Tracks runtime library calls from dynamically linked executables
Name: ltrace
Version: 0.8.1
Release: 1%{?dist}
Version: 0.7.91
Release: 42%{?dist}
# In coordination with Juan Céspedes, upstream is now officially on gitlab.
# We are going to being sending all of our Fedora patches upstream to gitlab.
URL: https://gitlab.com/cespedes/ltrace
License: GPL-2.0-or-later
License: GPLv2+
BuildRequires: elfutils-devel dejagnu
BuildRequires: libselinux-devel
@ -13,9 +13,125 @@ BuildRequires: autoconf automake libtool
BuildRequires: gcc-c++
BuildRequires: make
# https://gitlab.com/cespedes/ltrace/-/releases
# Note: this URL needs to be updated for each release, as the file
# number changes for each file. Full list of released files is at:
# https://alioth.debian.org/frs/?group_id=30892
Source: ltrace-%{version}.tar.bz2
# Merge of several upstream commits that fixes compilation on ARM.
Patch0: ltrace-0.7.91-arm.patch
# Upstream patch that fixes accounting of exec, __libc_start_main and
# others in -c output.
Patch1: ltrace-0.7.91-account_execl.patch
# Upstream patch that fixes interpretation of PLT on x86_64 when
# IRELATIVE slots are present.
Patch2: ltrace-0.7.91-x86_64-irelative.patch
# Upstream patch that fixes fetching of system call arguments on s390.
Patch3: ltrace-0.7.91-s390-fetch-syscall.patch
# Upstream patch that enables tracing of IRELATIVE PLT slots on s390.
Patch4: ltrace-0.7.91-s390-irelative.patch
# Fix for a regression in tracing across fork. Upstream patch.
Patch5: ltrace-0.7.91-ppc64-fork.patch
# Fix crashing a prelinked PPC64 binary which makes PLT calls through
# slots that ltrace doesn't trace.
# https://bugzilla.redhat.com/show_bug.cgi?id=1051221
Patch6: ltrace-0.7.91-breakpoint-on_install.patch
Patch7: ltrace-0.7.91-ppc64-unprelink.patch
# Man page nits. Backport of an upstream patch.
Patch8: ltrace-0.7.91-man.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1044766
Patch9: ltrace-0.7.91-cant_open.patch
# Support Aarch64 architecture.
Patch10: ltrace-0.7.91-aarch64.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1064406
Patch11: ltrace-0.7.2-e_machine.patch
# Support for ppc64le, backported from upstream.
# http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commit;h=eea4ad2cce289753aaa35b4e0258a76d8f8f367c
# https://bugzilla.redhat.com/show_bug.cgi?id=1131956
Patch13: ltrace-0.7.91-ppc64le-support.patch
# 35a9677dc9dcb7909ebd28f30200474d7e8b660f,
# 437d2377119036346f4dbd93039c847b4cc9d0be,
# eb3993420734f091cde9a6053ca6b4edcf9ae334
Patch14: ltrace-0.7.91-ppc64le-fixes.patch
# http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commit;h=2e9f9f1f5d0fb223b109429b9c904504b7f638e2
# http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commit;h=f96635a03b3868057db5c2d7972d5533e2068345
Patch15: ltrace-0.7.91-parser-ws_after_id.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1171165
# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=d8f1287b85e2c2b2ae0235809e956f4365e53c45
# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=d80c5371454383e3f9978622e5578cf02af8c44c
# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=bf82100966deda9c7d26ad085d97c08126a8ae88
Patch16: ltrace-0.7.91-ppc-bias.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1158714
Patch17: ltrace-0.7.91-x86-plt_map.patch
Patch18: ltrace-0.7.91-x86-unused_label.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1170315
Patch19: ltrace-0.7.91-unwind-elfutils.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1208351
# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=4724bd5a4a19db117a1d280b9d1a3508fd4e03fa
# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=72ee29639c55b5942bc07c8ed0013005f8fc5a97
Patch20: ltrace-0.7.91-multithread-no-f-1.patch
Patch21: ltrace-0.7.91-multithread-no-f-2.patch
# Fix problems with building a number of test cases.
# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=694d19ff14017926454771cbb63a22355b72f1bf
# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=a3a03622fb4ca9772dca13eae724a94ba1e728f4
Patch22: ltrace-0.7.91-testsuite-includes.patch
Patch23: ltrace-0.7.91-testsuite-includes-2.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1210653
# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=eea6091f8672b01f7f022b0fc367e0f568225ffc
Patch24: ltrace-0.7.91-ppc64le-configure.patch
Patch25: ltrace-rh1307754.patch
# GCC now warns (errors) on "tautological compares", and readdir_r is deprecated.
Patch26: ltrace-0.7.91-tautology.patch
# ARM code has unreachable code after switch statement, move initialization
Patch27: ltrace-rh1423913.patch
# AARCH64 large parameters and syscall testsuite fixes.
Patch28: ltrace-0.7.91-aarch64-params.patch
# gcc-9 fix. Avoid passing NULL as argument to %s
Patch29: ltrace-0.7.91-null.patch
# Adds support for CET PLTs via second-plt lookups.
Patch30: ltrace-0.7.91-cet.patch
# Extra #includes for gcc 9
Patch31: ltrace-0.7.91-aarch64-headers.patch
# Testsuite: AARCH64 ifuncs not supported yet yet.
Patch32: ltrace-rh1225568.patch
# testsuite fixes for pre-installed config files
Patch33: ltrace-0.7.91-testsuite-system_call_params.patch
# Ignore bogus files from the environment
Patch34: ltrace-0.7.91-XDG_CONFIG_DIRS.patch
# GCC erroneously warns about uninitialized values
Patch35: ltrace-0.7.91-rh1799619.patch
# Support for both SC and SCV sycall insns
Patch36: ltrace-0.7.91-ppc64le-scv.patch
%description
Ltrace is a debugging program which runs a specified command until the
command exits. While the command is executing, ltrace intercepts and
@ -28,6 +144,42 @@ execution of processes.
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%build
autoreconf -i
@ -55,42 +207,6 @@ echo ====================TESTING END=====================
%{_datadir}/ltrace
%changelog
* Tue Sep 16 2025 DJ Delorie <dj@redhat.com> - 0.8.1-1
- Rebased to ltrace 0.8.1
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-53
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-52
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-51
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-50
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-49
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-48
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-47
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-46
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri May 03 2022 Carlos O'Donell <carlos@redhat.com> - 0.7.91-45
- Rebuild ltrace for rawhide (#2046722)
* Thu Jan 27 2022 DJ Delorie <dj@redhat.com> - 0.7.91-44
- Fix use-after-free cases.
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-43
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-42
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

View file

@ -3,4 +3,4 @@ discover:
how: fmf
directory: tests
execute:
how: tmt
how: beakerlib

View file

@ -1 +1 @@
SHA512 (ltrace-0.8.1.tar.bz2) = 68fdf10abb3c9534987cb4fcf2531502f8376c56299d56908406ba903fa63af2e0a82c3b902ed0cd47e4985154155a4e9387a11ada066515de26486301dddbaf
9db3bdee7cf3e11c87d8cc7673d4d25b ltrace-0.7.91.tar.bz2

View file

@ -8,8 +8,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
void child() {
printf("Fork Child\n");
@ -26,7 +24,7 @@ int main() {
child();
else {
printf("My child pid is %d\n",pid);
wait(NULL);
wait();
}
return 0;
}

View file

@ -55,8 +55,8 @@ rlJournalStart
fi
;;
esac
elif rlIsRHEL ">=9" && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "RHEL >=9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking"
elif rlIsRHEL 9 && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "RHEL-9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking"
skip_test=1
elif rlIsFedora 33 && [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "FC33 ltrace fails to trace system binaries on ppc64le due to bz#1902770, hence skipping failure checking"

View file

@ -3,7 +3,6 @@
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#ifndef NI_MAXHOST

View file

@ -25,7 +25,7 @@ export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.c
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean

View file

@ -1,7 +0,0 @@
#include <unistd.h>
int main()
{
alarm(42);
return 0;
}

View file

@ -28,12 +28,11 @@ rlJournalStart
rlAssertRpm $(rpm -qf $(which gcc))
rlShowRunningKernel
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp reproducer.c $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest "ltrace with -o and -c options tracing testing binary"
rlRun "gcc -x c -o test.bin reproducer.c"
rlRun "echo 'int main(){alarm(42);return 0;}'| gcc -x c -o test.bin -"
rlRun "ltrace -o ltrace-test.log -c ./test.bin" 0 "ltrace is crunching a testing binary"
rlRun -l "cat ltrace-test.log"
rlAssertGrep "alarm" ltrace-test.log
@ -59,8 +58,8 @@ rlJournalStart
fi
;;
esac
elif rlIsRHEL ">=9" && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "RHEL >=9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking"
elif rlIsRHEL 9 && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "RHEL-9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking"
skip_system_binary_test=1
elif rlIsFedora 33 && [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "FC33 ltrace fails to trace system binaries on ppc64le due to bz#1902770, hence skipping failure checking"
@ -68,22 +67,15 @@ rlJournalStart
fi
# ltrace no longer reports __libc_start_main on rhel-8 x86_64 (rhbz#1654734)
# search for either malloc or ioctl.
func_found=0
for traced_func in "malloc" "ioctl"; do
if grep "$traced_func" ltrace-test-sys.log; then
func_found=1
fi
done
if [ $func_found -ne 0 ]; then
if grep "ioctl" ltrace-test-sys.log; then
if [ $skip_system_binary_test ]; then
rlLogWarning "Test was skipped but it seems ok. Review skip check."
fi
else
if [ $skip_system_binary_test ]; then
rlLogInfo "ltrace output does not contain ioctl or malloc calls (expected failure)"
rlLogInfo "ltrace output does not contain ioctl calls (expected failure)"
else
rlFail "ltrace output does not contain ioctl or malloc calls"
rlFail "ltrace output does not contain ioctl calls"
fi
fi

View file

@ -42,7 +42,6 @@ rlJournalStart
#include <stdio.h>
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>
int main()
{

View file

@ -32,7 +32,7 @@ CMD='ltrace'
BIN=$(which --skip-alias $CMD)
PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN)}"
if rlIsRHEL ">=9" || rlIsFedora; then
if rlIsRHEL 9 || rlIsFedora; then
PROC_NAME=dbus-broker
SERVICE_NAME=dbus-broker
elif rlIsRHEL 6; then
@ -46,19 +46,19 @@ fi
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "pgrep -x $PROC_NAME || service $SERVICE_NAME start" 0 "Checking/starting $SERVICE_NAME"
rlRun "pgrep $PROC_NAME || service $SERVICE_NAME start" 0 "Checking/starting $SERVICE_NAME"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "PID='$(pidof -s $PROC_NAME)'"
rlRun "PID=$(pidof $PROC_NAME)"
# try to ltrace dbus-daemon. If there is a bug (BZ#1360259), it will crash
rlWatchdog "ltrace -S -p $PID > output.log 2>&1" 30 INT
rlAssertEquals "ltrace is expected to be terminated by watchdog" 1 "$?"
rlLog "output.log: $(cat output.log)"
rlAssertNotGrep "\(Assertion.*failed\|Segmentation fault\)" output.log
rlAssertEquals "$PROC_NAME is expected to be still running" $PID "$(pidof -s $PROC_NAME)"
rlAssertEquals "$PROC_NAME is expected to be still running" $PID "$(pidof $PROC_NAME)"
rlFileSubmit output.log
rlPhaseEnd

View file

@ -29,7 +29,7 @@ export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.c
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean

View file

@ -10,10 +10,12 @@ framework: beakerlib
recommend:
- ltrace
- gcc
- libgcc
- glibc-devel
- libgcc.i686
- glibc-devel.i686
- libgcc.ppc64
- glibc-devel.ppc64
- libgcc.s390
- glibc-devel.s390
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=868281

View file

@ -1,7 +0,0 @@
#include <unistd.h>
int main()
{
alarm(42);
return 0;
}

View file

@ -39,16 +39,14 @@ rlJournalStart
rlAssertRpm $LTRACE_RPM
rlAssertRpm $GCC_RPM
rlAssertRpm $BINUTILS_RPM
ARCH="$(rlGetPrimaryArch)"
SARCH="$(rlGetSecondaryArch)"
for arch in $ARCH $SARCH; do
for arch in $(rlGetPrimaryArch) $(rlGetSecondaryArch); do
rlCheckRpm glibc.$arch
done
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp reproducer.c $TmpDir"
rlRun "pushd $TmpDir"
if [ -d /usr/lib64 ]; then
ARCH=`uname -i`
if [[ $ARCH =~ s390.* ]]; then
if rlIsRHEL '>=8'; then
rlLogInfo "RHEL-8 and newer do not support s390x 31-bit compilation"
@ -64,9 +62,6 @@ rlJournalStart
elif [[ $ARCH =~ ia64|aarch64|ppc64le ]]; then
rlLogInfo "$ARCH does not support 32-bit compilation"
MBITS=
elif rlIsRHEL ">=10"; then
rlLogInfo "RHEL >=10 does not support 32-bit packages"
MBITS=
else
MBITS=32
fi
@ -74,11 +69,11 @@ rlJournalStart
rlLogInfo "MBITS=$MBITS"
rlRun "$GCC -fPIE -pie -x c reproducer.c -o a-native.out"
rlRun "echo 'int main(){alarm(42);return 0;}'| $GCC -fPIE -pie -x c -o a-native.out -"
rlAssertExists a-native.out
if [ -n "$MBITS" ]; then
rlRun "$GCC -fPIE -pie -m$MBITS -x c reproducer.c -o a-$MBITS.out"
rlRun "echo 'int main(){alarm(42);return 0;}'| $GCC -fPIE -pie -m$MBITS -x c -o a-$MBITS.out -"
rlAssertExists a-$MBITS.out
fi
rlPhaseEnd

View file

@ -1,64 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support
# Description: Test for BZ#1449588 (Can ltrace be built with backtrace support?)
# Author: Edjunior Machado <emachado@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Edjunior Machado <emachado@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1449588 (Can ltrace be built with backtrace support?)" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1449588" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -1,5 +0,0 @@
PURPOSE of /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support
Description: Test for BZ#1449588 (Can ltrace be built with backtrace support?)
Author: Edjunior Machado <emachado@redhat.com>
Bug summary: Can ltrace be built with backtrace support?
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1449588

View file

@ -1,16 +0,0 @@
summary: Test for BZ#1449588 (Can ltrace be built with backtrace support?)
description: |
Bug summary: Can ltrace be built with backtrace support?
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1449588
contact: Edjunior Machado <emachado@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1449588
extra-summary: /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support
extra-task: /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support

View file

@ -1,53 +0,0 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support
# Description: Test for BZ#1449588 (Can ltrace be built with backtrace support?)
# Author: Edjunior Machado <emachado@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
CMD="ltrace"
PACKAGE=$(rpm -qf $(which $CMD))
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
set -o pipefail
rlRun -l "ltrace --help |& tee help-output.log" 0 "Collecting help output"
rlRun -l "grep -- '-w, --where=NR.*print backtrace showing NR stack frames at most.' help-output.log" 0 "Checking if '-w, --where=NR' parameter is available on help output"
rlRun -l "ltrace -w 4 /bin/ls" 0 "Trivial smoke test"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -1,64 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Sanity/random-apps
# Description: Runs random app which caused strace problems in the past
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/ltrace/Sanity/random-apps
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE *.c
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Runs random app which caused strace problems in the past" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 1h" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace" >> $(METADATA)
@echo "Requires: gcc glibc-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: yes" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -1,3 +0,0 @@
PURPOSE of /tools/ltrace/Sanity/random-apps
Description: Runs random app which caused strace problems in the past
Author: Michal Nowak <mnowak@redhat.com>

View file

@ -1,6 +0,0 @@
#include <stdlib.h>
int main() {
abort();
}

View file

@ -1,14 +0,0 @@
summary: Runs random app which caused strace problems in the past
description: ''
contact: Michal Nowak <mnowak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- gcc
- glibc-devel
duration: 1h
extra-summary: /tools/ltrace/Sanity/random-apps
extra-task: /tools/ltrace/Sanity/random-apps

View file

@ -1,35 +0,0 @@
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <stdlib.h>
static int thd_no;
static void *sub_thd(void *c)
{
fprintf(stderr, "sub-thread %d created\n", ++thd_no);
for (;;)
getuid();
return NULL;
}
int main(int argc, char *argv[])
{
int i;
pthread_t *thd;
int num_threads = 1;
if (argv[1])
num_threads = atoi(argv[1]);
thd = malloc(num_threads * sizeof(thd[0]));
fprintf(stderr, "test start, num_threads:%d...\n", num_threads);
for (i = 0; i < num_threads; i++) {
pthread_create(&thd[i], NULL, sub_thd, NULL);
fprintf(stderr, "after pthread_create\n");
}
/* Exit. This kills all threads */
return 0;
}

View file

@ -1,44 +0,0 @@
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#define NTHD 60
int thd_no;
long sub_func(void)
{
uid_t uid;
printf("sub-thread created: %d\n", ++thd_no);
for (;;) {
uid = getuid();
sleep(1);
}
return (long)uid;
}
void *sub_thd(void *c)
{
sub_func();
}
int main(int argc, char *argv[])
{
int i;
pthread_t thd[NTHD];
printf("test start...\n");
for (i = 0; i < NTHD; i++) {
pthread_create(&thd[i], NULL, sub_thd, NULL);
}
// pause();
return 0;
}

View file

@ -1,15 +0,0 @@
#include <pthread.h>
#include <unistd.h>
void *start (void *arg) {
return arg;
}
pthread_t thread1;
int main () {
pthread_create (&thread1, NULL, start, NULL);
sleep (1);
return 0;
}

View file

@ -1,15 +0,0 @@
#include <stddef.h>
#include <signal.h>
static void h(int sig) {}
int main()
{
struct sigaction sa;
sigemptyset(&sa.sa_mask);
sa.sa_handler = h;
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
sigaction (SIGUSR1, &sa, NULL);
return 0;
}

View file

@ -1,15 +0,0 @@
#include <pthread.h>
#include <unistd.h>
void *start (void *arg) {
return arg;
}
pthread_t thread1;
int main () {
pthread_create (&thread1, NULL, start, NULL);
sleep (1);
return 0;
}

View file

@ -1,101 +0,0 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Sanity/random-apps
# Description: Runs random app which caused strace problems in the past
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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
CMD='ltrace'
BIN=$(which --skip-alias $CMD)
PACKAGE="$(rpm -qf --qf='%{name}\n' $BIN)"
#export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
cp *.c $TmpDir
rlRun "pushd $TmpDir"
rlPhaseEnd
touch FAILED PASSED
PASSED_CNT=0
FAILED_CNT=0
ALL_CNT=0
for test in *.c; do
RESULT="PASS"
rlPhaseStartTest "Test ${test}"
rlRun "gcc $test -o ${test}.bin -lpthread" 0 "Compile $test"
rlAssertExists "${test}.bin"
rlRun "ltrace -o ${test}.LOG -f ./${test}.bin" 0 "Run $test under ltrace"
[ $? -ne 0 ] && RESULT=FAIL
echo
cat ${test}.LOG
echo
rlAssertNotGrep "\-\-\- SIGKILL" ${test}.LOG
[ $? -ne 0 ] && RESULT=FAIL
rlAssertNotGrep "\-\-\- SIGSEGV" ${test}.LOG
[ $? -ne 0 ] && RESULT=FAIL
rlAssertNotGrep "\-\-\- SIGILL" ${test}.LOG
[ $? -ne 0 ] && RESULT=FAIL
rlAssertNotGrep "\-\-\- SIGTRAP" ${test}.LOG
[ $? -ne 0 ] && RESULT=FAIL
rlAssertNotGrep "\-\-\- SIGINT" ${test}.LOG
[ $? -ne 0 ] && RESULT=FAIL
if [[ "$RESULT" == "PASS" ]]; then
let "PASSED_CNT = $PASSED_CNT + 1"
echo "$test $opt" >> PASSED
else
let "FAILED_CNT = $FAILED_CNT + 1"
echo "$test $opt" >> FAILED
fi
let "ALL_CNT = $ALL_CNT + 1"
rlPhaseEnd
done
rlPhaseStartTest
rlLog "PASSED : $PASSED_CNT of $ALL_CNT"
cat PASSED
rlLog "FAILED : $FAILED_CNT of $ALL_CNT"
cat FAILED
if [ $FAILED_CNT -eq 0 ]; then
rlPass "All testcases passed."
else
rlFail "There are some errors."
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "tar c *.LOG *.bin PASSED FAILED | gzip > logs.tar.gz"
rlFileSubmit "logs.tar.gz"
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -1,8 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
printf("Linux\n");
exit(0);
}

View file

@ -1,6 +0,0 @@
#include <unistd.h>
int main()
{
sleep (15);
}

View file

@ -1,220 +0,0 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <sys/mman.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/sem.h>
#include <unistd.h>
//#include "trigger_error.h"
#define THREAD_NUM 100
#define MALLOC_LEN 1024*1024*10
#define DEFAULT_NUM 0
#define MAXSEM 5
int fd[10000];
int fullid;
int emptyid;
int mutxid;
union semun
{
int val; /* Value for SETVAL */
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
unsigned short *array; /* Array for GETALL, SETALL */
struct seminfo *__buf; /* Buffer for IPC_INFO (Linux-specific) */
};
void *thread_handle_a(void *temp);
int main(int argc, char *argv[])
{
pthread_t tid_a;
int i;
int ai[THREAD_NUM];
int ret_a = -1;
int file_num;
char filename[10];
char str[20];
struct sembuf P, V;;
union semun arg;
pid_t pid;
int *array;
int *sum;
int *set;
int *get;
if (DEFAULT_NUM == 0) {
file_num = 10;
}
#ifdef STS_SLEEP
sleep(10);
#endif
for (i = 0; i < file_num; i++) {
sprintf(filename, "%d", i);
printf("open fd%d\n", i);
fd[i] = open(filename, O_RDONLY);
if (fd[i] < 0)
continue;
if (read(fd[i], str, sizeof(str)) < 0) {
close(fd[i]);
fd[i] = -1;
continue;
}
printf("%s", str);
}
for (i = 0; i < file_num; i++) {
if (fd[i] >= 0) {
close(fd[i]);
}
}
for (i = 0; i < file_num; i++) {
fd[0] = open("/dev/null", O_RDONLY);
if (fd[0] < 0) {
perror("open /dev/null");
continue;
}
close(fd[0]);
}
for (i = 0; i < file_num; i++) {
fd[0] = open("/proc/meminfo", O_RDONLY);
if (fd[0] < 0) {
perror("open /proc/meminfo");
continue;
}
if (read(fd[0], str, sizeof(str)) < 0) {
close(fd[0]);
continue;
}
printf("%s\n", str);
close(fd[0]);
}
for (i = 0; i < file_num; i++) {
fd[0] = open("/proc/self/maps", O_RDONLY);
if (fd[0] < 0) {
perror("open /proc/meminfo");
continue;
}
if (read(fd[0], str, sizeof(str)) < 0) {
close(fd[0]);
continue;
}
printf("%s\n", str);
close(fd[0]);
}
array =
(int *)mmap(NULL, sizeof(int) * 5, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
sum =
(int *)mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
get =
(int *)mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
set =
(int *)mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
*sum = 0;
*get = 0;
*set = 0;
fullid = semget(IPC_PRIVATE, 1, IPC_CREAT | 00666);
emptyid = semget(IPC_PRIVATE, 1, IPC_CREAT | 00666);
mutxid = semget(IPC_PRIVATE, 1, IPC_CREAT | 00666);
arg.val = 0;
if (semctl(fullid, 0, SETVAL, arg) == -1)
perror("semctl setval error");
arg.val = MAXSEM;
if (semctl(emptyid, 0, SETVAL, arg) == -1)
perror("semctl setval error");
arg.val = 1;
if (semctl(mutxid, 0, SETVAL, arg) == -1)
perror("setctl setval error");
V.sem_num = 0;
V.sem_op = 1;
V.sem_flg = SEM_UNDO;
P.sem_num = 0;
P.sem_op = -1;
P.sem_flg = SEM_UNDO;
i = 0;
while (i < 5) {
semop(emptyid, &P, 1);
semop(mutxid, &P, 1);
array[*(set) % MAXSEM] = i + 1;
printf("Producer %d\n", array[(*set) % MAXSEM]);
(*set)++;
fflush(NULL);
semop(mutxid, &V, 1);
semop(fullid, &V, 1);
i++;
}
semctl(fullid, 0, IPC_RMID);
semctl(emptyid, 0, IPC_RMID);
semctl(mutxid, 0, IPC_RMID);
if ((pid = fork()) == 0) {
for (i = 0; i < THREAD_NUM; i++) {
ai[i] = i;
ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]);
printf("thread a : \n");
if (ret_a == 0) {
pthread_detach(tid_a);
}
}
} else if (pid > 0) {
for (i = 0; i < THREAD_NUM; i++) {
ai[i] = i;
ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]);
printf("thread a : \n");
if (ret_a == 0) {
pthread_detach(tid_a);
}
}
} else {
printf("fork error\n");
}
fflush(NULL);
write(1, "BEFORE_ERROR\n", 13);
//trigger_error();
raise(SIGFPE);
write(1, "EXIT_FLAG\n", 10);
return 10;
}
void *thread_handle_a(void *t)
{
long page_size = MALLOC_LEN;
int j = *(int *)t;
char *addr;
addr = (char *)malloc(page_size);
if (addr != NULL) {
sprintf(addr, "hello");
printf("(a) malloc %d success: %s\n", j, addr);
} else {
printf("(a)malloc %d failed\n", j);
}
printf("thread (a) will exit\n");
fflush(NULL);
return NULL;
}

View file

@ -1,52 +0,0 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int pfd[2];
pid_t pid = -1;
int rc = 0;
char buf[BUFSIZ];
sigset_t sig_mask;
/*
* Mask of SIGTRAP
* Initialize of the value of sig_mask
*/
sigemptyset(&sig_mask);
/* Set of SIGTRAP in sig_mask */
sigaddset(&sig_mask, SIGTRAP);
/* Set of SIGTRAP */
sigprocmask(SIG_SETMASK, &sig_mask, NULL);
rc = pipe(pfd);
if(rc == -1){
perror("pipe Error\n");
exit (1);
}
pid = fork();
if (pid == -1){
perror("Fork Error\n");
exit (1);
} else if (pid == 0) {
close(pfd[0]);
close(1);
dup(pfd[1]);
close(pfd[1]);
execl("./test2.sh", (char *)0);
exit(0);
} else {
close(pfd[1]);
while((read(pfd[0], buf, sizeof(buf))) > 0) {
printf("%s", buf);
}
close(pfd[0]);
wait(NULL);
exit(0);
}
}

View file

@ -1,78 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <sys/wait.h>
#define DEFAULT_NUM 0
#define THREAD_NUM 3
#define MALLOC_LEN 1024*1024*10
void *thread_handle_a(void *t)
{
long page_size = MALLOC_LEN;
int j = *(int *)t;
char *ptr;
char *addr;
struct stat buf;
addr = (char *)malloc(page_size);
if (addr != NULL) {
sprintf(addr, "hello");
printf("(a) malloc %d success: %s\n", j, addr);
} else {
printf("(a)malloc %d failed\n", j);
}
printf("thread (a) will exit\n");
fflush(NULL);
if(addr != NULL)
free(addr);
return NULL;
}
int main()
{
int i = 0;
pid_t pid;
pthread_t tid_a;
int ai[THREAD_NUM];
int ret_a = -1;
#ifdef STS_SLEEP
sleep(10);
#endif
if ((pid = fork()) == 0) {
for (i = 0; i < THREAD_NUM; i++) {
ai[i] = i;
ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]);
printf("thread a : \n");
if (ret_a == 0) {
pthread_detach(tid_a);
}
}
} else if (pid > 0) {
for (i = 0; i < THREAD_NUM; i++) {
ai[i] = i;
ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]);
printf("thread a : \n");
if (ret_a == 0) {
pthread_detach(tid_a);
}
}
waitpid(pid, NULL, 0);
fflush(NULL);
write(1, "EXIT_FLAG\n", 10);
} else {
printf("fork error\n");
}
return 0;
}

View file

@ -1,71 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#define MAXBUF 1024
#define THREAD_NUM 100
#define MALLOC_LEN 1024*1024*10
void *thread_handle_a(void *t)
{
long page_size = MALLOC_LEN;
int j = *(int *)t;
char *addr;
addr = (char *)malloc(page_size);
if (addr != NULL) {
sprintf(addr, "hello");
printf("(a) malloc %d success: %s\n", j, addr);
} else {
printf("(a)malloc %d failed\n", j);
}
printf("thread (a) will exit\n");
fflush(NULL);
return NULL;
}
int main(int argc, char **argv)
{
fd_set wfds;
struct timeval tv;
int retval, maxfd = -1;
pthread_t tid_a;
int i;
int ai[THREAD_NUM];
int ret_a = -1;
sleep(5);
for (i = 0; i < THREAD_NUM; i++) {
ai[i] = i;
ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]);
printf("thread a : \n");
if (ret_a == 0) {
pthread_detach(tid_a);
}
}
FD_ZERO(&wfds);
FD_SET(STDOUT_FILENO, &wfds);
maxfd = STDOUT_FILENO;
tv.tv_sec = 1;
tv.tv_usec = 0;
retval = select(maxfd+1, NULL, &wfds, NULL, &tv);
if (retval == -1) {
fprintf(stderr, "select failed\n");
} else if (retval == 0){
printf("Time out\n");
} else {
printf("stdout can be write\n");
}
printf("EXIT_FLAG\n");
return 0;
}

View file

@ -1,34 +0,0 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <signal.h>
#define THREAD_NUM 32
void *thread_function (void *);
int main (int argc, char *argv[])
{
int i =0, x = 0;
int res = 0;
pthread_t a_thread[THREAD_NUM];
void *thread_result;
for (i = 0; i < THREAD_NUM; i++) {
res = pthread_create (&a_thread[i], NULL, thread_function, (void *)0);
if (res != 0) {
printf("Thread create failed\n");
return (10);
}
}
raise(SIGABRT);
return (0);
}
void *thread_function (void *arg)
{
sleep(1);
printf("Thread TEST\n");
}

View file

@ -1,15 +0,0 @@
#define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
int main (void)
{
pid_t child = vfork ();
/* PRINTF/SLEEP violate the VFORK operations restriction. */
printf ("%d pid=%d\n", (int) child, (int) getpid ());
sleep (1);
if (!child)
execlp ("/bin/true", "/bin/true", NULL);
return 0;
}

View file

@ -1,71 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Sanity/testsuite
# Description: upstream tests for ltrace
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/ltrace/Sanity/testsuite
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: upstream tests for ltrace" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5h" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace" >> $(METADATA)
@echo "Requires: gcc" >> $(METADATA)
@echo "Requires: gcc-c++" >> $(METADATA)
@echo "Requires: libstdc++" >> $(METADATA)
@echo "Requires: libstdc++-devel" >> $(METADATA)
@echo "Requires: rpm-build yum-utils" >> $(METADATA)
@echo "Requires: elfutils-devel" >> $(METADATA)
@echo "Requires: dejagnu" >> $(METADATA)
@echo "Requires: libselinux-devel" >> $(METADATA)
@echo "Requires: libtool" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -1,3 +0,0 @@
PURPOSE of /tools/ltrace/Sanity/testsuite
Description: upstream tests for ltrace
Author: Martin Cermak <mcermak@redhat.com>

View file

@ -1,23 +0,0 @@
summary: upstream tests for ltrace
description: ''
contact: Martin Cermak <mcermak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- gcc
- gcc-c++
- libstdc++
- libstdc++-devel
- rpm-build
- yum-utils
- elfutils-devel
- dejagnu
- libselinux-devel
- libtool
- koji
duration: 5h
extra-summary: /tools/ltrace/Sanity/testsuite
extra-task: /tools/ltrace/Sanity/testsuite

View file

@ -1,91 +0,0 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Sanity/testsuite
# Description: upstream tests for ltrace
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
CMD='ltrace'
BIN=$(which --skip-alias $CMD)
PACKAGE="${PACKAGE:-$(rpm -qf $BIN)}"
export PACKAGE
GCC=${GCC:-gcc}
export GCC
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun -l "rpm -qf $(which $GCC)" 0 "Checking gcc rpm version"
rlRun "NVR=$(rpm -q --qf='%{NAME}-%{VERSION}-%{RELEASE}' $PACKAGE)"
rlRun "TMP=`mktemp -d`"
rlRun "pushd $TMP"
set -x
dnf download --disablerepo='*' --enablerepo=test-artifacts --source $NVR || \
cp /var/share/test-artifacts/$NVR.src.rpm . || \
rlFetchSrcForInstalled ltrace
set +x
rlRun "dnf builddep -y $NVR.src.rpm"
rlRun "rpm --define='_topdir $TMP' -Uvh $NVR.src.rpm"
rlRun "${RPMBUILD_GCC:+CC=$RPMBUILD_GCC} rpmbuild --define='_topdir $TMP' -bc SPECS/${CMD}.spec"
MAKEFILE_PATH=$(ls BUILD/${CMD}-*/Makefile 2>/dev/null)
if [[ -z "$MAKEFILE_PATH" ]]; then
MAKEFILE_PATH=$(ls BUILD/${CMD}-*/${CMD}-*/Makefile 2>/dev/null)
fi
rlLogInfo "MAKEFILE_PATH=$MAKEFILE_PATH"
rlPhaseEnd
rlPhaseStartTest
rlRun "pushd ${MAKEFILE_PATH%/Makefile}"
# known issues to be ignored
ignore_list=''
rlRun "ignore_list+=' system_calls.exp'" 0 "Failure reported bz#1963110"
# define --ignore parameter for 'make check' if there is any testcase to be ignored
[ -n "$ignore_list" ] && rlRun "ignore_param=\"--ignore '$ignore_list'\"" 0 "Ignored testcases that will not be run: $ignore_list"
# test
set -o pipefail
rlRun "make check RUNTESTFLAGS=\"--tool_exec=$BIN CC_FOR_TARGET=$GCC $ignore_param\" |& tee $TMP/check.log"
rlRun "popd"
# no unexpected results should appear
rlRun -l "grep '^FAIL:' check.log" 1
rlRun -l "grep '^# of unexpected' check.log" 1
rlFileSubmit "$TMP/check.log" "$PACKAGE-check.log"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMP"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd