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

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