Commit 3bbdb535 authored by Daniel Vetter's avatar Daniel Vetter

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's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Reviewed-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
Signed-off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@intel.com>
parent ee6e0062
......@@ -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();
......
......@@ -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;
......
......@@ -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();
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment