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

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