projects
/
libc-test
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix malloc-brk-fail
[libc-test]
/
src
/
functional
/
string_memset.c
diff --git
a/src/functional/string_memset.c
b/src/functional/string_memset.c
index
5c0dd02
..
e688742
100644
(file)
--- a/
src/functional/string_memset.c
+++ b/
src/functional/string_memset.c
@@
-3,7
+3,7
@@
#include <stdint.h>
#include "test.h"
#include <stdint.h>
#include "test.h"
-#define N
4
00
+#define N
5
00
static char buf[N];
static char buf2[N];
static char buf[N];
static char buf2[N];
@@
-11,7
+11,7
@@
static void *(*volatile pmemset)(void *, int, size_t);
static char *aligned(void *p)
{
static char *aligned(void *p)
{
- return (char*)(((uintptr_t)p + 63) & -64
U
);
+ return (char*)(((uintptr_t)p + 63) & -64);
}
static void test_align(int align, int len)
}
static void test_align(int align, int len)
@@
-21,7
+21,7
@@
static void test_align(int align, int len)
char *p;
int i;
char *p;
int i;
- if (
s - buf + len >= N
)
+ if (
len + 64 > buf + N - s || len + 64 > buf2 + N - want
)
abort();
for (i = 0; i < N; i++)
buf[i] = buf2[i] = ' ';
abort();
for (i = 0; i < N; i++)
buf[i] = buf2[i] = ' ';
@@
-30,11
+30,11
@@
static void test_align(int align, int len)
p = pmemset(s, '#', len);
if (p != s)
t_error("memset(%p,...) returned %p\n", s, p);
p = pmemset(s, '#', len);
if (p != s)
t_error("memset(%p,...) returned %p\n", s, p);
- for (i =
0; i < N
; i++)
- if (
buf[i] != buf2
[i]) {
+ for (i =
-64; i < len+64
; i++)
+ if (
s[i] != want
[i]) {
t_error("memset(align %d, '#', %d) failed at pos %d\n", align, len, i);
t_error("memset(align %d, '#', %d) failed at pos %d\n", align, len, i);
- t_printf("got : '%.*s'\n",
N, s
);
- t_printf("want: '%.*s'\n",
N, want
);
+ t_printf("got : '%.*s'\n",
len+128, s-64
);
+ t_printf("want: '%.*s'\n",
len+128, want-64
);
break;
}
}
break;
}
}
@@
-57,8
+57,8
@@
int main(void)
pmemset = memset;
pmemset = memset;
- for (i = 0; i <
16
; i++)
- for (j = 0; j <
200
; j++)
+ for (i = 0; i <
64
; i++)
+ for (j = 0; j <
N-256
; j++)
test_align(i,j);
test_value('c');
test_align(i,j);
test_value('c');