changeset 969:752d78bbb899

enabled Valgrind checks
author thomask
date Wed, 19 Apr 2006 06:44:38 +0000
parents 8b6d2dcf9954
children 3a6109fe74c5
files Makefile Makefile.parallel crashRun.c
diffstat 3 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Apr 19 06:43:40 2006 +0000
+++ b/Makefile	Wed Apr 19 06:44:38 2006 +0000
@@ -80,7 +80,7 @@
 ###############################################################################
 
 # tools
-return__	:= ./return__
+return__	:= $(PWD)/return__
 ifeq__		:= ./ifeq__
 extract__	:= ./extract__
 dstress__	:= ./dstress
@@ -123,7 +123,7 @@
 	$(CC) $(CFLAGS) $< -o $@
 
 $(crashRun__) : crashRun.c Makefile
-	$(CC) $(CFLAGS) $< -o $@
+	$(CC) $(CFLAGS) -DUSE_VALGRIND $< -o $@
 
 basic_tools : $(ifeq__) $(return__) $(extract__) $(dstress__)
 
--- a/Makefile.parallel	Wed Apr 19 06:43:40 2006 +0000
+++ b/Makefile.parallel	Wed Apr 19 06:44:38 2006 +0000
@@ -77,7 +77,7 @@
 all :: version compile nocompile run norun
 
 % : %.c
-	$(CC) $(CFLAGS) $< -o $@
+	$(CC) $(CFLAGS) -DUSE_VALGRIND $< -o $@
 	
 tools :: $(dstress) $(crashRun)
 
--- a/crashRun.c	Wed Apr 19 06:43:40 2006 +0000
+++ b/crashRun.c	Wed Apr 19 06:44:38 2006 +0000
@@ -34,6 +34,7 @@
 
 #undef WAIT_GUARD
 #define WAIT_GUARD 3
+#define VALGRIND "valgrind -q --suppressions=valgrind.suppress"
 
 /* time-out in seconds
  * Posix: cpu time(timeOut) and system time(timeOut * WAIT_GUARD)
@@ -226,6 +227,10 @@
 		cmdLen+=3;
 	}
 
+#ifdef USE_VALGRIND
+	cmdLen += strlen(VALGRIND);
+#endif
+
 	cmd = malloc(cmdLen);
 	if(!cmd){
 		fprintf(stderr, "failed to allocate enough memory");
@@ -235,6 +240,12 @@
 	*cmd = '\x00';
 	tmp = cmd;
 
+#ifdef USE_VALGRIND
+	tmpLen = snprintf(tmp, cmdLen, "%s ", VALGRIND);
+	tmp += tmpLen;
+	cmdLen -= tmpLen;
+#endif
+
 	for(i=0; i<argc; i++){
 		tmpLen = snprintf(tmp, cmdLen, "\"%s\" ", argv[i]);
 		tmp += tmpLen;