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

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