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

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