Add Nanos6 emu test to check strict nesting model

This commit is contained in:
Rodrigo Arias 2023-10-27 14:24:55 +02:00
parent 3e5b949c4e
commit f8fdcc0a79
2 changed files with 47 additions and 0 deletions

View File

@ -6,6 +6,7 @@ test_emu(nested-tasks-bad.c SHOULD_FAIL
REGEX "body_execute: body(id=1,taskid=1) state must be Created but is Running")
test_emu(task-types.c MP)
test_emu(blocking.c MP)
test_emu(if0-pause-parent.c)
test_emu(ss-mismatch.c SHOULD_FAIL
REGEX "thread [0-9]\\+ ended with 1 stacked nanos6 subsystems")
test_emu(delayed-connect-ss.c)

View File

@ -0,0 +1,46 @@
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include <stdint.h>
#include "compat.h"
#include "instr.h"
#include "instr_nanos6.h"
/* Ensure that we can accept a Nanos6 task model in which the parent gets paused
* before the if0 task begins. */
int
main(void)
{
instr_start(0, 1);
instr_nanos6_init();
int ntasks = 100;
uint32_t typeid = 1;
instr_nanos6_type_create(typeid);
/* Create and run the tasks, one nested into another */
for (int32_t id = 1; id <= ntasks; id++) {
instr_nanos6_handle_task_enter();
instr_nanos6_task_create_begin();
instr_nanos6_task_create(id, typeid);
instr_nanos6_task_create_end();
instr_nanos6_task_body_enter();
instr_nanos6_task_execute(id);
sleep_us(500);
instr_nanos6_task_pause(id);
}
/* End the tasks in the opposite order */
for (int32_t id = ntasks; id >= 1; id--) {
instr_nanos6_task_resume(id);
instr_nanos6_task_end(id);
instr_nanos6_task_body_exit();
instr_nanos6_handle_task_exit();
}
instr_end();
return 0;
}