Re: [LTP] [PATCH v2] ltp/pounder: Don't let the testing log output to /dev/tty

2015-08-31 Thread Li Wang
ping, is there possible to push this before the newest LTP released?


On Fri, Aug 21, 2015 at 6:13 PM, Li Wang  wrote:

> v1-->v2:
> - FILE *tty_fp --> FILE *out
> - Using out = stdout to replace the fdopen() operate;
>
> Signed-off-by: Li Wang 
> Signed-off-by: Cyril Hrubis 
> ---
>  tools/pounder21/Install  |  2 +-
>  tools/pounder21/fancy_timed_loop.c   | 29 -
>  tools/pounder21/infinite_loop.c  | 25 ++---
>  tools/pounder21/pounder  | 14 +++---
>  tools/pounder21/test_scripts/memtest |  2 +-
>  tools/pounder21/timed_loop.c | 27 +++
>  6 files changed, 42 insertions(+), 57 deletions(-)
>
> diff --git a/tools/pounder21/Install b/tools/pounder21/Install
> index bf13528..6fb3a8f 100755
> --- a/tools/pounder21/Install
> +++ b/tools/pounder21/Install
> @@ -65,7 +65,7 @@ done
>  # Set up optdir
>  mkdir -p "$POUNDER_OPTDIR"
>  if [ ! -d "$POUNDER_OPTDIR" ]; then
> -   echo "Could not create $POUNDER_OPTDIR; aborting." > /dev/tty
> +   echo "Could not create $POUNDER_OPTDIR; aborting."
> exit 1
>  fi
>
> diff --git a/tools/pounder21/fancy_timed_loop.c
> b/tools/pounder21/fancy_timed_loop.c
> index cf8580e..e2ca1dc 100644
> --- a/tools/pounder21/fancy_timed_loop.c
> +++ b/tools/pounder21/fancy_timed_loop.c
> @@ -32,13 +32,13 @@
>  static int res = 0;
>  static char *progname;
>  static pid_t test_pgrp;
> -static FILE *tty_fp;
> +static FILE *out;
>
>  static int the_signal = SIGTERM;
>
>  static void int_func(int signum)
>  {
> -   pounder_fprintf(tty_fp,
> +   pounder_fprintf(out,
> "%s: Killed by interrupt.  Last exit code = %d.\n",
> progname, res);
> kill(-test_pgrp, the_signal);
> @@ -47,7 +47,7 @@ static void int_func(int signum)
>
>  static void alarm_func(int signum)
>  {
> -   pounder_fprintf(tty_fp, "%s: Killed by timer.  Last exit code =
> %d.\n",
> +   pounder_fprintf(out, "%s: Killed by timer.  Last exit code =
> %d.\n",
> progname, res);
> kill(-test_pgrp, the_signal);
> exit(res);
> @@ -90,14 +90,9 @@ int main(int argc, char *argv[])
> }
> }
>
> -   tty_fp = fdopen(3, "w+");
> -   if (tty_fp == NULL) {
> -   tty_fp = fopen("/dev/tty", "w+");
> -   if (tty_fp == NULL) {
> -   perror("stdout");
> -   exit(2);
> -   }
> -   }
> +   out = fdopen(3, "w+");
> +   if (out == NULL)
> +   out = stdout;
>
> if (use_max_failures) {
> progname = rindex(argv[7], '/');
> @@ -142,11 +137,11 @@ int main(int argc, char *argv[])
> gid = atoi(argv[3]);
> }
>
> -   pounder_fprintf(tty_fp, "%s: uid = %d, gid = %d, sig = %d\n",
> +   pounder_fprintf(out, "%s: uid = %d, gid = %d, sig = %d\n",
> progname, uid, gid, the_signal);
>
> while (1) {
> -   pounder_fprintf(tty_fp, "%s: %s loop #%d.\n", progname,
> +   pounder_fprintf(out, "%s: %s loop #%d.\n", progname,
> start_msg, revs++);
> pid = fork();
> if (pid == 0) {
> @@ -196,22 +191,22 @@ int main(int argc, char *argv[])
> }
> // interrogate it
> if (WIFSIGNALED(stat)) {
> -   pounder_fprintf(tty_fp, "%s: %s on signal %d.\n",
> +   pounder_fprintf(out, "%s: %s on signal %d.\n",
> progname, fail_msg,
> WTERMSIG(stat));
> res = 255;
> } else {
> res = WEXITSTATUS(stat);
> if (res == 0) {
> -   pounder_fprintf(tty_fp, "%s: %s.\n",
> progname,
> +   pounder_fprintf(out, "%s: %s.\n", progname,
> pass_msg);
> } else if (res < 0 || res == 255) {
> -   pounder_fprintf(tty_fp,
> +   pounder_fprintf(out,
> "%s: %s with code %d.\n",
> progname, abort_msg, res);
> exit(-1);
> // FIXME: add test to blacklist
> } else {
> -   pounder_fprintf(tty_fp,
> +   pounder_fprintf(out,
> "%s: %s with code %d.\n",
> progname, fail_msg, res);
> if (max_failures > 0) {
> diff --git a/tools/pounder21/infinite_loop.c
> 

Re: [LTP] LTP release

2015-08-31 Thread Cyril Hrubis
Hi!
I've did my release testing and pushed a few fixes, mosty minor ones.

Now the only problem that that blocks the release on my side are
failures of the newly rewritten netns testcases that were discussed
last week.

Jiri: What about changing the ns_exec to join only net namespace for
  now and rewriting it after the release?

Everybody: If you have issues with the latest git please report them.
   And if you haven't tested it yet please do so ASAP.

-- 
Cyril Hrubis
chru...@suse.cz

--
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[LTP] [PATCH v6 4/7] lib6/asapi_05.c: Cleanup

2015-08-31 Thread Zeng Linggang
* Add 'static' before some functions and global variables.
* Use 'tst_tmpdir' and 'tst_rmdir'.
* Remove useless comments.
* Use SAFE_XXX().
* Modify the format of etab[] and ftab[].
* Some cleanup.

Signed-off-by: Zeng Linggang 
Signed-off-by: Alexey Kodanev 
Signed-off-by: Cyril Hrubis 
---
 testcases/network/lib6/asapi_05.c | 157 +++---
 1 file changed, 63 insertions(+), 94 deletions(-)

diff --git a/testcases/network/lib6/asapi_05.c 
b/testcases/network/lib6/asapi_05.c
index e251eee..c19cd82 100644
--- a/testcases/network/lib6/asapi_05.c
+++ b/testcases/network/lib6/asapi_05.c
@@ -1,38 +1,21 @@
 /*
+ * Copyright (c) 2015 Fujitsu Ltd.
+ * Copyright (c) International Business Machines  Corp., 2001
  *
- *   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 3 of the License, or
+ * (at your option) any later version.
  *
- *   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.
  *
- *   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
- */
-
-/*
- * Test Name: asapi_05
- *
- * Test Description:
- *  These tests are for the "Advanced Sockets API" (RFC 3542)
- *  Verify that in6 and sockaddr fields are present.
- *
- * Usage:  
- *  asapi_05
- *
- * HISTORY
- * 04/2005 written by David L Stevens
- *
- * RESTRICTIONS:
- *  None.
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
  *
+ * Author: David L Stevens
  */
 
 #include 
@@ -47,86 +30,83 @@
 #include 
 
 #include "test.h"
+#include "safe_macros.h"
 
-char *TCID = "asapi_05";   /* Test program identifier.*/
+char *TCID = "asapi_05";
 
-void setup(void);
-void cleanup(void);
+static void setup(void);
+static void cleanup(void);
 
-void icmp6_ft(void);
+static void icmp6_ft(void);
 
 int main(int argc, char *argv[])
 {
int lc;
 
-   /* Parse standard options given to run the test. */
tst_parse_opts(argc, argv, NULL, NULL);
 
setup();
 
-   for (lc = 0; TEST_LOOPING(lc); ++lc) {
+   for (lc = 0; TEST_LOOPING(lc); ++lc)
icmp6_ft();
-   }
 
cleanup();
-
tst_exit();
 }
 
-void setup(void)
+static void setup(void)
 {
-   TEST_PAUSE; /* if -P option specified */
+   TEST_PAUSE;
tst_require_root();
+
+   tst_tmpdir();
 }
 
-void cleanup(void)
+static void cleanup(void)
 {
+   tst_rmdir();
 }
 
-/*
- * This is for old, broken glibc-header icmp6_filter structure definitions.
- * If icmp6.h has struct icmp6_filter with field named "data" instead
- * of the standard "icmp_filt", uncomment this line.
- */
-/*#define icmp_filtdata */
-
-enum tt { T_WILLPASS, T_WILLBLOCK, T_SETPASS, T_SETBLOCK, T_SETPASSALL,
+enum tt {
+   T_WILLPASS,
+   T_WILLBLOCK,
+   T_SETPASS,
+   T_SETBLOCK,
+   T_SETPASSALL,
T_SETBLOCKALL
 };
-struct ftent {
-   char *ft_tname; /* test name, for logging */
+
+static struct ftent {
+   char *ft_tname; /* test name, for logging */
unsigned char ft_sndtype;   /* send type field */
unsigned char ft_flttype;   /* filter type field */
-   enum tt ft_test;/* what macro to test */
-   int ft_expected;/* packet should pass? */
+   enum tt ft_test;/* what macro to test */
+   int ft_expected;/* packet should pass? */
 } ftab[] = {
-   {
-   "ICMP6_FILTER_SETPASS s 20 f 20", 20, 20, T_SETPASS, 1}, {
-   "ICMP6_FILTER_SETPASS s 20 f 21", 20, 21, T_SETPASS, 0}, {
-   "ICMP6_FILTER_SETBLOCK s 20 f 20", 20, 20, T_SETBLOCK, 0}, {
-   "ICMP6_FILTER_SETBLOCK s 20 f 21", 20, 21, T_SETBLOCK, 1}, {
-   "ICMP6_FILTER_PASSALL s 20", 20, 0, T_SETPASSALL, 1}, {
-   "ICMP6_FILTER_PASSALL s 20", 21, 0, 

[LTP] [PATCH v6 6/7] lib6/getaddrinfo_01.c: Cleanup

2015-08-31 Thread Zeng Linggang
* Add 'static' before some functions and global variables.
* Remove cleanup() function.
* Remove useless comments.
* In every test function, using TINFO instead of TPASS
  marks the success of each inner test.
* Some cleanup.

Signed-off-by: Zeng Linggang 
Signed-off-by: Alexey Kodanev 
Signed-off-by: Cyril Hrubis 
---
 testcases/network/lib6/getaddrinfo_01.c | 503 ++--
 1 file changed, 281 insertions(+), 222 deletions(-)

diff --git a/testcases/network/lib6/getaddrinfo_01.c 
b/testcases/network/lib6/getaddrinfo_01.c
index ec29b5d..a812e77 100644
--- a/testcases/network/lib6/getaddrinfo_01.c
+++ b/testcases/network/lib6/getaddrinfo_01.c
@@ -1,43 +1,21 @@
 /*
+ * Copyright (c) 2015 Fujitsu Ltd.
+ * Copyright (c) International Business Machines  Corp., 2001
  *
- *   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 3 of the License, or
+ * (at your option) any later version.
  *
- *   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.
  *
- *   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
- */
-
-/*
- * Test Name: getaddrinfo_01
- *
- * Test Description:
- *  Tests for getaddrinfo library function
- *
- * Usage:  
- *  getaddrinfo_01 [-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/2004 written by David L Stevens
- *
- * RESTRICTIONS:
- *  None.
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
  *
+ * Author: David L Stevens
  */
 
 #include 
@@ -53,40 +31,38 @@
 #define AI_V4MAPPED0x0008  /* IPv4 mapped addresses are acceptable.  */
 #endif
 
-char *TCID = "getaddrinfo_01"; /* Test program identifier.*/
-int testno;
+static void setup(void);
+static void gaiv4(void);
+static void gaiv6(void);
 
-void setup(void), cleanup(void);
-
-int TST_TOTAL = 1;
-
-/* a host that isn't where LTP is running */
-#define REMOTEHOSTNAME "www.ibm.com"
-
-void gaiv4(void), gaiv6(void);
-void dumpres(struct addrinfo *);
+char *TCID = "getaddrinfo_01";
+int TST_TOTAL = 2;
 
 int main(int argc, char *argv[])
 {
int lc;
 
-   /* Parse standard options given to run the test. */
tst_parse_opts(argc, argv, NULL, NULL);
 
setup();
 
for (lc = 0; TEST_LOOPING(lc); ++lc) {
+   tst_count = 0;
+
gaiv4();
gaiv6();
}
-   cleanup();
 
-   return (0);
+   tst_exit();
 }
 
-/* getaddrinfo tests (v4) */
+static void setup(void)
+{
+   TEST_PAUSE;
+}
 
-void gaiv4(void)
+/* getaddrinfo tests (v4) */
+static void gaiv4(void)
 {
struct addrinfo *aires, hints, *pai;
char hostname[MAXHOSTNAMELEN + 1];
@@ -132,13 +108,18 @@ void gaiv4(void)
 psin ? psin->sin_family : 0,
 psin ? psin->sin_port : 0,
 psin ? htons(psin->sin_port) : 0);
-   } else
-   tst_resm(TPASS, "getaddrinfo IPv4 basic lookup");
-   freeaddrinfo(aires);
-   } else
-   tst_resm(TEST_RETURN ? TFAIL : TPASS, "getaddrinfo IPv4 basic "
+   freeaddrinfo(aires);
+   return;
+   } else {
+   tst_resm(TINFO, "getaddrinfo IPv4 basic lookup");
+   freeaddrinfo(aires);
+   }
+   } else {
+   tst_resm(TFAIL, "getaddrinfo IPv4 basic "
 "lookup (\"%s\") returns %ld (\"%s\")", hostname,
 

Re: [LTP] Test Anything Protocal output

2015-08-31 Thread Cyril Hrubis
Hi!
> I read your January 2015 article where someone asked if TAP test output would 
> be supported. It sounded like
> you were going to look into it. Did you make any progress?

Unfortunately not yet.

> The reason I asked if because I was wanting the same feature and I was going 
> to review the LTP code to see
> how hard it would be to add it, but I wouldn't want to start if someone else 
> has already done it. I did
> see anything in the git history tho.

Well, have a look at lib/tst_res.c, that is the place where test results
are stored/printed. Unfortunately this code hasn't been cleaned up yet.

I've started to work on this just recently. Just now I'm experimenting
with rewriting it from scratch keeping most of the API unchanged (since
we cannot change easily the API for > ~1000 testcases).

Then there is another problem, so far LTP testcases are executed using
the ltp-pan test driver, which executes testcases, catches segfaults,
etc. We would have to consider how that would interact with the output
generated from testcases.

One option would be to get rid of most of the pan functionality by
moving the test driver code into the test library, so that each testcase
would fork first, then run the real test in it's own virtual terminal,
etc.

-- 
Cyril Hrubis
chru...@suse.cz

--
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[LTP] [PATCH v6 1/7] lib6: Remove runcc.* and the testcases that use it.

2015-08-31 Thread Zeng Linggang
Signed-off-by: Zeng Linggang 
Signed-off-by: Alexey Kodanev 
Signed-off-by: Cyril Hrubis 
---
 runtest/ipv6_lib  |   4 -
 testcases/network/.gitignore  |   4 -
 testcases/network/lib6/Makefile   |   4 -
 testcases/network/lib6/asapi_01.c | 251 
 testcases/network/lib6/asapi_02.c | 338 --
 testcases/network/lib6/asapi_03.c | 234 --
 testcases/network/lib6/asapi_05.c | 119 +-
 testcases/network/lib6/asapi_07.c | 144 
 testcases/network/lib6/runcc.c| 209 ---
 testcases/network/lib6/runcc.h|  30 
 10 files changed, 1 insertion(+), 1336 deletions(-)
 delete mode 100644 testcases/network/lib6/asapi_01.c
 delete mode 100644 testcases/network/lib6/asapi_02.c
 delete mode 100644 testcases/network/lib6/asapi_03.c
 delete mode 100644 testcases/network/lib6/asapi_07.c
 delete mode 100644 testcases/network/lib6/runcc.c
 delete mode 100644 testcases/network/lib6/runcc.h

diff --git a/runtest/ipv6_lib b/runtest/ipv6_lib
index 75614fb..203e275 100644
--- a/runtest/ipv6_lib
+++ b/runtest/ipv6_lib
@@ -2,10 +2,6 @@
 in6_01 in6_01
 in6_02 in6_02
 getaddrinfo_01 getaddrinfo_01
-asapi_01 asapi_01
-asapi_02 asapi_02
-asapi_03 asapi_03
 asapi_04 asapi_04
 asapi_05 asapi_05
 asapi_06 asapi_06
-asapi_07 asapi_07
diff --git a/testcases/network/.gitignore b/testcases/network/.gitignore
index aa6d4da..18b0203 100644
--- a/testcases/network/.gitignore
+++ b/testcases/network/.gitignore
@@ -1,13 +1,9 @@
 /can/filter-tests/can_filter
 /can/filter-tests/can_rcv_own_msgs
 /datafiles/
-/lib6/asapi_01
-/lib6/asapi_02
-/lib6/asapi_03
 /lib6/asapi_04
 /lib6/asapi_05
 /lib6/asapi_06
-/lib6/asapi_07
 /lib6/getaddrinfo_01
 /lib6/in6_01
 /lib6/in6_02
diff --git a/testcases/network/lib6/Makefile b/testcases/network/lib6/Makefile
index e337938..e9fde3b 100644
--- a/testcases/network/lib6/Makefile
+++ b/testcases/network/lib6/Makefile
@@ -31,8 +31,4 @@ LDLIBS+= -lpthread
 
 CLEAN_TARGETS  += $(LIB)
 
-FILTER_OUT_MAKE_TARGETS:= runcc
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
-
-$(MAKE_TARGETS): %: %.o runcc.o
diff --git a/testcases/network/lib6/asapi_01.c 
b/testcases/network/lib6/asapi_01.c
deleted file mode 100644
index 5d8bdc7..000
--- a/testcases/network/lib6/asapi_01.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- *
- *   Copyright (c) International Business Machines  Corp., 2001
- *   Author: David L Stevens
- *
- *   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
- */
-/*
- *   Description:
- * These tests are for the "Advanced Sockets API" (RFC 3542)
- * Verify that in6 and sockaddr fields are present.
- */
-
-#include 
-#include 
-#include 
-
-#include 
-
-#include 
-
-#include "test.h"
-#include "runcc.h"
-
-enum ttype { EXISTS, ALIAS, VALUE };
-
-static struct ftent {
-   char *ft_tname; /* test name */
-   int ft_type;/* test type */
-   char *ft_incl;  /* include file list */
-   char *ft_struct;/* structure name */
-   char *ft_field; /* field name */
-   char *ft_offset;/* field offset */
-   union {
-   char *fu_value; /* field size or value */
-   char *fu_dname; /* #define name */
-   } ftun;
-#define ft_value   ftun.fu_value
-#define ft_dname   ftun.fu_dname
-} ftab[] = {
-   /* section 2.1 structure & field definitions */
-   { "ip6_hdr un1_flow", EXISTS, IP6_H, "ip6_hdr",
-   "ip6_ctlun.ip6_un1.ip6_un1_flow", "0", {"4"} },
-   { "ip6_hdr ip6_flow", ALIAS, IP6_H, "ip6_hdr",
-   "ip6_ctlun.ip6_un1.ip6_un1_flow", NULL, {"ip6_flow"} },
-   { "ip6_hdr un1_plen", EXISTS, IP6_H, "ip6_hdr",
-   "ip6_ctlun.ip6_un1.ip6_un1_plen", "4", {"2"} },
-   { "ip6_hdr ip6_plen", ALIAS, IP6_H, "ip6_hdr",
-   "ip6_ctlun.ip6_un1.ip6_un1_plen", "4", {"ip6_plen"} },
-   { "ip6_hdr un1_nxt", EXISTS, IP6_H, "ip6_hdr",
-   "ip6_ctlun.ip6_un1.ip6_un1_nxt", "6", {"1"} },
-   { "ip6_hdr ip6_nxt", ALIAS, IP6_H, "ip6_hdr",
-   

[LTP] [PATCH v6 5/7] lib6/asapi_06.c: Cleanup

2015-08-31 Thread Zeng Linggang
* Add 'static' before some functions and global variables.
* Use 'tst_tmpdir' and 'tst_rmdir'.
* Remove useless comments.
* Use SAFE_XXX().
* Remove unused variables.
* Modify the format of sotab[] and cmtab[].
* Modify the initialization of sotab[].
* Some cleanup.

Signed-off-by: Zeng Linggang 
Signed-off-by: Alexey Kodanev 
Signed-off-by: Cyril Hrubis 
---
 testcases/network/lib6/asapi_06.c | 317 +++---
 1 file changed, 120 insertions(+), 197 deletions(-)

diff --git a/testcases/network/lib6/asapi_06.c 
b/testcases/network/lib6/asapi_06.c
index 960ebb5..204bf23 100644
--- a/testcases/network/lib6/asapi_06.c
+++ b/testcases/network/lib6/asapi_06.c
@@ -1,37 +1,21 @@
 /*
+ * Copyright (c) 2015 Fujitsu Ltd.
+ * Copyright (c) International Business Machines  Corp., 2001
  *
- *   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 3 of the License, or
+ * (at your option) any later version.
  *
- *   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.
  *
- *   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
- */
-
-/*
- * Test Name: asapi_06
- *
- * Test Description:
- *  Tests for RFC 3542 section 4 socket options and ancillary data
- *
- * Usage:  
- *  asapi_06
- *
- * HISTORY
- * 05/2005 written by David L Stevens
- *
- * RESTRICTIONS:
- *  None.
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
  *
+ * Author: David L Stevens
  */
 
 #include "config.h"
@@ -57,25 +41,19 @@
 #include 
 
 #include "test.h"
+#include "safe_macros.h"
 
-char *TCID = "asapi_06";   /* Test program identifier.*/
+char *TCID = "asapi_06";
 
 int TST_TOTAL = 1;
 
-pid_t pid;
-
-struct {
-   char *prt_name;
-   int prt_value;
-} ptab[] = {
-};
-
-#define PTCOUNT(sizeof(ptab)/sizeof(ptab[0]))
+static pid_t pid;
 
 #define READ_TIMEOUT   5   /* secs */
 
-void do_tests(void);
-void setup(void), cleanup(void);
+static void do_tests(void);
+static void setup(void);
+static void cleanup(void);
 
 int main(int argc, char *argv[])
 {
@@ -97,40 +75,40 @@ int main(int argc, char *argv[])
 #define NH_TEST0x9f
 
 #ifndef IPV6_RECVPKTINFO
-#define IPV6_RECVPKTINFO   -1
+# define IPV6_RECVPKTINFO  -1
 #endif
 #ifndef IPV6_RECVHOPLIMIT
-#define IPV6_RECVHOPLIMIT  -1
+# define IPV6_RECVHOPLIMIT -1
 #endif
 #ifndef IPV6_RECVRTHDR
-#define IPV6_RECVRTHDR -1
+# define IPV6_RECVRTHDR-1
 #endif
 #ifndef IPV6_RECVHOPOPTS
-#define IPV6_RECVHOPOPTS   -1
+# define IPV6_RECVHOPOPTS  -1
 #endif
 #ifndef IPV6_RECVDSTOPTS
-#define IPV6_RECVDSTOPTS   -1
+# define IPV6_RECVDSTOPTS  -1
 #endif
 #ifndef IPV6_RECVTCLASS
-#define IPV6_RECVTCLASS-1
+# define IPV6_RECVTCLASS   -1
 #endif
 #ifndef IPV6_TCLASS
-#define IPV6_TCLASS-1
+# define IPV6_TCLASS   -1
 #endif
 #ifndef IPV6_2292PKTINFO
-#defineIPV6_2292PKTINFO-1
+# define   IPV6_2292PKTINFO-1
 #endif
 #ifndef IPV6_2292HOPLIMIT
-#defineIPV6_2292HOPLIMIT   -1
+# define   IPV6_2292HOPLIMIT   -1
 #endif
 #ifndef IPV6_2292RTHDR
-#defineIPV6_2292RTHDR  -1
+# define   IPV6_2292RTHDR  -1
 #endif
 #ifndef IPV6_2292HOPOPTS
-#defineIPV6_2292HOPOPTS-1
+# define   IPV6_2292HOPOPTS-1
 #endif
 #ifndef IPV6_2292DSTOPTS
-#defineIPV6_2292DSTOPTS-1
+# define   IPV6_2292DSTOPTS-1
 #endif
 
 union soval {
@@ -150,7 +128,7 @@ union soval {
 #define IN6_ANY{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
}
 
 /* so_clrval and so_setval members are initilized in the body */
-struct soent {
+static struct soent {
char *so_tname;
int so_opt;
int so_dorecv;   

[LTP] [PATCH v6 2/7] SAFE_MACROS: Add socket(), bind(), listen(), connect() and getsockname()

2015-08-31 Thread Zeng Linggang
Signed-off-by: Zeng Linggang 
Signed-off-by: Alexey Kodanev 
Signed-off-by: Cyril Hrubis 
---
 include/safe_macros.h |   1 +
 include/safe_net.h|  59 +
 lib/safe_net.c| 117 ++
 3 files changed, 177 insertions(+)
 create mode 100644 include/safe_net.h
 create mode 100644 lib/safe_net.c

diff --git a/include/safe_macros.h b/include/safe_macros.h
index cd86931..e938f17 100644
--- a/include/safe_macros.h
+++ b/include/safe_macros.h
@@ -28,6 +28,7 @@
 #include 
 
 #include "safe_stdio.h"
+#include "safe_net.h"
 
 char*  safe_basename(const char *file, const int lineno,
void (*cleanup_fn)(void), char *path);
diff --git a/include/safe_net.h b/include/safe_net.h
new file mode 100644
index 000..f9ce040
--- /dev/null
+++ b/include/safe_net.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015 Fujitsu Ltd.
+ *
+ * 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 3 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, see .
+ *
+ */
+
+#ifndef __SAFE_NET_H__
+#define __SAFE_NET_H__
+
+#include 
+#include 
+#include 
+#include 
+
+#defineGET_ADDR(sock_addr) \
+   (inet_ntoa(((struct sockaddr_in *)sock_addr)->sin_addr))
+
+int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void),
+   int domain, int type, int protocol);
+#define SAFE_SOCKET(cleanup_fn, domain, type, protocol) \
+   safe_socket(__FILE__, __LINE__, (cleanup_fn), domain, type, protocol)
+
+int safe_bind(const char *file, const int lineno, void (cleanup_fn)(void),
+ int socket, const struct sockaddr *address,
+ socklen_t address_len);
+#define SAFE_BIND(cleanup_fn, socket, address, address_len) \
+   safe_bind(__FILE__, __LINE__, (cleanup_fn), socket, address, \
+ address_len)
+
+int safe_listen(const char *file, const int lineno, void (cleanup_fn)(void),
+   int socket, int backlog);
+#define SAFE_LISTEN(cleanup_fn, socket, backlog) \
+   safe_listen(__FILE__, __LINE__, (cleanup_fn), socket, backlog)
+
+int safe_connect(const char *file, const int lineno, void (cleanup_fn)(void),
+int sockfd, const struct sockaddr *addr, socklen_t addrlen);
+#define SAFE_CONNECT(cleanup_fn, sockfd, addr, addrlen) \
+   safe_connect(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, addrlen)
+
+int safe_getsockname(const char *file, const int lineno,
+void (cleanup_fn)(void), int sockfd, struct sockaddr *addr,
+socklen_t *addrlen);
+#define SAFE_GETSOCKNAME(cleanup_fn, sockfd, addr, addrlen) \
+   safe_getsockname(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, \
+addrlen)
+
+#endif /* __SAFE_NET_H__ */
diff --git a/lib/safe_net.c b/lib/safe_net.c
new file mode 100644
index 000..5130fac
--- /dev/null
+++ b/lib/safe_net.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2015 Fujitsu Ltd.
+ *
+ * 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 3 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, see .
+ *
+ */
+
+#include 
+#include "test.h"
+#include "safe_net.h"
+
+int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void),
+   int domain, int type, int protocol)
+{
+   int rval;
+
+   rval = socket(domain, type, protocol);
+
+   if (rval < 0) {
+   tst_brkm(TBROK | TERRNO, cleanup_fn,
+"%s:%d: socket(%d, %d, %d) failed", file, lineno,
+domain, type, protocol);
+   }
+
+   return rval;
+}
+
+int safe_bind(const char *file, const int lineno, void (cleanup_fn)(void),
+ int socket, const struct sockaddr *address,
+ socklen_t address_len)
+{
+   int i;
+
+   for (i = 0; i < 120; i++) {
+   if (!bind(socket, address, 

[LTP] [PATCH v6 3/7] lib6/asapi_04.c: Cleanup

2015-08-31 Thread Zeng Linggang
* Add 'static' before some functions and global variables.
* Remove useless comments.
* Use SAFE_XXX().
* Modify the format of ptab[] and cstab[].
* Rewrite 'csum_test()' and 'isocketpair()'.
* Use 'tst_tmpdir' and 'tst_rmdir'.
* Some cleanup.

Signed-off-by: Zeng Linggang 
Signed-off-by: Alexey Kodanev 
Signed-off-by: Cyril Hrubis 
---
 testcases/network/lib6/asapi_04.c | 287 --
 1 file changed, 122 insertions(+), 165 deletions(-)

diff --git a/testcases/network/lib6/asapi_04.c 
b/testcases/network/lib6/asapi_04.c
index 76de26b..76e8f8e 100644
--- a/testcases/network/lib6/asapi_04.c
+++ b/testcases/network/lib6/asapi_04.c
@@ -1,38 +1,21 @@
 /*
+ * Copyright (c) 2015 Fujitsu Ltd.
+ * Copyright (c) International Business Machines  Corp., 2001
  *
- *   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 3 of the License, or
+ * (at your option) any later version.
  *
- *   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.
  *
- *   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
- */
-
-/*
- * Test Name: asapi_04
- *
- * Test Description:
- *  Verify that in6 and sockaddr fields are present. Most of these are
- *  "PASS" if they just compile.
- *
- * Usage:  
- *  asapi_04
- *
- * HISTORY
- * 04/2005 written by David L Stevens
- *
- * RESTRICTIONS:
- *  None.
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
  *
+ * Author: David L Stevens
  */
 
 #include 
@@ -48,33 +31,35 @@
 #include 
 
 #include "test.h"
+#include "safe_macros.h"
 
-char *TCID = "asapi_04";   /* Test program identifier.*/
+char *TCID = "asapi_04";
 
-pid_t pid;
+static pid_t pid;
 
-struct {
+static struct {
char *prt_name;
int prt_value;
 } ptab[] = {
-   {
-   "hopopt", 0}, {
-   "ipv6", 41}, {
-   "ipv6-route", 43}, {
-   "ipv6-frag", 44}, {
-   "esp", 50}, {
-   "ah", 51}, {
-   "ipv6-icmp", 58}, {
-   "ipv6-nonxt", 59}, {
-"ipv6-opts", 60},};
-
-#define PTCOUNT(sizeof(ptab)/sizeof(ptab[0]))
+   {"hopopt", 0},
+   {"ipv6", 41},
+   {"ipv6-route", 43},
+   {"ipv6-frag", 44},
+   {"esp", 50},
+   {"ah", 51},
+   {"ipv6-icmp", 58},
+   {"ipv6-nonxt", 59},
+   {"ipv6-opts", 60},
+};
+
+#define PTCOUNTARRAY_SIZE(ptab)
 
 #define READ_TIMEOUT   5   /* secs */
 
-void do_tests(void);
-void setup(void), cleanup(void);
-int csum_test(char *rhost);
+static void do_tests(void);
+static void setup(void);
+static void cleanup(void);
+static int csum_test(void);
 
 int main(int argc, char *argv[])
 {
@@ -90,44 +75,41 @@ int main(int argc, char *argv[])
do_tests();
 
cleanup();
-
tst_exit();
 }
 
-void do_tests(void)
+static void do_tests(void)
 {
-   int i;
+   unsigned int i;
 
 /* RFC 3542, Section 2.3 */
 #ifndef IN6_ARE_ADDR_EQUAL
-   tst_resm(TBROK, "IN6_ARE_ADDR_EQUAL not present");
+   tst_resm(TCONF, "IN6_ARE_ADDR_EQUAL not present");
 #else /* IN6_ARE_ADDR_EQUAL */
/*
 * set each bit in an address and check for unequal; then set
 * in the second address and check for equal. Covers all bits, all
 * combinations.
 */
-   {
-   struct in6_addr a1, a2;
-   int word, bit;
-   int rv = 1;
+   struct in6_addr a1, a2;
+   int word, bit;
+   int rv = 1;
 
-   memset(, 0, sizeof(a1));
-   memset(, 0, sizeof(a2));
+   memset(, 0, sizeof(a1));
+   memset(, 0, sizeof(a2));
 
-   rv = IN6_ARE_ADDR_EQUAL(, );
+   rv = IN6_ARE_ADDR_EQUAL(, );
 
-   for (word = 0; word < 4; ++word)
-   for (bit = 0; bit < 32; ++bit) {
-   

[LTP] [PATCH v6 7/7] ipv6_lib: Add it into default

2015-08-31 Thread Zeng Linggang
Signed-off-by: Zeng Linggang 
Signed-off-by: Alexey Kodanev 
Signed-off-by: Cyril Hrubis 
---
 scenario_groups/default | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scenario_groups/default b/scenario_groups/default
index 3a55702..60b1b27 100644
--- a/scenario_groups/default
+++ b/scenario_groups/default
@@ -32,3 +32,4 @@ dma_thread_diotest
 cpuacct
 can
 cpuhotplug
+ipv6_lib
-- 
1.9.3


--
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


Re: [LTP] LTP release

2015-08-31 Thread Guangwen Feng


On 2015/08/31 19:23, Cyril Hrubis wrote:
> Hi!
> I've did my release testing and pushed a few fixes, mosty minor ones.
> 
> Now the only problem that that blocks the release on my side are
> failures of the newly rewritten netns testcases that were discussed
> last week.
> 

In RHEL5.11GA, ns_ifmove.c gives compilation error since 'IFLA_NET_NS_PID'
undeclared in the kernel.

> Jiri: What about changing the ns_exec to join only net namespace for
>   now and rewriting it after the release?
> 
> Everybody: If you have issues with the latest git please report them.
>And if you haven't tested it yet please do so ASAP.
> 

--
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


Re: [LTP] Linux 3.10

2015-08-31 Thread Cyril Hrubis
Hi!
> hello dear:
> Does ltp support Linux 3.10?

Yes.

> I want write a virtual usb device and I wan to reference the tusb
> module. But when I compile the module on ubuntu 12.04,I get many
> errors.

Looks like nobody has touched the test code for some quite time (there
was one minor change but apart from that nothing), it's not build by
default and basically abandoned.

The problem is that in-kernel API is not stable. So if the kernel part
of the test fails to compile you have to figure out what part of the API
has changed and fix the code accordingly. Patches for the testcases are
of course welcomed.

-- 
Cyril Hrubis
chru...@suse.cz

--
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[LTP] Test Anything Protocal output

2015-08-31 Thread dwalker
Hi,

I read your January 2015 article where someone asked if TAP test output would 
be supported. It sounded like
you were going to look into it. Did you make any progress?

The reason I asked if because I was wanting the same feature and I was going to 
review the LTP code to see
how hard it would be to add it, but I wouldn't want to start if someone else 
has already done it. I did
see anything in the git history tho.

Thanks for any information.

Daniel

--
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[LTP] Linux 3.10

2015-08-31 Thread 大漠之鹰
hello dear:
Does ltp support Linux 3.10? I want write a  virtual usb device and I wan 
to  reference the tusb module.But when I compile the  module on ubuntu 12.04,I 
get many errors.
Now I need your help.Please help me.
Thanks very very much.
--
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list