Skip to contentSkip to conversation

sctp/func_test: add check on the sctp driver

PATCH New Kory Maincent 2 participants 4 messages Jan 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sctp/func_test: add check on the sctp driver

Add the verification on the sctp driver for all the sctp tests.

---
 utils/sctp/func_tests/test_1_to_1_accept_close.c       | 3 +++
 utils/sctp/func_tests/test_1_to_1_addrs.c              | 3 +++
 utils/sctp/func_tests/test_1_to_1_connect.c            | 3 +++
 utils/sctp/func_tests/test_1_to_1_connectx.c           | 3 +++
 utils/sctp/func_tests/test_1_to_1_events.c             | 3 +++
 utils/sctp/func_tests/test_1_to_1_initmsg_connect.c    | 4 ++++
 utils/sctp/func_tests/test_1_to_1_nonblock.c           | 3 +++
 utils/sctp/func_tests/test_1_to_1_recvfrom.c           | 3 +++
 utils/sctp/func_tests/test_1_to_1_recvmsg.c            | 3 +++
 utils/sctp/func_tests/test_1_to_1_rtoinfo.c            | 3 +++
 utils/sctp/func_tests/test_1_to_1_send.c               | 3 +++
 utils/sctp/func_tests/test_1_to_1_sendmsg.c            | 3 +++
 utils/sctp/func_tests/test_1_to_1_sendto.c             | 3 +++
 utils/sctp/func_tests/test_1_to_1_shutdown.c           | 3 +++
 utils/sctp/func_tests/test_1_to_1_socket_bind_listen.c | 3 +++
 utils/sctp/func_tests/test_1_to_1_sockopt.c            | 3 +++
 utils/sctp/func_tests/test_1_to_1_threads.c            | 3 +++
 utils/sctp/func_tests/test_assoc_abort.c               | 3 +++
 utils/sctp/func_tests/test_assoc_shutdown.c            | 3 +++
 utils/sctp/func_tests/test_autoclose.c                 | 3 +++
 utils/sctp/func_tests/test_basic.c                     | 3 +++
 utils/sctp/func_tests/test_connect.c                   | 3 +++
 utils/sctp/func_tests/test_connectx.c                  | 3 +++
 utils/sctp/func_tests/test_fragments.c                 | 3 +++
 utils/sctp/func_tests/test_getname.c                   | 3 +++
 utils/sctp/func_tests/test_inaddr_any.c                | 3 +++
 utils/sctp/func_tests/test_peeloff.c                   | 3 +++
 utils/sctp/func_tests/test_recvmsg.c                   | 3 +++
 utils/sctp/func_tests/test_sctp_sendrecvmsg.c          | 3 +++
 utils/sctp/func_tests/test_sockopt.c                   | 3 +++
 utils/sctp/func_tests/test_tcp_style.c                 | 3 +++
 utils/sctp/func_tests/test_timetolive.c                | 3 +++
 32 files changed, 97 insertions(+)
utils/sctp/func_tests/test_1_to_1_accept_close.c +3 -0
index b1d8a0ad9..43de196e8 100644
@@ -83,6 +83,9 @@ main(void)
 
         struct sockaddr_in conn_addr,lstn_addr,acpt_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbuffered.
          */
utils/sctp/func_tests/test_1_to_1_addrs.c +3 -0
index 9443f69d8..c8117d99c 100644
@@ -98,6 +98,9 @@ main(void)
         struct sockaddr_in conn_addr,lstn_addr,acpt_addr;
 	struct sockaddr_in *addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbuffered.
          */
utils/sctp/func_tests/test_1_to_1_connect.c +3 -0
index 885b3d23b..edaa73d3d 100644
@@ -77,6 +77,9 @@ main(void)
 
         struct sockaddr_in conn_addr,lstn_addr,acpt_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbuffered.
          */
utils/sctp/func_tests/test_1_to_1_connectx.c +3 -0
index 27999bc9c..7e3a1a7a6 100644
@@ -76,6 +76,9 @@ main(void)
 	struct sockaddr_in conn_addr,lstn_addr,acpt_addr;
 	struct sockaddr *tmp_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
 	 * be unbuffered.
 	 */
utils/sctp/func_tests/test_1_to_1_events.c +3 -0
index 57fb842e3..192b6ef5b 100644
@@ -68,6 +68,9 @@ main(void)
 	uint32_t ppid;
 	uint32_t stream;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_1_to_1_initmsg_connect.c +4 -0
