Commit 1329e40e authored by Shuah Khan's avatar Shuah Khan

selftests/net: remove ARRAY_SIZE define from individual tests

ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.

Remove ARRAY_SIZE from net tests and pickup the one defined in
kselftest.h.
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 5a69d33b
...@@ -57,10 +57,11 @@ ...@@ -57,10 +57,11 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "../kselftest.h"
#define DPORT 8000 #define DPORT 8000
#define SPORT 1500 #define SPORT 1500
#define PAYLOAD_LEN 100 #define PAYLOAD_LEN 100
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define NUM_PACKETS 4 #define NUM_PACKETS 4
#define START_SEQ 100 #define START_SEQ 100
#define START_ACK 100 #define START_ACK 100
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#define pr_err(fmt, ...) printk(fmt ": %m", ##__VA_ARGS__) #define pr_err(fmt, ...) printk(fmt ": %m", ##__VA_ARGS__)
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#define IPV4_STR_SZ 16 /* xxx.xxx.xxx.xxx is longest + \0 */ #define IPV4_STR_SZ 16 /* xxx.xxx.xxx.xxx is longest + \0 */
......
...@@ -24,9 +24,7 @@ ...@@ -24,9 +24,7 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <unistd.h> #include <unistd.h>
#ifndef ARRAY_SIZE #include "../kselftest.h"
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif
struct test_params { struct test_params {
int recv_family; int recv_family;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <linux/net_tstamp.h> #include <linux/net_tstamp.h>
#include <linux/errqueue.h> #include <linux/errqueue.h>
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #include "../kselftest.h"
struct options { struct options {
int so_timestamp; int so_timestamp;
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include "../kselftest.h"
struct socket_testcase { struct socket_testcase {
int domain; int domain;
int type; int type;
...@@ -31,7 +33,6 @@ static struct socket_testcase tests[] = { ...@@ -31,7 +33,6 @@ static struct socket_testcase tests[] = {
{ AF_INET, SOCK_STREAM, IPPROTO_UDP, -EPROTONOSUPPORT, 1 }, { AF_INET, SOCK_STREAM, IPPROTO_UDP, -EPROTONOSUPPORT, 1 },
}; };
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define ERR_STRING_SZ 64 #define ERR_STRING_SZ 64
static int run_tests(void) static int run_tests(void)
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
#include "../kselftest.h"
#ifndef TCP_FASTOPEN_KEY #ifndef TCP_FASTOPEN_KEY
#define TCP_FASTOPEN_KEY 33 #define TCP_FASTOPEN_KEY 33
#endif #endif
...@@ -34,10 +36,6 @@ ...@@ -34,10 +36,6 @@
#define PROC_FASTOPEN_KEY "/proc/sys/net/ipv4/tcp_fastopen_key" #define PROC_FASTOPEN_KEY "/proc/sys/net/ipv4/tcp_fastopen_key"
#define KEY_LENGTH 16 #define KEY_LENGTH 16
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif
static bool do_ipv6; static bool do_ipv6;
static bool do_sockopt; static bool do_sockopt;
static bool do_rotate; static bool do_rotate;
......
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