Make run_tests.py work with paths instead of configuration names

This is co-dependent with
https://chromium-review.googlesource.com/457736.

I’ve been trying to share a source tree between different platforms,
using gyp_crashpad.py --generator-output to put the build output in the
right place. On Windows, it winds up in
out\win\out\{Debug,Release}{,_x64}. This makes it tricky to use
run_tests.py, which expects to find build output right in the “out”
directory. It’s not impossible to use, because you can tell it
“win\out\Debug_x64”, but it’s really awkward to use that path when we
all know that it’s not relative to anything that makes sense, like the
current directory.

This simplifies run_tests.py to work directly with the
configuration-specific output directory. For most users, this means
including “out/” or “out\” when running the script.

Bug: chromium:703890
Change-Id: Ic7de82fabd2adda7ae00558844cb3ce91aa4a5ed
Reviewed-on: https://chromium-review.googlesource.com/457716
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
Mark Mentovai 2017-03-21 20:52:50 -04:00 committed by Commit Bot
parent 542306626d
commit 39f13a77a4
2 changed files with 10 additions and 22 deletions

View File

@ -15,7 +15,6 @@
# limitations under the License.
import os
import platform
import subprocess
import sys
@ -25,25 +24,12 @@ import sys
# location in the recipe.
def main(args):
if len(args) != 1:
print >> sys.stderr, \
'usage: run_tests.py {Debug|Release|Debug_x64|Release_x64}'
print >> sys.stderr, 'usage: run_tests.py <binary_dir>'
return 1
crashpad_dir = \
os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir)
# In a standalone Crashpad build, the out directory is in the Crashpad root.
out_dir = os.path.join(crashpad_dir, 'out')
if not os.path.exists(out_dir):
# In an in-Chromium build, the out directory is in the Chromium root, and
# the Crashpad root is in third_party/crashpad/crashpad relative to the
# Chromium root.
chromium_dir = os.path.join(crashpad_dir, os.pardir, os.pardir, os.pardir)
out_dir = os.path.join(chromium_dir, 'out')
if not os.path.exists(out_dir):
raise Exception('could not determine out_dir', crashpad_dir)
binary_dir = os.path.join(out_dir, args[0])
binary_dir = args[0]
tests = [
'crashpad_client_test',
@ -59,12 +45,12 @@ def main(args):
subprocess.check_call(os.path.join(binary_dir, test))
if sys.platform == 'win32':
name = 'snapshot/win/end_to_end_test.py'
script = 'snapshot/win/end_to_end_test.py'
print '-' * 80
print name
print script
print '-' * 80
subprocess.check_call(
[sys.executable, os.path.join(crashpad_dir, name), binary_dir])
[sys.executable, os.path.join(crashpad_dir, script), binary_dir])
return 0

View File

@ -91,7 +91,9 @@ crashpad`, `gclient sync`, or `gclient runhooks`.
The Ninja build files and build output are in the `out` directory. Both debug-
and release-mode configurations are available. The examples below show the debug
configuration. To build and test the release configuration, substitute `Release`
for `Debug`.
for `Debug`. On Windows, four configurations are available: `Debug` and
`Release` produce 32-bit x86 executables, and `Debug_x64` and `Release_x64`
produce x86_64 executables.
```
$ cd ~/crashpad/crashpad
@ -193,11 +195,11 @@ $ out/Debug/crashpad_util_test
```
A script is provided to run all of Crashpads tests. It accepts a single
argument that tells it which configuration to test.
argument, a path to the directory containing the test executables.
```
$ cd ~/crashpad/crashpad
$ python build/run_tests.py Debug
$ python build/run_tests.py out/Debug
```
### Android