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

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