|
From: <sv...@va...> - 2005-11-01 17:21:05
|
Author: tom
Date: 2005-11-01 17:21:03 +0000 (Tue, 01 Nov 2005)
New Revision: 4978
Log:
Fixed test to not assume that malloc(10) will return 10 nul bytes!
Removed:
trunk/memcheck/tests/fwrite.stdout.exp
Modified:
trunk/memcheck/tests/fwrite.c
trunk/memcheck/tests/fwrite.stderr.exp
trunk/memcheck/tests/fwrite.stderr.exp2
Modified: trunk/memcheck/tests/fwrite.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/fwrite.c 2005-11-01 17:15:50 UTC (rev 4977)
+++ trunk/memcheck/tests/fwrite.c 2005-11-01 17:21:03 UTC (rev 4978)
@@ -1,9 +1,17 @@
-
+#include <fcntl.h>
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main ( void )
{
char* arr =3D malloc(10);
- (void) write( 1 /* stdout */, arr, 10 );
+ int fd =3D open("/dev/null", O_WRONLY);
+ if (fd < 0) {
+ fprintf(stderr, "open failed\n");
+ } else {
+ (void)write(fd, arr, 10);
+ (void)close(fd);
+ }
+
return 0;
}
Modified: trunk/memcheck/tests/fwrite.stderr.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/fwrite.stderr.exp 2005-11-01 17:15:50 UTC (rev 4=
977)
+++ trunk/memcheck/tests/fwrite.stderr.exp 2005-11-01 17:21:03 UTC (rev 4=
978)
@@ -4,4 +4,4 @@
by 0x........: ...
Address 0x........ is 0 bytes inside a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (fwrite.c:6)
+ by 0x........: main (fwrite.c:7)
Modified: trunk/memcheck/tests/fwrite.stderr.exp2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/fwrite.stderr.exp2 2005-11-01 17:15:50 UTC (rev =
4977)
+++ trunk/memcheck/tests/fwrite.stderr.exp2 2005-11-01 17:21:03 UTC (rev =
4978)
@@ -1,6 +1,6 @@
Syscall param write(buf) points to uninitialised byte(s)
at 0x........: write (in /...libc...)
- by 0x........: main (fwrite.c:7)
+ by 0x........: main (fwrite.c:12)
Address 0x........ is 0 bytes inside a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (fwrite.c:6)
+ by 0x........: main (fwrite.c:7)
Deleted: trunk/memcheck/tests/fwrite.stdout.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/fwrite.stdout.exp 2005-11-01 17:15:50 UTC (rev 4=
977)
+++ trunk/memcheck/tests/fwrite.stdout.exp 2005-11-01 17:21:03 UTC (rev 4=
978)
@@ -1 +0,0 @@
-=00=00=00=00=00=00=00=00=00=00
\ No newline at end of file
|
|
From: Julian S. <js...@ac...> - 2005-11-01 17:49:42
|
> Fixed test to not assume that malloc(10) will return 10 nul bytes! I also noticed that toobig_allocs fails on a 4G-userspace machine with tons of memory and swap (g5), because the allegedly-too-big malloc which is supposed to fail actually succeeds. Is on my todo list. J |