crashpad/build/run_tests.py
Mark Mentovai 32a9d410ca Locate test data more robustly.
Test code that requires test data should call Paths::TestDataRoot() to
obtain the test data root. This will use the CRASHPAD_TEST_DATA_ROOT
environment variable if set. Otherwise, it will look for test data at
known locations relative to the executable path. If the test data is not
found in any of these locations, it falls back to using the working
directory, the same as the current behavior.

BUG=crashpad:4
TEST=crashpad_util_test Paths.TestDataRoot and others
R=rsesek@chromium.org, scottmg@chromium.org

Review URL: https://codereview.chromium.org/992503002
2015-03-09 15:13:13 -04:00

50 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python
# Copyright 2014 The Crashpad Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import subprocess
import sys
# This script is primarily used from the waterfall so that the list of tests
# that are run is maintained in-tree, rather than in a separate infrastructure
# location in the recipe.
def main(args):
if len(args) != 1:
print >>sys.stderr, 'usage: run_tests.py {Debug|Release}'
return 1;
crashpad_dir = \
os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir)
binary_dir = os.path.join(crashpad_dir, 'out', args[0])
tests = [
'crashpad_client_test',
'crashpad_minidump_test',
'crashpad_snapshot_test',
'crashpad_util_test',
]
for test in tests:
print '-' * 80
print test
print '-' * 80
subprocess.check_call(os.path.join(binary_dir, test))
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))