Compare commits

...
Sign in to create a new pull request.

64 commits

Author SHA1 Message Date
DJ Delorie
a8c41cd354 Rebase to ltrace 0.8.1 2025-09-16 12:54:36 -04:00
Fedora Release Engineering
955c1e43d1 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 20:55:16 +00:00
Fedora Release Engineering
10f68c7444 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 16:07:24 +00:00
Martin Coufal
287df279b5 tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option: make pidof return only one PID 2024-11-13 13:59:27 +01:00
Martin Coufal
4b0ed33102 tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries: fix for rhel10
* disable 32b part of the test for rhel10
* fix getting ARCH/SARCH
* move reproducer to a separate file, add missing include
2024-11-13 10:42:54 +01:00
Martin Coufal
665a435b81 tests: fix for rhel10
We use tests in Fedora for RHEL testing as well and some of the tests
need to be updated to compile and run successfully on RHEL-10.

* tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option:
  add missing includes, add NULL arg to wait()
* tests/Regression/211163-ltrace-with--c-omit-execl-call: fix IF
  condition to include rhel-10
* tests/Regression/427444-ltrace-crashes-process-to-be-analysed: add
  missing include
* tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file:
  moved reproducer to a separate file, add missing include, fix IF
  condition to include rhel-10
* tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots:
  add missing include
* tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option:
  fix IF condition to include rhel-10
* tests/Sanity/random-apps: add return type and return to main function,
  add missing includes, add semun union definition
