55 void test_ok (
int success,
const char *file,
unsigned int line,
67 printf (
"FAILURE: \"%s\" test failed at %s line %d: ( %s )\n",
97 printf (
"FAILURE: \"%s\" %d of %d tests failed",
100 printf (
" with %d assertion failures",
105 printf (
"OK: \"%s\" %d tests passed\n",
118 unsigned int assertions = 0;
119 unsigned int total = 0;
122 printf (
"Starting %s self-tests\n",
_S2 ( ARCH ) );
133 printf (
"FAILURE: %d of %d tests failed",
136 printf (
" with %d assertion failures", assertions );
156 .
name =
"self-tests",
172 DBG (
"Could not register self-test image: %s\n",
struct arbelprm_rc_send_wqe rc
int printf(const char *fmt,...)
Write a formatted string to the console.
unsigned int failures
Number of test failures.
unsigned int total
Number of tests run.
#define _S2(x)
Stringify expanded argument.
static int run_all_tests(void)
Run all self-tests.
#define INIT_EARLY
Early initialisation.
An executable image type.
void(* exec)(void)
Run self-tests.
Self-test infrastructure.
const char * name
Test set name.
unsigned int assertion_failures
Number of assertion failures triggered.
char * name
Name of this image type.
struct init_fn test_init_fn __init_fn(INIT_EARLY)
Self-test initialisation function.
void profstat(void)
Print profiling statistics.
An initialisation function.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define __unused
Declare a variable or data structure as unused.
static void test_init(void)
static struct image_type test_image_type
#define EINPROGRESS
Operation in progress.
int register_image(struct image *image)
Register executable image.
char * strerror(int errno)
Retrieve string representation of error number.
#define SELF_TESTS
Self-test table.
static int test_image_exec(struct image *image __unused)
unsigned int assertion_failures
Number of assertion failures.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
void test_ok(int success, const char *file, unsigned int line, const char *test)
Report test result.
static void run_tests(struct self_test *tests)
Run self-test set.
static int test_image_probe(struct image *image __unused)
#define ENOTTY
Inappropriate I/O control operation.
#define REF_INIT(free_fn)
Initialise a static reference counter.
static struct self_test * current_tests
Current self-test set.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define DBG(...)
Print a debugging message.
static struct image test_image
void ref_no_free(struct refcnt *refcnt __unused)
Do not free reference-counted object.
#define NULL
NULL pointer (VOID *)
struct refcnt refcnt
Reference count.