Commit Graph

29 Commits

Author SHA1 Message Date
Gerald Combs dacbfc4ae9 Tools: Try to exit more gracefully from fuzzing.
If we catch a signal while we're fuzzing, exit with a successful status
and clean up after ourselves.
2021-05-11 11:07:27 -07:00
Gerald Combs 4905983845 More shellcheck checks and fixes.
Remove a libtool check while we're here.

Change-Id: I813add2031480f34ce89f268b541f8939016c2c7
Reviewed-on: https://code.wireshark.org/review/28066
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-06-07 18:11:12 +00:00
Darius Davis 06571ad330 Add valgrind support to randpkt-test.sh.
There's already valgrind support in fuzz-test.sh; This change simply clones the
relevant fragments of script into randpkt-test.sh, making very minor tweaks as
needed.  Valgrind support in randpkt-test.sh is enabled through the "-g"
command-line option, just like with fuzz-test.sh.

In my testing here, it seems MAX_LEAK could be reduced somewhat, but I don't
think that that belongs as part of this change; I've simply kept the MAX_LEAK
value from fuzz-test.sh.

While we're here, the last line of valgrind-wireshark.sh launches a subprocess,
and that shell then simply returns its exit code, so there is no need for the
shell to stick around.  So, let's use "exec" here to replace the shell with the
new process.

Testing Done: On Linux amd64, ran several iterations of randpkt-test.sh and
   fuzz-test.sh, both with and without the "-g" option.

Change-Id: I87cc63559dc2e66c42c905f46657ce40cabf0104
Reviewed-on: https://code.wireshark.org/review/27741
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-30 08:22:48 +00:00
Gerald Combs 2b5020aca5 randpkt-test: Fix our optstring
"-a" doesn't have an argument.

Change-Id: Ia178985925da6e8bf9e1f0e9626521fb93656632
Reviewed-on: https://code.wireshark.org/review/18086
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-10-05 18:35:44 +00:00
Gerald Combs b725d6c9ac Add an initial "shellcheck" target.
Look for shellcheck in Autotools and CMake, and if found add a target
that checks some of our shell scripts.

Add a "source=" directive to targets that include test-common.sh so
that shellcheck will correctly process the scripts. Note that this
requires shellcheck 0.4.0 or later.

To do: Fix the issues that shellcheck found and check more scripts.

Change-Id: I441f9f59d8a3f8eec6718119c2370f2560b98f3c
Reviewed-on: https://code.wireshark.org/review/17943
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-09-26 23:17:02 +00:00
Gerald Combs 17546ad883 Check for ASAN when fuzzing.
Try to determine if we passed -fsanitize=address to gcc or clang and
adjust the ASAN variable fuzz-test.sh, randpkt-test.sh and
test-captures.sh accordingly.

Change-Id: I88a34828fb5875e1a74a3b180ffb3da37daac0bd
Reviewed-on: https://code.wireshark.org/review/17848
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-09-24 21:04:31 +00:00
Guy Harris ec0aeb983b Set the VA limit with ulimit -S, and clean up comments.
Other limits are set with -S, do that with the virtual address space
limit as well.

Change-Id: Ie427341a4c7be56d3e8d96be6c1713c56e9bad87
Reviewed-on: https://code.wireshark.org/review/17846
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-21 21:41:47 +00:00
Guy Harris 11d3a0f963 Add a -a flag to specify running under ASan, and don't set ulimit -v if so.
You can't run ASan-built programs with a ulimit, as ASan allocates a
huge amount of shadow memory.

Change-Id: Ic4d3c2fae77719f65d4594774bc8aa92d2a3a035
Ping-Bug: 12797
Reviewed-on: https://code.wireshark.org/review/17645
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-11 19:09:24 +00:00
Evan Huus 8f40e2cd8d tools: permit setting BIN_DIR in the environment
For out-of-tree builds you have to pass the location of your build to our tools
like the fuzz script, valgrind script etc. Modify them so that the value can be
set in the environment rather than requiring a shell script flag.

Set the environment variable in the vagrant provision step, so that the scripts
Just Work (TM) in the VM.

