Blame SOURCES/ltrace-0.7.91-multithread-no-f-1.patch

c25f0b
From 4724bd5a4a19db117a1d280b9d1a3508fd4e03fa Mon Sep 17 00:00:00 2001
c25f0b
From: Petr Machata <pmachata@redhat.com>
c25f0b
Date: Wed, 8 Apr 2015 07:11:52 -0400
c25f0b
Subject: [PATCH 1/2] Convert main-threaded test case to new style
c25f0b
c25f0b
---
c25f0b
 testsuite/ltrace.main/Makefile.am       |   4 +-
c25f0b
 testsuite/ltrace.main/main-threaded.c   |  30 ----------
c25f0b
 testsuite/ltrace.main/main-threaded.exp | 103 ++++++++++++++++++++------------
c25f0b
 3 files changed, 66 insertions(+), 71 deletions(-)
c25f0b
 delete mode 100644 testsuite/ltrace.main/main-threaded.c
c25f0b
c25f0b
diff --git a/testsuite/ltrace.main/Makefile.am b/testsuite/ltrace.main/Makefile.am
c25f0b
index 23ab8ab..06ad613 100644
c25f0b
--- a/testsuite/ltrace.main/Makefile.am
c25f0b
+++ b/testsuite/ltrace.main/Makefile.am
c25f0b
@@ -1,4 +1,4 @@
c25f0b
-# Copyright (C) 1992 - 2001, 2012, 2013 Free Software Foundation, Inc.
c25f0b
+# Copyright (C) 1992 - 2001, 2012, 2013, 2015 Free Software Foundation, Inc.
c25f0b
 #
c25f0b
 # This program is free software; you can redistribute it and/or modify
c25f0b
 # it under the terms of the GNU General Public License as published by
c25f0b
@@ -17,7 +17,7 @@
c25f0b
 
c25f0b
 EXTRA_DIST = branch_func.c branch_func.exp filters.exp hello-vfork.c	\
c25f0b
 	hello-vfork.exp main.c main.exp main-internal.exp main-lib.c	\
c25f0b
-	main-threaded.c main-threaded.exp main-vfork.c main-vfork.exp	\
c25f0b
+	main-threaded.exp main-vfork.c main-vfork.exp			\
c25f0b
 	parameters.c parameters.conf parameters.exp parameters-lib.c	\
c25f0b
 	parameters2.exp parameters3.exp signals.c signals.exp		\
c25f0b
 	system_calls.c system_calls.exp system_call_params.exp
