Move the last remaining tests out of corecheck.

Also introduced VG_(showing_core_errors)() to make core error display
more consistent.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4073
This commit is contained in:
Nicholas Nethercote 2005-07-01 04:15:36 +00:00
parent 1cfc0e7971
commit 4e8bcf9076
21 changed files with 61 additions and 52 deletions

View File

@ -1,24 +1 @@
##---------------------------------------------------------------------------
## These test core error checking, eg. "silly values" for malloc/calloc,
## pthread errors (and suppressions), signal handling errors, invalid fds for
## blocking syscalls, etc.
##---------------------------------------------------------------------------
noinst_SCRIPTS = filter_stderr
EXTRA_DIST = $(noinst_SCRIPTS) \
erringfds.stderr.exp erringfds.stdout.exp erringfds.vgtest \
sigkill.stderr.exp sigkill.stderr.exp2 sigkill.vgtest \
stack_changes.vgtest
check_PROGRAMS = \
erringfds sigkill stack_changes
AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -O0
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CXXFLAGS = $(AM_CFLAGS)
sigkill_SOURCES = sigkill.c
# Stack tests
stack_changes_SOURCES = stack_changes.c

View File

@ -1,4 +0,0 @@
Warning: invalid file descriptor -1 in syscall read()
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

View File

@ -231,6 +231,13 @@ void VG_(set_supp_extra) ( Supp* su, void* extra )
/*--- Helper fns ---*/
/*------------------------------------------------------------*/
// Only show core errors if the tool wants to, we're not running with -q,
// and were not outputting XML.
Bool VG_(showing_core_errors)(void)
{
return VG_(needs).core_errors && VG_(clo_verbosity) >= 1 && !VG_(clo_xml);
}
/* Compare error contexts, to detect duplicates. Note that if they
are otherwise the same, the faulting addrs and associated rwoffsets
are allowed to be different. */

View File

@ -617,8 +617,7 @@ SysRes VG_(do_sys_sigaction) ( Int signo,
return VG_(mk_SysRes_Success)( 0 );
bad_signo:
if (VG_(needs).core_errors && VG_(clo_verbosity) >= 1
&& !VG_(clo_xml)) {
if (VG_(showing_core_errors)()) {
VG_(message)(Vg_UserMsg,
"Warning: bad signal number %d in sigaction()",
signo);
@ -626,8 +625,7 @@ SysRes VG_(do_sys_sigaction) ( Int signo,
return VG_(mk_SysRes_Error)( VKI_EINVAL );
bad_signo_reserved:
if (VG_(needs).core_errors && VG_(clo_verbosity) >= 1
&& !VG_(clo_xml)) {
if (VG_(showing_core_errors)()) {
VG_(message)(Vg_UserMsg,
"Warning: ignored attempt to set %s handler in sigaction();",
signame(signo));
@ -638,8 +636,7 @@ SysRes VG_(do_sys_sigaction) ( Int signo,
return VG_(mk_SysRes_Error)( VKI_EINVAL );
bad_sigkill_or_sigstop:
if (VG_(needs).core_errors && VG_(clo_verbosity) >= 1
&& !VG_(clo_xml)) {
if (VG_(showing_core_errors)()) {
VG_(message)(Vg_UserMsg,
"Warning: ignored attempt to set %s handler in sigaction();",
signame(signo));

View File

@ -33,6 +33,7 @@
#include "pub_core_debuginfo.h" // Needed for pub_core_aspacemgr :(
#include "pub_core_aspacemgr.h"
#include "pub_core_debuglog.h"
#include "pub_core_errormgr.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcfile.h"
@ -857,7 +858,9 @@ static Addr do_brk(Addr newbrk)
/* Return true if we're allowed to use or create this fd */
Bool ML_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool soft)
{
if (fd < 0 || fd >= VG_(fd_hard_limit) || fd == VG_(clo_log_fd)) {
if ((fd < 0 || fd >= VG_(fd_hard_limit) || fd == VG_(clo_log_fd)) &&
VG_(showing_core_errors)())
{
VG_(message)(Vg_UserMsg,
"Warning: invalid file descriptor %d in syscall %s()",
fd, syscallname);

View File

@ -1,3 +1,4 @@
/*--------------------------------------------------------------------*/
/*--- ErrorMgr: management of errors and suppressions. ---*/
/*--- pub_core_errormgr.h ---*/
@ -55,6 +56,8 @@ extern void VG_(show_error_counts_as_XML) ( void );
extern Bool VG_(is_action_requested) ( Char* action, Bool* clo );
extern Bool VG_(showing_core_errors) ( void );
extern UInt VG_(get_n_errs_found) ( void );
#endif // __PUB_CORE_ERRORMGR_H

View File

@ -130,8 +130,9 @@ extern void VG_(details_bug_reports_to) ( Char* bug_reports_to );
extern void VG_(needs_libc_freeres) ( void );
/* Want to have errors detected by Valgrind's core reported? Includes:
- pthread API errors (many; eg. unlocking a non-locked mutex)
- invalid file descriptors to blocking syscalls read() and write()
- pthread API errors (many; eg. unlocking a non-locked mutex)
[currently disabled]
- invalid file descriptors to syscalls like read() and write()
- bad signal numbers passed to sigaction()
- attempt to install signal handler for SIGKILL or SIGSTOP */
extern void VG_(needs_core_errors) ( void );

View File

@ -23,6 +23,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
custom_alloc.stderr.exp custom_alloc.vgtest \
describe-block.stderr.exp describe-block.vgtest \
doublefree.stderr.exp doublefree.vgtest \
erringfds.stderr.exp erringfds.stdout.exp erringfds.vgtest \
error_counts.stderr.exp error_counts.stdout.exp error_counts.vgtest \
errs1.stderr.exp errs1.vgtest \
exitprog.stderr.exp exitprog.vgtest \
@ -65,8 +66,10 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
realloc2.stderr.exp realloc2.vgtest \
realloc3.stderr.exp realloc3.vgtest \
sigaltstack.stderr.exp sigaltstack.vgtest \
sigkill.stderr.exp sigkill.stderr.exp2 sigkill.vgtest \
signal2.stderr.exp signal2.stdout.exp signal2.vgtest \
sigprocmask.stderr.exp sigprocmask.vgtest \
stack_changes.stderr.exp stack_changes.stdout.exp stack_changes.vgtest \
strchr.stderr.exp strchr.vgtest \
str_tester.stderr.exp str_tester.vgtest \
supp1.stderr.exp supp1.vgtest \
@ -88,7 +91,7 @@ check_PROGRAMS = \
badloop badpoll badrw brk brk2 buflen_check \
clientperm custom_alloc \
describe-block \
doublefree error_counts errs1 exitprog execve execve2 \
doublefree error_counts errs1 exitprog execve execve2 erringfds \
fprw fwrite hello inits inline \
leak-0 leak-cycle leak-tree leak-regroot leakotron \
malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
@ -99,8 +102,8 @@ check_PROGRAMS = \
pointer-trace \
post-syscall \
realloc1 realloc2 realloc3 \
sigaltstack signal2 sigprocmask \
strchr str_tester supp1 supp2 suppfree \
sigaltstack signal2 sigprocmask sigkill \
stack_changes strchr str_tester supp1 supp2 suppfree \
trivialleak weirdioctl \
mismatches new_override metadata \
vgtest_ume xml1 \
@ -112,18 +115,18 @@ AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g
AM_CXXFLAGS = $(AM_CFLAGS)
# C ones
addressable_SOURCES = addressable.c
badaddrvalue_SOURCES = badaddrvalue.c
badfree_SOURCES = badfree.c
badjump_SOURCES = badjump.c
badjump2_SOURCES = badjump2.c
badloop_SOURCES = badloop.c
badpoll_SOURCES = badpoll.c
badrw_SOURCES = badrw.c
brk_SOURCES = brk.c
brk2_SOURCES = brk2.c
buflen_check_SOURCES = buflen_check.c
clientperm_SOURCES = clientperm.c
#addressable_SOURCES = addressable.c
#badaddrvalue_SOURCES = badaddrvalue.c
#badfree_SOURCES = badfree.c
#badjump_SOURCES = badjump.c
#badjump2_SOURCES = badjump2.c
#badloop_SOURCES = badloop.c
#badpoll_SOURCES = badpoll.c
#badrw_SOURCES = badrw.c
#brk_SOURCES = brk.c
#brk2_SOURCES = brk2.c
#buflen_check_SOURCES = buflen_check.c
#clientperm_SOURCES = clientperm.c
custom_alloc_SOURCES = custom_alloc.c
describe_block_SOURCES = describe-block.c
doublefree_SOURCES = doublefree.c
@ -159,13 +162,15 @@ null_socket_SOURCES = null_socket.c
overlap_SOURCES = overlap.c
# Don't allow GCC to inline memcpy(), because then we can't intercept it
overlap_CFLAGS = $(AM_CFLAGS) -fno-builtin-memcpy
pointer_trace_SOURCES = pointer-trace.c
#pointer_trace_SOURCES = pointer-trace.c
post_syscall_SOURCES = post-syscall.c
realloc1_SOURCES = realloc1.c
realloc2_SOURCES = realloc2.c
realloc3_SOURCES = realloc3.c
sigkill_SOURCES = sigkill.c
signal2_SOURCES = signal2.c
sigprocmask_SOURCES = sigprocmask.c
stack_changes_SOURCES = stack_changes.c
supp1_SOURCES = supp.c
supp2_SOURCES = supp.c
suppfree_SOURCES = suppfree.c

View File

@ -0,0 +1,8 @@
Warning: invalid file descriptor -1 in syscall read()
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
malloc/free: in use at exit: 0 bytes in 0 blocks.
malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
For a detailed leak analysis, rerun with: --leak-check=yes
For counts of detected errors, rerun with: -v

View File

@ -196,3 +196,7 @@ Invalid argument
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
malloc/free: in use at exit: 0 bytes in 0 blocks.
malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
For a detailed leak analysis, rerun with: --leak-check=yes
For counts of detected errors, rerun with: -v

View File

@ -196,3 +196,7 @@ Invalid argument
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
malloc/free: in use at exit: 0 bytes in 0 blocks.
malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
For a detailed leak analysis, rerun with: --leak-check=yes
For counts of detected errors, rerun with: -v

View File

@ -196,3 +196,7 @@ Invalid argument
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
malloc/free: in use at exit: 0 bytes in 0 blocks.
malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
For a detailed leak analysis, rerun with: --leak-check=yes
For counts of detected errors, rerun with: -v