From 1b9a3117c6d37ca9e31629a9f7014860ffb23d8c Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 26 Sep 2026 18:00:37 +0000 Subject: Improve the failure simulation test/code. Right now, a lot of test cases fail because if this. Next up: fixing them :) FossilOrigin-Name: 6dd2985bcae86ed3f7c5651e2ce7bc848b80516bf4c1d5482b6095c18dfcc058 --- src/include/aplwc.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/include/aplwc.h') diff --git a/src/include/aplwc.h b/src/include/aplwc.h index 5a6cb79..09507a1 100644 --- a/src/include/aplwc.h +++ b/src/include/aplwc.h @@ -29,6 +29,7 @@ enum aplwc_rc { APLWC_NOT_YET_IMPLEMENTED, APLWC_INVALID_UTF8, APLWC_INVALID_SYNTAX, + APLWC_OTHER_FAILURE, APLWC_RC_LAST = APLWC_INVALID_SYNTAX }; @@ -44,14 +45,21 @@ struct aplwc_ref { typedef struct { struct aplwc_ref ref; } AplwcLine; typedef struct { struct aplwc_ref ref; } AplwcValue; +enum aplwc_failsim_parameter { + APLWC_FAILSIM_START, + APLWC_FAILSIM_COUNT, + APLWC_FAILSIM_HITS, + APLWC_FAILSIM_FAILS, + + APLWC_FAILSIM_PARAMETER_COUNT /* Not a real parameter, just the count */ +}; + struct aplwc_fns { void *(*alloc)(size_t, size_t *); void (*dealloc)(void *); + unsigned long (*setup_failsim)(enum aplwc_failsim_parameter, unsigned long); }; -extern uint64_t aplwc_simulate_failure_at; -extern uint64_t aplwc_simulate_failure_count; - struct aplwc *aplwc_new(struct aplwc_fns, enum aplwc_rc *); void aplwc_destroy(struct aplwc *); void aplwc_clear_line(AplwcLine *); @@ -67,6 +75,7 @@ void aplwc_eval(AplwcLine *, AplwcValue *); void aplwc_free_value(AplwcValue *); const char *aplwc_value_string(AplwcValue *); enum aplwc_rc aplwc_load_module(struct aplwc *, const char *, const char *, int n); +unsigned long aplwc_failsim_query(enum aplwc_failsim_parameter); int aplwc_simulate_failure(void); #endif /* APLWC_H */ -- cgit v1.2.3