[Ltrace-devel] r59 - in ltrace/trunk: . testsuite/ltrace.main
Ian Wienand
ianw-guest at costa.debian.org
Mon Aug 7 02:55:24 UTC 2006
Author: ianw-guest
Date: 2006-08-07 02:55:24 +0000 (Mon, 07 Aug 2006)
New Revision: 59
Added:
ltrace/trunk/testsuite/ltrace.main/parameters-lib.c
ltrace/trunk/testsuite/ltrace.main/parameters.c
ltrace/trunk/testsuite/ltrace.main/parameters.conf
ltrace/trunk/testsuite/ltrace.main/parameters.exp
Modified:
ltrace/trunk/ChangeLog
ltrace/trunk/testsuite/ltrace.main/Makefile.in
Log:
new testsuite items for new parameters
Modified: ltrace/trunk/ChangeLog
===================================================================
--- ltrace/trunk/ChangeLog 2006-08-07 02:50:42 UTC (rev 58)
+++ ltrace/trunk/ChangeLog 2006-08-07 02:55:24 UTC (rev 59)
@@ -1,3 +1,12 @@
+2006-08-07 Steve Fink <sphink at gmail.com>
+
+ * testsuite/ltrace.main/Makefile.in : update testsuite for
+ new parameters
+ * testsuite/ltrace.main/parameters-lib.c : added
+ * testsuite/ltrace.main/parameters.c : added
+ * testsuite/ltrace.main/parameters.conf : added
+ * testsuite/ltrace.main/parameters.exp : added
+
2006-08-07 Steve Fink <sphink at gmail.com>
* display_args.c, etc/ltrace.conf, ltrace.h, read_config_file.c,
Modified: ltrace/trunk/testsuite/ltrace.main/Makefile.in
===================================================================
--- ltrace/trunk/testsuite/ltrace.main/Makefile.in 2006-08-07 02:50:42 UTC (rev 58)
+++ ltrace/trunk/testsuite/ltrace.main/Makefile.in 2006-08-07 02:55:24 UTC (rev 59)
@@ -19,7 +19,7 @@
.SUFFIXES:
clean:
- -rm -f main main-internal system_calls signals
+ -rm -f main main-internal system_calls signals parameters
-rm -f *.o *.so
-rm -f *.ltrace
-rm -f $(CLEANFILES)
Added: ltrace/trunk/testsuite/ltrace.main/parameters-lib.c
===================================================================
--- ltrace/trunk/testsuite/ltrace.main/parameters-lib.c 2006-08-07 02:50:42 UTC (rev 58)
+++ ltrace/trunk/testsuite/ltrace.main/parameters-lib.c 2006-08-07 02:55:24 UTC (rev 59)
@@ -0,0 +1,38 @@
+#include <string.h>
+#include <stdio.h>
+
+void func_ignore(int a, int b, int c)
+{
+ printf("%d\n", a + b + c);
+}
+
+void func_intptr(int *i)
+{
+ printf("%d\n", *i);
+}
+
+void func_intptr_ret(int *i)
+{
+ *i = 42;
+}
+
+int func_strlen(char* p)
+{
+ strcpy(p, "Hello world");
+ return strlen(p);
+}
+
+void func_strfixed(char* p)
+{
+ strcpy(p, "Hello world");
+}
+
+void func_ppp(int*** ppp)
+{
+ printf("%d\n", ***ppp);
+}
+
+void func_stringp(char** sP)
+{
+ printf("%s\n", *sP);
+}
Added: ltrace/trunk/testsuite/ltrace.main/parameters.c
===================================================================
--- ltrace/trunk/testsuite/ltrace.main/parameters.c 2006-08-07 02:50:42 UTC (rev 58)
+++ ltrace/trunk/testsuite/ltrace.main/parameters.c 2006-08-07 02:55:24 UTC (rev 59)
@@ -0,0 +1,44 @@
+/* Ltrace Test : parameters.c.
+ Objectives : Verify that Ltrace can handle all the different
+ parameter types
+
+ This file was written by Steve Fink <sphink at gmail.com>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+void func_ignore(int a, int b, int c);
+void func_intptr(int *i);
+void func_intptr_ret(int *i);
+int func_strlen(char*);
+void func_strfixed(char*);
+void func_ppp(int***);
+void func_stringp(char**);
+
+int
+main ()
+{
+ int x = 17;
+ int *xP, **xPP;
+ char buf[200];
+ char *s;
+ func_ignore(1, 2, 3);
+ func_intptr(&x);
+ func_intptr_ret(&x);
+ func_strlen(buf);
+ printf("%s\n", buf);
+ func_strfixed(buf);
+ printf("%s\n", buf);
+ x = 80;
+ xP = &x;
+ xPP = &xP;
+ func_ppp(&xPP);
+ s = (char*) malloc(100);
+ strcpy(s, "Dude");
+ func_stringp(&s);
+}
Added: ltrace/trunk/testsuite/ltrace.main/parameters.conf
===================================================================
--- ltrace/trunk/testsuite/ltrace.main/parameters.conf 2006-08-07 02:50:42 UTC (rev 58)
+++ ltrace/trunk/testsuite/ltrace.main/parameters.conf 2006-08-07 02:55:24 UTC (rev 59)
@@ -0,0 +1,7 @@
+void func_ignore(int,ignore,int)
+void func_intptr(int*)
+void func_intptr_ret(+int*)
+int func_strlen(+string[retval])
+void func_strfixed(string[4])
+void func_ppp(int***)
+void func_stringp(string*)
Added: ltrace/trunk/testsuite/ltrace.main/parameters.exp
===================================================================
--- ltrace/trunk/testsuite/ltrace.main/parameters.exp 2006-08-07 02:50:42 UTC (rev 58)
+++ ltrace/trunk/testsuite/ltrace.main/parameters.exp 2006-08-07 02:55:24 UTC (rev 59)
@@ -0,0 +1,52 @@
+# This file was written by Steve Fink <sphink at gmail.com>.
+# Based on main.c by Yao Qi <qiyao at cn.ibm.com>.
+
+set testfile "parameters"
+set srcfile ${testfile}.c
+set binfile ${testfile}
+set libfile "parameters-lib"
+set libsrc $srcdir/$subdir/$libfile.c
+set lib_sl $srcdir/$subdir/lib$testfile.so
+
+
+if [get_compiler_info $binfile] {
+ return -1
+}
+
+verbose "compiling source file now....."
+if { [ltrace_compile_shlib $libsrc $lib_sl debug ] != ""
+ || [ltrace_compile $srcdir/$subdir/$srcfile $srcdir/$subdir/$binfile executable [list debug shlib=$lib_sl] ] != ""} {
+ send_user "Testcase compile failed, so all tests in this file will automatically fail.\n"
+}
+
+# set options for ltrace.
+ltrace_options "-l" "$srcdir/$subdir/libparameters.so" "-F" "$srcdir/$subdir/parameters.conf"
+
+# Run PUT for ltarce.
+set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
+
+# Check the output of this program.
+verbose "ltrace runtest output: $exec_output\n"
+if [regexp {ELF from incompatible architecture} $exec_output] {
+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!"
+ return
+} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
+ fail "Couldn't get .hash data!"
+ return
+}
+
+# Verify the output
+set pattern "func_ignore(1, *, *3)"
+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_intptr(17)"
+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_intptr_ret(42)"
+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_strlen(\\\"Hello world\\\") *= *11"
+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_strfixed(\\\"Hell\\\")"
+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_ppp(80)"
+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
+set pattern "func_stringp(\\\"Dude\\\")"
+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
More information about the Ltrace-devel
mailing list