diff --git a/CHANGELOG.md b/CHANGELOG.md index 8333977..df64be2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Streams are marked as finished when `ovni_thread_free()` is called. A warning is emitted in the emulator for those streams that are not finished properly. - List the emulation models and versions with `ovniemu -h` +- New `-a` ovniemu option to enable all models ### Changed diff --git a/src/emu/emu_args.c b/src/emu/emu_args.c index daecbe9..21fafe5 100644 --- a/src/emu/emu_args.c +++ b/src/emu/emu_args.c @@ -19,13 +19,15 @@ usage(void) { rerr("%s -- version %s\n", progname, version); rerr("\n"); - rerr("Usage: %s [-c offsetfile] [-bdlh] tracedir\n", progname); + rerr("Usage: %s [-c offsetfile] [-abdlh] tracedir\n", progname); rerr("\n"); rerr("Options:\n"); rerr(" -c offsetfile Use the given offset file to correct\n"); rerr(" the clocks among nodes. It can be\n"); rerr(" generated by the ovnisync program\n"); rerr("\n"); + rerr(" -a Enable all models (experimental)\n"); + rerr("\n"); rerr(" -b Enable breakdown model (experimental)\n"); rerr("\n"); rerr(" -d Enable debug output (very verbose)\n"); @@ -51,7 +53,7 @@ emu_args_init(struct emu_args *args, int argc, char *argv[]) memset(args, 0, sizeof(struct emu_args)); int opt; - while ((opt = getopt(argc, argv, "bdc:lh")) != -1) { + while ((opt = getopt(argc, argv, "abdc:lh")) != -1) { switch (opt) { case 'c': args->clock_offset_file = optarg; @@ -59,6 +61,9 @@ emu_args_init(struct emu_args *args, int argc, char *argv[]) case 'l': args->linter_mode = 1; break; + case 'a': + args->enable_all_models = 1; + break; case 'b': args->breakdown = 1; break; diff --git a/src/emu/emu_args.h b/src/emu/emu_args.h index f2267d6..87b43d5 100644 --- a/src/emu/emu_args.h +++ b/src/emu/emu_args.h @@ -7,6 +7,7 @@ struct emu_args { int linter_mode; int breakdown; + int enable_all_models; char *clock_offset_file; char *tracedir; }; diff --git a/src/emu/model.c b/src/emu/model.c index cbff52c..7e053d3 100644 --- a/src/emu/model.c +++ b/src/emu/model.c @@ -6,6 +6,7 @@ #include "common.h" #include "version.h" #include "emu.h" +#include "emu_args.h" #include "thread.h" #include "proc.h" @@ -61,7 +62,7 @@ model_probe(struct model *model, struct emu *emu) } /* Zero is disabled */ - if (ret > 0) { + if (ret > 0 || emu->args.enable_all_models) { model->enabled[i] = 1; nenabled++; } @@ -70,7 +71,10 @@ model_probe(struct model *model, struct emu *emu) if (nenabled == 0) { warn("no models enabled"); } else { - info("the following %d models are enabled: ", nenabled); + if (emu->args.enable_all_models) + info("all %d models are enabled (-a): ", nenabled); + else + info("the following %d models are enabled: ", nenabled); for (int i = 0; i < MAX_MODELS; i++) { if (!model->enabled[i]) continue; diff --git a/test/emu/nosv/CMakeLists.txt b/test/emu/nosv/CMakeLists.txt index 4e39fca..f65bb8b 100644 --- a/test/emu/nosv/CMakeLists.txt +++ b/test/emu/nosv/CMakeLists.txt @@ -13,3 +13,7 @@ test_emu(task-pause-from-submit.c) test_emu(same-subsystem.c) test_emu(require-missing.c SHOULD_FAIL REGEX "model nosv not enabled for event") +test_emu(require-missing.c + NAME flag-enable-all + DRIVER "flag-enable-all.driver.sh" + REGEX "all .* models are enabled") diff --git a/test/emu/nosv/flag-enable-all.driver.sh b/test/emu/nosv/flag-enable-all.driver.sh new file mode 100644 index 0000000..4067238 --- /dev/null +++ b/test/emu/nosv/flag-enable-all.driver.sh @@ -0,0 +1,4 @@ +# Test the -a flag with a program that doesn't enable the required models for +# the events in the stream. +$OVNI_TEST_BIN +ovniemu -a ovni