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

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