diff options
Diffstat (limited to 'testcode/replay.c')
| -rw-r--r-- | testcode/replay.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/testcode/replay.c b/testcode/replay.c index 08d87470bd00..93a600425ca1 100644 --- a/testcode/replay.c +++ b/testcode/replay.c @@ -458,6 +458,8 @@ replay_scenario_read(FILE* in, const char* name, int* lineno) if(parse_keyword(&parse, ";")) continue; /* comment */ if(parse_keyword(&parse, "SCENARIO_BEGIN")) { + if(scen) + fatal_exit("%d: double SCENARIO_BEGIN", *lineno); scen = make_scenario(parse); if(!scen) fatal_exit("%d: could not make scen", *lineno); @@ -801,14 +803,19 @@ macro_expand(rbtree_type* store, struct replay_runtime* runtime, char** text) /* check for functions */ if(strcmp(buf, "time") == 0) { - snprintf(buf, sizeof(buf), ARG_LL "d", (long long)runtime->now_secs); + if(runtime) + snprintf(buf, sizeof(buf), ARG_LL "d", (long long)runtime->now_secs); + else + snprintf(buf, sizeof(buf), ARG_LL "d", (long long)0); *text += len; return strdup(buf); } else if(strcmp(buf, "timeout") == 0) { time_t res = 0; - struct fake_timer* t = first_timer(runtime); - if(t && (time_t)t->tv.tv_sec >= runtime->now_secs) - res = (time_t)t->tv.tv_sec - runtime->now_secs; + if(runtime) { + struct fake_timer* t = first_timer(runtime); + if(t && (time_t)t->tv.tv_sec >= runtime->now_secs) + res = (time_t)t->tv.tv_sec - runtime->now_secs; + } snprintf(buf, sizeof(buf), ARG_LL "d", (long long)res); *text += len; return strdup(buf); |
