summaryrefslogtreecommitdiff
path: root/lib/tests
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2019-02-20 15:24:47 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-02-21 00:41:54 +0100
commit3bbdb535438951ffb8eac78abbf4152dcfa2185d (patch)
treeee334b938eacaaf28f6776c66c937a6bd1f3eccb /lib/tests
parentee6e006202a50c5aef373c0b075027ed7177935a (diff)
lib/tests: Use ARRAY_SIZE
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> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/igt_assert.c3
-rw-r--r--lib/tests/igt_exit_handler.c3
-rw-r--r--lib/tests/igt_fork.c3
-rw-r--r--lib/tests/igt_invalid_subtest_name.c5
-rw-r--r--lib/tests/igt_list_only.c2
-rw-r--r--lib/tests/igt_no_exit.c4
-rw-r--r--lib/tests/igt_no_subtest.c2
-rw-r--r--lib/tests/igt_segfault.c4
8 files changed, 14 insertions, 12 deletions
diff --git a/lib/tests/igt_assert.c b/lib/tests/igt_assert.c
index 632e1597..1caf5d88 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 f8a74786..892a7f14 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 10003120..7e8b4f9b 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 f962e0df..92e767ab 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 65fa9da6..b18d13d3 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 4a777412..82f00b52 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 1ae62cfd..92e6c277 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 2a24531a..0d872f67 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)