Add switch-same-type nosv test

Generates a script with the values of the delta clock, PRV type and
value to be matched in the .prv traces, to ensure the emulator emitted
the switching type event.
This commit is contained in:
Rodrigo Arias 2023-02-24 11:58:53 +01:00 committed by Rodrigo Arias Mallo
parent 64360796b9
commit 97dac6e83b
2 changed files with 48 additions and 0 deletions

View File

@ -7,3 +7,4 @@ ovni_test(nested-tasks-bad.c SHOULD_FAIL
ovni_test(task-types.c MP) ovni_test(task-types.c MP)
ovni_test(pause.c MP) ovni_test(pause.c MP)
ovni_test(mp-rank.c MP) ovni_test(mp-rank.c MP)
ovni_test(switch-same-type.c)

View File

@ -0,0 +1,47 @@
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include "instr_nosv.h"
#include "emu_prv.h"
int
main(void)
{
/* Tests that switching to a nested task of the same type produces a
* duplicated event in the Paraver trace with the task type. */
instr_start(0, 1);
uint32_t typeid = 100;
uint32_t gid = instr_nosv_type_create(typeid);
/* Create two tasks of the same type */
instr_nosv_task_create(1, typeid);
instr_nosv_task_create(2, typeid);
instr_nosv_task_execute(1);
/* Change subsystem to prevent duplicates */
instr_nosv_submit_enter();
/* Run another nested task with same type id */
instr_nosv_task_execute(2);
/* Match the PRV line in the trace */
FILE *f = fopen("match.sh", "w");
if (f == NULL)
die("fopen failed:");
int prvtype = PRV_NOSV_TYPE;
int64_t t = get_delta();
fprintf(f, "grep ':%ld:%d:%d' ovni/thread.prv\n", t, prvtype, gid);
fprintf(f, "grep ':%ld:%d:%d' ovni/cpu.prv\n", t, prvtype, gid);
fclose(f);
/* Exit from tasks and subsystem */
instr_nosv_task_end(2);
instr_nosv_submit_exit();
instr_nosv_task_end(1);
instr_end();
return 0;
}