index 3743679fe..98013cd30 100644
@@ -110,4 +110,8 @@ static void test_sctp(unsigned int n)
 static struct tst_test test = {
 	.test = test_sctp,
 	.tcnt = ARRAY_SIZE(testcase_list),
+	.needs_drivers = (const char *[]) {
+		"sctp",
+		NULL
+	},
 };
utils/sctp/func_tests/test_1_to_1_nonblock.c +3 -0
index a6229e31b..d914c11b7 100644
@@ -79,6 +79,9 @@ main(void)
 	
         struct sockaddr_in conn_addr,lstn_addr,svr_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbufferd
          */
utils/sctp/func_tests/test_1_to_1_recvfrom.c +3 -0
index f9fbd99f3..d539492f3 100644
@@ -74,6 +74,9 @@ main(void)
 
         struct sockaddr_in conn_addr,lstn_addr,svr_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbuffered.
          */
utils/sctp/func_tests/test_1_to_1_recvmsg.c +3 -0
index dc98fb937..8373ba782 100644
@@ -79,6 +79,9 @@ main(void)
 
         struct sockaddr_in conn_addr,lstn_addr,svr_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbuffered.
          */
utils/sctp/func_tests/test_1_to_1_rtoinfo.c +3 -0
index cb46e3920..ce81d2afd 100644
@@ -66,6 +66,9 @@ main(void)
 	struct sctp_rtoinfo srtoinfo; /*setting the variables*/
 	struct sctp_rtoinfo grtoinfo; /*Getting the variables*/
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	sd = test_socket (PF_INET, SOCK_STREAM, IPPROTO_SCTP);
 
 	len = sizeof(struct sctp_rtoinfo);
utils/sctp/func_tests/test_1_to_1_send.c +3 -0
index 05fae4f3e..29a909fff 100644
@@ -74,6 +74,9 @@ main(void)
 
         struct sockaddr_in conn_addr,lstn_addr,svr_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbuffered.
          */
utils/sctp/func_tests/test_1_to_1_sendmsg.c +3 -0
index 9c88630b2..a52975d49 100644
@@ -89,6 +89,9 @@ main(void)
 	int fd, err_no = 0;
 	char filename[21];
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbuffered.
          */
utils/sctp/func_tests/test_1_to_1_sendto.c +3 -0
index 114e6c04b..08b81dee7 100644
@@ -69,6 +69,9 @@ main(void)
 	
         struct sockaddr_in conn_addr,lstn_addr,svr_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbufferd
          */
utils/sctp/func_tests/test_1_to_1_shutdown.c +3 -0
index 228ec442f..9f006c861 100644
@@ -73,6 +73,9 @@ main(void)
 	int fd, err_no = 0;
 	char filename[21];
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_1_to_1_socket_bind_listen.c +3 -0
index 09323ca9e..caf1d760d 100644
@@ -90,6 +90,9 @@ main(void)
 
         struct sockaddr_in bind_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbuffered.
          */
utils/sctp/func_tests/test_1_to_1_sockopt.c +3 -0
index 436b344e9..bccfede7d 100644
@@ -101,6 +101,9 @@ main(void)
 	int fd, err_no = 0;
 	char filename[21];
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
          * be unbuffered.
          */
utils/sctp/func_tests/test_1_to_1_threads.c +3 -0
index e2a7eeeed..0e6fbce18 100644
@@ -146,6 +146,9 @@ main(void)
 	socklen_t len = sizeof(struct sockaddr_in);
 	struct sockaddr_in svr_addr;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 	
utils/sctp/func_tests/test_assoc_abort.c +3 -0
index af1d997bd..4e3ce5f80 100644
@@ -84,6 +84,9 @@ main(void)
 	struct sctp_status status;
 	socklen_t status_len;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_assoc_shutdown.c +3 -0
index 8287df923..9134d66ab 100644
@@ -83,6 +83,9 @@ main(void)
 	struct sctp_status status;
 	socklen_t status_len;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_autoclose.c +3 -0
index 484875bbc..97287e905 100644
@@ -70,6 +70,9 @@ main(void)
 	char *message = "hello, world!\n";
 	uint32_t autoclose;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered. 
 	 */
