pty/pty02.c: Fix compiler error

Message ID 1527734724-348-1-git-send-email-huangjh.jy@cn.fujitsu.com
State Changes Requested
Headers show
Series
  • pty/pty02.c: Fix compiler error
Related show

Commit Message

Jinhui huang May 31, 2018, 2:45 a.m.
Compilation failed because of undefined EXTPROC on old distros(e.g. RHEL5/6).

Based on the fix patch[1] and added EXTPROC, tcgetattr() still could not detect
invalid EXTPROC on old distros.  So we wanted to skip the case if EXTPROC was not
defined on current distros.

[1] http://lists.linux.it/pipermail/ltp/2018-May/008253.html

Signed-off-by: Jinhui huang <huangjh.jy@cn.fujitsu.com>
---
 testcases/kernel/pty/pty02.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Li Wang June 5, 2018, 3:36 a.m. | #1
On Thu, May 31, 2018 at 10:45 AM, Jinhui huang <huangjh.jy@cn.fujitsu.com>
wrote:

> Compilation failed because of undefined EXTPROC on old distros(e.g.
> RHEL5/6).
>
> Based on the fix patch[1] and added EXTPROC, tcgetattr() still could not
> detect
> invalid EXTPROC on old distros.  So we wanted to skip the case if EXTPROC
> was not
> defined on current distros.
>
> [1] http://lists.linux.it/pipermail/ltp/2018-May/008253.html
>
> Signed-off-by: Jinhui huang <huangjh.jy@cn.fujitsu.com>
> ---
>  testcases/kernel/pty/pty02.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/testcases/kernel/pty/pty02.c b/testcases/kernel/pty/pty02.c
> index fd3d26b..548f8d1 100644
> --- a/testcases/kernel/pty/pty02.c
> +++ b/testcases/kernel/pty/pty02.c
> @@ -29,6 +29,8 @@
>
>  #include "tst_test.h"
>
> +#ifdef EXTPROC
>

​This fix is fine. But image that a distribution defined both EXTPROC and
ICANON, if the ICANON(enables canonical input processing, also called line
mode) ​needs newline('\n') to ptmx there, this test will hung there forever.



> +
>  static void do_test(void)
>  {
>         struct termios io = { .c_lflag = EXTPROC | ICANON };
> @@ -60,3 +62,7 @@ static void do_test(void)
>  static struct tst_test test = {
>         .test_all = do_test,
>  };
> +
> +#else
> +       TST_TEST_TCONF("EXTPROC is not defined");
> +#endif
> --
> 1.8.3.1
>
>
>
>

Patch

diff --git a/testcases/kernel/pty/pty02.c b/testcases/kernel/pty/pty02.c
index fd3d26b..548f8d1 100644
--- a/testcases/kernel/pty/pty02.c
+++ b/testcases/kernel/pty/pty02.c
@@ -29,6 +29,8 @@ 
 
 #include "tst_test.h"
 
+#ifdef EXTPROC
+
 static void do_test(void)
 {
 	struct termios io = { .c_lflag = EXTPROC | ICANON };
@@ -60,3 +62,7 @@  static void do_test(void)
 static struct tst_test test = {
 	.test_all = do_test,
 };
+
+#else
+	TST_TEST_TCONF("EXTPROC is not defined");
+#endif