From 78c4bba62e5ab93ffcf0a9eb01b88652e1d5727d Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 24 Feb 2023 18:04:52 +0100 Subject: [PATCH] Match the PRV event in delayed-connect-ss test Ensures the delayed connect of the CPU and thread muxes still causes the output to be updated properly. --- test/emu/nanos6/delayed-connect-ss.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/test/emu/nanos6/delayed-connect-ss.c b/test/emu/nanos6/delayed-connect-ss.c index 8a75ec8..dd5f6db 100644 --- a/test/emu/nanos6/delayed-connect-ss.c +++ b/test/emu/nanos6/delayed-connect-ss.c @@ -3,6 +3,9 @@ #include "instr_nanos6.h" +#include "emu_prv.h" +#include "nanos6/nanos6_priv.h" + int main(void) { @@ -15,13 +18,31 @@ main(void) * will remain selecting a null input until the thread state * changes. */ - /* FIXME: We should be able to test that after emitting the - * nanos6 event the emulator follows some properties. */ - instr_nanos6_worker_loop_enter(); + /* Match the PRV line in the trace */ + FILE *f = fopen("match.sh", "w"); + if (f == NULL) + die("fopen failed:"); + + /* Ensure that after the Nanos6 connect phase, the CPU subsystem mux has + * selected the correct input, based on the running thread */ + int type = PRV_NANOS6_SUBSYSTEM; + int64_t t = get_delta(); + int value = ST_WORKER_LOOP; + fprintf(f, "grep ':%ld:%d:%d$' ovni/thread.prv\n", t, type, value); + fprintf(f, "grep ':%ld:%d:%d$' ovni/cpu.prv\n", t, type, value); + instr_nanos6_worker_loop_exit(); + /* Also test when exitting the stacked subsystem */ + t = get_delta(); + value = 0; + fprintf(f, "grep ':%ld:%d:%d$' ovni/thread.prv\n", t, type, value); + fprintf(f, "grep ':%ld:%d:%d$' ovni/cpu.prv\n", t, type, value); + + fclose(f); + instr_end(); return 0;