michael@0: # Copyright (c) 2012 The Chromium Authors. All rights reserved. michael@0: # Use of this source code is governed by a BSD-style license that can be michael@0: # found in the LICENSE file. michael@0: michael@0: """Helper functions common to native, java and python test runners.""" michael@0: michael@0: import logging michael@0: import os michael@0: michael@0: michael@0: def GetExpectations(file_name): michael@0: """Returns a list of test names in the |file_name| test expectations file.""" michael@0: if not file_name or not os.path.exists(file_name): michael@0: return [] michael@0: return [x for x in [x.strip() for x in file(file_name).readlines()] michael@0: if x and x[0] != '#'] michael@0: michael@0: michael@0: def SetLogLevel(verbose_count): michael@0: """Sets log level as |verbose_count|.""" michael@0: log_level = logging.WARNING # Default. michael@0: if verbose_count == 1: michael@0: log_level = logging.INFO michael@0: elif verbose_count >= 2: michael@0: log_level = logging.DEBUG michael@0: logging.getLogger().setLevel(log_level)