From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: IGT development <igt-dev@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Subject: [igt-dev] [PATCH i-g-t 1/3] lib/tests: Use ARRAY_SIZE
Date: Wed, 20 Feb 2019 15:24:47 +0100 [thread overview]
Message-ID: <20190220142449.4986-1-daniel.vetter@ffwll.ch> (raw)
Except in igt_simulation.c where we use tricks and intentionally only
want part of the array in some cases.
Suggested-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
lib/tests/igt_assert.c | 3 ++-
lib/tests/igt_exit_handler.c | 3 ++-
lib/tests/igt_fork.c | 3 ++-
lib/tests/igt_invalid_subtest_name.c | 5 +++--
lib/tests/igt_list_only.c | 2 +-
lib/tests/igt_no_exit.c | 4 ++--
lib/tests/igt_no_subtest.c | 2 +-
lib/tests/igt_segfault.c | 4 +---
8 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/lib/tests/igt_assert.c b/lib/tests/igt_assert.c
index 632e15978978..1caf5d885ddb 100644
--- a/lib/tests/igt_assert.c
+++ b/lib/tests/igt_assert.c
@@ -34,6 +34,7 @@
#include <sys/wait.h>
#include "igt_core.h"
+#include "drmtest.h"
#include "igt_tests_common.h"
@@ -63,7 +64,7 @@ static int do_fork(void)
case -1:
internal_assert(0);
case 0:
- argc = 1;
+ argc = ARRAY_SIZE(argv_run);
igt_simple_init(argc, argv_run);
test_to_run();
igt_exit();
diff --git a/lib/tests/igt_exit_handler.c b/lib/tests/igt_exit_handler.c
index f8a747862c01..892a7f141e90 100644
--- a/lib/tests/igt_exit_handler.c
+++ b/lib/tests/igt_exit_handler.c
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include "igt_core.h"
+#include "drmtest.h"
#include "igt_tests_common.h"
@@ -63,7 +64,7 @@ static int testfunc(enum test_type test_type)
{
char prog[] = "igt_no_exit";
char *fake_argv[] = {prog};
- int fake_argc = 1;
+ int fake_argc = ARRAY_SIZE(fake_argv);
pid_t pid;
int status;
char tmp = 0;
diff --git a/lib/tests/igt_fork.c b/lib/tests/igt_fork.c
index 100031207461..7e8b4f9b5477 100644
--- a/lib/tests/igt_fork.c
+++ b/lib/tests/igt_fork.c
@@ -30,6 +30,7 @@
#include <sys/wait.h>
#include "igt_core.h"
+#include "drmtest.h"
#include "igt_tests_common.h"
@@ -93,7 +94,7 @@ static int do_fork(void (*test_to_run)(void))
case -1:
internal_assert(0);
case 0:
- argc = 1;
+ argc = ARRAY_SIZE(argv_run);
igt_simple_init(argc, argv_run);
test_to_run();
igt_exit();
diff --git a/lib/tests/igt_invalid_subtest_name.c b/lib/tests/igt_invalid_subtest_name.c
index f962e0df0121..92e767abe06f 100644
--- a/lib/tests/igt_invalid_subtest_name.c
+++ b/lib/tests/igt_invalid_subtest_name.c
@@ -25,6 +25,7 @@
#include <sys/wait.h>
#include "igt_core.h"
+#include "drmtest.h"
#include "igt_tests_common.h"
@@ -32,7 +33,7 @@ static void invalid_subtest_name(void)
{
char prog[] = "igt_no_exit";
char *fake_argv[] = {prog};
- int fake_argc = 1;
+ int fake_argc = ARRAY_SIZE(fake_argv);
igt_subtest_init(fake_argc, fake_argv);
@@ -49,7 +50,7 @@ static void nonexisting_subtest(void)
char arg1[] = "--run-subtest";
char arg2[] = "invalid-subtest";
char *fake_argv[] = {prog, arg1, arg2};
- int fake_argc = 3;
+ int fake_argc = ARRAY_SIZE(fake_argv);
igt_subtest_init(fake_argc, fake_argv);
diff --git a/lib/tests/igt_list_only.c b/lib/tests/igt_list_only.c
index 65fa9da66362..b18d13d3ddef 100644
--- a/lib/tests/igt_list_only.c
+++ b/lib/tests/igt_list_only.c
@@ -32,7 +32,7 @@ int main(int argc, char **argv)
char prog[] = "igt_list_only";
char arg[] = "--list-subtests";
char *fake_argv[] = {prog, arg};
- int fake_argc = 2;
+ int fake_argc = ARRAY_SIZE(fake_argv);
igt_subtest_init(fake_argc, fake_argv);
diff --git a/lib/tests/igt_no_exit.c b/lib/tests/igt_no_exit.c
index 4a777412b6a9..82f00b5220b1 100644
--- a/lib/tests/igt_no_exit.c
+++ b/lib/tests/igt_no_exit.c
@@ -36,7 +36,7 @@ static void no_exit_list_only(void)
char prog[] = "igt_list_only";
char arg[] = "--list-subtests";
char *fake_argv[] = {prog, arg};
- int fake_argc = 2;
+ int fake_argc = ARRAY_SIZE(fake_argv);
igt_subtest_init(fake_argc, fake_argv);
@@ -48,7 +48,7 @@ static void no_exit(void)
{
char prog[] = "igt_no_exit";
char *fake_argv[] = {prog};
- int fake_argc = 1;
+ int fake_argc = ARRAY_SIZE(fake_argv);
igt_subtest_init(fake_argc, fake_argv);
diff --git a/lib/tests/igt_no_subtest.c b/lib/tests/igt_no_subtest.c
index 1ae62cfd8027..92e6c277e60b 100644
--- a/lib/tests/igt_no_subtest.c
+++ b/lib/tests/igt_no_subtest.c
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
{
char prog[] = "igt_no_exit";
char *fake_argv[] = {prog};
- int fake_argc = 1;
+ int fake_argc = ARRAY_SIZE(fake_argv);
igt_subtest_init(fake_argc, fake_argv);
diff --git a/lib/tests/igt_segfault.c b/lib/tests/igt_segfault.c
index 2a24531aaa8c..0d872f67850a 100644
--- a/lib/tests/igt_segfault.c
+++ b/lib/tests/igt_segfault.c
@@ -65,15 +65,13 @@ static int do_fork(void)
case -1:
internal_assert(0);
case 0:
+ argc = ARRAY_SIZE(argv_run);
if (simple) {
- argc = 1;
igt_simple_init(argc, argv_run);
crashme();
igt_exit();
} else {
-
- argc = 1;
igt_subtest_init(argc, argv_run);
if(runa)
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-02-20 14:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 14:24 Daniel Vetter [this message]
2019-02-20 14:24 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_mmap_write_crc: Fix igt_fixture handling Daniel Vetter
2019-02-20 14:31 ` Chris Wilson
2019-02-20 23:44 ` Daniel Vetter
2019-02-20 14:24 ` [igt-dev] [PATCH i-g-t 3/3] lib: disallow fixtures/subtest groups in simple tests Daniel Vetter
2019-02-20 14:51 ` Arkadiusz Hiler
2019-02-20 23:41 ` Daniel Vetter
2019-02-20 15:00 ` [igt-dev] [PATCH i-g-t 1/3] lib/tests: Use ARRAY_SIZE Arkadiusz Hiler
2019-02-20 23:38 ` Daniel Vetter
2019-02-20 15:14 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2019-02-20 17:46 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20190220142449.4986-1-daniel.vetter@ffwll.ch \
--to=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@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