Add -a flag in ovniemu to enable all models
The experimental flag -a is used to ease the transition to the usage of ovni_thread_require(), as it may be posible to have traces in which not all libraries have requested their model. The flag causes all emulation models to be enabled. This flag is considered experimental and it may be removed or renamed in future versions.
This commit is contained in:
parent
998200d507
commit
0f7ccc89de
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -7,6 +7,7 @@
|
||||
struct emu_args {
|
||||
int linter_mode;
|
||||
int breakdown;
|
||||
int enable_all_models;
|
||||
char *clock_offset_file;
|
||||
char *tracedir;
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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")
|
||||
|
4
test/emu/nosv/flag-enable-all.driver.sh
Normal file
4
test/emu/nosv/flag-enable-all.driver.sh
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user