[netfilter-cvslog] r4131 - trunk/nfsim/core
rusty at netfilter.org
rusty at netfilter.org
Tue Jul 19 22:24:17 CEST 2005
Author: rusty at netfilter.org
Date: 2005-07-19 22:24:14 +0200 (Tue, 19 Jul 2005)
New Revision: 4131
Modified:
trunk/nfsim/core/failtest.c
Log:
Implement --failtest-no-report for suppressing warnings about ignoring failure from warn_if_extra_mangle.
Modified: trunk/nfsim/core/failtest.c
===================================================================
--- trunk/nfsim/core/failtest.c 2005-07-19 10:13:14 UTC (rev 4130)
+++ trunk/nfsim/core/failtest.c 2005-07-19 20:24:14 UTC (rev 4131)
@@ -28,8 +28,9 @@
static bool failtest = false;
unsigned int suppress_failtest;
-static unsigned int fails = 0, fails_once = 0;
+static unsigned int fails = 0, excessive_fails = 2;
unsigned int failpoints = 0;
+static const char *failtest_no_report = NULL;
struct fail_decision
{
@@ -90,6 +91,25 @@
}
cmdline_opt("failpath", 1, 0, cmdline_failpath);
+/*** XML Argument:
+ <section id="a:failtest-no-report">
+ <title><option>--failtest-no-report
+ <replaceable>function</replaceable></option></title>
+ <subtitle>Exclude a function from excessive failure reports</subtitle>
+
+ <para>Sometimes code deliberately ignores the failures of a
+ certain function. This suppresses complaints about that for any
+ functions containing this name.</para> </section>
+*/
+static void cmdline_failtest_no_report(struct option *opt)
+{
+ extern char *optarg;
+ if (!optarg)
+ barf("failtest-no-report option requires an argument");
+ failtest_no_report = optarg;
+}
+cmdline_opt("failtest-no-report", 1, 0, cmdline_failtest_no_report);
+
bool get_failtest(void)
{
return failtest;
@@ -219,7 +239,7 @@
return false;
if (should_i_fail(location)) {
- fails_once++;
+ excessive_fails++;
return true;
}
return false;
@@ -243,10 +263,8 @@
return false;
/* If a testcase ignores a spuriously-inserted failure, it's
- * not specific enough, and we risk doing 2^n tests! Limit it
- * to 2. should_i_fail_once() is used on "expected" failures,
- * like del_timer, so don't count those. */
- if (fails - fails_once > 2) {
+ * not specific enough, and we risk doing 2^n tests! */
+ if (fails > excessive_fails) {
static bool warned = false;
if (!warned++)
warn_failure();
@@ -266,7 +284,8 @@
* point, but should not crash. */
if (child == 0) {
dec->failed = true;
- fails++;
+ if (!failtest_no_report || !strstr(func, failtest_no_report))
+ fails++;
/* If we're talking to iptables, it has to fork too. */
fork_other_program();
return true;
More information about the netfilter-cvslog
mailing list