Change-Id: If8ce6b278176085ba6dd994137b82fc989b80124
Reviewed-on: https://code.wireshark.org/review/9168
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-26 06:52:58 +00:00
Bill Meier 550e3153bf Fix fuzz-test.sh '-b' option so it works again; Do some other tools/*test*.sh changes
- Add -b option to randpkt-test.sh and test-captures.sh;
- Create/ue a common function to do '-x' tests on files/dirs;
- Rename exit_error function to ws_exit_error

Change-Id: I032c9d784bec1fb6b0717aaad08a061e4d935476
Reviewed-on: https://code.wireshark.org/review/872
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-03-30 21:03:15 +00:00
Jeff Morriss 82e2865739 Remove $Id$ and other Subversion leftovers from the tools.
There are a few things in here which could still use attention.

Don't regenerate anything now.

Change-Id: I283c224d3523212144707fca3d6265916cb11792
Reviewed-on: https://code.wireshark.org/review/205
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-02-14 01:35:57 +00:00
Jeff Morriss 2a62d8e8e6 Include the output (fuzz'd) file name in the output when fuzz (or randpkt)
testing fails.

Useful for when you want to use up a few spare CPU cores running multiple
simultaneous fuzz tests...

svn path=/trunk/; revision=50449
2013-07-08 19:49:17 +00:00
Jeff Morriss 4509929f2a Exit if we can't load the test-common.sh library.
svn path=/trunk/; revision=49625
2013-05-30 00:35:46 +00:00
Gerald Combs 3c66ac4b83 Forward-port r47305 from trunk-1.8:
------------------------------------------------------------------------
  r47305 | gerald | 2013-01-26 12:12:52 -0800 (Sat, 26 Jan 2013) | 6 lines
  Changed paths:
     M /trunk-1.8/tools/fuzz-test.sh

  Instead of setting resource limits on the fuzz-test.sh process itself,
  set limits on the TShark subprocess. This should hopefully take care
  of the strange fuzz failures we've seen lately.

  Reduce the maximum CPU time to 5 minutes while we're at it.
  ------------------------------------------------------------------------

svn path=/trunk/; revision=47307
2013-01-26 20:36:57 +00:00
Gerald Combs 739c90f0ad Move a lot of common fuzz-test and randpkt-test code to its own file
(test-common.sh). Add build information to the error output as suggested
in http://www.wireshark.org/lists/wireshark-dev/201212/msg00037.html

svn path=/trunk/; revision=46446
2012-12-07 17:57:09 +00:00
Gerald Combs ff32bd8000 If our error output is huge (> 5 MB) trim out the middle of the file.
The recent loop bugs have generated output that's too large to attach to
Bugzilla.

svn path=/trunk/; revision=45437
2012-10-09 20:47:22 +00:00
Gerald Combs 52972458e8 Add the command and arguments to the error file.
svn path=/trunk/; revision=45294
2012-10-03 18:03:12 +00:00
Gerald Combs a5b9de38b4 Fix return code checking (hopefully).
svn path=/trunk/; revision=45289
2012-10-03 16:39:35 +00:00
Gerald Combs 498db62022 Test with the presence (-nVxr) and absence (-nr) of the tree. We now
use an array of arguments so additional combinations can be added.

svn path=/trunk/; revision=45258
2012-10-02 17:58:00 +00:00
Gerald Combs 345529250f Run 'git log' if we have a .git directory. Fixes a copy+paste error.
svn path=/trunk/; revision=44784
2012-09-05 20:58:15 +00:00
Evan Huus 450d24d835 Don't go into a tight loop when there's no specific number of passes.
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7651

Also, use consistent indentation.

svn path=/trunk/; revision=44581
2012-08-19 13:50:22 +00:00
Evan Huus f385acc461 From Toralf Förster via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7652
Use a fast bash built-in rather than a slow call out to `expr` to increment
the loop count.

svn path=/trunk/; revision=44580
2012-08-19 13:38:53 +00:00
Gerald Combs faf3cdf75d Move error reporting to a common function. Lot information about the
most recent revision / commit.

svn path=/trunk/; revision=44552
2012-08-17 16:28:28 +00:00
Gerald Combs 17febadb12 Terminate our inner loops as well.
svn path=/trunk/; revision=42134
2012-04-18 16:10:08 +00:00
Gerald Combs bb606959f7 Tell the main loop to terminate when we catch a signal instead of trying
to clean up in two places.

svn path=/trunk/; revision=42133
2012-04-18 16:04:05 +00:00
Gerald Combs 6a49671fa2 Make sure we use the "randpkt-" prefix everywhere.
svn path=/trunk/; revision=33468
2010-07-07 19:53:40 +00:00
Jörg Mayer a41982ca05 It's not only executable but a script as well: propset eol-style + keywords
svn path=/trunk/; revision=18837
2006-08-04 16:30:54 +00:00
Gerald Combs 35cac1cb36 Make the output file name a little more descriptive.
svn path=/trunk/; revision=18828
2006-08-02 21:19:56 +00:00
Gerald Combs b380600ab9 Add a script for randpkt testing. Copied from fuzz-test.sh.
svn path=/trunk/; revision=18824
2006-08-02 18:59:29 +00:00