c25f0b
diff --git a/testsuite/ltrace.main/main-threaded.c b/testsuite/ltrace.main/main-threaded.c
c25f0b
deleted file mode 100644
c25f0b
index 2992d1e..0000000
c25f0b
--- a/testsuite/ltrace.main/main-threaded.c
c25f0b
+++ /dev/null
c25f0b
@@ -1,29 +0,0 @@
c25f0b
-#include <pthread.h>
c25f0b
-
c25f0b
-extern void print (char *);
c25f0b
-
c25f0b
-#define	PRINT_LOOP	10
c25f0b
-
c25f0b
-void *
c25f0b
-th_main (void *arg)
c25f0b
-{
c25f0b
-  int i;
c25f0b
-  for (i=0; i
c25f0b
-    print (arg);
c25f0b
-}
c25f0b
-
c25f0b
-int
c25f0b
-main ()
c25f0b
-{
c25f0b
-  pthread_t thread1;
c25f0b
-  pthread_t thread2;
c25f0b
-  pthread_t thread3;
c25f0b
-  pthread_create (&thread1, NULL, th_main, "aaa");
c25f0b
-  pthread_create (&thread2, NULL, th_main, "bbb");
c25f0b
-  pthread_create (&thread3, NULL, th_main, "ccc");
c25f0b
-  pthread_join (thread1, NULL);
c25f0b
-  pthread_join (thread2, NULL);
c25f0b
-  pthread_join (thread3, NULL);
c25f0b
-  return 0;
c25f0b
-}
c25f0b
-
c25f0b
diff --git a/testsuite/ltrace.main/main-threaded.exp b/testsuite/ltrace.main/main-threaded.exp
c25f0b
index 4d5f478..cead82d 100644
c25f0b
--- a/testsuite/ltrace.main/main-threaded.exp
c25f0b
+++ b/testsuite/ltrace.main/main-threaded.exp
c25f0b
@@ -1,39 +1,64 @@
c25f0b
-# This file was written by Yao Qi <qiyao@cn.ibm.com>.
c25f0b
+# This file is part of ltrace.
c25f0b
+# Copyright (C) 2011, 2015 Petr Machata, Red Hat Inc.
c25f0b
+# Copyright (C) 2006 Yao Qi <qiyao@cn.ibm.com>.
c25f0b
+#
c25f0b
+# This program is free software; you can redistribute it and/or
c25f0b
+# modify it under the terms of the GNU General Public License as
c25f0b
+# published by the Free Software Foundation; either version 2 of the
c25f0b
+# License, or (at your option) any later version.
c25f0b
+#
c25f0b
+# This program is distributed in the hope that it will be useful, but
c25f0b
+# WITHOUT ANY WARRANTY; without even the implied warranty of
c25f0b
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
c25f0b
+# General Public License for more details.
c25f0b
+#
c25f0b
+# You should have received a copy of the GNU General Public License
c25f0b
+# along with this program; if not, write to the Free Software
c25f0b
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
c25f0b
+# 02110-1301 USA
c25f0b
+
c25f0b
+set libprint [ltraceCompile libprint.so [ltraceSource c {
c25f0b
+    #include<stdio.h>
c25f0b
+
c25f0b
+    void
c25f0b
+    print(char* s)
c25f0b
+    {
c25f0b
+	printf("%s\n",s);
c25f0b
+    }
c25f0b
+}]]
c25f0b
+
c25f0b
+set bin [ltraceCompile {} $libprint -lpthread [ltraceSource c {
c25f0b
+    #include <pthread.h>
c25f0b
+
c25f0b
+    extern void print (char *);
c25f0b
+
c25f0b
+    #define	PRINT_LOOP	10
c25f0b
+
c25f0b
+    void *
c25f0b
+    th_main (void *arg)
c25f0b
+    {
c25f0b
+	int i;
c25f0b
+	for (i=0; i
c25f0b
+	print (arg);
c25f0b
+	return NULL;
c25f0b
+    }
c25f0b
+
c25f0b
+    int
c25f0b
+    main (void)
c25f0b
+    {
c25f0b
+	pthread_t thread1;
c25f0b
+	pthread_t thread2;
c25f0b
+	pthread_t thread3;
c25f0b
+	pthread_create (&thread1, NULL, th_main, "aaa");
c25f0b
+	pthread_create (&thread2, NULL, th_main, "bbb");
c25f0b
+	pthread_create (&thread3, NULL, th_main, "ccc");
c25f0b
+	pthread_join (thread1, NULL);
c25f0b
+	pthread_join (thread2, NULL);
c25f0b
+	pthread_join (thread3, NULL);
c25f0b
+	return 0;
c25f0b
+    }
c25f0b
+}]]
c25f0b
 
c25f0b
-set testfile "main-threaded"
c25f0b
-set srcfile ${testfile}.c
c25f0b
-set binfile ${testfile}
c25f0b
-set libfile "main-lib"
c25f0b
-set libsrc $srcdir/$subdir/$libfile.c
c25f0b
-set lib_sl $objdir/$subdir/lib$testfile.so
c25f0b
-
c25f0b
-
c25f0b
-if [get_compiler_info $binfile] {
c25f0b
-  return -1
c25f0b
-}
c25f0b
-
c25f0b
-verbose "compiling source file now....."
c25f0b
-if { [ltrace_compile_shlib $libsrc $lib_sl debug ] != "" 
c25f0b
-  || [ltrace_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug shlib=$lib_sl ldflags=-pthread] ] != ""} {
c25f0b
-  send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
c25f0b
-}
c25f0b
-
c25f0b
-# set options for ltrace.
c25f0b
-ltrace_options "-l" "lib$testfile.so" "-f"
c25f0b
-
c25f0b
-# Run PUT for ltarce.
c25f0b
-set exec_output [ltrace_runtest $objdir/$subdir $objdir/$subdir/$binfile]
c25f0b
-
c25f0b
-# Check the output of this program.
c25f0b
-verbose "ltrace runtest output: $exec_output\n"
c25f0b
-if [regexp {ELF from incompatible architecture} $exec_output] {
c25f0b
-	fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
c25f0b
-	return 
c25f0b
-} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
c25f0b
-	fail "Couldn't get .hash data!"
c25f0b
-	return
c25f0b
-}
c25f0b
-
c25f0b
-# Verify the output by checking numbers of print in main-threaded.ltrace.
c25f0b
-set pattern "print"
c25f0b
-ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 30
c25f0b
+ltraceMatch1 [ltraceRun -f -l libprint.so -- $bin] {print\(} == 30
c25f0b
+
c25f0b
+ltraceDone
c25f0b
Only in ltrace.main: main-threaded.exp~
c25f0b
Only in ltrace.main: .main-threaded.exp.~undo-tree~