Nightmare test harness
include/nightmare/nightmare.h View source View on GitHubStructs
Section titled “Structs”nightmare_verdict
Section titled “nightmare_verdict” struct nightmare_verdict (4 fields) source
§
enum nightmare_result result §
enum nightmare_skip_reason skip_reason §
const char *reason §
const char *msg nightmare_finding_site
Section titled “nightmare_finding_site” struct nightmare_finding_site (4 fields) source
nightmare_ctx
Section titled “nightmare_ctx” struct nightmare_ctx (10 fields) source
nightmare_ops
Section titled “nightmare_ops” struct nightmare_ops (5 fields) source
§
struct nightmare_verdict (*prepare)(struct nightmare_ctx *) §
void (*worker)(struct nightmare_ctx *, struct test_conc_worker *) §
struct nightmare_verdict (*quiesce_check)(struct nightmare_ctx *) §
void (*probe)(struct nightmare_ctx *) §
struct nightmare_verdict (*finish)(struct nightmare_ctx *) nightmare
Section titled “nightmare” struct nightmare (11 fields) source
§
const char *name §
const char *fname §
const char *desc §
const struct nightmare_ops *ops §
enum nightmare_seed_policy seed_policy §
enum nightmare_requires requires §
const char *const *perturb §
struct scaled_param intensity_desc §
size_t min_mem_mib nightmare_exit_code
Section titled “nightmare_exit_code” enum nightmare_exit_code (5 variants) source
nightmare_seed_policy
Section titled “nightmare_seed_policy” enum nightmare_seed_policy : uint8_t (3 variants) source
nightmare_seed_mode
Section titled “nightmare_seed_mode” enum nightmare_seed_mode : uint8_t (3 variants) source
nightmare_requires
Section titled “nightmare_requires” enum nightmare_requires : uint32_t (5 variants) source
nightmare_result
Section titled “nightmare_result” enum nightmare_result : uint8_t (5 variants) source
nightmare_skip_reason
Section titled “nightmare_skip_reason” enum nightmare_skip_reason : uint8_t (12 variants) source
§
NIGHTMARE_SKIP_NONE = 0 §
NIGHTMARE_SKIP_NOT_COMPILED §
NIGHTMARE_SKIP_NO_SUCH_NIGHTMARE §
NIGHTMARE_SKIP_NEEDS_SMP §
NIGHTMARE_SKIP_NEEDS_PREEMPT §
NIGHTMARE_SKIP_NEEDS_ASAN §
NIGHTMARE_SKIP_NEEDS_INJECT §
NIGHTMARE_SKIP_RAM_LOW §
NIGHTMARE_SKIP_SEED_UNUSED §
NIGHTMARE_SKIP_SEED_MISSING §
NIGHTMARE_SKIP_SERVICE_MISSING §
NIGHTMARE_SKIP_PREPARE_REFUSED nightmare_finding_tier
Section titled “nightmare_finding_tier” enum nightmare_finding_tier : uint8_t (2 variants) source
Functions
Section titled “Functions”nightmare_run
Section titled “nightmare_run”void nightmare_run(void) source nightmare_must_stop
Section titled “nightmare_must_stop”bool nightmare_must_stop(void) source nightmare_stop_after_finding
Section titled “nightmare_stop_after_finding”void nightmare_stop_after_finding(void) source nightmare_must_park
Section titled “nightmare_must_park”bool nightmare_must_park(void) source nightmare_park
Section titled “nightmare_park”void nightmare_park(struct test_conc_worker *worker) source nightmare_report_stall
Section titled “nightmare_report_stall”void nightmare_report_stall(const struct test_stall_evidence *evidence) source Macros
Section titled “Macros”NIGHTMARE_DEFINE
Section titled “NIGHTMARE_DEFINE”#define NIGHTMARE_DEFINE(id, ...) source Expansion
#define NIGHTMARE_DEFINE(id, ...) \
cc_wno_override_init_start extern struct nightmare __nightmare_##id; \
LINKER_SECTION_OBJECT(struct nightmare, nightmares) \
__nightmare_##id = {.name = #id, \
.fname = __RELFILE__, \
.seed_policy = NIGHTMARE_SEED_IGNORED, \
.requires = NIGHTMARE_REQ_NONE, \
.intensity = NIGHTMARE_INTENSITY_SENTINEL, \
__VA_ARGS__}; \
cc_wno_override_init_end NIGHTMARE
Section titled “NIGHTMARE”NIGHTMARE_EXTERN
Section titled “NIGHTMARE_EXTERN”#define NIGHTMARE_EXTERN(id) source Expansion
#define NIGHTMARE_EXTERN(id) extern struct nightmare __nightmare_##id NIGHTMARE_PERTURB
Section titled “NIGHTMARE_PERTURB”#define NIGHTMARE_PERTURB(...) source Expansion
#define NIGHTMARE_PERTURB(...) ((const char *const[]) {__VA_ARGS__, NULL}) NIGHTMARE_INTENSITY_SENTINEL
Section titled “NIGHTMARE_INTENSITY_SENTINEL”NIGHTMARE_INTENSITY_DEFAULT
Section titled “NIGHTMARE_INTENSITY_DEFAULT”NIGHTMARE_INTENSITY_CORES
Section titled “NIGHTMARE_INTENSITY_CORES”#define NIGHTMARE_INTENSITY_CORES(min_, def_, max_, unit_) source Expansion
#define NIGHTMARE_INTENSITY_CORES(min_, def_, max_, unit_) \
.intensity_desc = {.curve = SCALE_CORE_MULTIPLIER, \
.min_val = (min_), \
.def_val = (def_), \
.max_val = (max_), \
.unit = (unit_)} NIGHTMARE_WORKER
Section titled “NIGHTMARE_WORKER”#define NIGHTMARE_WORKER(id) source Expansion
#define NIGHTMARE_WORKER(id) \
static void id(struct nightmare_ctx *NM_CTX cc_unused, \
struct test_conc_worker *NM_SELF cc_unused) NIGHTMARE_OPTIONS_DEFINE
Section titled “NIGHTMARE_OPTIONS_DEFINE”#define NIGHTMARE_OPTIONS_DEFINE(id, struct_type, instance, ...) source Expansion
#define NIGHTMARE_OPTIONS_DEFINE(id, struct_type, instance, ...) \
static void *__nightmare_options_resolve_##id(const char *path, \
size_t path_len) { \
return path_len == sizeof(#id) - 1 && \
strncmp(path, #id, path_len) == 0 \
? &(instance) \
: NULL; \
} \
CMDLINE_SCHEMA_DEFINE(__nightmare_options_##id, "nightmare", #id, \
"Nightmare subject options", \
__nightmare_options_resolve_##id, __VA_ARGS__) NIGHTMARE_OK
Section titled “NIGHTMARE_OK”#define NIGHTMARE_OK source Expansion
#define NIGHTMARE_OK \
((struct nightmare_verdict) {.result = NIGHTMARE_RESULT_OK}) NIGHTMARE_FAIL
Section titled “NIGHTMARE_FAIL”#define NIGHTMARE_FAIL(reason_, msg_) source Expansion
#define NIGHTMARE_FAIL(reason_, msg_) \
((struct nightmare_verdict) { \
.result = NIGHTMARE_RESULT_FAIL, .reason = (reason_), .msg = (msg_)}) NIGHTMARE_SKIP
Section titled “NIGHTMARE_SKIP”#define NIGHTMARE_SKIP(reason_) source Expansion
#define NIGHTMARE_SKIP(reason_) \
((struct nightmare_verdict) {.result = NIGHTMARE_RESULT_SKIP, \
.skip_reason = (reason_)}) NIGHTMARE_PROGRESS
Section titled “NIGHTMARE_PROGRESS”#define NIGHTMARE_PROGRESS() source Subjects keep their own spelling; the counter itself is shared.
Expansion
#define NIGHTMARE_PROGRESS() TEST_PROGRESS() NIGHTMARE_FINDING
Section titled “NIGHTMARE_FINDING”#define NIGHTMARE_FINDING(kind_, fmt, ...) source Expansion
#define NIGHTMARE_FINDING(kind_, fmt, ...) \
nightmare_finding_at( \
&(const struct nightmare_finding_site) {.kind = (kind_), \
.tier = \
NIGHTMARE_TIER_AMBIGUOUS, \
.file = __RELFILE__, \
.line = __LINE__}, \
0, (fmt), ##__VA_ARGS__) NIGHTMARE_FINDING_TIER
Section titled “NIGHTMARE_FINDING_TIER”#define NIGHTMARE_FINDING_TIER(kind_, tier_, discriminator_, fmt, ...) source Expansion
#define NIGHTMARE_FINDING_TIER(kind_, tier_, discriminator_, fmt, ...) \
nightmare_finding_at( \
&(const struct nightmare_finding_site) {.kind = (kind_), \
.tier = (tier_), \
.file = __RELFILE__, \
.line = __LINE__}, \
(discriminator_), (fmt), ##__VA_ARGS__)