[netfilter-cvslog] r3521 - in trunk: nfsim nfsim/core
nfsim/kernelenv nfsim-testsuite
rusty at netfilter.org
rusty at netfilter.org
Thu Dec 30 08:22:22 CET 2004
Author: rusty at netfilter.org
Date: 2004-12-30 08:22:21 +0100 (Thu, 30 Dec 2004)
New Revision: 3521
Modified:
trunk/nfsim-testsuite/test-kernel-source
trunk/nfsim/Makefile.in
trunk/nfsim/core/core.c
trunk/nfsim/core/core.h
trunk/nfsim/kernelenv/proc_stuff.c
Log:
Add --ignore-proc-issues so every test doesn't fail on exit for 2.6.9 & 2.6.10
Add core/failtest.c to files which contain cmdline documentation (must have edited Makefile previously by mistake)
Modified: trunk/nfsim/Makefile.in
===================================================================
--- trunk/nfsim/Makefile.in 2004-12-30 06:44:00 UTC (rev 3520)
+++ trunk/nfsim/Makefile.in 2004-12-30 07:22:21 UTC (rev 3521)
@@ -26,7 +26,7 @@
HELP_OBJS:=
# files which we can extract command line usage from
-USAGE_SOURCES := core/core.c
+USAGE_SOURCES := core/core.c core/failtest.c kernelenv/proc_stuff.c
all: simulator core/fakesockopt.so.1.0
Modified: trunk/nfsim/core/core.c
===================================================================
--- trunk/nfsim/core/core.c 2004-12-30 06:44:00 UTC (rev 3520)
+++ trunk/nfsim/core/core.c 2004-12-30 07:22:21 UTC (rev 3521)
@@ -345,6 +345,8 @@
void check_allocations(void)
{
+ proc_cleanup();
+
if (talloc_total_blocks(nfsim_tallocs)!=nfsim_tallocs_initial_blocks){
talloc_report_full(nfsim_tallocs, stderr);
barf("Resource leak");
Modified: trunk/nfsim/core/core.h
===================================================================
--- trunk/nfsim/core/core.h 2004-12-30 06:44:00 UTC (rev 3520)
+++ trunk/nfsim/core/core.h 2004-12-30 07:22:21 UTC (rev 3521)
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <getopt.h>
#include <kernelenv.h>
+#include <utils.h>
#include <linux/list.h>
@@ -284,6 +285,7 @@
/* Proc interface. */
bool nfsim_proc_cat(const char *name);
bool nfsim_proc_write(const char *name, char *argv[]);
+void proc_cleanup(void);
/* Root for all kernel code allocations (so we check memory leaks) */
extern void *nfsim_tallocs;
Modified: trunk/nfsim/kernelenv/proc_stuff.c
===================================================================
--- trunk/nfsim/kernelenv/proc_stuff.c 2004-12-30 06:44:00 UTC (rev 3520)
+++ trunk/nfsim/kernelenv/proc_stuff.c 2004-12-30 07:22:21 UTC (rev 3521)
@@ -19,6 +19,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <core.h>
#include <kernelenv.h>
struct proc_dir_entry proc_root, *proc_net, *proc_net_stat, *proc_sys_root;
@@ -284,6 +285,24 @@
return ent;
}
+/*** XML Argument:
+ <section id="a:ignore-proc-issues">
+ <title><option>--ignore-proc-issues</option></title>
+ <subtitle>Ignore issues with /proc files leaking</subtitle>
+
+ <para>The <option>--ignore-proc-issues</option> can be used to
+ suppress failure due to removing non-existent proc entries and
+ leaving proc files behind, which happened in 2.6.10 and previous.
+ </para>
+ </section>
+*/
+static bool ignore_proc_issues = false;
+static void cmdline_ignore_proc_issues(struct option *opt)
+{
+ ignore_proc_issues = true;
+}
+cmdline_opt("ignore-proc-issues", 0, 0, cmdline_ignore_proc_issues);
+
void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
{
struct proc_dir_entry **p;
@@ -292,7 +311,7 @@
int len;
if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
- goto out;
+ barf("Cannot remove non-existent entry '%s'", name);
len = strlen(fn);
for (p = &parent->subdir; *p; p=&(*p)->next ) {
if (!proc_match(len, fn, *p))
@@ -300,10 +319,11 @@
de = *p;
*p = de->next;
talloc_free(de);
- break;
+ return;
}
-out:
- return;
+ if (!ignore_proc_issues)
+ barf("Cannot find entry '%s' under %s to remove", name,
+ parent ? parent->name : "/");
}
struct proc_dir_entry *create_proc_info_entry(const char *name,
@@ -924,5 +944,15 @@
proc_sys_root = proc_mkdir("sys", NULL);
}
+void proc_cleanup(void)
+{
+ if (ignore_proc_issues) {
+ /* Free and reinitialize, so it's like before. */
+ talloc_free(__proc_ctx);
+ memset(&proc_root, 0, sizeof(proc_root));
+ proc_init();
+ }
+}
+
init_call(proc_init);
Modified: trunk/nfsim-testsuite/test-kernel-source
===================================================================
--- trunk/nfsim-testsuite/test-kernel-source 2004-12-30 06:44:00 UTC (rev 3520)
+++ trunk/nfsim-testsuite/test-kernel-source 2004-12-30 07:22:21 UTC (rev 3521)
@@ -73,6 +73,12 @@
(build_nfsim $KERNELDIR $NFSIM) >/dev/null || barf Failed to build nfsim for $1
fi
+# Work around 2.6.9/2.6.10 proc bug.
+if [ "`$NFSIM -q < /dev/null 2>&1`" = "FATAL: Cannot find entry 'ip_conntrack_stat' under net to remove" ]; then
+ echo This nfsim built using kernel with proc issues: ignoring.
+ EXTRA_ARGS="--ignore-proc-issues $EXTRA_ARGS"
+fi
+
echo Running tests...
./test.sh $EXTRA_ARGS --nfsim=$NFSIM $TEST || barf Tests failed for $1
More information about the netfilter-cvslog
mailing list