From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/4] tests/kms_invalid_mode: Convert the max dotclock test into a subtest
Date: Fri, 15 Nov 2019 15:15:18 +0200 [thread overview]
Message-ID: <20191115131520.9872-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20191115131520.9872-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
We want to add different subtests to kms_invalud_mode. Convert
the current max dotclock test into a subtest.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/kms_invalid_mode.c | 82 ++++++++++++++++++++++++++++------------
1 file changed, 57 insertions(+), 25 deletions(-)
diff --git a/tests/kms_invalid_mode.c b/tests/kms_invalid_mode.c
index 1e8a354b5b3a..323f965dde77 100644
--- a/tests/kms_invalid_mode.c
+++ b/tests/kms_invalid_mode.c
@@ -27,13 +27,16 @@
IGT_TEST_DESCRIPTION("Make sure all modesets are rejected when the requested mode is invalid");
-typedef struct {
+typedef struct _data data_t;
+
+struct _data {
int drm_fd;
igt_display_t display;
igt_output_t *output;
drmModeResPtr res;
int max_dotclock;
-} data_t;
+ bool (*adjust_mode)(data_t *data, drmModeModeInfoPtr mode);
+};
static bool has_scaling_mode_prop(data_t *data)
{
@@ -44,13 +47,10 @@ static bool has_scaling_mode_prop(data_t *data)
NULL, NULL, NULL);
}
-static int
-test_output(data_t *data)
+static bool
+adjust_mode_clock_too_high(data_t *data, drmModeModeInfoPtr mode)
{
- igt_output_t *output = data->output;
- drmModeModeInfo mode;
- struct igt_fb fb;
- int i;
+ igt_require(data->max_dotclock != 0);
/*
* FIXME When we have a fixed mode, the kernel will ignore
@@ -61,14 +61,28 @@ test_output(data_t *data)
* test on any connector with a fixed mode.
*/
if (has_scaling_mode_prop(data))
- return 0;
+ return false;
+
+ mode->clock = data->max_dotclock + 1;
+
+ return true;
+}
+
+static int
+test_output(data_t *data)
+{
+ igt_output_t *output = data->output;
+ drmModeModeInfo mode;
+ struct igt_fb fb;
+ int i;
/*
* FIXME test every mode we have to be more
* sure everything is really getting rejected?
*/
mode = *igt_output_get_mode(output);
- mode.clock = data->max_dotclock + 1;
+ if (!data->adjust_mode(data, &mode))
+ return 0;
igt_create_fb(data->drm_fd,
mode.hdisplay, mode.vdisplay,
@@ -122,29 +136,47 @@ static int i915_max_dotclock(data_t *data)
return max_dotclock;
}
+static const struct {
+ const char *name;
+ bool (*adjust_mode)(data_t *data, drmModeModeInfoPtr mode);
+} subtests[] = {
+ { .name = "clock-too-high",
+ .adjust_mode = adjust_mode_clock_too_high,
+ },
+};
+
static data_t data;
-igt_simple_main
+igt_main
{
- igt_skip_on_simulation();
+ igt_fixture {
+ igt_skip_on_simulation();
- data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
- igt_require_intel(data.drm_fd);
+ data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+ igt_require_intel(data.drm_fd);
- kmstest_set_vt_graphics_mode();
+ kmstest_set_vt_graphics_mode();
- igt_display_require(&data.display, data.drm_fd);
- data.res = drmModeGetResources(data.drm_fd);
- igt_assert(data.res);
+ igt_display_require(&data.display, data.drm_fd);
+ data.res = drmModeGetResources(data.drm_fd);
+ igt_assert(data.res);
- kmstest_unset_all_crtcs(data.drm_fd, data.res);
+ data.max_dotclock = i915_max_dotclock(&data);
+ igt_info("Max dotclock: %d kHz\n", data.max_dotclock);
- data.max_dotclock = i915_max_dotclock(&data);
- igt_info("Max dotclock: %d kHz\n", data.max_dotclock);
+ kmstest_unset_all_crtcs(data.drm_fd, data.res);
+ }
- test(&data);
+ for (int i = 0; i < ARRAY_SIZE(subtests); i++) {
+ igt_subtest(subtests[i].name) {
+ data.adjust_mode = subtests[i].adjust_mode;
+ test(&data);
+ }
+ }
- igt_display_fini(&data.display);
- igt_reset_connectors();
- drmModeFreeResources(data.res);
+ igt_fixture {
+ igt_display_fini(&data.display);
+ igt_reset_connectors();
+ drmModeFreeResources(data.res);
+ }
}
--
2.23.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-11-15 13:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-15 13:15 [igt-dev] [PATCH i-g-t 1/4] tests/kms_invalid_dotclock: Rename to kms_invalid_mode Ville Syrjala
2019-11-15 13:15 ` Ville Syrjala [this message]
2019-11-15 13:15 ` [igt-dev] [PATCH i-g-t 3/4] tests/kms_invalid_mode: Test various bogus timings Ville Syrjala
2019-11-15 13:15 ` [igt-dev] [PATCH i-g-t 4/4] tests/kms_invalid_mode: Allow the test on !i915 Ville Syrjala
2019-11-15 13:41 ` [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [i-g-t,1/4] tests/kms_invalid_dotclock: Rename to kms_invalid_mode Patchwork
2019-11-15 13:52 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-11-16 21:26 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=20191115131520.9872-2-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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