]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Move the last remaining tests out of corecheck.
authorNicholas Nethercote <njn@valgrind.org>
Fri, 1 Jul 2005 04:15:36 +0000 (04:15 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Fri, 1 Jul 2005 04:15:36 +0000 (04:15 +0000)
Also introduced VG_(showing_core_errors)() to make core error display
more consistent.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4073

21 files changed:
corecheck/tests/Makefile.am
corecheck/tests/erringfds.stderr.exp [deleted file]
coregrind/m_errormgr.c
coregrind/m_signals.c
coregrind/m_syswrap/syswrap-generic.c
coregrind/pub_core_errormgr.h
include/pub_tool_tooliface.h
memcheck/tests/Makefile.am
memcheck/tests/erringfds.c [moved from corecheck/tests/erringfds.c with 100% similarity]
memcheck/tests/erringfds.stderr.exp [new file with mode: 0644]
memcheck/tests/erringfds.stdout.exp [moved from corecheck/tests/erringfds.stdout.exp with 100% similarity]
memcheck/tests/erringfds.vgtest [moved from corecheck/tests/erringfds.vgtest with 100% similarity]
memcheck/tests/sigkill.c [moved from corecheck/tests/sigkill.c with 100% similarity]
memcheck/tests/sigkill.stderr.exp [moved from corecheck/tests/sigkill.stderr.exp with 94% similarity]
memcheck/tests/sigkill.stderr.exp2 [moved from corecheck/tests/sigkill.stderr.exp2 with 94% similarity]
memcheck/tests/sigkill.stderr.exp3 [moved from corecheck/tests/sigkill.stderr.exp3 with 94% similarity]
memcheck/tests/sigkill.vgtest [moved from corecheck/tests/sigkill.vgtest with 100% similarity]
memcheck/tests/stack_changes.c [moved from corecheck/tests/stack_changes.c with 100% similarity]
memcheck/tests/stack_changes.stderr.exp [moved from corecheck/tests/stack_changes.stderr.exp with 100% similarity]
memcheck/tests/stack_changes.stdout.exp [moved from corecheck/tests/stack_changes.stdout.exp with 100% similarity]
memcheck/tests/stack_changes.vgtest [moved from corecheck/tests/stack_changes.vgtest with 100% similarity]

index 319c8de6e2f10b0e0a4d310ce5f1877fae1ed0f9..d1a9ba94fcb26a917d515e3bccadd1bc7d93a56b 100644 (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
diff --git a/corecheck/tests/erringfds.stderr.exp b/corecheck/tests/erringfds.stderr.exp
deleted file mode 100644 (file)
index b6a487d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-
-Warning: invalid file descriptor -1 in syscall read()
-
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
index cf6cfb0253079e5f805877066ab5b927d61a59a5..364c38c0d1ab7919acc65d86925c2d132f20227a 100644 (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.  */
index fc66e23704cc2e5a28eade992e6926d763e3abfb..248d29891676b0897a71648bcb06bcde0d719312 100644 (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));
index cbef16bea0bcd3338fcaf39b9cfd59abae03b3e8..69a793d3268b9906a5eb7f4733f6dc41cf1f2bc2 100644 (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);
index 4483555b60a83235e6f2592a31cf9da506905d35..bcd1f3b1567e81a7c28b7aea64745a4c6542e38d 100644 (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
index 92e413a0f61ff21ff8470e1ad30bca0efa31eb45..3482c0103d4cebda4eb2d4038fe0f8acc061a920 100644 (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 );
index bb1537fa18deef7be3459c19944eb8fb81960b5c..85d2eed0f5822effdd9b55bd757752000e1851df 100644 (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
diff --git a/memcheck/tests/erringfds.stderr.exp b/memcheck/tests/erringfds.stderr.exp
new file mode 100644 (file)
index 0000000..0516e09
--- /dev/null
@@ -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
similarity index 94%
rename from corecheck/tests/sigkill.stderr.exp
rename to memcheck/tests/sigkill.stderr.exp
index b71799ddac63840de107904522668cdcb9e6349b..7dbb0d48fce7e8a81a3550d82507125ca02cf860 100644 (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
similarity index 94%
rename from corecheck/tests/sigkill.stderr.exp2
rename to memcheck/tests/sigkill.stderr.exp2
index 896213faa2b5e200476d1d3e9406f94bdecdd9b1..3cc35594ac1fc1f7506046711f196eb93dfc1dd9 100644 (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
similarity index 94%
rename from corecheck/tests/sigkill.stderr.exp3
rename to memcheck/tests/sigkill.stderr.exp3
index a538a530fb9f1be5a01164c6b26a679c667b974a..dfe65480d8de9019c6b41bedb74656fb8fc9f4f3 100644 (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