Skip to content

Commit 7388bb5

Browse files
committed
fix travis valgrind error
skip overlapping memccpy call there. locally is enough
1 parent 4b3cabe commit 7388bb5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/test_memccpy_s.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88

99
#include "test_private.h"
1010
#include "test_expmem.h"
11-
#if !defined(__KERNEL__) && defined(HAVE_VALGRIND_VALGRIND_H)
11+
#ifndef __KERNEL__
12+
#include <stdlib.h>
13+
#ifdef HAVE_VALGRIND_VALGRIND_H
1214
#include <valgrind/valgrind.h>
1315
#endif
16+
#endif
1417

1518
#define LEN (128)
1619

@@ -127,12 +130,15 @@ int test_memccpy_s(void) {
127130
CHECK_SLACK(str1, nlen);
128131
#if !defined(__KERNEL__) && defined(HAVE_MEMCCPY) && \
129132
(defined(__GLIBC__) || defined(_WIN32))
133+
/* Ignore on smoker under valgrind */
134+
if (!(getenv("TRAVIS") && getenv("VG")))
135+
{
130136
#if defined(HAVE_VALGRIND_VALGRIND_H) && \
131137
(__VALGRIND_MAJOR__ > 3 || \
132138
(__VALGRIND_MAJOR__ == 3 && __VALGRIND_MINOR__ >= 13))
133-
if (!RUNNING_ON_VALGRIND)
139+
if (!RUNNING_ON_VALGRIND)
134140
#endif
135-
{
141+
{
136142
/* with glibc/windows overlap allowed, &str[1] returned.
137143
* an darwin/bsd fails the __memccpy_chk().
138144
* fails also since valgrind 3.13, 3.12 was ok.
@@ -141,6 +147,7 @@ int test_memccpy_s(void) {
141147
char *sub = (char *)memccpy(str1, str1, 0, nlen);
142148
GCC_POP_WARN_RESTRICT
143149
printf("memccpy overlap: %p <=> %p\n", (void *)sub, (void *)str1);
150+
}
144151
}
145152
#endif
146153

0 commit comments

Comments
 (0)