tests: Split run-tests.py logger info into per test case files

The run-tests.py -l argument does not take an argument value anymore.
Instead, debug output is directed to a separate file <test>.log for each
test case.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-10-31 12:46:42 +02:00 committed by Jouni Malinen
parent e955226208
commit c9aa430896
24 changed files with 51 additions and 28 deletions

View file

@ -141,7 +141,7 @@ timestamp and a postfix to identify the specific log:
- hwsim0 = wlantest debug log
- hwsim0.pcapng = capture with all frames exchanged during the tests
- tcpdump = tcpdump output
- run = debug prints from the test scripts
- *.log = debug prints from the test scripts
- trace.dat = Linux tracing record (if enabled)
- hlr_auc_gw - hlr_auc_gw (EAP-SIM/AKA/AKA' authentication) log
- auth_serv - hostapd as RADIUS authentication server log

View file

@ -11,7 +11,7 @@ import time
import logging
import wpaspy
logger = logging.getLogger(__name__)
logger = logging.getLogger()
hapd_ctrl = '/var/run/hostapd'
hapd_global = '/var/run/hostapd-global'

View file

@ -9,7 +9,7 @@
import os
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
def test_connectivity(ifname1, ifname2):
if os.path.isfile("../../mac80211_hwsim/tools/hwsim_test"):

View file

@ -63,7 +63,7 @@ if ! ./start.sh $CONCURRENT $VALGRIND $TRACE; then
exit 1
fi
./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -l run $DB -e failed -r results.txt $CONCURRENT_TESTS $@ || errors=1
./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -l $DB -e failed -r results.txt $CONCURRENT_TESTS $@ || errors=1
./stop-wifi.sh

View file

@ -15,7 +15,7 @@ import argparse
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
sys.path.append('../../wpaspy')
@ -101,8 +101,8 @@ def main():
help="verbose debug output")
group.add_argument('-q', const=logging.WARNING, action='store_const',
dest='loglevel', help="be quiet")
group.add_argument('-l', metavar='<filename>', dest='logfile',
help='debug log filename (in log directory)')
group.add_argument('-l', action='store_true', dest='logfile',
help='store debug log to a file (in log directory)')
parser.add_argument('-e', metavar="<filename>", dest='errorfile',
nargs='?', const="failed",
@ -142,11 +142,17 @@ def main():
sys.exit(2)
if args.logfile:
logging.basicConfig(filename=os.path.join(args.logdir, args.logfile),
level=logging.DEBUG)
logger.setLevel(logging.DEBUG)
file_name = os.path.join(args.logdir, 'run-tests.log')
log_handler = logging.FileHandler(file_name)
fmt = "%(asctime)s %(levelname)s %(message)s"
log_formatter = logging.Formatter(fmt)
log_handler.setFormatter(log_formatter)
logger.addHandler(log_handler)
log_to_file = True
else:
logging.basicConfig(level=args.loglevel)
log_handler = None
log_to_file = False
if args.loglevel == logging.WARNING:
print_res = True
@ -216,6 +222,15 @@ def main():
if args.testmodules:
if not t.__module__.replace('test_', '', 1) in args.testmodules:
continue
if log_handler:
log_handler.stream.close()
logger.removeHandler(log_handler)
file_name = os.path.join(args.logdir, name + '.log')
log_handler = logging.FileHandler(file_name)
log_handler.setFormatter(log_formatter)
logger.addHandler(log_handler)
with DataCollector(args.logdir, name, args.tracing, args.dmesg):
logger.info("START " + name)
if log_to_file:
@ -282,6 +297,14 @@ def main():
logger.info(e)
reset_devs(dev, apdev)
if log_handler:
log_handler.stream.close()
logger.removeHandler(log_handler)
file_name = os.path.join(args.logdir, 'run-tests.log')
log_handler = logging.FileHandler(file_name)
log_handler.setFormatter(log_formatter)
logger.addHandler(log_handler)
if conn:
conn.close()

View file

@ -9,7 +9,7 @@
import time
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils
import hostapd

View file

@ -9,7 +9,7 @@
import time
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import os.path
import hwsim_utils

View file

@ -9,7 +9,7 @@
import time
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils
import hostapd

View file

@ -9,7 +9,7 @@
import time
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import os.path
import subprocess

View file

@ -9,7 +9,7 @@
import time
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils
import hostapd

View file

@ -9,7 +9,7 @@
import time
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils
import hostapd

View file

@ -8,7 +8,7 @@
import time
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils
from hostapd import HostapdGlobal

View file

@ -9,7 +9,7 @@
import time
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils
import hostapd

View file

@ -8,7 +8,7 @@
import time
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import re
import hostapd

View file

@ -7,7 +7,7 @@
# See README for more details.
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import time
import re

View file

@ -9,7 +9,7 @@
import time
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils
import hostapd

View file

@ -9,7 +9,7 @@
import time
import subprocess
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils
from wlantest import Wlantest

View file

@ -7,7 +7,7 @@
# See README for more details.
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils

View file

@ -7,7 +7,7 @@
# See README for more details.
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import time
import threading
import Queue

View file

@ -7,7 +7,7 @@
# See README for more details.
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils

View file

@ -7,7 +7,7 @@
# See README for more details.
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils

View file

@ -7,7 +7,7 @@
# See README for more details.
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger()
import hwsim_utils

View file

@ -12,7 +12,7 @@ import subprocess
import logging
import wpaspy
logger = logging.getLogger(__name__)
logger = logging.getLogger()
class Wlantest:
def __init__(self):

View file

@ -13,7 +13,7 @@ import re
import subprocess
import wpaspy
logger = logging.getLogger(__name__)
logger = logging.getLogger()
wpas_ctrl = '/var/run/wpa_supplicant'
class WpaSupplicant: