Ensure all looms have at least one CPU

This commit is contained in:
Rodrigo Arias 2023-03-21 16:43:49 +01:00 committed by Rodrigo Arias Mallo
parent 3d957f444c
commit f22d9084ba
3 changed files with 23 additions and 1 deletions

View File

@ -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;
}

View File

@ -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")

13
test/emu/ovni/no-cpus.c Normal file
View File

@ -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;
}