diff mbox

[2/3] pm_rps: Convert to subtest structure

Message ID 1389999366-19715-3-git-send-email-jeff.mcgee@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

jeff.mcgee@intel.com Jan. 17, 2014, 10:56 p.m. UTC
From: Jeff McGee <jeff.mcgee@intel.com>

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
---
 tests/pm_rps.c | 119 ++++++++++++++++++++++++++++++---------------------------
 1 file changed, 62 insertions(+), 57 deletions(-)

Comments

Daniel Vetter Jan. 19, 2014, 2:29 p.m. UTC | #1
On Fri, Jan 17, 2014 at 04:56:05PM -0600, jeff.mcgee@intel.com wrote:
> From: Jeff McGee <jeff.mcgee@intel.com>
> 
> Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>

I've missed that you've forgotten to move the test to the _M Makefile
target. Without that testrunners like piglit won't enumerate the subtests
and run the individually. I've fixed this up now.
-Daniel

> ---
>  tests/pm_rps.c | 119 ++++++++++++++++++++++++++++++---------------------------
>  1 file changed, 62 insertions(+), 57 deletions(-)
> 
> diff --git a/tests/pm_rps.c b/tests/pm_rps.c
> index ec07dd2..4d64f0a 100644
> --- a/tests/pm_rps.c
> +++ b/tests/pm_rps.c
> @@ -142,66 +142,71 @@ static void pm_rps_exit_handler(int sig)
>  	}
>  }
>  
> -igt_simple_main
> +igt_main
>  {
> -	const int device = drm_get_card();
> -	struct junk *junk = stuff;
> -	int fd, ret;
> -
>  	igt_skip_on_simulation();
>  
> -	/* Use drm_open_any to verify device existence */
> -	fd = drm_open_any();
> -	close(fd);
> -
> -	do {
> -		int val = -1;
> -		char *path;
> -		ret = asprintf(&path, sysfs_base_path, device, junk->name);
> -		igt_assert(ret != -1);
> -		junk->filp = fopen(path, junk->mode);
> -		igt_require(junk->filp);
> -		setbuf(junk->filp, NULL);
> -
> -		val = readval(junk->filp);
> -		igt_assert(val >= 0);
> -		junk++;
> -	} while(junk->name != NULL);
> -
> -	origmin = fmin;
> -	origmax = fmax;
> -
> -	igt_install_exit_handler(pm_rps_exit_handler);
> -
> -	if (verbose)
> -		printf("Original min = %d\nOriginal max = %d\n", origmin, origmax);
> -
> -	if (verbose)
> -		dumpit();
> -
> -	checkit();
> -	setfreq(origmin);
> -	if (verbose)
> -		dumpit();
> -	igt_assert(fcur == fmin);
> -	setfreq(origmax);
> -	if (verbose)
> -		dumpit();
> -	igt_assert(fcur == fmax);
> -	checkit();
> -
> -	/* And some errors */
> -	writeval_inval(stuff[MIN].filp, frpn - 1);
> -	writeval_inval(stuff[MAX].filp, frp0 + 1000);
> -	checkit();
> -
> -	writeval_inval(stuff[MIN].filp, fmax + 1000);
> -	writeval_inval(stuff[MAX].filp, fmin - 1);
> -	checkit();
> +	igt_fixture {
> +		const int device = drm_get_card();
> +		struct junk *junk = stuff;
> +		int fd, ret;
> +
> +		/* Use drm_open_any to verify device existence */
> +		fd = drm_open_any();
> +		close(fd);
> +
> +		do {
> +			int val = -1;
> +			char *path;
> +			ret = asprintf(&path, sysfs_base_path, device, junk->name);
> +			igt_assert(ret != -1);
> +			junk->filp = fopen(path, junk->mode);
> +			igt_require(junk->filp);
> +			setbuf(junk->filp, NULL);
> +
> +			val = readval(junk->filp);
> +			igt_assert(val >= 0);
> +			junk++;
> +		} while(junk->name != NULL);
> +
> +		origmin = fmin;
> +		origmax = fmax;
> +
> +		igt_install_exit_handler(pm_rps_exit_handler);
> +	}
>  
> -	writeval_inval(stuff[MIN].filp, 0x11111110);
> -	writeval_inval(stuff[MAX].filp, 0);
> +	igt_subtest("min-max-config-at-idle") {
> +		if (verbose)
> +			printf("Original min = %d\nOriginal max = %d\n",
> +			        origmin, origmax);
> +
> +		if (verbose)
> +			dumpit();
> +
> +		checkit();
> +		setfreq(origmin);
> +		if (verbose)
> +			dumpit();
> +		igt_assert(fcur == fmin);
> +		setfreq(origmax);
> +		if (verbose)
> +			dumpit();
> +		igt_assert(fcur == fmax);
> +		checkit();
> +
> +		/* And some errors */
> +		writeval_inval(stuff[MIN].filp, frpn - 1);
> +		writeval_inval(stuff[MAX].filp, frp0 + 1000);
> +		checkit();
> +
> +		writeval_inval(stuff[MIN].filp, fmax + 1000);
> +		writeval_inval(stuff[MAX].filp, fmin - 1);
> +		checkit();
> +
> +		writeval_inval(stuff[MIN].filp, 0x11111110);
> +		writeval_inval(stuff[MAX].filp, 0);
>  
> -	writeval(stuff[MIN].filp, origmin);
> -	writeval(stuff[MAX].filp, origmax);
> +		writeval(stuff[MIN].filp, origmin);
> +		writeval(stuff[MAX].filp, origmax);
> +	}
>  }
> -- 
> 1.8.5.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index ec07dd2..4d64f0a 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -142,66 +142,71 @@  static void pm_rps_exit_handler(int sig)
 	}
 }
 
