ovni/test/emu/nanos6/sponge-breakdown.c
Rodrigo Arias 354f2f50eb Register emulation models only if required
Until now, emulation models were always being registered via probe(),
which causes the emulator to initialize all the channels. To reduce the
overhead, the channels were not connected or registered in the bay
until the first event of that model was received. This delayed connect
was causing issues in muxes where the newly connected model required
refreshing the touched channels. Which in turn was causing unexpected
PRV events.

By determining which models we need to enable, we can remove the delayed
connect mechanism and just enable those models at initialization time,
and connect the channels.
2023-11-16 12:39:05 +01:00

59 lines
1.2 KiB
C

/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include <stdint.h>
#include <stdio.h>
#include "common.h"
#include "emu_prv.h"
#include "instr.h"
#include "instr_nanos6.h"
#include "nanos6/nanos6_priv.h"
int
main(void)
{
instr_start(0, 1);
instr_nanos6_init();
int type = PRV_NANOS6_BREAKDOWN;
FILE *f = fopen("match.sh", "w");
if (f == NULL)
die("fopen failed:");
instr_nanos6_worker_loop_enter();
/* Enter sponge subsystem */
instr_nanos6_sponge_enter();
/* Set state to Absorbing */
instr_nanos6_absorbing();
/* Ensure the only row in breakdown is in absorbing */
fprintf(f, "grep '1:%ld:%d:%d$' ovni/nanos6-breakdown.prv\n",
get_delta(), type, ST_ABSORBING);
/* Set state to Resting */
instr_nanos6_resting();
/* Ensure the only row in breakdown is in Resting */
fprintf(f, "grep '1:%ld:%d:%d$' ovni/nanos6-breakdown.prv\n",
get_delta(), type, ST_RESTING);
instr_nanos6_progressing();
/* Now the state must follow the subsystem, which should be
* sponge mode */
fprintf(f, "grep '1:%ld:%d:%d$' ovni/nanos6-breakdown.prv\n",
get_delta(), type, ST_SPONGE);
fclose(f);
instr_nanos6_sponge_exit();
instr_nanos6_worker_loop_exit();
instr_end();
return 0;
}