You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.6 KiB
41 lines
1.6 KiB
/* Изоляция регрессий: падение/зависание одного случая не скрывает остальные. */ |
|
#ifndef ASYNC_REGRESSION_H |
|
#define ASYNC_REGRESSION_H |
|
|
|
#include "../lib/u_async.h" |
|
#include "../lib/ll_queue.h" |
|
#include "../lib/mem.h" |
|
#include <stdio.h> |
|
#include <sys/epoll.h> |
|
|
|
#define CHECK(cond) do { if (!(cond)) { \ |
|
fprintf(stderr, "[FAIL] %s:%d: %s\n", __FILE__, __LINE__, #cond); return 1; \ |
|
} } while (0) |
|
#define CHECK_EQ(actual, expected) do { \ |
|
long long a_ = (long long)(actual), e_ = (long long)(expected); \ |
|
if (a_ != e_) { fprintf(stderr, "[FAIL] %s:%d: %s=%lld expected=%lld\n", \ |
|
__FILE__, __LINE__, #actual, a_, e_); return 1; } \ |
|
} while (0) |
|
|
|
struct regression_case { |
|
const char* name; |
|
int (*run)(int param); |
|
int param; |
|
}; |
|
|
|
int regression_run(int argc, char** argv, const struct regression_case* cases, size_t count); |
|
uint64_t regression_time_ms(void); |
|
void regression_log_init(void); |
|
|
|
enum regression_alloc { FAULT_MALLOC = 1, FAULT_CALLOC = 2, FAULT_REALLOC = 4, FAULT_ALLOC = 7 }; |
|
// nth=0 — устойчивый отказ, nth>0 — отказ только соответствующего выделения. |
|
void regression_fault_arm(int mask, const char* scope, int nth); |
|
int regression_fault_hit(void); |
|
void regression_fault_reset(void); |
|
void regression_clock_shift(int64_t milliseconds); |
|
void regression_epoll_events(const struct epoll_event* events, int count); |
|
void regression_epoll_ctl_fail(int operation); |
|
void regression_eventfd_fail(void); |
|
void regression_epoll_create_fail(void); |
|
|
|
#endif
|
|
|