[igt-dev] [PATCH i-g-t 3/4] tests: Make .seed unsigned

Ville Syrjala ville.syrjala at linux.intel.com
Tue Feb 23 21:09:49 UTC 2021


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

srand() takes an unsigned int, so let's make our seed such.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/kms_concurrent.c     | 4 ++--
 tests/kms_plane_multiple.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
index 1838a8ca5b47..5a269014e31c 100644
--- a/tests/kms_concurrent.c
+++ b/tests/kms_concurrent.c
@@ -41,8 +41,8 @@ typedef struct {
 /* Command line parameters. */
 struct {
 	int iterations;
+	unsigned int seed;
 	bool user_seed;
-	int seed;
 	bool run;
 } opt = {
 	.iterations = 1,
@@ -348,7 +348,7 @@ static int opt_handler(int option, int option_index, void *input)
 		break;
 	case 's':
 		opt.user_seed = true;
-		opt.seed = strtol(optarg, NULL, 0);
+		opt.seed = strtoul(optarg, NULL, 0);
 		break;
 	default:
 		return IGT_OPT_HANDLER_ERROR;
diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 4202117eab81..93c6ea7d269d 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -54,8 +54,8 @@ typedef struct {
 /* Command line parameters. */
 struct {
 	int iterations;
+	unsigned int seed;
 	bool user_seed;
-	int seed;
 } opt = {
 	.iterations = 1,
 };
@@ -409,7 +409,7 @@ static int opt_handler(int option, int option_index, void *input)
 		break;
 	case 's':
 		opt.user_seed = true;
-		opt.seed = strtol(optarg, NULL, 0);
+		opt.seed = strtoul(optarg, NULL, 0);
 		break;
 	default:
 		return IGT_OPT_HANDLER_ERROR;
-- 
2.26.2



More information about the igt-dev mailing list