Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Melissa Wen <mwen@igalia.com>
To: "Maíra Canal" <mcanal@igalia.com>
Cc: igt-dev@lists.freedesktop.org, petri.latvala@intel.com,
	Emma Anholt <emma@anholt.net>
Subject: Re: [igt-dev] [PATCH i-g-t v2 6/7] tests/v3d_create_bo: Create test for V3D's Create BO IOCTL
Date: Fri, 25 Nov 2022 13:05:03 -0100	[thread overview]
Message-ID: <20221125140446.ngr64ruqiphsqdj6@mail.igalia.com> (raw)
In-Reply-To: <20221111195813.277822-7-mcanal@igalia.com>


[-- Attachment #1.1: Type: text/plain, Size: 3397 bytes --]

On 11/11, Maíra Canal wrote:
> Add three igt_subtests for the DRM_IOCTL_V3D_CREATE_BO, which tests the
> creation of a zeroed BO and a 4096 bytes BO, and tests if the BO is
> properly cleaned.
> 
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
> ---
>  tests/meson.build         |  1 +
>  tests/v3d/v3d_create_bo.c | 63 +++++++++++++++++++++++++++++++++++++++
>  tests/v3d_ci/v3d.testlist |  3 ++
>  3 files changed, 67 insertions(+)
>  create mode 100644 tests/v3d/v3d_create_bo.c
> 
> diff --git a/tests/meson.build b/tests/meson.build
> index 5c9b1829..f1a6a9dd 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -256,6 +256,7 @@ msm_progs = [
>  ]
>  
>  v3d_progs = [
> +	'v3d_create_bo',
>  	'v3d_get_bo_offset',
>  	'v3d_get_param',
>  	'v3d_mmap',
> diff --git a/tests/v3d/v3d_create_bo.c b/tests/v3d/v3d_create_bo.c
> new file mode 100644
> index 00000000..efdb218e
> --- /dev/null
> +++ b/tests/v3d/v3d_create_bo.c
> @@ -0,0 +1,63 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2022 Igalia S.L.
> + */
> +
> +#include "igt.h"
> +#include "igt_v3d.h"
> +
> +IGT_TEST_DESCRIPTION("Tests for the V3D's Create BO IOCTL");
> +
> +igt_main
> +{
> +	int fd;
> +
> +	igt_fixture
> +		fd = drm_open_driver(DRIVER_V3D);
> +
> +	igt_describe("Make sure a BO cannot be created with size zero.");
> +	igt_subtest("create-bo-0") {
> +		struct drm_v3d_create_bo create = {
> +			.size = 0,
> +		};
> +		do_ioctl_err(fd, DRM_IOCTL_V3D_CREATE_BO, &create, EINVAL);
> +	}

How about including a subtest for no-flags validation?

> +
> +	igt_describe("Sanity check for creating a BO with size 4096.");
> +	igt_subtest("create-bo-4096") {
> +		struct v3d_bo *bo = igt_v3d_create_bo(fd, PAGE_SIZE);
> +		igt_v3d_free_bo(fd, bo);
> +	}
> +
> +	igt_describe("Make sure that BOs can be allocated in different fd without "
> +		     "carrying old contents from one another.");
> +	igt_subtest("create-bo-zeroed") {
> +		int fd2 = drm_open_driver(DRIVER_V3D);
> +		struct v3d_bo *bo;
> +		/* A size different from any used in our other tests, to try
> +		 * to convince it to land as the only one of its size in the
> +		 * kernel BO cache
> +		 */
> +		size_t size = 3 * PAGE_SIZE, i;
> +
> +		/* Make a BO and free it on our main fd. */
> +		bo = igt_v3d_create_bo(fd, size);
> +		bo->map = igt_v3d_mmap_bo(fd, bo->handle, size, PROT_READ | PROT_WRITE);
> +		memset(bo->map, 0xd0, size);
> +		igt_v3d_free_bo(fd, bo);
> +
> +		/* Now, allocate a BO on the other fd and make sure it doesn't
> +		 * have the old contents.
> +		 */
> +		bo = igt_v3d_create_bo(fd2, size);
> +		bo->map = igt_v3d_mmap_bo(fd2, bo->handle, size, PROT_READ | PROT_WRITE);
> +		for (i = 0; i < size / 4; i++)
> +			igt_assert_eq_u32(((uint32_t *)bo->map)[i], 0x0);
> +		igt_v3d_free_bo(fd2, bo);
> +
> +		close(fd2);
> +	}
> +
> +	igt_fixture
> +		close(fd);
> +}
> diff --git a/tests/v3d_ci/v3d.testlist b/tests/v3d_ci/v3d.testlist
> index b55e8e57..f4355285 100644
> --- a/tests/v3d_ci/v3d.testlist
> +++ b/tests/v3d_ci/v3d.testlist
> @@ -1,3 +1,6 @@
> +igt@v3d_create_bo@create-bo-0
> +igt@v3d_create_bo@create-bo-4096
> +igt@v3d_create_bo@create-bo-zeroed
>  igt@v3d_get_bo_offset@create-get-offsets
>  igt@v3d_get_bo_offset@get-bad-handle
>  igt@v3d_get_param@base-params
> -- 
> 2.38.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-11-25 14:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 19:58 [igt-dev] [PATCH i-g-t v2 0/7] V3D IGT Tests Updates Maíra Canal
2022-11-11 19:58 ` [igt-dev] [PATCH i-g-t v2 1/7] include/drm-uapi: Update to the latest v3d_drm.h Maíra Canal
2022-11-11 19:58 ` [igt-dev] [PATCH i-g-t v2 2/7] tests/v3d: Move V3D tests to their own folder Maíra Canal
2022-11-25 14:00   ` Melissa Wen
2022-11-11 19:58 ` [igt-dev] [PATCH i-g-t v2 3/7] tests/v3d: Remove unused or redundant includes Maíra Canal
2022-11-11 19:58 ` [igt-dev] [PATCH i-g-t v2 4/7] tests/v3d: Add igt_describe() to all V3D subtests Maíra Canal
2022-11-11 19:58 ` [igt-dev] [PATCH i-g-t v2 5/7] lib/igt_v3d: Add PAGE_SIZE macro to V3D Maíra Canal
2022-11-11 19:58 ` [igt-dev] [PATCH i-g-t v2 6/7] tests/v3d_create_bo: Create test for V3D's Create BO IOCTL Maíra Canal
2022-11-25 14:05   ` Melissa Wen [this message]
2022-11-11 19:58 ` [igt-dev] [PATCH i-g-t v2 7/7] tests/v3d_perfmon: Create test for V3D's Perfmon IOCTLs Maíra Canal
2022-11-11 21:45 ` [igt-dev] ✓ Fi.CI.BAT: success for V3D IGT Tests Updates (rev2) Patchwork
2022-11-12 14:30 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-11-25 14:08 ` [igt-dev] [PATCH i-g-t v2 0/7] V3D IGT Tests Updates Melissa Wen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221125140446.ngr64ruqiphsqdj6@mail.igalia.com \
    --to=mwen@igalia.com \
    --cc=emma@anholt.net \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mcanal@igalia.com \
    --cc=petri.latvala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox