TC: Expand tc for termios API's
authorLokesh B V <lokesh.bv@partner.samsung.com>
Tue, 18 Jul 2017 14:46:07 +0000 (20:16 +0530)
committerLokesh B V <lokesh.bv@partner.samsung.com>
Tue, 1 Aug 2017 09:52:35 +0000 (15:22 +0530)
1) Adds missing test cases for isatty() and cfgetspeed() API's.
2) Adds failure test case: invlaid 'option' input to tcsetattr() API.

Signed-off-by: Lokesh B V <lokesh.bv@partner.samsung.com>
apps/examples/testcase/le_tc/kernel/tc_termios.c

index 45b0d08..a3b01f1 100644 (file)
@@ -45,6 +45,19 @@ static void tc_termios_tcsetattr_tcgetattr(void)
        }
 
        sleep(1);
+       /* isatty() returns 1 if fd is an open file descriptor referring to a terminal */
+       ret_chk = isatty(fileno(stdin));
+       TC_ASSERT_EQ("isatty", ret_chk, 1);
+
+       ret_chk = cfgetspeed(&prev_tio);
+       TC_ASSERT_GEQ("cfgetspeed", ret_chk, 0);
+
+       /* Failure case: invalid option */
+       sleep(1);
+       ret_chk = tcsetattr(fileno(stdin), 33, &prev_tio);
+       TC_ASSERT_LT("tcsetattr", ret_chk, 0);
+
+       sleep(1);
        prev_tio.c_oflag &= ~ONLCR;
        ret_chk = tcsetattr(fileno(stdin), TCSANOW, &prev_tio);
        TC_ASSERT_EQ("tcsetattr", ret_chk, 0);