Enumerations
enum ExporterLaunchError
| Name | Value |
|---|---|
| OPEN_FILE | 0 |
| CREATE_CHANNEL | 1 |
| FIDL_ERROR | 2 |
| CONNECT_TO_LOGGER_SERVICE | 3 |
| NO_ERROR | 4 |
Error while launching LogExporter.
Defined at line 28 of file ../../zircon/system/ulib/runtests-utils/include/runtests-utils/log-exporter.h
enum LaunchStatus
| Name | Value |
|---|---|
| SUCCESS | 0 |
| FAILED_TO_LAUNCH | 1 |
| FAILED_TO_WAIT | 2 |
| FAILED_DURING_IO | 3 |
| FAILED_TO_RETURN_CODE | 4 |
| FAILED_NONZERO_RETURN_CODE | 5 |
| FAILED_COLLECTING_SINK_DATA | 6 |
| FAILED_UNKNOWN | 7 |
| TIMED_OUT | 8 |
Status of launching a test subprocess.
Defined at line 28 of file ../../zircon/system/ulib/runtests-utils/include/runtests-utils/runtests-utils.h
Records
Functions
-
bool SetUpForTestComponent (const char * test_path, fbl::String * out_component_executor)If test is a component, this function will find the appropriate component executor and modify
launch arguments.
Returns:
|true|: if test is not a component, or if test is a component and it can find the correct
component executor.
|false|: if setup fails.
Defined at line 65 of file ../../zircon/system/ulib/runtests-utils/fuchsia-run-test.cc
-
std::unique_ptr<Result> FuchsiaRunTest (const char *[] argv, const char * output_dir, const char * output_filename, const char * test_name, uint64_t timeout_millis)Invokes a Fuchsia test binary and writes its output to a file.
|argv| is a null-terminated array of argument strings passed to the test
program.
|output_dir| is the name of a directory where debug data
will be written. If nullptr, no debug data will be collected.
|output_filename| is the name of the file to which the test binary's output
will be written. May be nullptr, in which case the output will not be
redirected.
|test_name| is used to populate Result properly and in log messages.
|timeout_millis| is a number of milliseconds to wait for the test. If 0,
will wait indefinitely.
-
std::unique_ptr<Result> RunTest (const char *[] argv, const char * output_dir, const char * test_name, int64_t timeout_msec)Invokes a test binary and writes its output to a file.
|argv| is a null-terminated array of argument strings passed to the test
program.
|output_dir| is the name of a directory where debug data
will be written. If nullptr, no debug data will be collected.
|test_name| is used to populate Result and in log messages.
|timeout_msec| is a number of milliseconds to wait for the test. If 0,
will wait indefinitely.
Defined at line 99 of file ../../zircon/system/ulib/runtests-utils/fuchsia-run-test.cc
-
void ParseTestNames (std::string_view input, fbl::Vector<fbl::String> * output)Splits |input| by ',' and appends the results onto |output|.
Empty strings are not put into output.
Defined at line 40 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc
-
uint64_t GetSeconds (zx::time_boot timestamp)Returns only seconds part
Defined at line 42 of file ../../zircon/system/ulib/runtests-utils/log-exporter.cc
-
uint64_t GetNanoSeconds (zx::time_boot timestamp)Returns only nano seconds part
Defined at line 45 of file ../../zircon/system/ulib/runtests-utils/log-exporter.cc
-
bool IsInWhitelist (std::string_view name, const fbl::Vector<fbl::String> & whitelist)Returns true iff |name| is equal to one of strings in |whitelist|.
Defined at line 55 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc
-
int MkDirAll (std::string_view dir_name)Ensures |dir_name| exists by creating it and its parents if it doesn't.
Returns 0 on success, else an error code compatible with errno.
Defined at line 64 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc
-
zx_status_t RunLoopUntilSignalOrDeadline (async::Loop & loop, zx::time deadline, zx_handle_t handle, zx_signals_t signal)Run the loop until |deadline|, or until the specified |signal| is asserted on the |handle|.
Defined at line 84 of file ../../zircon/system/ulib/runtests-utils/fuchsia-run-test.cc
-
std::unique_ptr<LogExporter> LaunchLogExporter (async_dispatcher_t * dispatcher, std::string_view syslog_path, ExporterLaunchError * error)Launches Log Exporter.
|dispatcher| the dispatcher on which to run the listener.
|syslog_path| file path where to write logs.
|error| error to set in case of failure.
Returns nullptr if it is not possible to launch Log Exporter.
Defined at line 153 of file ../../zircon/system/ulib/runtests-utils/log-exporter.cc
-
fbl::String JoinPath (std::string_view parent, std::string_view child)Returns "|parent|/|child|". Unless child is absolute, in which case it returns |child|.
|parent| is the parent path.
|child| is the child path.
Defined at line 94 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc
-
int WriteSummaryJSON (const fbl::Vector<std::unique_ptr<Result>> & results, std::string_view syslog_path, FILE * summary_json)Writes a JSON summary of test results given a sequence of results.
|results| are the run results to summarize.
|syslog_path| is the file path where syslogs are written.
|summary_json| is the file stream to write the JSON summary to.
Returns 0 on success, else an error code compatible with errno.
Defined at line 110 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc
-
int ResolveGlobs (const fbl::Vector<fbl::String> & globs, fbl::Vector<fbl::String> * resolved)Resolves a set of globs.
|globs| is an array of glob patterns.
|resolved| will hold the results of resolving |globs|.
Returns 0 on success, else an error code from glob.h.
Defined at line 178 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc
-
bool RunTests (const fbl::Vector<fbl::String> & test_paths, const fbl::Vector<fbl::String> & test_args, int repeat, int64_t timeout_msec, const char * output_dir, int * failed_count, fbl::Vector<std::unique_ptr<Result>> * results)Executes all specified binaries.
|test_paths| are the paths of the binaries to execute.
|test_args| are arguments passed into the binaries under test.
|repeat| runs the entire test suite this many times. The entire suite is repeated rather than
each test individually so that:
a) any flakes due to the sequencing of tests can be reproduced
b) we can get an idea of global flake rates without waiting for all runs to complete
|timeout_msec| is the number of milliseconds to wait for a test before considering it failed.
ignored if 0.
|output_dir| is the directory for all the tests' debug data sinks. May be nullptr, in
which case debug data will not be captured.
|failed_count| is an output parameter which will be set to the number of test
binaries that failed.
|results| is an output parameter to which run results will be appended.
Returns false if any test binary failed, true otherwise.
Defined at line 292 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc
-
int DiscoverTestsInDirGlobs (const fbl::Vector<fbl::String> & dir_globs, const char * ignore_dir_name, const fbl::Vector<fbl::String> & basename_whitelist, fbl::Vector<fbl::String> * test_paths)Expands |dir_globs| and searches those directories for files.
|dir_globs| are expanded as globs to directory names, and then those directories are searched.
|ignore_dir_name| iff not null, any directory with this basename will not be searched.
|basename_whitelist| iff not empty, only files that have a basename in this whitelist will be
returned.
|test_paths| is an output parameter to which absolute file paths will be appended.
Returns 0 on success, else an error code compatible with errno.
Defined at line 224 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc
-
int DiscoverAndRunTests (int argc, const char *const * argv, const fbl::Vector<fbl::String> & default_test_dirs, Stopwatch * stopwatch, std::string_view syslog_file_name)Discovers and runs tests based on command line arguments.
|argc|: length of |argv|.
|argv|: see //system/ulib/runtests-utils/discover-and-run-tests.cpp,
specifically the 'Usage()' function, for documentation.
|default_test_dirs|: directories in which to look for tests if no test
directory globs are specified.
|stopwatch|: for timing how long all tests took to run.
|syslog_file_name|: if an output directory is specified ("-o"), syslog ouput
will be written to a file under that directory and this name.
Returns EXIT_SUCCESS if all tests passed; else, returns EXIT_FAILURE.
Defined at line 87 of file ../../zircon/system/ulib/runtests-utils/discover-and-run-tests.cc
-
bool IsSharedLibraryName (std::string_view filename)Defined at line 198 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc
-
bool IsFuchsiaPkgURI (const char * s)Returns true iff |s| is a fuchsia-pkg URI.
Defined at line 358 of file ../../zircon/system/ulib/runtests-utils/runtests-utils.cc