utils/sctp/func_tests/test_basic.c +3 -0
index b8d4eaea1..07ed81036 100644
@@ -92,6 +92,9 @@ int main(void)
 	struct sockaddr_in6 *in6_addr;
 	void *addr_buf;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered. 
 	 */
utils/sctp/func_tests/test_connect.c +3 -0
index 3642d6bd0..874301682 100644
@@ -67,6 +67,9 @@ main(void)
 	char *big_buffer;
 	int flags;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_connectx.c +3 -0
index 1d3e6fa0b..e66126c7b 100644
@@ -81,6 +81,9 @@ main(void)
 	struct sockaddr_in clt_loop3[NUMADDR];
 	sockaddr_storage_t svr_test[NUMADDR], clt_test1[NUMADDR], clt_test2[NUMADDR];
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_fragments.c +3 -0
index 5ef1da1bb..f1e9ec978 100644
@@ -95,6 +95,9 @@ main(void)
 	int disable_frag;
 	socklen_t optlen;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered. 
 	 */
utils/sctp/func_tests/test_getname.c +3 -0
index 653bf7167..a4caf58d4 100644
@@ -69,6 +69,9 @@ main(void)
 	int fd, err_no = 0;
 	char filename[21];
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_inaddr_any.c +3 -0
index 722a7025f..c06dec7b6 100644
@@ -84,6 +84,9 @@ main(void)
 	uint32_t stream;
 	socklen_t namelen;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered. 
 	 */
utils/sctp/func_tests/test_peeloff.c +3 -0
index 1b9e7014b..cd4ba4935 100644
@@ -81,6 +81,9 @@ main(void)
         char *message = "hello, world!\n";
 	int pf_class;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_recvmsg.c +3 -0
index 0fb3012b9..62b326458 100644
@@ -70,6 +70,9 @@ main(void)
 	char *big_buffer;
 	void *msg_buf;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_sctp_sendrecvmsg.c +3 -0
index 294784791..b49dcb527 100644
@@ -92,6 +92,9 @@ int main(void)
 	socklen_t len, oldlen;
 	struct sctp_status gstatus;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
 	/* Rather than fflush() throughout the code, set stdout to
 	 * be unbuffered.
 	 */
utils/sctp/func_tests/test_sockopt.c +3 -0
index a31c5d3ab..c8acf1239 100644
@@ -101,6 +101,9 @@ main(void)
 	struct sctp_status status;
 	struct sctp_assoc_value value;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to
 	 * be unbuffered.
 	 */
utils/sctp/func_tests/test_tcp_style.c +3 -0
index 91a19c459..6bd20b6d8 100644
@@ -81,6 +81,9 @@ main(void)
 	char *big_buffer;
 	struct iovec iov;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to 
 	 * be unbuffered.  
 	 */ 
utils/sctp/func_tests/test_timetolive.c +3 -0
index 1d6fa2b80..6cc302f3a 100644
@@ -114,6 +114,9 @@ int main(void)
 	int orig_len; 
 	struct sctp_status gstatus;
 
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");
+
         /* Rather than fflush() throughout the code, set stdout to
 	 * be unbuffered.
 	 */
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 sctp/func_test: add check on the sctp driver

Hi Kory,

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");

Using tst_check_driver requires #include "tst_kernel.h".

Kind regards,
Petr

#2 lore raw

PATCH 1/1 sctp/func_test: add check on the sctp driver

Hi Petr,

Quoted 5 lines · On Fri, 29 Jan 2021 14:47:19 +0100 Petr Vorel <[email protected]> wrote:

Hi Kory,

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");  

Using tst_check_driver requires #include "tst_kernel.h".

Weird I did not get any build error and the binaries are built. Maybe Yocto manage to build it even without the include. Sorry for that.

Regards,

Kory

#3 lore raw

PATCH 1/1 sctp/func_test: add check on the sctp driver

Hi Kory,

Quoted 7 lines
Quoted 3 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (tst_check_driver("sctp"))
+		tst_brkm(TCONF, tst_exit, "sctp driver not available");  

Using tst_check_driver requires #include "tst_kernel.h".

Weird I did not get any build error and the binaries are built. Maybe Yocto manage to build it even without the include. Sorry for that.

It's safer to test build and patches also on x86_64 machine with typical linux distro :).

Kind regards,
Petr