56void test_ok (
int success,
const char *file,
unsigned int line,
68 printf (
"FAILURE: \"%s\" test failed at %s line %d: ( %s )\n",
98 printf (
"FAILURE: \"%s\" %d of %d tests failed",
101 printf (
" with %d assertion failures",
106 printf (
"OK: \"%s\" %d tests passed\n",
119 unsigned int assertions = 0;
120 unsigned int total = 0;
123 printf (
"Starting %s self-tests\n",
_S2 ( ARCH ) );
134 printf (
"FAILURE: %d of %d tests failed",
137 printf (
" with %d assertion failures", assertions );
157 .name =
"self-tests",
174 DBG (
"Could not register self-test image: %s\n",
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
unsigned int assertion_failures
Number of assertion failures triggered.
#define assert(condition)
Assert a condition at run-time.
uint32_t type
Operating system type.
#define __unused
Declare a variable or data structure as unused.
#define DBG(...)
Print a debugging message.
#define INIT_EARLY
Early initialisation.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EINPROGRESS
Operation in progress.
#define ENOTTY
Inappropriate I/O control operation.
int register_image(struct image *image)
Register executable image.
#define IMAGE_STATIC_NAME
Image name is statically allocated.
#define IMAGE_STATIC
Image is statically allocated.
#define _S2(x)
Stringify expanded argument.
#define __init_fn(init_order)
Declare an initialisation functon.
void profstat(void)
Print profiling statistics.
void ref_no_free(struct refcnt *refcnt __unused)
Do not free reference-counted object.
#define REF_INIT(free_fn)
Initialise a static reference counter.
char * strerror(int errno)
Retrieve string representation of error number.
An executable image type.
An initialisation function.
unsigned int failures
Number of test failures.
unsigned int total
Number of tests run.
const char * name
Test set name.
unsigned int assertion_failures
Number of assertion failures.
void(* exec)(void)
Run self-tests.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
static struct image_type test_image_type
static void run_tests(struct self_test *tests)
Run self-test set.
static struct image test_image
static int test_image_exec(struct image *image __unused)
static int test_image_probe(struct image *image __unused)
static struct self_test * current_tests
Current self-test set.
static void test_init(void)
void test_ok(int success, const char *file, unsigned int line, const char *test)
Report test result.
static int run_all_tests(void)
Run all self-tests.
Self-test infrastructure.
#define SELF_TESTS
Self-test table.
int printf(const char *fmt,...)
Write a formatted string to the console.