1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/build/android/pylib/run_tests_helper.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +# Copyright (c) 2012 The Chromium Authors. All rights reserved. 1.5 +# Use of this source code is governed by a BSD-style license that can be 1.6 +# found in the LICENSE file. 1.7 + 1.8 +"""Helper functions common to native, java and python test runners.""" 1.9 + 1.10 +import logging 1.11 +import os 1.12 + 1.13 + 1.14 +def GetExpectations(file_name): 1.15 + """Returns a list of test names in the |file_name| test expectations file.""" 1.16 + if not file_name or not os.path.exists(file_name): 1.17 + return [] 1.18 + return [x for x in [x.strip() for x in file(file_name).readlines()] 1.19 + if x and x[0] != '#'] 1.20 + 1.21 + 1.22 +def SetLogLevel(verbose_count): 1.23 + """Sets log level as |verbose_count|.""" 1.24 + log_level = logging.WARNING # Default. 1.25 + if verbose_count == 1: 1.26 + log_level = logging.INFO 1.27 + elif verbose_count >= 2: 1.28 + log_level = logging.DEBUG 1.29 + logging.getLogger().setLevel(log_level)