Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add timeout keyword to set-option in the smt2 frontend #527

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/frontend/smt2/smt2_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -6283,6 +6283,10 @@ void smt2_set_option(const char *name, aval_t value) {
set_boolean_option(g, name, value, &g->dump_models);
break;

case SMT2_KW_TIMEOUT:
set_uint32_option(g, name, value, &g->timeout);
break;

case SMT2_KW_PRODUCE_UNSAT_ASSUMPTIONS:
// optional: if true, get-unsat-assumptions can be used
if (option_can_be_set(name)) {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/smt2/smt2_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ typedef struct smt2_globals_s {
uint32_t nthreads; // default = 0 (single threaded)

// timeout
uint32_t timeout; // default = 0 (no timeout)
uint32_t timeout; // default = 0 (no timeout); global timeout used for every check-sat
timeout_t *to; // initially NULL. Non-NULL once init_timeout is called
bool interrupted; // true if the most recent call to check_sat timed out

Expand Down
3 changes: 2 additions & 1 deletion src/frontend/smt2/smt2_keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ struct keyword_s;
:category, SMT2_KW_CATEGORY
:difficulty, SMT2_KW_DIFFICULTY
:notes, SMT2_KW_NOTES
:dump-models, SMT2_KW_DUMP_MODELS
:dump-models, SMT2_KW_DUMP_MODELS
:timeout, SMT2_KW_TIMEOUT
1 change: 1 addition & 0 deletions src/frontend/smt2/smt2_lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ static const char * const smt2_keyword_string[NUM_SMT2_KEYWORDS] = {
":reproducible-resource-limit", // SMT2_KW_REPRODUCIBLE_RESOURCE_LIMIT
":verbosity", // SMT2_KW_VERBOSITY
":dump-models", // SMT2_KW_DUMP_MODELS
":timeout", // SMT2_KW_TIMEOUT

":all-statistics", // SMT2_KW_ALL_STATISTICS
":assertion-stack-levesl", // SMT2_KM_ASSERTIONS_STACK_LEVELS
Expand Down
1 change: 1 addition & 0 deletions src/frontend/smt2/smt2_lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ enum smt2_keyword {
SMT2_KW_REPRODUCIBLE_RESOURCE_LIMIT,
SMT2_KW_VERBOSITY,
SMT2_KW_DUMP_MODELS,
SMT2_KW_TIMEOUT,

// Predefined keywords for (get-info ...)
SMT2_KW_ALL_STATISTICS,
Expand Down
3 changes: 3 additions & 0 deletions tests/regress/set-timeout.smt2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(set-option :timeout 1)
(set-logic QF_UF)
(exit)
Empty file.
Loading
Loading