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

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