View | Details | Raw Unified | Return to bug 781
Collapse All | Expand All

(-)a/test.py (-1 / +83 lines)
 Lines 585-594    Link Here 
585
        if options.verbose:
585
        if options.verbose:
586
            print "os.environ[\"LD_LIBRARY_PATH\"] == %s" % os.environ["LD_LIBRARY_PATH"]
586
            print "os.environ[\"LD_LIBRARY_PATH\"] == %s" % os.environ["LD_LIBRARY_PATH"]
587
587
588
#
589
# Short note on generating suppressions:
590
#
591
# See the valgrind documentation for a description of suppressions.  The easiest
592
# way to generate a suppression expression is by using the valgrind 
593
# --gen-suppressions option.  To do that you have to figure out how to run the 
594
# test in question.
595
#
596
# If you do "test.py -v -g -s <suitename> then test.py will output most of what
597
# you need.  For example, if you are getting a valgrind error in the
598
# devices-mesh-dot11s-regression test suite, you can run:
599
#
600
#   ./test.py -v -g -s devices-mesh-dot11s-regression 
601
#
602
# You should see in the verbose output something that looks like:
603
#
604
#   Synchronously execute valgrind --suppressions=/home/craigdo/repos/ns-3-allinone-dev/ns-3-dev/testpy.supp
605
#   --leak-check=full --error-exitcode=2 /home/craigdo/repos/ns-3-allinone-dev/ns-3-dev/build/debug/utils/test-runner 
606
#   --suite=devices-mesh-dot11s-regression --basedir=/home/craigdo/repos/ns-3-allinone-dev/ns-3-dev 
607
#   --tempdir=testpy-output/2010-01-12-22-47-50-CUT 
608
#   --out=testpy-output/2010-01-12-22-47-50-CUT/devices-mesh-dot11s-regression.xml
609
#
610
# You need to pull out the useful pieces, and so could run the following to 
611
# reproduce your error:
612
#
613
#   valgrind --suppressions=/home/craigdo/repos/ns-3-allinone-dev/ns-3-dev/testpy.supp
614
#   --leak-check=full --error-exitcode=2 /home/craigdo/repos/ns-3-allinone-dev/ns-3-dev/build/debug/utils/test-runner 
615
#   --suite=devices-mesh-dot11s-regression --basedir=/home/craigdo/repos/ns-3-allinone-dev/ns-3-dev 
616
#   --tempdir=testpy-output 
617
#
618
# Hint: Use the first part of the command as is, and point the "tempdir" to 
619
# somewhere real.  You don't need to specify an "out" file.
620
#
621
# When you run the above command you should see your valgrind error.  The 
622
# suppression expression(s) can be generated by adding the --gen-suppressions=yes
623
# option to valgrind.  Use something like:
624
#
625
#   valgrind --gen-suppressions=yes --suppressions=/home/craigdo/repos/ns-3-allinone-dev/ns-3-dev/testpy.supp
626
#   --leak-check=full --error-exitcode=2 /home/craigdo/repos/ns-3-allinone-dev/ns-3-dev/build/debug/utils/test-runner 
627
#   --suite=devices-mesh-dot11s-regression --basedir=/home/craigdo/repos/ns-3-allinone-dev/ns-3-dev 
628
#   --tempdir=testpy-output 
629
#
630
# Now when valgrind detects an error it will ask:
631
#
632
#   ==27235== ---- Print suppression ? --- [Return/N/n/Y/y/C/c] ----
633
#
634
# to which you just enter 'y'<ret>.
635
#
636
# You will be provided with a suppression expression that looks something like
637
# the following:
638
#   {
639
#     <insert_a_suppression_name_here>
640
#     Memcheck:Addr8
641
#     fun:_ZN3ns36dot11s15HwmpProtocolMac8SendPreqESt6vectorINS0_6IePreqESaIS3_EE
642
#     fun:_ZN3ns36dot11s15HwmpProtocolMac10SendMyPreqEv
643
#     fun:_ZN3ns36dot11s15HwmpProtocolMac18RequestDestinationENS_12Mac48AddressEjj
644
#     ...
645
#     the rest of the stack frame
646
#     ...
647
#   }
648
#
649
# You need to add a supression name which will only be printed out by valgrind in 
650
# verbose mode (but it needs to be there in any case).  The entire stack frame is
651
# shown to completely characterize the error, but in most cases you won't need 
652
# all of that info.  For example, if you want to turn off all errors that happen
653
# when the function (fun:) is called, you can just delete the rest of the stack
654
# frame.  You can also use wildcards to make the mangled signatures more readable.
655
#
656
# I added the following to the testpy.supp file for this particular error:
657
#
658
#   {
659
#     Supress invalid read size errors in SendPreq() when using HwmpProtocolMac
660
#     Memcheck:Addr8
661
#     fun:*HwmpProtocolMac*SendPreq*
662
#   }
663
#
664
# Now, when you run valgrind the error will be suppressed.
665
#
666
VALGRIND_SUPPRESSIONS_FILE = "testpy.supp"
667
588
def run_job_synchronously(shell_command, directory, valgrind):
668
def run_job_synchronously(shell_command, directory, valgrind):
669
    (base, build) = os.path.split (NS3_BUILDDIR)
670
    suppressions_path = os.path.join (base, VALGRIND_SUPPRESSIONS_FILE)
589
    path_cmd = os.path.join (NS3_BUILDDIR, NS3_ACTIVE_VARIANT, shell_command)
671
    path_cmd = os.path.join (NS3_BUILDDIR, NS3_ACTIVE_VARIANT, shell_command)
590
    if valgrind:
672
    if valgrind:
591
        cmd = "valgrind --leak-check=full --error-exitcode=2 %s" % path_cmd
673
        cmd = "valgrind --suppressions=%s --leak-check=full --error-exitcode=2 %s" % (suppressions_path, path_cmd)
592
    else:
674
    else:
593
        cmd = path_cmd
675
        cmd = path_cmd
594
676
(-)be7ee94b8f79 (+5 lines)
Added Link Here 
1
{
2
  Supress invalid read size errors in SendPreq() when using HwmpProtocolMac
3
  Memcheck:Addr8
4
  fun:*HwmpProtocolMac*SendPreq*
5
}

Return to bug 781