#ifndef TESTS_H #define TESTS_H #include #include typedef enum { T_PENDING = 0, T_PASS, T_FAIL, T_SKIP } tstatus_t; #define TMSG_LEN 72 typedef struct { const char *name; const char *what; /* one line: what this proves */ int (*run)(char *msg, size_t n); /* 0 = pass, 1 = fail, 2 = skip */ tstatus_t status; char msg[TMSG_LEN]; } test_t; typedef struct { const char *name; const char *what; test_t *tests; int ntests; } suite_t; extern suite_t g_suites[]; extern const int g_nsuites; /* Set once an NCRA reset has been issued this session. The device ID is a * ONE-SHOT: reads of address 0 return it only until the first NCRA reset * clears id_phase in the gateware, after which address 0 reads back NCRA. * That is correct behaviour (it matches the GC's own init order), but it * means the ID test can only pass once per console power cycle. */ void tests_run_test(test_t *t); void tests_run_suite(suite_t *s); void tests_run_all(void); void tests_reset_status(void); void tests_tally(int *pass, int *fail, int *skip, int *pending); #endif