From 4a936dcb9965b4fb5b0bf23ed4d76c5ea0446488 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 14 Apr 2023 11:10:44 +0200 Subject: [PATCH] Add test to prevent re-running tasks in Nanos6 For now is disabled until we have a better instrumentation for task states. --- test/emu/nanos6/CMakeLists.txt | 5 +++++ test/emu/nanos6/rerun-task-bad.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 test/emu/nanos6/rerun-task-bad.c diff --git a/test/emu/nanos6/CMakeLists.txt b/test/emu/nanos6/CMakeLists.txt index 9f7c7dd..80fac0b 100644 --- a/test/emu/nanos6/CMakeLists.txt +++ b/test/emu/nanos6/CMakeLists.txt @@ -13,3 +13,8 @@ test_emu(switch-same-type.c) test_emu(sponge.c) test_emu(sponge-breakdown.c BREAKDOWN) test_emu(breakdown-no-black.c BREAKDOWN) + +# FIXME: Disabled to support the taskiter in NODES until we have more detailed +# task states instrumentation. +test_emu(rerun-task-bad.c DISABLED SHOULD_FAIL + REGEX "task_execute: cannot execute task [0-9]\\+: state is not created") diff --git a/test/emu/nanos6/rerun-task-bad.c b/test/emu/nanos6/rerun-task-bad.c new file mode 100644 index 0000000..5935592 --- /dev/null +++ b/test/emu/nanos6/rerun-task-bad.c @@ -0,0 +1,29 @@ +/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include +#include "instr.h" +#include "instr_nanos6.h" + +/* Ensure a Nanos6 task cannot be executed again after ending. */ + +int +main(void) +{ + instr_start(0, 1); + + uint32_t typeid = 666; + instr_nanos6_type_create(typeid); + + uint32_t taskid = 1; + instr_nanos6_task_create_and_execute(taskid, typeid); + instr_nanos6_task_end(taskid); + + /* Run again the same task (should fail) */ + instr_nanos6_task_execute(taskid); + instr_nanos6_task_end(taskid); + + instr_end(); + + return 0; +}