diff mbox series

[24/24] check: try reloading modules

Message ID 160013432812.2923511.2856221820399528798.stgit@magnolia (mailing list archive)
State Superseded, archived
Headers show
Series fstests: tons of random fixes | expand

Commit Message

Darrick J. Wong Sept. 15, 2020, 1:45 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Optionally reload the module between each test to try to pinpoint slab
cache errors and whatnot.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 README |    3 +++
 check  |    9 +++++++++
 2 files changed, 12 insertions(+)

Comments

Amir Goldstein Sept. 15, 2020, 8:42 a.m. UTC | #1
On Tue, Sep 15, 2020 at 4:47 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
>
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Optionally reload the module between each test to try to pinpoint slab
> cache errors and whatnot.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  README |    3 +++
>  check  |    9 +++++++++
>  2 files changed, 12 insertions(+)
>
>
> diff --git a/README b/README
> index d0e23fcd..4af331b4 100644
> --- a/README
> +++ b/README
> @@ -106,6 +106,9 @@ Preparing system for tests:
>               - set USE_KMEMLEAK=yes to scan for memory leaks in the kernel
>                 after every test, if the kernel supports kmemleak.
>               - set KEEP_DMESG=yes to keep dmesg log after test
> +             - Set TEST_FS_MODULE_RELOAD=1 to unload the module and reload
> +               it between test invocations.  This assumes that the name of
> +               the module is the same as FSTYP.
>
>          - or add a case to the switch in common/config assigning
>            these variables based on the hostname of your test
> diff --git a/check b/check
> index 5ffa8777..29306262 100755
> --- a/check
> +++ b/check
> @@ -810,6 +810,15 @@ function run_section()
>                         _check_dmesg || err=true
>                 fi
>
> +               # Reload the module after each test to check for leaks or
> +               # other problems.
> +               if [ -n "${TEST_FS_MODULE_RELOAD}" ]; then
> +                       _test_unmount 2> /dev/null
> +                       _scratch_unmount 2> /dev/null
> +                       modprobe -r $FSTYP
> +                       modprobe $FSTYP

It is safer to use fs-$FSTYP namespaced module alias.

Thanks,
Amir.
diff mbox series

Patch

diff --git a/README b/README
index d0e23fcd..4af331b4 100644
--- a/README
+++ b/README
@@ -106,6 +106,9 @@  Preparing system for tests:
              - set USE_KMEMLEAK=yes to scan for memory leaks in the kernel
                after every test, if the kernel supports kmemleak.
              - set KEEP_DMESG=yes to keep dmesg log after test
+             - Set TEST_FS_MODULE_RELOAD=1 to unload the module and reload
+               it between test invocations.  This assumes that the name of
+               the module is the same as FSTYP.
 
         - or add a case to the switch in common/config assigning
           these variables based on the hostname of your test
diff --git a/check b/check
index 5ffa8777..29306262 100755
--- a/check
+++ b/check
@@ -810,6 +810,15 @@  function run_section()
 			_check_dmesg || err=true
 		fi
 
+		# Reload the module after each test to check for leaks or
+		# other problems.
+		if [ -n "${TEST_FS_MODULE_RELOAD}" ]; then
+			_test_unmount 2> /dev/null
+			_scratch_unmount 2> /dev/null
+			modprobe -r $FSTYP
+			modprobe $FSTYP
+		fi
+
 		# Scan for memory leaks after every test so that associating
 		# a leak to a particular test will be as accurate as possible.
 		_check_kmemleak || err=true