diff --git a/src/emu/system.c b/src/emu/system.c index 07914a4..02c7df0 100644 --- a/src/emu/system.c +++ b/src/emu/system.c @@ -183,6 +183,14 @@ create_system(struct system *sys, struct trace *trace) stream_data_set(s, lpt); } + /* Ensure all looms have at least one CPU */ + for (struct loom *l = sys->looms; l; l = l->next) { + if (l->ncpus == 0) { + err("loom %s has no physical CPUs", l->id); + return -1; + } + } + return 0; } diff --git a/test/emu/ovni/CMakeLists.txt b/test/emu/ovni/CMakeLists.txt index 323d209..053755a 100644 --- a/test/emu/ovni/CMakeLists.txt +++ b/test/emu/ovni/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Barcelona Supercomputing Center (BSC) +# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC) # SPDX-License-Identifier: GPL-3.0-or-later # Only run performance sensitive tests on Release builds @@ -16,3 +16,4 @@ ovni_test(mp-simple.c MP) ovni_test(version-good.c) ovni_test(version-bad.c SHOULD_FAIL REGEX "version mismatch") ovni_test(clockgate.c MP SHOULD_FAIL REGEX "detected large clock gate") +ovni_test(no-cpus.c SHOULD_FAIL REGEX "loom .* has no physical CPUs") diff --git a/test/emu/ovni/no-cpus.c b/test/emu/ovni/no-cpus.c new file mode 100644 index 0000000..1d446a2 --- /dev/null +++ b/test/emu/ovni/no-cpus.c @@ -0,0 +1,13 @@ +/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include "instr_ovni.h" + +int +main(void) +{ + instr_start(0, 0); + instr_end(); + + return 0; +}