|
From: Nicholas N. <nj...@ca...> - 2004-10-14 08:38:10
|
CVS commit by nethercote:
Added a unit self-test -- a test program that incorporates a small part of
Valgrind itself (the files ume.c, ume_entry.c and jmp_with_stack.c). Thus,
we are using Memcheck to check these files in a unit test setting.
I hope to do unit self-testing for many more parts of Valgrind, eventually all
the bits that can be pulled out into any kind of sensible stand-alone form.
Doing so achieves two things:
a) it introduces unit testing into our framework (a serious shortcoming at the
moment)
b) it lets us use Valgrind (esp. Memcheck) on itself, to some extent
This should help reliability. This first unit self-test isn't very exhaustive,
but it's a start.
Note that this involves something like bootstrapping, in that we are checking
parts of a Valgrind build with itself. I don't think this will be a problem,
since we (at least, I do) tend to only run the regtests when we think the
Valgrind build is ok.
A hello.c 1.1 [POSSIBLY UNSAFE: printf] [no copyright]
A vgtest_ume.c 1.1 [no copyright]
A vgtest_ume.stderr.exp 1.1
A vgtest_ume.vgtest 1.1
M +2 -0 .cvsignore 1.17
M +15 -2 Makefile.am 1.44
--- valgrind/memcheck/tests/.cvsignore #1.16:1.17
@@ -22,4 +22,5 @@
fprw
fwrite
+hello
inits
inline
@@ -50,4 +51,5 @@
trivialleak
tronical
+vgtest_ume
weirdioctl
*.stdout.diff
--- valgrind/memcheck/tests/Makefile.am #1.43:1.44
@@ -76,4 +76,5 @@
threadederrno.stderr.exp threadederrno.stdout.exp \
threadederrno.vgtest \
+ vgtest_ume.stderr.exp vgtest_ume.vgtest \
writev.stderr.exp writev.vgtest \
zeropage.stderr.exp zeropage.stderr.exp2 zeropage.vgtest
@@ -84,5 +85,5 @@
clientperm custom_alloc \
doublefree error_counts errs1 exitprog execve execve2 \
- fpeflags fprw fwrite inits inline \
+ fpeflags fprw fwrite hello inits inline \
malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
memalign_test memalign2 memcmptest mempool mmaptest \
@@ -91,5 +92,8 @@
realloc1 realloc2 realloc3 sigaltstack signal2 supp1 supp2 suppfree \
trivialleak tronical weirdioctl \
- mismatches new_override metadata threadederrno writev zeropage
+ mismatches new_override metadata threadederrno \
+ vgtest_ume \
+ writev zeropage
+
AM_CPPFLAGS = -I$(top_srcdir)/include
@@ -149,4 +153,5 @@
threadederrno_SOURCES = threadederrno.c
threadederrno_LDADD = -lpthread
+vgtest_ume_SOURCES = vgtest_ume.c
writev_SOURCES = writev.c
zeropage_SOURCES = zeropage.c
@@ -157,4 +162,12 @@
new_override_SOURCES = new_override.cpp
+# Valgrind unit self-tests
+hello_SOURCES = hello.c
+hello_LDFLAGS = -Wl,-defsym,kickstart_base=0x50000000 \
+ -Wl,-T,../../coregrind/${VG_ARCH}/stage2.lds
+vgtest_ume_LDADD = ../../coregrind/ume.o \
+ ../../coregrind/ume_entry.o \
+ ../../coregrind/jmp_with_stack.o
+
# must be built with these flags -- bug only occurred with them
fpeflags.o: CFLAGS += -march=i686
|