New library conversion for few system call tests
v2 cover New library conversion for few system call tests
Following series is a set of system call tests that are converted to new library. Also deleted bdflush test at the same time. I have been going through the system call tests alphabetically and convert them to new library as applicable, so there will be more to come.
I have tested this on cuttlefish[1] and made sure they don't regress.
Sandeep Patil (3):
syscalls/adjtimex02: Convert to new library
syscalls/asyncio02: convert to new library.
syscalls/bind01: convert to new library.
.../kernel/syscalls/adjtimex/adjtimex02.c | 313 +++++------------- testcases/kernel/syscalls/asyncio/.gitignore | 1 - testcases/kernel/syscalls/asyncio/Makefile | 23 -- testcases/kernel/syscalls/asyncio/asyncio02.c | 294 ---------------- testcases/kernel/syscalls/bind/bind01.c | 198 +++-------- testcases/kernel/syscalls/stat/stat02.c | 93 ++++++ 6 files changed, 220 insertions(+), 702 deletions(-) delete mode 100644 testcases/kernel/syscalls/asyncio/.gitignore delete mode 100644 testcases/kernel/syscalls/asyncio/Makefile delete mode 100644 testcases/kernel/syscalls/asyncio/asyncio02.c create mode 100644 testcases/kernel/syscalls/stat/stat02.c
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
PATCH v2 1/3 syscalls/adjtimex02: Convert to new library
remove UCLINUX checks along the way and simplify the test.
---v1->v2
======
- Remove the test case structure
- handle expected error numbers in one place (swich statement)
.../kernel/syscalls/adjtimex/adjtimex02.c | 313 +++++------------- 1 file changed, 79 insertions(+), 234 deletions(-)
testcases/kernel/syscalls/adjtimex/adjtimex02.c +79 -234
@@ -1,274 +1,119 @@ +// SPDX-License-Identifier: GPL-2.0 +/* * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -* +* AUTHOR : Saji Kumar.V.R <[email protected]> */ -/********************************************************** -* -* TEST IDENTIFIER : adjtimex02 -* -* EXECUTED BY : root / superuser -* -* TEST TITLE : Tests for error conditions -* -* TEST CASE TOTAL : 6 -* -* AUTHOR : Saji Kumar.V.R <[email protected]> -* -* SIGNALS -* Uses SIGUSR1 to pause before test if option set. -* (See the parse_opts(3) man page). -* -* DESCRIPTION -* Verify that -* 1) adjtimex(2) fails with errno set to EFAULT if buf does -* not point to writable memory -* 2) adjtimex(2) fails with errno set to EINVAL if an attempt -* is made to set buf.tick to a value < 900000/HZ -* 3) adjtimex(2) fails with errno set to EINVAL if an attempt -* is made to set buf.tick to a value > 1100000/HZ -* 4) adjtimex(2) fails with errno set to EINVAL if an attempt -* is made to set buf.offset to a value > 512000L -* (This test case will be executed only if the kernel version -* is 2.6.25 or below) -* 5) adjtimex(2) fails with errno set to EINVAL if an attempt -* is made to set buf.offset to a value < 512000L -* (This test case will be executed only if the kernel version -* is 2.6.25 or below) -* 6) adjtimex(2) fails with errno set to EPERM if buf.mode is -* non-zero and the user is not super-user. -* -* Setup: -* Setup signal handling. -* Pause for SIGUSR1 if option specified. -* Save current parameters in tim_save -* -* Test: -* Loop if the proper options are given. -* Call test case specific setup if needed -* call adjtimex with saved timex structure -* Check return value is between 0 & 5 -* Test passed -* Otherwise -* Test failed -* Call test case specific cleanup if needed -* -* Cleanup: -* Print errno log and/or timing stats if options given -* -* USAGE: <for command-line> -* adjtimex02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p] -* where, -c n : Run n copies concurrently. -* -e : Turn on errno logging. -* -h : Show help screen -* -f : Turn off functional testing -* -i n : Execute test n times. -* -I x : Execute test for x seconds. -* -p : Pause for SIGUSR1 before starting -* -P x : Pause for x seconds between iterations. -* -t : Turn on syscall timing. -* -****************************************************************/ - -#if definedUCLINUX && !__THROW -/* workaround for libc bug causing failure in sys/timex.h */ -#define __THROW -#endif #include <errno.h> #include <sys/timex.h> #include <unistd.h> #include <pwd.h> -#include "test.h" -#include "safe_macros.h" +#include "tst_test.h" #define SET_MODE ( ADJ_OFFSET | ADJ_FREQUENCY | ADJ_MAXERROR | ADJ_ESTERROR | \ ADJ_STATUS | ADJ_TIMECONST | ADJ_TICK ) -static void setup (void ); -static int setup2 (void ); -static int setup3 (void ); -static int setup4 (void ); -static int setup5 (void ); -static int setup6 (void ); -static void cleanup (void ); -static void cleanup6 (void ); - -char *TCID ="adjtimex02" ; -static int hz;/* HZ from sysconf */ static struct timex tim_save;static struct timex buff; -static char nobody_uid[] ="nobody" ;struct passwd *ltpuser; -struct test_cases_t { -struct timex *buffp; -int (*setup) (); -void (*cleanup) (); -int exp_errno; -} test_cases[] = { -#ifndef UCLINUX -/* Skip since uClinux does not implement memory protection */ - { - (struct timex *)-1 ,NULL ,NULL ,EFAULT }, -#endif - { - &buff, setup2,NULL ,EINVAL }, { - &buff, setup3,NULL ,EINVAL }, { - &buff, setup4,NULL ,EINVAL }, { - &buff, setup5,NULL ,EINVAL }, { - &buff, setup6, cleanup6,EPERM } -}; - -int TST_TOTAL =sizeof (test_cases) /sizeof (test_cases[0 ]); - -int main (int ac,char **av) +void verify_adjtimex (unsigned int nr) { - -int lc, i; - -tst_parse_opts (ac, av,NULL ,NULL ); - -setup (); - -for (lc =0 ;TEST_LOOPING (lc); lc++) { - - tst_count =0 ; - -for (i =0 ; i <TST_TOTAL ; ++i) { -/* -* since Linux 2.6.26, if buf.offset value is outside -* the acceptable range, it is simply normalized instead -* of letting the syscall fail. so just skip this test -* case. -*/ -if ((i ==3 || i ==4 ) &&tst_kvercmp (2 ,6 ,25 ) >0 ) { -tst_resm (TCONF ,"this kernel normalizes buf." -"offset value if it is outside" -" the acceptable range." ); -continue ; - } - - buff = tim_save; - buff.modes =SET_MODE ; -if ((test_cases[i].setup) && (test_cases[i].setup ())) { -tst_resm (TWARN ,"setup() failed, skipping" -" this test case" ); -continue ; - } - -/* Call adjtimex(2) */ -TEST (adjtimex (test_cases[i].buffp)); - -if ((TEST_RETURN ==-1 ) && (TEST_ERRNO == - test_cases[i].exp_errno)) { -tst_resm (TPASS |TTERRNO , -"Test Passed, adjtimex() returned -1" ); - }else { -tst_resm (TFAIL |TTERRNO , -"Test Failed, adjtimex() returned %ld" , -TEST_RETURN ); - } -if (test_cases[i].cleanup) { - test_cases[i].cleanup (); - } - } +struct timex *buffp; +int expected_errno =0 ; + +/* +* since Linux 2.6.26, if buf.offset value is outside +* the acceptable range, it is simply normalized instead +* of letting the syscall fail. so just skip this test +* case. +*/ +if (nr >3 && (tst_kvercmp (2 ,6 ,25 ) >0 )) { +tst_res (TCONF ,"this kernel normalizes buf." +"offset value if it is outside" +" the acceptable range." ); +return ; } -/* cleanup and exit */ -cleanup (); + buff = tim_save; + buff.modes =SET_MODE ; + buffp = &buff; +switch (nr) { +case 0 : + buffp = (struct timex *)-1 ; + expected_errno =EFAULT ; +break ; +case 1 : + buff.tick =900000 / hz -1 ; + expected_errno =EINVAL ; +break ; +case 2 : + buff.tick =1100000 / hz +1 ; + expected_errno =EINVAL ; +break ; +case 3 : +/* Switch to nobody user for correct error code collection */ + ltpuser =SAFE_GETPWNAM ("nobody" ); +SAFE_SETEUID (ltpuser->pw_uid); + expected_errno =EPERM ; +break ; +case 4 : + buff.offset =512000L +1 ; + expected_errno =EINVAL ; +break ; +case 5 : + buff.offset = (-1 ) * (512000L ) -1 ; + expected_errno =EINVAL ; +break ; +default : +tst_brk (TFAIL ,"Invalid test case %u " , nr); + } -tst_exit (); +TEST (adjtimex (buffp)); +if ((TST_RET ==-1 ) && (TST_ERR == expected_errno)) { +tst_res (TPASS |TTERRNO , +"adjtimex() error %u " , expected_errno); + }else { +tst_res (TFAIL |TTERRNO , +"Test Failed, adjtimex() returned %ld" , +TST_RET ); + } +/* clean up after ourselves */ +if (nr ==3 ) +SAFE_SETEUID (0 ); } -/* setup() - performs all ONE TIME setup for this test */ void setup (void ) { -tst_require_root (); - tim_save.modes =0 ; -tst_sig (NOFORK ,DEF_HANDLER , cleanup); -/* set the HZ from sysconf */ - hz =SAFE_SYSCONF (NULL , _SC_CLK_TCK); + hz =SAFE_SYSCONF (_SC_CLK_TCK); -TEST_PAUSE ; - -/* Save current parameters in tim_save */ -if ((adjtimex (&tim_save)) ==-1 ) { -tst_brkm (TBROK ,NULL ,"Failed to save current parameters" ); - } +/* Save current parameters */ +if ((adjtimex (&tim_save)) ==-1 ) +tst_brk (TBROK |TERRNO , +"adjtimex(): failed to save current params" ); } -/* -*cleanup() - performs all ONE TIME cleanup for this test at -* completion or premature exit. -*/ void cleanup (void ) { - tim_save.modes =SET_MODE ; -/* Restore saved parameters */ -if ((adjtimex (&tim_save)) ==-1 ) { -tst_resm (TWARN ,"Failed to restore saved parameters" ); - } -} - -int setup2 (void ) -{ - buff.tick =900000 / hz -1 ; -return 0 ; -} - -int setup3 (void ) -{ - buff.tick =1100000 / hz +1 ; -return 0 ; -} - -int setup4 (void ) -{ - buff.offset =512000L +1 ; -return 0 ; -} - -int setup5 (void ) -{ - buff.offset = (-1 ) * (512000L ) -1 ; -return 0 ; -} -int setup6 (void ) -{ -/* Switch to nobody user for correct error code collection */ -if ((ltpuser =getpwnam (nobody_uid)) ==NULL ) { -tst_brkm (TBROK ,NULL ,"\"nobody\" user not present" ); - } -if (seteuid (ltpuser->pw_uid) ==-1 ) { -tst_resm (TWARN |TERRNO ,"seteuid(%d) failed" , ltpuser->pw_uid); -return 1 ; - } -return 0 ; +/* Restore saved parameters */ +if ((adjtimex (&tim_save)) ==-1 ) +tst_res (TWARN ,"Failed to restore saved parameters" ); } -void cleanup6 (void ) -{ -/* Set effective user id back to root */ -SAFE_SETEUID (cleanup,0 ); -} +static struct tst_test test = { + .needs_root =1 , + .tcnt =6 , + .setup = setup, + .cleanup = cleanup, + .test = verify_adjtimex, +};
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
PATCH v2 1/3 syscalls/adjtimex02: Convert to new library
Hi!
Pushed, thanks.
(I've added a few missing static keywords to cleanup/setup...)
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 2/3 syscalls/asyncio02: convert to new library.
In reply to Sandeep PatilMove the test to stat/stat02 and drop several
duplicate test cases along the way
---
v1->v2
------
- Move the test to stat/stat02.c
- Delete the asyncio skeleton for good.
testcases/kernel/syscalls/asyncio/.gitignore | 1 - testcases/kernel/syscalls/asyncio/Makefile | 23 -- testcases/kernel/syscalls/asyncio/asyncio02.c | 294 ------------------ testcases/kernel/syscalls/stat/stat02.c | 93 ++++++ 4 files changed, 93 insertions(+), 318 deletions(-) delete mode 100644 testcases/kernel/syscalls/asyncio/.gitignore delete mode 100644 testcases/kernel/syscalls/asyncio/Makefile delete mode 100644 testcases/kernel/syscalls/asyncio/asyncio02.c create mode 100644 testcases/kernel/syscalls/stat/stat02.c
testcases/kernel/syscalls/asyncio/.gitignore deleted +0 -1
@@ -1 +0,0 @@ -/asyncio02
testcases/kernel/syscalls/asyncio/Makefile deleted +0 -23
@@ -1,23 +0,0 @@ -# -# Copyright (c) International Business Machines Corp., 2001 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -# the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# - -top_srcdir ?= ../../../.. - -include $(top_srcdir)/include/mk/testcases.mk - -include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/asyncio/asyncio02.c deleted +0 -294
294 lines not on this page · raw message
testcases/kernel/syscalls/stat/stat02.c new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
PATCH v2 2/3 syscalls/asyncio02: convert to new library.
Hi!
testcases/kernel/syscalls/stat/stat02.c line 1
Quoted 7 lines
testcases/kernel/syscalls/stat/stat02.c new file +1
-0@@ -0,0 +1,93 @@ +// SPDX-License-Identifier: GPL-2.0
Changed this to GPL-2.0-or-later to match the original here as well and pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 3/3 syscalls/bind01: convert to new library.
In reply to Sandeep PatilDrop UCLINUX specific tests along the way.
---
v1->v2
------
- Rebased after commit 'fa6a4e708 ("net: Introduce TST_GET_UNUSED_PORT() macro..)'
testcases/kernel/syscalls/bind/bind01.c | 198 ++++++------------------ 1 file changed, 48 insertions(+), 150 deletions(-)
testcases/kernel/syscalls/bind/bind01.c +48 -150
@@ -1,43 +1,7 @@ -/* -* -* Copyright (c) International Business Machines Corp., 2001 -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -* the GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ +// SPDX-License-Identifier: GPL-2.0 /* -* Test Name: bind01 -* -* Test Description: -* Verify that bind() returns the proper errno for various failure cases -* -* Usage: <for command-line> -* bind01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] -* where, -c n : Run n copies concurrently. -* -e : Turn on errno logging. -* -i n : Execute test n times. -* -I x : Execute test for x seconds. -* -P x : Pause for x seconds between iterations. -* -t : Turn on syscall timing. -* -* HISTORY -* 07/2001 Ported by Wayne Boyer -* -* RESTRICTIONS: -* None. -* +* Copyright (c) International Business Machines Corp., 2001 */ #include <stdio.h>
@@ -51,104 +15,51 @@#include <netinet/in.h> -#include "test.h" -#include "safe_macros.h" +#include "tst_test.h" -char *TCID ="bind01" ; -int testno; +int inet_socket; +int dev_null; -int s;/* socket descriptor */ struct sockaddr_in sin1, sin2, sin3; -struct sockaddr_un sun1; - -void setup (void ),setup0 (void ),setup1 (void ),setup2 (void ), -cleanup (void ),cleanup0 (void ),cleanup1 (void ); +struct sockaddr_un sun; -struct test_case_t {/* test case structure */ -int domain;/* PF_INET, PF_UNIX, ... */ -int type;/* SOCK_STREAM, SOCK_DGRAM ... */ -int proto;/* protocol number (usually 0 = default) */ +static struct test_case { +int *socket_fd;/* file descriptor for test case */ struct sockaddr *sockaddr;/* socket address buffer */ -int salen;/* bind's 3rd argument */ -int retval;/* syscall return value */ +socklen_t salen;/* bind's 3rd argument */ +int retval;/* expected return value */ int experrno;/* expected errno */ -void (*setup) (void ); -void (*cleanup) (void );char *desc; -} tdat[] = { -#ifndef UCLINUX -/* Skip since uClinux does not implement memory protection */ - { -PF_INET ,SOCK_STREAM ,0 , (struct sockaddr *)-1 , -sizeof (struct sockaddr_in ),-1 ,EFAULT , setup0, - cleanup0,"invalid sockaddr" }, -#endif - { -PF_INET ,SOCK_STREAM ,0 , (struct sockaddr *)&sin1, -3 ,-1 ,EINVAL , setup0, cleanup0,"invalid salen" }, { -0 ,0 ,0 , (struct sockaddr *)&sin1, -sizeof (sin1),-1 ,ENOTSOCK , setup1, cleanup1, -"invalid socket" } - , { -PF_INET ,SOCK_STREAM ,0 , (struct sockaddr *)&sin2, -sizeof (sin2),0 ,0 , setup0, cleanup0,"INADDR_ANYPORT" } - , { -PF_UNIX ,SOCK_STREAM ,0 , (struct sockaddr *)&sun1, -sizeof (sun1),-1 ,EADDRINUSE , setup0, cleanup0, -"UNIX-domain of current directory" } - , { -PF_INET ,SOCK_STREAM ,0 , (struct sockaddr *)&sin3, -sizeof (sin3),-1 ,EADDRNOTAVAIL , setup0, cleanup0, -"non-local address" } -,}; - -int TST_TOTAL =sizeof (tdat) /sizeof (tdat[0 ]); - -int main (int argc,char *argv[]) +} tcases[] = { + { &inet_socket, (struct sockaddr *)&sin1,3 ,-1 , +EINVAL ,"invalid salen" }, + { &dev_null, (struct sockaddr *)&sin1,sizeof (sin1),-1 , +ENOTSOCK ,"invalid socket" }, + { &inet_socket, (struct sockaddr *)&sin2,sizeof (sin2),0 , +0 ,"INADDR_ANYPORT" }, + { &inet_socket, (struct sockaddr *)&sun,sizeof (sun),-1 , +EAFNOSUPPORT ,"UNIX-domain of current directory" }, + { &inet_socket, (struct sockaddr *)&sin3,sizeof (sin3),-1 , +EADDRNOTAVAIL ,"non-local address" }, +}; + +void verify_bind (unsigned int nr) { -int lc; - -tst_parse_opts (argc, argv,NULL ,NULL ); - -setup (); - -for (lc =0 ;TEST_LOOPING (lc); ++lc) { - tst_count =0 ; - -for (testno =0 ; testno <TST_TOTAL ; ++testno) { - tdat[testno].setup (); - -TEST (bind - (s, tdat[testno].sockaddr, tdat[testno].salen)); -if (TEST_RETURN >0 ) { -TEST_RETURN =0 ; - }else { - } -if (TEST_RETURN != tdat[testno].retval || - (TEST_RETURN <0 && -TEST_ERRNO != tdat[testno].experrno)) { -tst_resm (TFAIL ,"%s ; returned" -" %ld (expected %d), errno %d (expected" -" %d)" , tdat[testno].desc, -TEST_RETURN , tdat[testno].retval, -TEST_ERRNO , tdat[testno].experrno); - }else { -tst_resm (TPASS ,"%s successful" , - tdat[testno].desc); - } - tdat[testno].cleanup (); - } +struct test_case *tcase = &tcases[nr]; + +TEST (bind (*tcase->socket_fd, tcase->sockaddr, tcase->salen)); +if (TST_RET != tcase->retval &&TST_ERR != tcase->experrno) { +tst_res (TFAIL ,"%s ; returned" +" %ld (expected %d), errno %d (expected" +" %d)" , tcase->desc,TST_RET , tcase->retval, +TST_ERR , tcase->experrno); + }else { +tst_res (TPASS ,"%s successful" , tcase->desc); } -cleanup (); - -tst_exit (); } -void setup (void ) +void test_setup (void ) { - -TEST_PAUSE ;/* if -p option specified */ -/* initialize sockaddr's */ sin1.sin_family =AF_INET ;/* this port must be unused! */
@@ -164,35 +75,22 @@ void setup(void)/* assumes 10.255.254.253 is not a local interface address! */ sin3.sin_addr.s_addr =htonl (0x0AFFFEFD ); - sun1.sun_family =AF_UNIX ; -strncpy (sun1.sun_path,"." ,sizeof (sun1.sun_path)); - -} - -void cleanup (void ) -{ -} + sun.sun_family =AF_UNIX ; +strncpy (sun.sun_path,"." ,sizeof (sun.sun_path)); -void setup0 (void ) -{ - s =SAFE_SOCKET (cleanup, tdat[testno].domain, tdat[testno].type, - tdat[testno].proto); + inet_socket =SAFE_SOCKET (PF_INET ,SOCK_STREAM ,0 ); + dev_null =SAFE_OPEN ("/dev/null" ,O_WRONLY ); } -void cleanup0 (void ) +void test_cleanup (void ) { - (void )close (s); +SAFE_CLOSE (inet_socket); +SAFE_CLOSE (dev_null); } -void setup1 (void ) -{ -/* setup for the "not a socket" case */ -if ((s =open ("/dev/null" ,O_WRONLY )) ==-1 ) -tst_brkm (TBROK |TERRNO , cleanup,"open(/dev/null) failed" ); - -} - -void cleanup1 (void ) -{ - s =-1 ; -} +static struct tst_test test = { + .tcnt =ARRAY_SIZE (tcases), + .setup = test_setup, + .cleanup = test_cleanup, + .test = verify_bind, +};
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
PATCH v2 3/3 syscalls/bind01: convert to new library.
Hi!
Pushed with minor changes, thanks.
However the test fails with -i 2 after this patch since on second iteration since the socket is already bind for the possitive test because we no longer close the socket after each iteration. Looking at the bind tests we should move this one into a separate testcase and add a few more positive tests as well we seem to test only AF_INET, SOCK_STREAM combination which does not even cover ipv4 nor we attemp to connect to the socket that have been bind.
Quoted 1 line
+// SPDX-License-Identifier: GPL-2.0
Changed this to GPL-2.0-or-later to match the original license.
And removed the NULL parameter from the TST_GET_UNUSED_PORT(), since newlib variant does not have the cleanup callback parameter.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 3/3 syscalls/bind01: convert to new library.
Hi!
Quoted 7 lines
However the test fails with -i 2 after this patch since on second iteration since the socket is already bind for the possitive test because we no longer close the socket after each iteration. Looking at the bind tests we should move this one into a separate testcase and add a few more positive tests as well we seem to test only
AF_INET,SOCK_STREAMcombination which does not even cover ipv4 nor we attemp to connect to the socket that have been bind.
FYI I've added an issue so that this is not forgotten:
https://github.com/linux-test-project/ltp/issues/538
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 3/3 syscalls/bind01: convert to new library.
In reply to Cyril HrubisQuoted 6 lines · Cyril Hrubis
Hi!
Pushed with minor changes, thanks.However the test fails with -i 2 after this patch since on second iteration since the socket is already bind for the possitive test because we no longer close the socket after each iteration.
Ew, sorry about that. I guess I never ran it with the option as I only tried what is listed in runtest.
I'll try it with '-i 2'.
Quoted 5 lines
Looking at
the bind tests we should move this one into a separate testcase and add a few more positive tests as well we seem to test onlyAF_INET,SOCK_STREAMcombination which does not even cover ipv4 nor we attemp to connect to the socket that have been bind.
Agree, added to my to-do list. I am mostly burning through tests and converting them to the new library manually.
Quoted 4 lines
Quoted 2 lines
+// SPDX-License-Identifier: GPL-2.0
Changed this to GPL-2.0-or-later to match the original license.
I thought the original was GPL-2.0 (may be I misread the text, sorry).
Quoted 3 lines
And removed the NULL parameter from the
TST_GET_UNUSED_PORT(), since newlib variant does not have the cleanup callback parameter.
Ack, thanks for doing this Cyril. Hopefully the next ones will apply without edits ;0)
- ssp