Make ovni.require a mandatory attribute

We no longer accept streams that don't have the ovni.require attribute.
This commit is contained in:
Rodrigo Arias 2024-09-12 15:56:24 +02:00
parent 1f30e8ef8b
commit f6d85e9af5
4 changed files with 7 additions and 16 deletions

View File

@ -235,13 +235,6 @@ model_finish(struct model *model, struct emu *emu)
static int
should_enable(int have[3], struct model_spec *spec, struct thread *t)
{
static int compat = 0;
/* Enable all models if we are in compatibility model. Don't check other
* threads metadata */
if (compat)
return 1;
if (t->meta == NULL) {
err("missing metadata for thread %s", t->id);
return -1;
@ -249,12 +242,8 @@ should_enable(int have[3], struct model_spec *spec, struct thread *t)
JSON_Object *require = json_object_dotget_object(t->meta, "ovni.require");
if (require == NULL) {
warn("missing 'ovni.require' key in thread %s", t->id);
warn("loading trace in compatibility mode");
warn("all models will be enabled (expect slowdown)");
warn("use ovni_thread_require() to enable only required models");
compat = 1;
return 1;
err("missing 'ovni.require' key in thread %s", t->id);
return -1;
}
/* May not have the current model */

View File

@ -21,7 +21,7 @@ test_emu(sort-cpus-by-rank.c MP)
test_emu(tracedir-subdir.c MP DRIVER "tracedir-subdir.driver.sh")
test_emu(empty-stream.c SHOULD_FAIL REGEX "missing ovni.finished")
test_emu(require-bad-version.c SHOULD_FAIL REGEX "unsupported ovni model version (want 666.66.6, have .*)")
test_emu(require-compat.c REGEX "loading trace in compatibility mode")
test_emu(require-compat.c SHOULD_FAIL REGEX "missing 'ovni.require' key in thread")
test_emu(require-repeated.c)
test_emu(thread-crash.c SHOULD_FAIL REGEX "missing ovni.finished")
test_emu(thread-free-isready.c)

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
/* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include <stdio.h>
@ -35,6 +35,7 @@ main(void)
for (int i = 0; i < N; i++)
ovni_add_cpu(i, cpus[i]);
instr_require("ovni");
instr_thread_execute(-1, -1, 0);
instr_end();

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
/* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include <stdio.h>
@ -36,6 +36,7 @@ main(void)
for (int i = 0; i < N; i++)
ovni_add_cpu(i, cpus[i]);
instr_require("ovni");
instr_thread_execute(-1, -1, 0);
instr_end();