-igt_simple_main
+igt_main
 {
-	const int device = drm_get_card();
-	struct junk *junk = stuff;
-	int fd, ret;
-
 	igt_skip_on_simulation();
 
-	/* Use drm_open_any to verify device existence */
-	fd = drm_open_any();
-	close(fd);
-
-	do {
-		int val = -1;
-		char *path;
-		ret = asprintf(&path, sysfs_base_path, device, junk->name);
-		igt_assert(ret != -1);
-		junk->filp = fopen(path, junk->mode);
-		igt_require(junk->filp);
-		setbuf(junk->filp, NULL);
-
-		val = readval(junk->filp);
-		igt_assert(val >= 0);
-		junk++;
-	} while(junk->name != NULL);
-
-	origmin = fmin;
-	origmax = fmax;
-
-	igt_install_exit_handler(pm_rps_exit_handler);
-
-	if (verbose)
-		printf("Original min = %d\nOriginal max = %d\n", origmin, origmax);
-
-	if (verbose)
-		dumpit();
-
-	checkit();
-	setfreq(origmin);
-	if (verbose)
-		dumpit();
-	igt_assert(fcur == fmin);
-	setfreq(origmax);
-	if (verbose)
-		dumpit();
-	igt_assert(fcur == fmax);
-	checkit();
-
-	/* And some errors */
-	writeval_inval(stuff[MIN].filp, frpn - 1);
-	writeval_inval(stuff[MAX].filp, frp0 + 1000);
-	checkit();
-
-	writeval_inval(stuff[MIN].filp, fmax + 1000);
-	writeval_inval(stuff[MAX].filp, fmin - 1);
-	checkit();
+	igt_fixture {
+		const int device = drm_get_card();
+		struct junk *junk = stuff;
+		int fd, ret;
+
+		/* Use drm_open_any to verify device existence */
+		fd = drm_open_any();
+		close(fd);
+
+		do {
+			int val = -1;
+			char *path;
+			ret = asprintf(&path, sysfs_base_path, device, junk->name);
+			igt_assert(ret != -1);
+			junk->filp = fopen(path, junk->mode);
+			igt_require(junk->filp);
+			setbuf(junk->filp, NULL);
+
+			val = readval(junk->filp);
+			igt_assert(val >= 0);
+			junk++;
+		} while(junk->name != NULL);
+
+		origmin = fmin;
+		origmax = fmax;
+
+		igt_install_exit_handler(pm_rps_exit_handler);
+	}
 
-	writeval_inval(stuff[MIN].filp, 0x11111110);
-	writeval_inval(stuff[MAX].filp, 0);
+	igt_subtest("min-max-config-at-idle") {
+		if (verbose)
+			printf("Original min = %d\nOriginal max = %d\n",
+			        origmin, origmax);
+
+		if (verbose)
+			dumpit();
+
+		checkit();
+		setfreq(origmin);
+		if (verbose)
+			dumpit();
+		igt_assert(fcur == fmin);
+		setfreq(origmax);
+		if (verbose)
+			dumpit();
+		igt_assert(fcur == fmax);
+		checkit();
+
+		/* And some errors */
+		writeval_inval(stuff[MIN].filp, frpn - 1);
+		writeval_inval(stuff[MAX].filp, frp0 + 1000);
+		checkit();
+
+		writeval_inval(stuff[MIN].filp, fmax + 1000);
+		writeval_inval(stuff[MAX].filp, fmin - 1);
+		checkit();
+
+		writeval_inval(stuff[MIN].filp, 0x11111110);
+		writeval_inval(stuff[MAX].filp, 0);
 
-	writeval(stuff[MIN].filp, origmin);
-	writeval(stuff[MAX].filp, origmax);
+		writeval(stuff[MIN].filp, origmin);
+		writeval(stuff[MAX].filp, origmax);
+	}
 }