UEFIStarter
a simple UEFI framework
|
This is the basis for all test suites. More...
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <UEFIStarter/core/memory.h>
#include <UEFIStarter/core/logger.h>
#include <UEFIStarter/core/cmdline.h>
#include <UEFIStarter/core/string.h>
#include <UEFIStarter/tests/tests.h>
#include <UEFIStarter/tests/output.h>
Macros | |
#define | ARG_SKIP_TESTS tests_args[0].value.wcstr |
helper macro to access the -skip argument's values | |
#define | ARG_VERBOSITY tests_args[1].value.uint64 |
helper macro to access the -verbosity argument's value | |
#define | ARG_MULTILINE tests_args[2].value.uint64 |
helper macro to access the -multiline argument's value | |
#define | ARG_NO_COUNTS tests_args[3].value.uint64 |
helper macro to access the -no-counts argument's value | |
#define | ARG_ASSERTIONS tests_args[4].value.uint64 |
helper macro to access the -assertions argument's value | |
#define | ARG_NO_STATISTICS tests_args[5].value.uint64 |
helper macro to access the -no-statistics argument's value | |
Functions | |
static BOOLEAN | validate_verbosity (cmdline_value_t v) |
Validator for the -verbosity <level> argument. More... | |
void | log_errorprint (LOGLEVEL level, CHAR16 *msg) |
Log printer function writing to STDERR. More... | |
void | reset_test_results (test_results_t *results) |
Initializes a test_results_t structure. More... | |
static test_outcome | _combine_outcomes (test_outcome v1, test_outcome v2) |
Internal: combines two test outcomes. More... | |
void | add_test_results (test_results_t *target, test_results_t *source) |
Adds test result data to a larger collection of results. More... | |
void | handle_result (test_results_t *result) |
Updates internal test_results_t data after a test. More... | |
void | handle_individual_result () |
Processes an individual test's results. | |
void | handle_group_result () |
Processes a test group's results. | |
void | run_test (void(*func)(), CHAR16 *description) |
Runs an individual test. More... | |
void | run_group (BOOLEAN(*func)()) |
Runs a test group. More... | |
static void | _parse_skipped_tests (CHAR16 *str) |
Internal: parses a list of skipped tests into internal storage. More... | |
BOOLEAN | is_skipped_test (CHAR16 *name) |
Tests whether a given test should be skipped. More... | |
void | assemble_and_set_verbosity () |
Transforms the -verbosity command-line argument into its internal representation. | |
int | main (int argc, char **argv_ascii) |
Main function for test suite, gets invoked by UEFI shell. More... | |
Variables | |
static LOGLEVEL | _initial_log_level |
internal storage for the initial log level to set before each test | |
static CHAR16 ** | _skipped_tests_list |
internal storage for the list of skipped tests | |
static UINTN | _skipped_tests_count |
internal storage for the number of skipped tests | |
test_verbosity_t | test_verbosity |
the current test verbosity | |
test_results_t | individual_test_results |
results for the current test | |
test_results_t | group_test_results |
results for the current test group | |
test_results_t | global_test_results |
results for all tests in this suite | |
cmdline_argument_t | tests_args [] |
list of command-line arguments More... | |
cmdline_argument_group_t | tests_arggroup ={ L"Test options" ,sizeof( tests_args )/sizeof(cmdline_argument_t), tests_args } |
command-line argument group | |
This is the basis for all test suites.
This handles the test execution, the test suite is just responsible for producing results.
add pause-on-error/incomplete feature
could add a way to capture error messages and output them later
|
static |
Validator for the -verbosity <level>
argument.
v | the input to validate |
void log_errorprint | ( | LOGLEVEL | level, |
CHAR16 * | msg | ||
) |
Log printer function writing to STDERR.
level | the log entry's log level |
msg | the log entry's message |
void reset_test_results | ( | test_results_t * | results | ) |
Initializes a test_results_t structure.
results | the structure to reset |
|
static |
Internal: combines two test outcomes.
v1 | the first value to compare |
v2 | the second value to compare |
void add_test_results | ( | test_results_t * | target, |
test_results_t * | source | ||
) |
Adds test result data to a larger collection of results.
This is e.g. used to sum up individual test results into test group results.
target | the larger collection of results to add to |
source | the new data to add |
void handle_result | ( | test_results_t * | result | ) |
Updates internal test_results_t data after a test.
result | the data to update |
void run_test | ( | void(*)() | func, |
CHAR16 * | description | ||
) |
Runs an individual test.
This function takes care of required setup/teardown around tests.
func | the test function to execute |
description | the test's description |
void run_group | ( | BOOLEAN(*)() | func | ) |
Runs a test group.
func | the test group to run |
|
static |
Internal: parses a list of skipped tests into internal storage.
str | the list of tests to skip |
BOOLEAN is_skipped_test | ( | CHAR16 * | name | ) |
Tests whether a given test should be skipped.
name | the test's name |
int main | ( | int | argc, |
char ** | argv_ascii | ||
) |
Main function for test suite, gets invoked by UEFI shell.
argc | the number of command-line arguments passed |
argv_ascii | the command-line arguments passed, as ASCII |
cmdline_argument_t tests_args[] |
list of command-line arguments