lkml.org 
[lkml]   [2017]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/5] android: binder: Add allocator selftest
Hi Sherry,

On Wed, Aug 16, 2017 at 2:25 AM, Sherry Yang <sherryy@android.com> wrote:
> binder_alloc_selftest tests that alloc_new_buf handles page allocation and
> deallocation properly when allocate and free buffers. The test allocates 5
> buffers of various sizes to cover all possible page alignment cases, and
> frees the buffers using a list of exhaustive freeing order.
>
> Test: boot the device with ANDROID_BINDER_IPC_SELFTEST config option
> enabled. Allocator selftest passes.
>
> Change-Id: I9064f60c85b1e0389c88e927e2b147ec92cae0d1
> Signed-off-by: Sherry Yang <sherryy@android.com>
> ---
> drivers/android/Kconfig | 10 ++
> drivers/android/Makefile | 1 +
> drivers/android/binder.c | 2 +
> drivers/android/binder_alloc.h | 5 +
> drivers/android/binder_alloc_selftest.c | 271 ++++++++++++++++++++++++++++++++
> 5 files changed, 289 insertions(+)
> create mode 100644 drivers/android/binder_alloc_selftest.c
>
> diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig
> index 832e885349b1..0f295704abd4 100644
> --- a/drivers/android/Kconfig
> +++ b/drivers/android/Kconfig
> @@ -44,6 +44,16 @@ config ANDROID_BINDER_IPC_32BIT
>
> Note that enabling this will break newer Android user-space.
>
> +config ANDROID_BINDER_IPC_SELFTEST
> + bool "Android Binder IPC Driver Selftest"

What about making this tristate...

> + depends on ANDROID_BINDER_IPC
> + ---help---
> + This feature allows binder selftest to run.
> +
> + Binder selftest checks the allocation and free of binder buffers
> + exhaustively with combinations of various buffer sizes and
> + alignments.
> +
> endif # if ANDROID
>
> endmenu
> diff --git a/drivers/android/Makefile b/drivers/android/Makefile
> index 4b7c726bb560..a01254c43ee3 100644
> --- a/drivers/android/Makefile
> +++ b/drivers/android/Makefile
> @@ -1,3 +1,4 @@
> ccflags-y += -I$(src) # needed for trace events
>
> obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o binder_alloc.o
> +obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index 9f95d7093f32..b31e64c6f666 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -4225,6 +4225,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> /*pr_info("binder_ioctl: %d:%d %x %lx\n",
> proc->pid, current->pid, cmd, arg);*/
>
> + binder_selftest_alloc(&proc->alloc);

... and calling the selftest function from module_init() in
drivers/android/binder_alloc_selftest.c?

That way the test can either run builtin during starup, or during module load,
like most other selftests?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

\
 
 \ /
  Last update: 2017-09-10 13:48    [W:0.059 / U:1.392 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site