Crashpad
|
Functions to obtain paths from within tests. More...
#include "test/test_paths.h"
Public Types | |
enum | FileType |
The type of file requested of BuildArtifact(). More... | |
enum | Architecture |
The architecture of the file requested of BuildArtifact(). More... | |
Public Member Functions | |
DISALLOW_IMPLICIT_CONSTRUCTORS (TestPaths) | |
Static Public Member Functions | |
static base::FilePath | Executable () |
Returns the pathname of the currently-running test executable. More... | |
static base::FilePath | ExpectedExecutableBasename (const base::FilePath::StringType &name) |
Returns the expected basename of the currently-running test executable. More... | |
static base::FilePath | TestDataRoot () |
Returns the pathname of the test data root. More... | |
static base::FilePath | BuildArtifact (const base::FilePath::StringType &module, const base::FilePath::StringType &artifact, FileType file_type, Architecture architecture=Architecture::kDefault) |
Returns the pathname of a build artifact. More... | |
static bool | Has32BitBuildArtifacts () |
Functions to obtain paths from within tests.
|
strong |
The architecture of the file requested of BuildArtifact().
|
strong |
The type of file requested of BuildArtifact().
This is used to establish the file extension used by the returned path.
|
static |
Returns the pathname of a build artifact.
[in] | module | The name of the Crashpad module associated with the artifact, such as "util" or "snapshot" . module must correspond to the module of the calling code, or execution will be aborted. |
[in] | artifact | The name of the specific artifact. |
[in] | file_type | The artifact’s type, used to establish the returned path’s extension. |
[in] | architecture | The artifact’s architecture. |
For example, the following snippet will return a path to crashpad_snapshot_test_module.so
or crashpad_snapshot_test_module.dll
(depending on platform) in the same directory as the currently running executable:
|
static |
Returns the pathname of the currently-running test executable.
On failure, aborts execution.
|
static |
Returns the expected basename of the currently-running test executable.
In Crashpad’s standalone build, this returns name, with the system’s extension for executables (.exe
) appended if appropriate.
When building in Chromium, name is ignored, and the name of the monolithic test executable (crashpad_tests
) is returned, with the system’s extension for executables appended if appropriate.
Only use this function to determine test expectations.
Do not use this function to obtain the name of the currently running test executable, use Executable() instead. Do not use this function to locate other build artifacts, use BuildArtifact() instead.
|
static |
true
if 32-bit build artifacts are available.Tests that require the use of 32-bit build output should call this function to determine whether that output is available. This function is only provided to aid 64-bit test code in locating 32-bit output. Only if this function indicates that 32-bit output is available, 64-bit test code may call BuildArtifact() with Architecture::k32Bit to obtain a path to the 32-bit output.
32-bit test code may assume the existence of 32-bit build output, which can be found its own directory, and located by calling BuildArtifact() with Architecture::kDefault.
|
static |
Returns the pathname of the test data root.
If the CRASHPAD_TEST_DATA_ROOT
environment variable is set, its value will be returned. Otherwise, this function will attempt to locate the test data root relative to the executable path. If this fails, it will fall back to returning the current working directory.
At present, the test data root is normally the root of the Crashpad source tree, although this may not be the case indefinitely. This function may only be used to locate test data, not for arbitrary access to source files.