2024-11-11 12:48:52 +01:00
Václav Kadlčík
d70730248f Fix gating tests on Rawhide 2024-09-18 14:16:14 +02:00
Fedora Release Engineering
941e708eb6 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 16:05:46 +00:00
Software Management Team
6444af4152 Eliminate use of obsolete %patchN syntax (#2283636) 2024-05-30 12:46:47 +02:00
Miroslav Suchý
4773a704b6 Migrate to SPDX license
This is a part of https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_3
2024-02-13 09:30:05 +00:00
Fedora Release Engineering
a77340edfd Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-25 04:54:45 +00:00
Fedora Release Engineering
15ef50aff4 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-21 06:18:29 +00:00
Fedora Release Engineering
cbc633d2a2 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 13:08:56 +00:00
Fedora Release Engineering
3abe3265ff Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 18:23:03 +00:00
Fedora Release Engineering
00f430ccbe Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-21 19:58:28 +00:00
Jesus Checa Hidalgo
dcc1247212 tests: fixes for gating tests
* plans/ci: setting "how: beakerlib" in execute step is deprecated.
  changed to "how: tmt" to comply with newer tmt versions.
  tmt versions.
* ltrace with both --o and --c does not produce output to file:
  add malloc to the list of syscalls to check for tracing.
* ltrace crashes when run on certain processes with --S option:
  make pgrep to exact match to avoid getting two PIDs, one from
  dbus-broker and other from dbus-broker-launch.
* ltrace doesn't work on PIE-binaries:
  Added missing 32-bit dependencies.
2022-05-11 13:54:16 +00:00
Carlos O'Donell
16ad28b259 Rebuild ltrace for rawhide (#2046722)
Resolves: #2046722
2022-05-03 10:03:37 -04:00
DJ Delorie
8b45d8ed68 Fix use-after-free in ppc64le's plt.c
Found by gcc 12

Resolves: #2046722
2022-01-27 23:25:46 -05:00
Fedora Release Engineering
464fde80d5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 18:10:39 +00:00
Martin Cermak
101cd9b6c3 CI testing: Fix the SRPM download
Usually, this test is used for gating ltrace.  In such case the
Fedora infrastructure offers the SRPM along with other ltrace
subrpms within a repo called "test-artifacts".

However, this test is also used to test dejagnu, because ltrace
has dejagnu based testsuite.  In such case the "test-artifacts"
repo has dejagnu, but not ltrace.

We need to be able to get the ltrace SRPM in both cases.
2021-11-12 09:09:08 +01:00
Martin Cermak
8fd295b7c5 Do not try to install compat arch requirements 2021-11-11 12:34:11 +01:00
Václav Kadlčík
809fa26deb Fix the setup in tests/Sanity/testsuite
"koji download-build" is a wrong tool to download artifacts being
tested. They are freshly scratch-built and hosted in a local repo
called "test-artifacts" unknown to koji. Using "dnf download"
directly and limited to that specific repo is a correct way to
reach them.

I'm adding a fallback using the repo's local files just in case
"dnf" suffers some temporary hiccup.
2021-09-24 13:12:50 +02:00
Václav Kadlčík
0e4ab8cfe4 Import RHEL's wrapper for the upstream test suite
Note: In RHEL, it's "testsuite2" outside of categories, here I'm adding
      it to the Sanity category.
Note: I've filed https://bugzilla.redhat.com/show_bug.cgi?id=1963110
      and included it as a known failure to make this test pass.
2021-08-17 16:31:24 +00:00
Václav Kadlčík
0554fda54f Import RHEL's test Sanity/random-apps
Note than several sub-tests (apps) had to be removed as unsuitable
for publishing.
2021-08-17 16:31:24 +00:00
Václav Kadlčík
c8ea90148a Import RHEL's test for RFE #1449588 2021-08-17 16:31:24 +00:00
Fedora Release Engineering
5ed23e066e - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 13:14:52 +00:00
Václav Kadlčík
04309572be Remove RHEL's test for #1427140
Right now it cannot work; it needs to access the source RPM for the
ltrace being tested which, in case of scratch builds, isn't currently
possible.
2021-05-19 15:40:27 +02:00
Václav Kadlčík
c0dedd804f Log more information in a regression test
To make the bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch work
not only for regular builds but for scratch builds as well, we need
to know how to refer them. This commit is just a temporary attempt to
find the environment variable holding the reference. I'll make use of
it in a follow-up commit.
2021-05-19 14:59:30 +02:00
Václav Kadlčík
d73a4e1684 Import a regression test from RHEL.
Sorry, no specific bug number, it wasn't recorded at that time and now
I can't find it, at least easily.
2021-05-19 13:29:09 +02:00
Václav Kadlčík
f20f6a9ea6 Import RHEL's regression test for #1158713
Note: I've prefixed the test with "bz1158713-" because ltrace's repo
      in Fedora ignores "ltrace-*/". See the .gitignore file.
2021-05-19 13:24:04 +02:00
Václav Kadlčík
9af7a027b2 Import RHEL's regression test for #211135 2021-05-19 13:16:02 +02:00
Václav Kadlčík
6c7c2d2b36 Import RHEL's regression test for #211163 2021-05-19 13:16:02 +02:00
Václav Kadlčík
6dd7382d3c Import RHEL's regression test for #223732 2021-05-19 13:16:02 +02:00
Václav Kadlčík
724196798c Import RHEL's regression test for #235671 2021-05-19 13:16:02 +02:00
Václav Kadlčík
644de0d37c Import RHEL's regression test for #427444 2021-05-19 13:16:02 +02:00
Václav Kadlčík
ec8db7cf57 Import RHEL's regression test for #447404 2021-05-19 13:16:01 +02:00
Václav Kadlčík
d7b87c0431 Import RHEL's regression test for #754096 2021-05-19 13:16:01 +02:00
Václav Kadlčík
f2f13e861b Import RHEL's regression test for #797761 2021-05-19 13:16:01 +02:00
Václav Kadlčík
ff856ee840 Import RHEL's regression test for #868281 2021-05-19 13:16:01 +02:00
Václav Kadlčík
b190a780c0 Import RHEL's regression test for #890961 2021-05-19 13:16:01 +02:00
Václav Kadlčík
4d182004cf Import RHEL's regression test for #1051221 2021-05-19 13:16:01 +02:00
Václav Kadlčík
cd59e55c7a Import RHEL's regression test for #1053765 2021-05-19 13:16:01 +02:00
Václav Kadlčík
dc3264a1bc Import RHEL's regression test for #1360259 2021-05-19 13:16:01 +02:00
Václav Kadlčík
fa03fb9fb0 Import RHEL's regression test for #1427140 2021-05-19 13:16:01 +02:00
DJ Delorie
7fad3fa72c Support ppc64le SCV syscall insn
If the kernel supports it AND glibc supports it, the ppc64le
syscalls may use the SCV variant instead of the SC variant.
The registers we care about have the same use so little change
is required.

Reference: RHEL BZ 1922305
2021-02-08 15:34:58 -05:00
Fedora Release Engineering
5ec9ca7d89 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 18:46:42 +00:00
Václav Kadlčík
e84d51dcc0 Introduce CI gating with a simple test 2021-01-18 16:44:54 +01:00
Tom Stellard
a3bd583aee Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2021-01-05 03:29:12 +00:00
Carlos O'Donell
bf46c36d90 Document official upstream. 2020-12-11 17:24:04 -05:00
Fedora Release Engineering
7583740404 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 06:22:42 +00:00
Tom Stellard
ddce3ea91b Use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
2020-07-14 20:47:11 +00:00
DJ Delorie
d258184038 Initialize some variables to avoid gcc warning
GCC cannot follow the logic that determines if it's safe to free
lrhs in expr.c.  Initializing these variables to NULL silences
this warning.

Resolves: #1799619
2020-02-06 17:06:01 -05:00
Fedora Release Engineering
26dcb3847a - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-29 11:23:18 +00:00
DJ Delorie
29bc5d8e70 Temporarily skip ppc64 tests
Tests on ppc64le are hanging koji, despite the forced timeout.
The rpmbuild finishes normally - even building rpms - but the
hung testcase keeps koji from seeing it as "done".

So skip tests on ppc64le for now, until we can fix the hang.
2019-07-23 15:05:27 -04:00
DJ Delorie
3306a47dce Testsuite fixed, aarch64 updates
- Add fixes in handling of bogus paths that come from XDG_CONFIG_DIRS.
- Testsuite fixes for pre-installed config files.
- Extra AARCH64 includes for gcc 9.
- Testsuite: AARCH64 ifuncs not supported yet yet.
2019-07-17 16:06:34 -04:00
DJ Delorie
33db0068ba Add Intel CET support
Adds two features:

1. Parsing CET-enabled PLTs.
2. Using a second "insecure" PLT as a fallback.
2019-04-04 17:23:36 -04:00
DJ Delorie
926a6be35e Revert previous patch.
Redundant.  Not esyr's fault.
2019-03-12 20:34:42 -04:00
Eugene Syromiatnikov
5695a6a3e5 Fix "Too many return value classes" assert
Patch to ensure e_machine is properly initialized in some cases where
we attach to a running multi-threaded process.
2019-03-05 17:51:33 -05:00
Fedora Release Engineering
32b5bcdc8d - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-01 09:06:12 +00:00
Igor Gnatenko
2aadca5477 Remove obsolete Group tag
References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag
2019-01-28 20:24:14 +01:00
Jeff Law
6ec3ae3207 - Avoid passing NULL as argument to %s in printf call 2019-01-16 15:06:46 -07:00
Fedora Release Engineering
b29373d636 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-13 09:25:07 +00:00
Jason Tibbitts
d85198bfb5 Remove needless use of %defattr 2018-07-10 01:50:56 -05:00
DJ Delorie
22553ad6c5 Fix AARCH64 params
- Fix aarch64 long parameters (via $r8) support.
- Make system_call_params test compare more exactly.
2018-07-06 14:54:28 -04:00
115 changed files with 4352 additions and 127 deletions

1
.fmf/version Normal file
View file

@ -0,0 +1 @@
1

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ 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

13
gating.yaml Normal file
View file

@ -0,0 +1,13 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View file

@ -0,0 +1,13 @@
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

@ -0,0 +1,151 @@
diff -rupN a/options.c b/options.c
--- a/options.c 2019-06-28 17:15:31.515626363 -0400
+++ b/options.c 2019-06-28 17:18:59.490632337 -0400
@@ -440,7 +440,8 @@ parse_int(const char *optarg, char opt,
}
int
-parse_colon_separated_list(const char *paths, struct vect *vec)
+parse_colon_separated_list(const char *paths, struct vect *vec,
+ enum opt_F_origin origin)
{
/* PATHS contains a colon-separated list of directories and
* files to load. It's modeled after shell PATH variable,
@@ -467,6 +468,7 @@ parse_colon_separated_list(const char *p
struct opt_F_t arg = {
.pathname = tok,
.own_pathname = tok == clone,
+ .origin = origin,
};
if (VECT_PUSHBACK(vec, &arg) < 0)
/* Presumably this is not a deal-breaker. */
@@ -494,16 +496,18 @@ opt_F_get_kind(struct opt_F_t *entry)
if (entry->kind == OPT_F_UNKNOWN) {
struct stat st;
if (lstat(entry->pathname, &st) < 0) {
- fprintf(stderr, "Couldn't stat %s: %s\n",
- entry->pathname, strerror(errno));
+ if (entry->origin == OPT_F_CMDLINE)
+ fprintf(stderr, "Couldn't stat %s: %s\n",
+ entry->pathname, strerror(errno));
entry->kind = OPT_F_BROKEN;
} else if (S_ISDIR(st.st_mode)) {
entry->kind = OPT_F_DIR;
} else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
entry->kind = OPT_F_FILE;
} else {
- fprintf(stderr, "%s is neither a regular file, "
- "nor a directory.\n", entry->pathname);
+ if (entry->origin == OPT_F_CMDLINE)
+ fprintf(stderr, "%s is neither a regular file, "
+ "nor a directory.\n", entry->pathname);
entry->kind = OPT_F_BROKEN;
}
}
@@ -607,7 +611,8 @@ process_options(int argc, char **argv)
options.follow = 1;
break;
case 'F':
- parse_colon_separated_list(optarg, &opt_F);
+ parse_colon_separated_list(optarg, &opt_F,
+ OPT_F_CMDLINE);
break;
case 'h':
usage();
diff -rupN a/options.h b/options.h
--- a/options.h 2019-06-28 17:15:31.515626363 -0400
+++ b/options.h 2019-06-28 17:18:55.984632238 -0400
@@ -1,6 +1,6 @@
/*
* This file is part of ltrace.
- * Copyright (C) 2012,2013 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2012, 2013, 2015 Petr Machata, Red Hat Inc.
* Copyright (C) 2009,2010 Joe Damato
* Copyright (C) 1998,2002,2008 Juan Cespedes
* Copyright (C) 2006 Ian Wienand
@@ -77,10 +77,16 @@ enum opt_F_kind {
OPT_F_DIR,
};
+enum opt_F_origin {
+ OPT_F_CMDLINE = 0,
+ OPT_F_ENVIRON,
+};
+
struct opt_F_t {
char *pathname;
int own_pathname : 1;
enum opt_F_kind kind : 2;
+ enum opt_F_origin origin : 1;
};
/* If entry->kind is OPT_F_UNKNOWN, figure out whether it should be
@@ -98,7 +104,8 @@ void opt_F_destroy(struct opt_F_t *entry
* The list is split and added to VEC, which shall be a vector
* initialized like VECT_INIT(VEC, struct opt_F_t); Returns 0 on
* success or a negative value on failure. */
-int parse_colon_separated_list(const char *paths, struct vect *vec);
+int parse_colon_separated_list(const char *paths, struct vect *vec,
+ enum opt_F_origin origin);
/* Vector of struct opt_F_t. */
extern struct vect opt_F;
diff -rupN a/sysdeps/linux-gnu/hooks.c b/sysdeps/linux-gnu/hooks.c
--- a/sysdeps/linux-gnu/hooks.c 2013-11-04 20:08:03.000000000 -0500
+++ b/sysdeps/linux-gnu/hooks.c 2019-06-28 17:18:55.989632238 -0400
@@ -1,6 +1,6 @@
/*
* This file is part of ltrace.
- * Copyright (C) 2012, 2013 Petr Machata
+ * Copyright (C) 2012, 2013, 2015 Petr Machata
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -153,7 +153,7 @@ again:
if (xdg_sys != NULL) {
struct vect v;
VECT_INIT(&v, struct opt_F_t);
- if (parse_colon_separated_list(xdg_sys, &v) < 0
+ if (parse_colon_separated_list(xdg_sys, &v, OPT_F_ENVIRON) < 0
|| VECT_EACH(&v, struct opt_F_t, NULL,
add_dir_component_cb, &dirs) != NULL)
fprintf(stderr,
diff -rupN a/testsuite/ltrace.main/XDG_CONFIG_DIRS.exp b/testsuite/ltrace.main/XDG_CONFIG_DIRS.exp
--- a/testsuite/ltrace.main/XDG_CONFIG_DIRS.exp 1969-12-31 19:00:00.000000000 -0500
+++ b/testsuite/ltrace.main/XDG_CONFIG_DIRS.exp 2019-06-28 17:18:55.989632238 -0400
@@ -0,0 +1,35 @@
+# This file is part of ltrace.
+# Copyright (C) 2015 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 {
+ int main() { return 0; }
+}]]
+
+setenv XDG_CONFIG_DIRS "blah"
+ltraceRun -L -- $bin
+unsetenv XDG_CONFIG_DIRS
+
+if {[catch "exec $LTRACE -L -F blah -- $bin" output]} {
+ ltraceMatch [ltraceSource ltrace "$output"] {
+ {blah == 1}
+ }
+} else {
+ fail "expected error message regarding `blah`"
+}
+
+ltraceDone

View file

@ -0,0 +1,24 @@
Index: ltrace-0.7.91/sysdeps/linux-gnu/aarch64/regs.c
===================================================================
--- ltrace-0.7.91.orig/sysdeps/linux-gnu/aarch64/regs.c
+++ ltrace-0.7.91/sysdeps/linux-gnu/aarch64/regs.c
@@ -23,6 +23,7 @@
#include <linux/uio.h>
#include <assert.h>
#include <stdlib.h>
+#include <stdio.h>
#include "backend.h"
#include "proc.h"
Index: ltrace-0.7.91/sysdeps/linux-gnu/aarch64/trace.c
===================================================================
--- ltrace-0.7.91.orig/sysdeps/linux-gnu/aarch64/trace.c
+++ ltrace-0.7.91/sysdeps/linux-gnu/aarch64/trace.c
@@ -24,6 +24,7 @@
#include <asm/ptrace.h>
#include <string.h>
#include <errno.h>
+#include <stdio.h>
#include "backend.h"
#include "proc.h"

View file

@ -0,0 +1,37 @@
diff -rup a/sysdeps/linux-gnu/aarch64/fetch.c b/sysdeps/linux-gnu/aarch64/fetch.c
--- a/sysdeps/linux-gnu/aarch64/fetch.c 2018-07-05 16:06:10.066626252 -0400
+++ b/sysdeps/linux-gnu/aarch64/fetch.c 2018-07-05 16:17:17.659748481 -0400
@@ -308,12 +308,9 @@ arch_fetch_arg_init(enum tof type, struc
struct fetch_script how = pass_arg(context, proc, ret_info);
if (how.c == CVT_ERR)
goto fail;
- if (how.c == CVT_NOP && how.f == FETCH_STACK) {
+ if (how.c == CVT_BYREF && how.f == FETCH_GPR) {
/* XXX double cast. */
context->x8 = (arch_addr_t) (uintptr_t) context->gregs.regs[8];
- /* See the comment above about the assert. */
- assert(! "Unexpected: first argument passed on stack.");
- abort();
}
return context;
diff -rup a/testsuite/ltrace.main/system_call_params.exp b/testsuite/ltrace.main/system_call_params.exp
--- a/testsuite/ltrace.main/system_call_params.exp 2018-07-05 16:06:10.516624926 -0400
+++ b/testsuite/ltrace.main/system_call_params.exp 2018-07-05 16:58:01.549830643 -0400
@@ -61,13 +61,13 @@ set conf [ltraceNamedSource "$dir/syscal
# doesn't list readdir, that would be taken from somelib.conf with a
# wrong prototype.
-ltraceMatch1 [ltraceRun -L -S -F $conf -- $bin] {^open@SYS\("/some/path"} == 0
+ltraceMatch1 [ltraceRun -L -S -F $conf -- $bin] {^open@SYS\("/some/path", 0\)} == 0
# On the other hand, if -F somedir/ is given, we want to accept
# syscalls.conf found there.
ltraceMatch [ltraceRun -L -S -F $dir -- $bin] {
- {{^open@SYS\("/some/path"} == 1}
+ {{^open@SYS\("/some/path", 0\)} == 1}
{{^write@SYS\(1, "something", 10\)} == 1}
{{^mount@SYS\("source", "target", "filesystemtype"} == 1}
}
Only in b/testsuite/ltrace.main: system_call_params.exp~

121
ltrace-0.7.91-cet.patch Normal file
View file

@ -0,0 +1,121 @@
diff -rup a/ltrace-elf.c b/ltrace-elf.c
--- a/ltrace-elf.c 2019-02-28 17:32:49.873659818 -0500
+++ b/ltrace-elf.c 2019-02-28 17:36:32.426779439 -0500
@@ -639,7 +639,21 @@ ltelf_read_elf(struct ltelf *lte, const
}
} else if (shdr.sh_type == SHT_PROGBITS
|| shdr.sh_type == SHT_NOBITS) {
- if (strcmp(name, ".plt") == 0) {
+ if (strcmp(name, ".plt") == 0
+ && lte->second_plt_seen == 0) {
+ lte->plt_addr = shdr.sh_addr;
+ lte->plt_size = shdr.sh_size;
+ lte->plt_data = elf_loaddata(scn, &shdr);
+ if (lte->plt_data == NULL)
+ fprintf(stderr,
+ "Can't load .plt data\n");
+ lte->plt_flags = shdr.sh_flags;
+ }
+ /* An Intel CET binary has two PLTs; the
+ initial PLTGOT points to the second
+ one. */
+ else if (strcmp(name, ".plt.sec") == 0) {
+ lte->second_plt_seen = 1;
lte->plt_addr = shdr.sh_addr;
lte->plt_size = shdr.sh_size;
lte->plt_data = elf_loaddata(scn, &shdr);
diff -rup a/ltrace-elf.h b/ltrace-elf.h
--- a/ltrace-elf.h 2019-02-28 17:32:49.874660328 -0500
+++ b/ltrace-elf.h 2019-02-28 17:36:32.428779868 -0500
@@ -45,6 +45,7 @@ struct ltelf {
Elf_Data *dynsym;
size_t dynsym_count;
const char *dynstr;
+ int second_plt_seen;
GElf_Addr plt_addr;
GElf_Word plt_flags;
size_t plt_size;
diff -rup a/sysdeps/linux-gnu/x86/plt.c b/sysdeps/linux-gnu/x86/plt.c
--- a/sysdeps/linux-gnu/x86/plt.c 2019-02-28 17:32:49.991720041 -0500
+++ b/sysdeps/linux-gnu/x86/plt.c 2019-02-28 17:36:32.429780083 -0500
@@ -28,18 +28,18 @@
#include "trace.h"
static GElf_Addr
-x86_plt_offset(uint32_t i)
+x86_plt_offset(struct ltelf *lte, uint32_t i)
{
/* Skip the first PLT entry, which contains a stub to call the
* resolver. */
- return (i + 1) * 16;
+ return (i + (lte->second_plt_seen ? 0 : 1)) * 16;
}
GElf_Addr
arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela *rela)
{
uint32_t i = *VECT_ELEMENT(&lte->arch.plt_map, uint32_t, ndx);
- return x86_plt_offset(i) + lte->plt_addr;
+ return x86_plt_offset(lte, i) + lte->plt_addr;
}
void *
@@ -116,6 +116,13 @@ arch_elf_init(struct ltelf *lte, struct
* 400426: 68 00 00 00 00 pushq $0x0
* 40042b: e9 e0 ff ff ff jmpq 400410 <_init+0x18>
*
+ * For CET binaries it is the following:
+ *
+ * 13d0: f3 0f 1e fa endbr64
+ * 13d4: 68 27 00 00 00 pushq $0x27 <-- index
+ * 13d9: f2 e9 71 fd ff ff bnd jmpq 1150 <.plt>
+ * 13df: 90 nop
+ *
* On i386, the argument to push is an offset of relocation to
* use. The first PLT slot has an offset of 0x0, the second
* 0x8, etc. On x86_64, it's directly the index that we are
@@ -128,11 +135,33 @@ arch_elf_init(struct ltelf *lte, struct
unsigned int i, sz = vect_size(&lte->plt_relocs);
for (i = 0; i < sz; ++i) {
- GElf_Addr offset = x86_plt_offset(i);
+ GElf_Addr offset = x86_plt_offset(lte, i);
+ uint32_t reloc_arg;
uint8_t byte;
- if (elf_read_next_u8(lte->plt_data, &offset, &byte) < 0
- || byte != 0xff
+ if (elf_read_next_u8(lte->plt_data, &offset, &byte) < 0)
+ continue;
+
+
+ if (byte == 0xf3
+ && elf_read_next_u8(lte->plt_data, &offset, &byte) >= 0
+ && byte == 0x0f
+ && elf_read_next_u8(lte->plt_data, &offset, &byte) >= 0
+ && byte == 0x1e
+ && elf_read_next_u8(lte->plt_data, &offset, &byte) >= 0
+ && byte == 0xfa
+ && elf_read_next_u8(lte->plt_data, &offset, &byte) >= 0
+ && byte == 0x68
+ && elf_read_next_u32(lte->plt_data,
+ &offset, &reloc_arg) >= 0)
+ {
+ /* CET */
+ fprintf(stderr, "%d: reloc_arg is %lx\n", i, (long)reloc_arg);
+ *VECT_ELEMENT(&lte->arch.plt_map, unsigned int, reloc_arg) = i;
+ continue;
+ }
+
+ if (byte != 0xff
|| elf_read_next_u8(lte->plt_data, &offset, &byte) < 0
|| (byte != 0xa3 && byte != 0x25))
continue;
@@ -140,7 +169,6 @@ arch_elf_init(struct ltelf *lte, struct
/* Skip immediate argument in the instruction. */
offset += 4;
- uint32_t reloc_arg;
if (elf_read_next_u8(lte->plt_data, &offset, &byte) < 0
|| byte != 0x68
|| elf_read_next_u32(lte->plt_data,

14
ltrace-0.7.91-null.patch Normal file
View file

@ -0,0 +1,14 @@
diff --git a/output.c b/output.c
index 7cab383..18f9cf0 100644
--- a/output.c
+++ b/output.c
@@ -598,6 +598,9 @@ frame_callback (Dwfl_Frame *state, void *arg)
NULL, NULL, NULL);
symname = dwfl_module_addrinfo(mod, pc, &off, &sym,
NULL, NULL, NULL);
+ } else {
+ modname = "unknown";
+ symname = "unknown";
}
/* This mimics the output produced by libunwind below. */

View file

@ -0,0 +1,20 @@
diff -rup a/sysdeps/linux-gnu/ppc/trace.c b/sysdeps/linux-gnu/ppc/trace.c
--- a/sysdeps/linux-gnu/ppc/trace.c 2021-02-08 14:35:16.876494095 -0500
+++ b/sysdeps/linux-gnu/ppc/trace.c 2021-02-08 15:05:59.468107311 -0500
@@ -57,6 +57,7 @@ get_arch_dep(struct process *proc)
}
#define SYSCALL_INSN 0x44000002
+#define SYSCALL2_INSN 0x44000001
/* Returns 1 if syscall, 2 if sysret, 0 otherwise. */
int
@@ -75,7 +76,7 @@ syscall_p(struct process *proc, int stat
0);
#endif
- if (insn == SYSCALL_INSN) {
+ if (insn == SYSCALL_INSN || insn == SYSCALL2_INSN) {
*sysnum =
(int)ptrace(PTRACE_PEEKUSER, proc->pid,
sizeof(long) * PT_R0, 0);

View file

@ -0,0 +1,16 @@
diff -rup a/expr.c b/expr.c
--- a/expr.c 2013-10-10 08:43:55.000000000 -0400
+++ b/expr.c 2020-02-06 17:05:40.658679755 -0500
@@ -189,10 +189,10 @@ int
expr_clone(struct expr_node *retp, const struct expr_node *node)
{
*retp = *node;
+ struct expr_node *nlhs;
+ struct expr_node *nrhs = NULL;
switch (node->kind) {
- struct expr_node *nlhs;
- struct expr_node *nrhs;
case EXPR_OP_ARGNO:
case EXPR_OP_SELF:

View file

@ -0,0 +1,68 @@
diff -rup a/testsuite/Makefile.am b/testsuite/Makefile.am
--- a/testsuite/Makefile.am 2012-12-16 20:53:45.000000000 -0500
+++ b/testsuite/Makefile.am 2019-06-28 16:59:19.935602953 -0400
@@ -39,6 +39,7 @@ 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)"' >> $@
+ echo set PREFIX '"$(prefix)"' >> $@
CLEANFILES = *.o *.so *.log *.sum *.ltrace site.bak setval.tmp site.exp env.exp
diff -rup a/testsuite/Makefile.in b/testsuite/Makefile.in
--- a/testsuite/Makefile.in 2013-11-04 20:22:47.000000000 -0500
+++ b/testsuite/Makefile.in 2019-06-28 16:59:12.075602806 -0400
@@ -648,6 +648,7 @@ 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)"' >> $@
+ echo set PREFIX '"$(prefix)"' >> $@
# 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.
diff -rup a/testsuite/ltrace.main/system_call_params.exp b/testsuite/ltrace.main/system_call_params.exp
--- a/testsuite/ltrace.main/system_call_params.exp 2019-06-28 16:44:07.542584754 -0400
+++ b/testsuite/ltrace.main/system_call_params.exp 2019-06-28 17:00:35.811604355 -0400
@@ -1,5 +1,5 @@
# This file is part of ltrace.
-# Copyright (C) 2013, 2014 Petr Machata, Red Hat Inc.
+# Copyright (C) 2013, 2014, 2015 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
@@ -60,8 +60,35 @@ set conf [ltraceNamedSource "$dir/syscal
# somelib.conf is passed, and syscalls.conf is not available, or
# doesn't list readdir, that would be taken from somelib.conf with a
# wrong prototype.
+#
+# This test relies on the fact that there is no global config file
+# that would provide legitimate system call prototypes. But that
+# doesn't have to be true, maybe ltrace is already installed on the
+# system with the right prefix. So first compile a wrapper that we
+# use to redirect fopen calls.
+
+set libfopen_so [ltraceCompile libfopen.so -ldl \
+ [ltraceSource c [string map [list "@PREFIX@" "$PREFIX"] {
+ #define _GNU_SOURCE
+ #include <dlfcn.h>
+ #include <stdio.h>
+ #include <string.h>
+
+ FILE *
+ fopen(const char *path, const char *mode)
+ {
+ #define PATH "@PREFIX@/share"
+ if (strncmp(path, PATH, sizeof(PATH) - 1) == 0)
+ path = "/dev/null";
+ return ((FILE *(*)(const char *, const char *))
+ dlsym(RTLD_NEXT, "fopen")) (path, mode);
+ }
+}]]]
+
+setenv LD_PRELOAD $libfopen_so
ltraceMatch1 [ltraceRun -L -S -F $conf -- $bin] {^open@SYS\("/some/path", 0\)} == 0
+unsetenv LD_PRELOAD
# On the other hand, if -F somedir/ is given, we want to accept
# syscalls.conf found there.

12
ltrace-rh1225568.patch Normal file
View file

@ -0,0 +1,12 @@
diff -Nrup a/testsuite/ltrace.minor/trace-irelative.exp b/testsuite/ltrace.minor/trace-irelative.exp
--- a/testsuite/ltrace.minor/trace-irelative.exp 2013-11-04 18:08:03.000000000 -0700
+++ b/testsuite/ltrace.minor/trace-irelative.exp 2015-06-01 12:30:59.737371166 -0600
@@ -54,6 +54,8 @@ set src [ltraceSource c {
}]
foreach ext {{} .pie} {
+ # ltrace does not yet support AARCH64's ifuncs
+ setup_xfail aarch64*-*-*
set bin1 [ltraceCompile $ext $src]
do_tests $bin1 ""
}

View file

@ -1,108 +1,21 @@
Summary: Tracks runtime library calls from dynamically linked executables
Name: ltrace
Version: 0.7.91
Release: 26%{?dist}
URL: http://ltrace.alioth.debian.org/
License: GPLv2+
Group: Development/Debuggers
Version: 0.8.1
Release: 1%{?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
BuildRequires: elfutils-devel dejagnu
BuildRequires: libselinux-devel
BuildRequires: autoconf automake libtool
BuildRequires: gcc-c++
BuildRequires: make
# 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
# https://gitlab.com/cespedes/ltrace/-/releases
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
%description
Ltrace is a debugging program which runs a specified command until the
command exits. While the command is executing, ltrace intercepts and
@ -115,51 +28,26 @@ 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
%build
autoreconf -i
%configure --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
make %{?_smp_mflags}
%make_build
%install
make DESTDIR=$RPM_BUILD_ROOT bindir=%{_bindir} install
%make_install bindir=%{_bindir}
# The testsuite is useful for development in real world, but fails in
# koji for some reason. Disable it, but have it handy.
%check
echo ====================TESTING=========================
# The ppc64 testsuite hangs rpmbuild hard in koji, disable until fixed.
%ifnarch ppc64le
timeout 180 make check ||:
%endif
echo ====================TESTING END=====================
%files
%defattr(-,root,root)
%doc NEWS COPYING CREDITS INSTALL README TODO
%{_bindir}/ltrace
%{_mandir}/man1/ltrace.1*
@ -167,6 +55,95 @@ 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
* Mon Feb 8 2021 DJ Delorie <dj@redhat.com> - 0.7.91-41
- Add support for SCV syscall insn for ppc64le
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-40
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-39
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 0.7.91-38
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Thu Feb 6 2020 DJ Delorie <dj@redhat.com> - 0.7.91-37
- Initialize some variables to avoid gcc warning (#1799619)
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-36
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Jul 23 2019 DJ Delorie <dj@redhat.com> - 0.7.91-35
- Skip ppc64 testsuite until the hangs in koji can be fixed.
* Wed Jul 17 2019 DJ Delorie <dj@redhat.com> - 0.7.91-34
- Add fixes in handling of bogus paths that come from XDG_CONFIG_DIRS.
- Testsuite fixes for pre-installed config files.
- Extra AARCH64 includes for gcc 9.
- Testsuite: AARCH64 ifuncs not supported yet yet.
* Thu Apr 4 2019 DJ Delorie <dj@redhat.com> - 0.7.91-33
- Add Intel CET support.
* Tue Mar 12 2019 DJ Delorie <dj@redhat.com> - 0.7.91-32
- Revert previous patch, redundant
* Tue Mar 5 2019 Eugene Syromiatnikov <esyr@redhat.com> - 0.7.91-31
- Fix "Too many return value classes" assert
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Jan 16 2019 Jeff Law <law@redhat.com> - 0.7.91-29
- Avoid passing NULL as argument to %s in printf call
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jul 05 2018 DJ Delorie <dj@redhat.com> - 0.7.91-27
- Fix aarch64 long parameters (via $r8) support.
- Make system_call_params test compare more exactly.
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.7.91-26
- Escape macros in %%changelog

6
plans/ci.fmf Normal file
View file

@ -0,0 +1,6 @@
summary: CI Gating Plan
discover:
how: fmf
directory: tests
execute:
how: tmt

View file

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

2
tests/README Normal file
View file

@ -0,0 +1,2 @@
The test's Makefiles are not used in Fedora CI infrastructure. But are kept here
for backward compatibility with traditional beakerlib test harness in RHEL.

View file

@ -0,0 +1,61 @@
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=ltrace
RELATIVE_PATH=Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.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
@touch $(METADATA)
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: ltrace hangs while tracing child process with -f option" >> $(METADATA)
@echo "Bug: 211135" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: glibc-devel" >> $(METADATA)
@echo "License: GPLv3+" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,2 @@
ltrace could possibly crash/hang when tracing fork() on ppc/ppc64
in ltrace with option "-f".

View file

@ -0,0 +1,17 @@
summary: ltrace hangs while tracing child process with -f option
description: |
ltrace could possibly crash/hang when tracing fork() on ppc/ppc64
in ltrace with option "-f".
contact: Michal Nowak <mnowak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- glibc-devel
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=211135
extra-summary: /tools/ltrace/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option
extra-task: /tools/ltrace/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option

View file

@ -0,0 +1,33 @@
/* Ltrace Test : trace-fork.c
* Objectives : Verify that ltrace can trace to child process after
* fork called.
*
* This file was written by Yao Qi <qiyao@cn.ibm.com>
*
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
void child() {
printf("Fork Child\n");
sleep(1);
}
int main() {
pid_t pid;
pid = fork ();
if (pid == -1)
printf("fork failed!\n");
else if (pid == 0)
child();
else {
printf("My child pid is %d\n",pid);
wait(NULL);
}
return 0;
}

View file

@ -0,0 +1,49 @@
#!/bin/bash
#
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# source the test script helpers
. /usr/bin/rhts_environment.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="$(rpm -qf $(which ltrace))"
rlJournalStart
rlPhaseStartSetup "Gathering information & compiling"
rlAssertRpm $PACKAGE
rlAssertRpm $(rpm -qf $(which gcc))
rlShowRunningKernel
rlRun "gcc reproducer.c -o reproducer" 0 "Compiling the reproducer"
rlPhaseEnd
rlPhaseStartTest
rlRun "ltrace -o ltrace-test.log -f ./reproducer" 0 "'ltrace -f' is crunching the reproducer"
rlAssertGrep "My child pid is" ltrace-test.log
rlAssertNotGrep "signal from wrong pid" ltrace-test.log
rlAssertGrep "SIGCHLD (Child exited)" ltrace-test.log
rlAssertNotGrep "Cannot attach to pid" ltrace-test.log
rlPhaseEnd
rlPhaseStartCleanup "Doing clean-up"
rlBundleLogs "ltrace-outputs" ltrace-test.log
rlRun "rm -f ltrace-test.log reproducer"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,61 @@
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=ltrace
RELATIVE_PATH=Regression/211163-ltrace-with--c-omit-execl-call
export TEST=/tools/ltrace/Regression/211163-ltrace-with--c-omit-execl-call
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.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: ltrace with -c omit execl call" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace gcc glibc-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv3+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 211163 528466" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1 @@
ltrace with -c omit execl call

View file

@ -0,0 +1,17 @@
summary: ltrace with -c omit execl call
description: |
ltrace with -c omit execl call
contact: Michal Nowak <mnowak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- gcc
- glibc-devel
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=211163
extra-summary: /tools/ltrace/Regression/211163-ltrace-with--c-omit-execl-call
extra-task: /tools/ltrace/Regression/211163-ltrace-with--c-omit-execl-call

View file

@ -0,0 +1,9 @@
#include <stdio.h>
#include <unistd.h>
int main()
{
execl("/bin/ls","ls",0);
return 0;
}

View file

@ -0,0 +1,109 @@
#!/bin/bash
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# source the test script helpers
. /usr/bin/rhts_environment.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE=$(rpm -qf $(which ltrace))
rlJournalStart
rlPhaseStartSetup "Gathering information & compiling"
rlAssertRpm $PACKAGE
rlAssertRpm $(rpm -qf $(which gcc))
rlShowRunningKernel
rlRun "gcc reproducer.c -o reproducer" 0 "Compiling the reproducer"
rlPhaseEnd
rlPhaseStartTest "Counting the number of calls noted by ltrace"
rlRun "ltrace -o ltrace-test-c.log -c ./reproducer" 0 "Execute reproducer"
rlRun "cat -n ltrace-test-c.log"
# Check if exec is not omitted (rhbz#797761)
rlAssertGrep "exec" ltrace-test-c.log
# Check if ltrace is able to trace system binaries with execl /bin/ls (rhbz#1618748/rhbz#1655368/rhbz#1731119)
if rlIsRHEL 8; then
case "$PACKAGE" in
ltrace*)
# bz#1655368 was fixed on ltrace-0.7.91-28.el8.x86_64, but it is still reproducible on ppc64le
if [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "RHEL8 ltrace fails to trace system binaries on ppc64le due to bz#1618748/bz#1655368, hence skipping failure checking"
skip_test=1
fi
;;
gcc-toolset-*)
if [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "RHEL8 gcc-toolset-*-ltrace fails to trace system binaries on ppc64le due to bz#1731119, hence skipping failure checking"
skip_test=1
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"
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"
skip_test=1
fi
rlRun "n_lines_c=$(grep -c . ltrace-test-c.log)"
if [ $n_lines_c -gt 20 ]; then
if [ $skip_test ]; then
rlLogWarning "Test was skipped but it seems ok. Review skip check."
fi
else
if [ $skip_test ]; then
rlLogInfo"'ltrace -c ./reproducer' does not report more than 20 lines of trace summary output (expected failure)"
else
rlFail "'ltrace -c ./reproducer' does not report more than 20 lines of trace summary output"
fi
fi
rlPhaseEnd
rlPhaseStartTest "Looking for SEGFAULT of reproducer under ltrace"
rlRun "ltrace -o ltrace-test.log ./reproducer" 0 "Execute reproducer"
rlRun "cat -n ltrace-test.log"
# Check if neither segfault nor 'unexpected breakpoint' errors occur (rhbz#211163)
rlAssertNotGrep "SIGSEGV" ltrace-test.log
rlAssertNotGrep "unexpected breakpoint" ltrace-test.log
# Check if exec is not omitted (rhbz#797761)
rlAssertGrep "exec" ltrace-test.log
# Check if ltrace is able to trace system binaries with execl /bin/ls (rhbz#1618748/rhbz#1655368/rhbz#1731119)
rlRun "n_lines=$(grep -c . ltrace-test.log)"
if [ $n_lines -gt 20 ]; then
if [ $skip_test ]; then
rlLogWarning "Test was skipped but it seems ok. Review skip check."
fi
else
if [ $skip_test ]; then
rlLogInfo"'ltrace ./reproducer' does not report more than 20 lines of trace summary output (expected failure)"
else
rlFail "'ltrace ./reproducer' does not report more than 20 lines of trace summary output"
fi
fi
rlPhaseEnd
rlPhaseStartCleanup "Doing clean-up"
rlBundleLogs "ltrace-outputs" ltrace-test.log ltrace-test-c.log
rlRun "rm -f ltrace-test.log ltrace-test-c.log reproducer"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,60 @@
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=ltrace
RELATIVE_PATH=Regression/223732-man-page-of-ltrace
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
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)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: man page of ltrace had a note about ELF32-support-only" >> $(METADATA)
@echo "Bug: 223732" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "License: GPLv3+" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,7 @@
Man page of ltrace said,
'Only ELF32 binaries are supported.'
I seemed ltrace does not support ia64 architecture.
That's not true.

View file

@ -0,0 +1,21 @@
summary: man page of ltrace had a note about ELF32-support-only
description: |+
Man page of ltrace said,
'Only ELF32 binaries are supported.'
I seemed ltrace does not support ia64 architecture.
That's not true.
contact: Michal Nowak <mnowak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=223732
extra-summary: /tools/ltrace/Regression/223732-man-page-of-ltrace
extra-task: /tools/ltrace/Regression/223732-man-page-of-ltrace

View file

@ -0,0 +1,41 @@
#!/bin/bash
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# source the test script helpers
. /usr/bin/rhts_environment.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE=ltrace
rlJournalStart
rlPhaseStartSetup "Gathering information"
rlShowPackageVersion $PACKAGE
rlShowRunningKernel
rlPhaseEnd
rlPhaseStartTest "Running tar inside ltrace"
man ltrace > trace.man
rlAssertNotGrep "Only ELF32 binaries are supported" trace.man
rlPhaseEnd
rlPhaseStartCleanup "Doing clean-up"
rm -f trace.man
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,60 @@
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=ltrace
RELATIVE_PATH=Regression/235671-ltrace-receives-SIGILL-signal
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
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)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: ltrace receives SIGILL signal and terminates" >> $(METADATA)
@echo "Bug: 235671" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "License: GPLv3+" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,2 @@
ltrace receives SIGILL signal instead of the ltraced program,
which terminates ltrace.

View file

@ -0,0 +1,16 @@
summary: ltrace receives SIGILL signal and terminates
description: |
ltrace receives SIGILL signal instead of the ltraced program,
which terminates ltrace.
contact: Michal Nowak <mnowak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=235671
extra-summary: /tools/ltrace/Regression/235671-ltrace-receives-SIGILL-signal
extra-task: /tools/ltrace/Regression/235671-ltrace-receives-SIGILL-signal

View file

@ -0,0 +1,43 @@
#!/bin/bash
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# source the test script helpers
. /usr/bin/rhts_environment.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="$(rpm -qf $(which ltrace))"
rlJournalStart
rlPhaseStartSetup "Gathering information"
rlAssertRpm $PACKAGE
rlAssertRpm $(rpm -qf $(which gcc))
rlShowRunningKernel
rlPhaseEnd
rlPhaseStartTest "Running tar inside ltrace"
rlRun "ltrace -o ltrace-test.log tar" 0 "ltrace is crunching tar"
rlAssertNotGrep "SIGILL" ltrace-test.log -A1
rlPhaseEnd
rlPhaseStartCleanup "Doing clean-up"
rlBundleLogs "ltrace-outputs" ltrace-test.log
rlRun "rm -f ltrace-test.log"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=ltrace
RELATIVE_PATH=Regression/427444-ltrace-crashes-process-to-be-analysed
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.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
@touch $(METADATA)
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: ltrace crashes process to be analysed" >> $(METADATA)
@echo "Bug: 427444" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: gcc" >> $(METADATA)
@echo "Requires: glibc-devel" >> $(METADATA)
@echo "License: GPLv3+" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1 @@
ltrace could possibly crash traced application on s390 and s390x.

View file

@ -0,0 +1,17 @@
summary: ltrace crashes process to be analysed
description: |
ltrace could possibly crash traced application on s390 and s390x.
contact: Michal Nowak <mnowak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- gcc
- glibc-devel
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=427444
extra-summary: /tools/ltrace/Regression/427444-ltrace-crashes-process-to-be-analysed
extra-task: /tools/ltrace/Regression/427444-ltrace-crashes-process-to-be-analysed

View file

@ -0,0 +1,70 @@
#include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#ifndef NI_MAXHOST
#define NI_MAXHOST 1025
#endif // NI_MAX_HOST
// On a DARWIN system EAI_OVERFLOW is define as EAI_MAX
#ifndef EAI_OVERFLOW
#define EAI_OVERFLOW EAI_MAX
#endif // EAI_OVERFLOW
int main(int argc, char *argv[])
{
// sleep before we can catch you via ltrace
sleep(5);
struct addrinfo * result;
size_t hostname_len = NI_MAXHOST;
char * hostname = NULL;
int error;
if ( 0 != ( error = getaddrinfo( "www.example.com", NULL, NULL, &result ) ) )
{
fprintf( stderr, "error using getaddrinfo: %s\n", gai_strerror( error ) );
}
if ( result )
{
for( ; ; hostname_len *= 2 )
{
hostname = ( char * ) realloc( hostname, hostname_len );
if ( NULL == hostname )
{
perror( "" );
break;
}
error = getnameinfo( result->ai_addr, result->ai_addrlen, hostname, hostname_len, NULL, 0, 0 );
if ( 0 == error )
{
break;
}
if ( EAI_OVERFLOW != error )
{
fprintf( stderr, "error using getaddrinfo: %s\n", gai_strerror( error ) );
break;
}
}
if ( NULL != hostname )
{
free( hostname );
}
freeaddrinfo( result );
}
return 0;
}

View file

@ -0,0 +1,46 @@
#!/bin/bash
#
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# source the test script helpers
. /usr/bin/rhts_environment.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="$(rpm -qf $(which ltrace))"
rlJournalStart
rlPhaseStartSetup "Gathering information & compiling"
rlAssertRpm $PACKAGE
rlAssertRpm $(rpm -qf $(which gcc))
rlShowRunningKernel
rlRun "gcc reproducer.c -o reproducer" 0 "Compiling the reproducer"
rlPhaseEnd
rlPhaseStartTest "Testing the executable under ltrace"
rlRun "./reproducer &" 0 "Fire the reproducer in the background"
rlWatchdog "ltrace -o ltrace-test.log -p $( pgrep reproducer )" 200
rlAssertNotGrep "gimme_arg called with wrong arguments" ltrace-test.log
rlPhaseEnd
rlPhaseStartCleanup "Doing clean-up"
rlBundleLogs "ltrace-outputs" ltrace-test.log
rlRun "rm -f ltrace-test.log reproducer"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,60 @@
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=ltrace
RELATIVE_PATH=Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.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
@touch $(METADATA)
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: When executing ltrace command with both -o and -c option, the result of ltrace command is not output into file" >> $(METADATA)
@echo "Bug: 447404" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME) gcc" >> $(METADATA)
@echo "License: GPLv3+" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,4 @@
When executing ltrace command with both -o and -c option,
the result of ltrace command is not output into the file
which is specified by -o option.

View file

@ -0,0 +1,18 @@
summary: When executing ltrace command with both -o and -c option, the result of ltrace
command is not output into file
description: "When executing ltrace command with both -o and -c option, \nthe result\
\ of ltrace command is not output into the file \nwhich is specified by -o option.\n\
\n"
contact: Michal Nowak <mnowak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- gcc
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=447404
extra-summary: /tools/ltrace/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file
extra-task: /tools/ltrace/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file

View file

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

View file

@ -0,0 +1,111 @@
#!/bin/bash
#
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# source the test script helpers
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="$(rpm -qf --queryformat '%{name}' $(which ltrace))"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
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 "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
rlAssertGreater "There has to be something in output file" $(cat ltrace-test.log | wc -l) 5
rlPhaseEnd
rlPhaseStartTest "ltrace with -o and -c options tracing system binary"
rlRun "ltrace -o ltrace-test-sys.log -c ls" 0 "ltrace is crunching ls"
rlRun -l "cat ltrace-test-sys.log"
if rlIsRHEL 8; then
case "$PACKAGE" in
"ltrace")
# bz#1655368 was fixed on ltrace-0.7.91-28.el8.x86_64, but it is still reproducible on ppc64le
if [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "RHEL8 ltrace fails to trace system binaries on ppc64le due to bz#1618748/bz#1655368, hence skipping failure checking"
skip_system_binary_test=1
fi
;;
"gcc-toolset-9-ltrace" | "gcc-toolset-10-ltrace")
if [ "$(arch)" = "ppc64le" ]; then
rlLogWarning "RHEL8 gcc-toolset-9-ltrace/gcc-toolset-10-ltrace fails to trace system binaries on ppc64le due to bz#1731119, hence skipping failure checking"
skip_system_binary_test=1
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"
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"
skip_system_binary_test=1
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 [ $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)"
else
rlFail "ltrace output does not contain ioctl or malloc calls"
fi
fi
rlRun "n_lines=$(grep -c . ltrace-test-sys.log)"
if [ $n_lines -gt 10 ]; 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 more than 10 lines (expected failure)"
else
rlFail "ltrace output does not contain more than 10 lines"
fi
fi
rlPhaseEnd
rlPhaseStartCleanup "Doing clean-up"
rlFileSubmit ltrace-test.log
rlFileSubmit ltrace-test-sys.log
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64
# Description: The test tries to workaround of a bz1051221 a little.
# Author: Michael Petlan <mpetlan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 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/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE hello.c
.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: Michael Petlan <mpetlan@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: The test tries to workaround of a bz1051221 a little." >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace prelink binutils gcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1051221" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64
Description: The test tries to workaround of a bz1051221 a little.
Author: Michael Petlan <mpetlan@redhat.com>

View file

@ -0,0 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
puts("Hello world...\n");
}

View file

@ -0,0 +1,17 @@
summary: The test tries to workaround of a bz1051221 a little.
description: ''
contact: Michael Petlan <mpetlan@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- prelink
- binutils
- gcc
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1051221
extra-summary: /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64
extra-task: /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64

View file

@ -0,0 +1,74 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64
# Description: The test tries to workaround of a bz1051221 a little.
# Author: Michael Petlan <mpetlan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 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="ltrace"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp hello.c $TmpDir/"
rlRun "pushd $TmpDir"
rlRun "gcc -o hello-raw hello.c"
rlRun "cp hello-raw hello-stripped"
rlRun "strip ./hello-stripped"
if rpm -q prelink; then
rlRun "cp hello-raw hello-prelinked"
rlRun "cp hello-raw hello-stripped-prelinked"
rlRun "cp hello-raw hello-prelinked-stripped"
rlRun "prelink ./hello-prelinked"
rlRun "strip ./hello-stripped-prelinked"
rlRun "prelink hello-stripped-prelinked"
rlRun "prelink hello-prelinked-stripped"
rlRun "strip hello-prelinked-stripped"
fi
rlPhaseEnd
rlPhaseStartTest
for binary in hello-*; do
rlLog "==== TESTING $binary ===="
rlRun "{ ltrace -e __libc_start_main ./$binary 2> err_$binary.log > out_$binary.log; } 2> superr_$binary.log"
rlAssertNotGrep "Aborted" superr_$binary.log
rlAssertNotGrep "SIGSEGV" superr_$binary.log
rlAssertNotGrep "Segmentation fault" superr_$binary.log
rlAssertNotGrep "killed" err_$binary.log
rlAssertNotGrep "SIGSEGV" err_$binary.log
rlAssertNotGrep "Segmentation fault" err_$binary.log
rlLog "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
done
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure
# Description: The test tries to ltrace a non-existing app, ltrace should handle that.
# Author: Michael Petlan <mpetlan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 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/Regression/bz1053765-invalid-command-assertion-failure
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: Michael Petlan <mpetlan@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: The test tries to ltrace a non-existing app, ltrace should handle that." >> $(METADATA)
@echo "Type: Regression" >> $(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: 1053765" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure
Description: The test tries to ltrace a non-existing app, ltrace should handle that.
Author: Michael Petlan <mpetlan@redhat.com>

View file

@ -0,0 +1,14 @@
summary: The test tries to ltrace a non-existing app, ltrace should handle that.
description: ''
contact: Michael Petlan <mpetlan@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1053765
extra-summary: /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure
extra-task: /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure

View file

@ -0,0 +1,59 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure
# Description: The test tries to ltrace a non-existing app, ltrace should handle that.
# Author: Michael Petlan <mpetlan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 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="$(rpm -qf $(which ltrace))"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlPhaseEnd
rlPhaseStartTest
rlRun "{ ltrace blahblahblah0123546213208412321 2> err.log > out.log; } 2> superr.log" 1 "Running ltrace with a non-existing binary."
rlAssertNotGrep "Aborted" superr.log
rlAssertNotGrep "destroy" err.log
rlAssertNotGrep "Assertion" err.log
rlAssertNotGrep "assertion" err.log
rlAssertNotGrep "relocs" err.log
rlAssertNotGrep "failed" err.log
echo "==== stderr ===="
cat err.log
echo "==== stdout ===="
cat out.log
echo "==== external stderr ===="
cat superr.log
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm err.log out.log superr.log"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots
# Description: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots
# 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/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots
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: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace gcc gawk" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1158713" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots
Description: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots
Author: Martin Cermak <mcermak@redhat.com>
Bug summary: ltrace assigns wrong names to glibc PLT slots
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1158713

View file

@ -0,0 +1,18 @@
summary: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots
description: |
Bug summary: ltrace assigns wrong names to glibc PLT slots
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1158713
contact: Martin Cermak <mcermak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- gcc
- gawk
duration: 10m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1158713
extra-summary: /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots
extra-task: /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots

View file

@ -0,0 +1,108 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots
# Description: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots
# 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
PACKAGE="$(rpm -qf $(which ltrace))"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlAssertRpm $(rpm -qf $(which gcc))
rlRun "TMPD=$(mktemp -d)"
rlRun "pushd $TMPD"
cat > test.c <<EOFA
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>
int main()
{
char *s = malloc(1000);
// trigger a free() call from libc:
setpwent();
getpwent();
endpwent();
// print maps
sprintf(s, "grep -F '[heap]' /proc/%d/maps", getpid());
system (s);
free(s);
}
EOFA
cat > test.awk <<EOFB
BEGIN {
addrindex = 0
}
/libc.*free\(0x[0-9a-f]+\)/ {
match(\$0,/0x[0-9a-f]+/,m)
addrs[addrindex++] = strtonum(m[0])
}
/\[heap\]/ {
sub("-", " ", \$0)
split(\$0, a, " ")
limit_min = strtonum("0x"a[1])
limit_max = strtonum("0x"a[2])
}
END {
for (i=0; i<addrindex; i++) {
if (addrs[i] < limit_min) {
print "ERROR 1 ("addrs[i]"<"limit_min")"
exit 1
}
if (addrs[i] > limit_max) {
print "ERROR 2 ("addrs[i]">"limit_max")"
exit 2
}
}
}
EOFB
rlRun "gcc test.c -o test"
rlPhaseEnd
rlPhaseStartTest
rlRun "ltrace -e free ./test |& tee log | awk -f test.awk" || \
rlRun "cat log"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMPD"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
# Description: Test for BZ#1360259 (ltrace crashes when run on certain processes with the -S option)
# 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/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
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#1360259 (ltrace crashes when run on certain processes with the -S option)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace dbus" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1360259" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
Description: Test for BZ#1360259 (ltrace crashes when run on certain processes with the -S option)
Author: Edjunior Machado <emachado@redhat.com>
Bug summary: ltrace crashes when run on certain processes with the -S option
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1360259

View file

@ -0,0 +1,18 @@
summary: Test for BZ#1360259 (ltrace crashes when run on certain processes with the
-S option)
description: |
Bug summary: ltrace crashes when run on certain processes with the -S option
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1360259
contact: Edjunior Machado <emachado@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- dbus
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1360259
extra-summary: /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
extra-task: /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option

View file

@ -0,0 +1,71 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
# Description: Test for BZ#1360259 (ltrace crashes when run on certain processes with the -S option)
# 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'
BIN=$(which --skip-alias $CMD)
PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN)}"
if rlIsRHEL ">=9" || rlIsFedora; then
PROC_NAME=dbus-broker
SERVICE_NAME=dbus-broker
elif rlIsRHEL 6; then
PROC_NAME=dbus-daemon
SERVICE_NAME=messagebus
else
PROC_NAME=dbus-daemon
SERVICE_NAME=dbus
fi
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "pgrep -x $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)'"
# 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)"
rlFileSubmit output.log
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlRun "service $SERVICE_NAME status --no-pager || service $SERVICE_NAME start" 0 "Checking/starting $SERVICE_NAME"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by
# Description: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by)
# Author: Miroslav Franc <mfranc@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by
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: Miroslav Franc <mfranc@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 2m" >> $(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: 754096" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by
Description: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by)
Author: Miroslav Franc <mfranc@redhat.com>
Bug summary: ltrace crashes on PowerPC if tracing is limited by `-e' to event not present in trace
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=754096

View file

@ -0,0 +1,16 @@
summary: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by)
description: |
Bug summary: ltrace crashes on PowerPC if tracing is limited by `-e' to event not present in trace
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=754096
contact: Miroslav Franc <mfranc@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
duration: 2m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=754096
extra-summary: /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by
extra-task: /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by

View file

@ -0,0 +1,52 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by
# Description: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by)
# Author: Miroslav Franc <mfranc@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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="$(rpm -qf $(which ltrace))"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "ltrace -e puts /bin/true"
rlRun "ltrace -e sprintf /bin/true"
rlRun "ltrace -e puts -e gets /bin/true"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,65 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call
# Description: The test tries to ltrace an app which uses execl calls.
# Author: Michael Petlan <mpetlan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call
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: Michael Petlan <mpetlan@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: The test tries to ltrace an app which uses execl calls." >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace" >> $(METADATA)
@echo "Requires: glibc-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 797761" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call
Description: The test tries to ltrace an app which uses execl calls.
Author: Michael Petlan <mpetlan@redhat.com>

View file

@ -0,0 +1,15 @@
summary: The test tries to ltrace an app which uses execl calls.
description: ''
contact: Michael Petlan <mpetlan@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- glibc-devel
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=797761
extra-summary: /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call
extra-task: /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call

View file

@ -0,0 +1,69 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call
# Description: The test tries to ltrace an app which uses execl calls.
# Author: Michael Petlan <mpetlan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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="ltrace"
create_reproducer()
{
cat <<EOF > reproducer.c
#include <stdio.h>
#include <unistd.h>
int main ()
{
execl("/bin/ls","ls",0);
return 0;
}
EOF
}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
create_reproducer
rlRun "gcc -o reproducer reproducer.c"
rlPhaseEnd
rlPhaseStartTest
# The main purpose of this section is to check if the file ltrace-c.log contains the 'exec' substring.
rlRun "ltrace ./reproducer 2>&1 >/dev/null | tee ltrace.log"
rlRun "ltrace -c ./reproducer 2>&1 >/dev/null | tee ltrace-c.log"
rlAssertGrep "exec" ltrace.log
rlAssertGrep "exec" ltrace-c.log
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,67 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries
# Description: Test for BZ#868281 (ltrace doesn't work on PIE binaries)
# Author: Miroslav Franc <mfranc@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.c
.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: Miroslav Franc <mfranc@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#868281 (ltrace doesn't work on PIE binaries)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace gcc" >> $(METADATA)
@echo "Requires: libgcc.i686 glibc-devel.i686" >> $(METADATA) # 32-bit
@echo "Requires: libgcc.ppc64 glibc-devel.ppc64" >> $(METADATA) # 32-bit
@echo "Requires: libgcc.s390 glibc-devel.s390" >> $(METADATA) # 32-bit
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 868281" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries
Description: Test for BZ#868281 (ltrace doesn't work on PIE binaries)
Author: Miroslav Franc <mfranc@redhat.com>
Bug summary: ltrace doesn't work on PIE binaries
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=868281

View file

@ -0,0 +1,21 @@
summary: Test for BZ#868281 (ltrace doesn't work on PIE binaries)
description: |
Bug summary: ltrace doesn't work on PIE binaries
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=868281
contact: Miroslav Franc <mfranc@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- gcc
- libgcc
- glibc-devel
- libgcc.i686
- glibc-devel.i686
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=868281
extra-summary: /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries
extra-task: /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries

View file

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

View file

@ -0,0 +1,118 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries
# Description: Test for BZ#868281 (ltrace doesn't work on PIE binaries)
# Author: Miroslav Franc <mfranc@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
LTRACE_RPM=$(rpm -qf `which ltrace`)
GCC="${GCC:-$(which gcc)}"
GCC_RPM=$(rpm -qf $GCC)
BINUTILS_RPM=$(rpm -qf `which ld`)
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $LTRACE_RPM
rlAssertRpm $GCC_RPM
rlAssertRpm $BINUTILS_RPM
ARCH="$(rlGetPrimaryArch)"
SARCH="$(rlGetSecondaryArch)"
for arch in $ARCH $SARCH; 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
if [[ $ARCH =~ s390.* ]]; then
if rlIsRHEL '>=8'; then
rlLogInfo "RHEL-8 and newer do not support s390x 31-bit compilation"
MBITS=
else
MBITS=31
if [[ "$LTRACE_RPM" =~ devtoolset-(9|10) ]] ; then
rlLogInfo "devtoolset-(9|10)-gcc do not support s390, hence using base gcc"
rlRun "GCC=/usr/bin/gcc"
rlAssertRpm $(rpm -qf $GCC)
fi
fi
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
fi
rlLogInfo "MBITS=$MBITS"
rlRun "$GCC -fPIE -pie -x c reproducer.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"
rlAssertExists a-$MBITS.out
fi
rlPhaseEnd
rlPhaseStartTest "Native binary testing"
rlRun "ltrace ./a-native.out > log 2>&1"
LIBC_START_MAIN=true
if [[ "$ARCH" = "x86_64" ]]; then
if rlIsRHEL '>=8' || rlIsFedora; then
rlLogInfo "x86_64: Since RHEL-8 __libc_start_main has been optimized into non-PLT call, no longer ltraced (bz#1654734)"
LIBC_START_MAIN=false
fi
fi
if $LIBC_START_MAIN; then
rlAssertGrep "__libc_start_main" log
fi
rlAssertGrep "alarm(42)" log
rlAssertGrep "exited (status 0)" log
rlLog "log file:\n$(cat log)"
rlPhaseEnd
if [ -n "$MBITS" ]; then
rlPhaseStartTest "$MBITS bit binary testing"
rlRun "ltrace ./a-$MBITS.out > log-$MBITS 2>&1"
rlAssertGrep "__libc_start_main" log-$MBITS
rlAssertGrep "alarm(42)" log-$MBITS
rlAssertGrep "exited (status 0)" log-$MBITS
rlLog "log file:\n$(cat log-$MBITS)"
rlPhaseEnd
fi
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due
# Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due)
# Author: Miroslav Franc <mfranc@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE ksh_bug.ksh
.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: Miroslav Franc <mfranc@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace ksh ltrace-debuginfo" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 890961" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due
Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due)
Author: Miroslav Franc <mfranc@redhat.com>
Bug summary: [RHEL 5] ltrace crashes with memory corruption due to double free()
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=890961

View file

@ -0,0 +1,8 @@
#!/usr/bin/env ksh
# from bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=890961
echo "Before processing a subshell"
NUMFILES=$(ls | wc -l)
echo "After processing a subshell"

View file

@ -0,0 +1,18 @@
summary: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due)
description: |
Bug summary: [RHEL 5] ltrace crashes with memory corruption due to double free()
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=890961
contact: Miroslav Franc <mfranc@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- ksh
- ltrace-debuginfo
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=890961
extra-summary: /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due
extra-task: /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due

View file

@ -0,0 +1,58 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due
# Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due)
# Author: Miroslav Franc <mfranc@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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="$(rpm -qf $(which ltrace))"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlAssertRpm ksh
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp ksh_bug.ksh $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
for ((i=0; i<10; ++i)); do
rlPhaseStartTest "test... $i"
rlRun "LIBC_FATAL_STDERR_=1 ltrace -f -o ./ltrace.out ksh ./ksh_bug.ksh 2> log.err > log.out"
rlAssertNotGrep 'glibc detected' log.err
rlRun "[[ $(wc -l <log.err) -eq 0 ]]"
rlAssertGrep 'Before processing a subshell' log.out
rlAssertGrep 'After processing a subshell' log.out
rlPhaseEnd
done; unset i
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/pthread-program-assertion-failure
# Description: pthread-program-assertion-failure
# 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/Regression/pthread-program-assertion-failure
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: pthread-program-assertion-failure" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace" >> $(METADATA)
@echo "Requires: gcc" >> $(METADATA)
@echo "Requires: glibc-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,6 @@
PURPOSE of /tools/ltrace/Regression/pthread-program-assertion-failure
Description: pthread-program-assertion-failure
Author: Martin Cermak <mcermak@redhat.com>
Issue reproduced using an f20 arm (32 bit) fedora system with ltrace-0.7.91-13.fc22.armv7hl.

View file

@ -0,0 +1,16 @@
summary: pthread-program-assertion-failure
description: |+
Issue reproduced using an f20 arm (32 bit) fedora system with ltrace-0.7.91-13.fc22.armv7hl.
contact: Martin Cermak <mcermak@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- gcc
- glibc-devel
duration: 10m
extra-summary: /tools/ltrace/Regression/pthread-program-assertion-failure
extra-task: /tools/ltrace/Regression/pthread-program-assertion-failure

View file

@ -0,0 +1,83 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/pthread-program-assertion-failure
# Description: pthread-program-assertion-failure
# 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
PACKAGE="$(rpm -qf $(which ltrace))"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlAssertRpm $(rpm -qf $(which gcc))
rlRun "TMP=\$(mktemp -d)"
rlRun "pushd $TMP"
cat > test.c <<EOF
#include <pthread.h>
#include <stdio.h>
extern void print (char *);
#define PRINT_LOOP 10
void *
th_main (void *arg)
{
int i;
for (i=0; i<PRINT_LOOP; i++)
printf (arg);
return NULL;
}
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;
}
EOF
rlRun "gcc -lpthread test.c"
rlPhaseEnd
rlPhaseStartTest
rlRun "ltrace -L ./a.out"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMP"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Sanity/broken-binary-handling
# Description: Try to trace broken binary by ltrace
# 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/broken-binary-handling
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE broken.bin.gz
.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: Try to trace broken binary by ltrace" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace gzip" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: yes" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /tools/ltrace/Sanity/broken-binary-handling
Description: Try to trace broken binary by ltrace
Author: Michal Nowak <mnowak@redhat.com>

Binary file not shown.

View file

@ -0,0 +1,14 @@
summary: Try to trace broken binary by ltrace
description: ''
contact:
- Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- gzip
duration: 5m
extra-summary: /tools/ltrace/Sanity/broken-binary-handling
extra-task: /tools/ltrace/Sanity/broken-binary-handling

View file

@ -0,0 +1,56 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Sanity/broken-binary-handling
# Description: Try to trace broken binary by ltrace
# 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
PACKAGE="$(rpm -qf $(which ltrace))"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
cp broken.bin.gz $TmpDir
rlRun "pushd $TmpDir"
gunzip broken.bin.gz
chmod +x broken.bin
rlPhaseEnd
rlPhaseStartTest
rlRun "ltrace -f ./broken.bin > out 2>&1 " 1 "ltrace can't trace broken.bin"
OUT=`cat out`
rlLog "LOG: $OUT"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

@ -0,0 +1,5 @@
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

@ -0,0 +1,16 @@
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

@ -0,0 +1,53 @@
#!/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

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

@ -0,0 +1,3 @@
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

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

View file

@ -0,0 +1,14 @@
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

@ -0,0 +1,35 @@
#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

@ -0,0 +1,44 @@
#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

@ -0,0 +1,15 @@
#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;
}

Some files were not shown because too many files have changed in this diff Show more