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

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