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

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