tests: Disable terminal echo for stdin control (-i)
This makes vm-run.sh output cleaner to parse for parallel-vm.py. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
2e0d48e5c8
commit
1942b68172
1 changed files with 16 additions and 0 deletions
|
@ -13,6 +13,7 @@ import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import termios
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
@ -27,6 +28,15 @@ from hostapd import HostapdGlobal
|
||||||
from check_kernel import check_kernel
|
from check_kernel import check_kernel
|
||||||
from wlantest import Wlantest
|
from wlantest import Wlantest
|
||||||
|
|
||||||
|
def set_term_echo(fd, enabled):
|
||||||
|
[iflag, oflag, cflag, lflag, ispeed, ospeed, cc] = termios.tcgetattr(fd)
|
||||||
|
if enabled:
|
||||||
|
lflag |= termios.ECHO
|
||||||
|
else:
|
||||||
|
lflag &= ~termios.ECHO
|
||||||
|
termios.tcsetattr(fd, termios.TCSANOW,
|
||||||
|
[iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
|
||||||
|
|
||||||
def reset_devs(dev, apdev):
|
def reset_devs(dev, apdev):
|
||||||
ok = True
|
ok = True
|
||||||
for d in dev:
|
for d in dev:
|
||||||
|
@ -353,6 +363,8 @@ def main():
|
||||||
num_tests = 0
|
num_tests = 0
|
||||||
else:
|
else:
|
||||||
num_tests = len(tests_to_run)
|
num_tests = len(tests_to_run)
|
||||||
|
if args.stdin_ctrl:
|
||||||
|
set_term_echo(sys.stdin.fileno(), False)
|
||||||
while True:
|
while True:
|
||||||
if args.stdin_ctrl:
|
if args.stdin_ctrl:
|
||||||
test = sys.stdin.readline()
|
test = sys.stdin.readline()
|
||||||
|
@ -412,6 +424,8 @@ def main():
|
||||||
if conn:
|
if conn:
|
||||||
conn.close()
|
conn.close()
|
||||||
conn = None
|
conn = None
|
||||||
|
if args.stdin_ctrl:
|
||||||
|
set_term_echo(sys.stdin.fileno(), True)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
try:
|
try:
|
||||||
if t.func_code.co_argcount > 2:
|
if t.func_code.co_argcount > 2:
|
||||||
|
@ -495,6 +509,8 @@ def main():
|
||||||
if not reset_ok:
|
if not reset_ok:
|
||||||
print "Terminating early due to device reset failure"
|
print "Terminating early due to device reset failure"
|
||||||
break
|
break
|
||||||
|
if args.stdin_ctrl:
|
||||||
|
set_term_echo(sys.stdin.fileno(), True)
|
||||||
|
|
||||||
if log_handler:
|
if log_handler:
|
||||||
log_handler.stream.close()
|
log_handler.stream.close()
|
||||||
|
|
Loading…
Reference in a new issue