diff --git a/CMakeLists.txt b/CMakeLists.txt index 50ec5c6..e27a71b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC) +# Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) # SPDX-License-Identifier: GPL-3.0-or-later cmake_minimum_required(VERSION 3.20) @@ -15,6 +15,7 @@ add_compile_options(-Wall -Wextra -Wformat ) set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED TRUE) set(CMAKE_C_EXTENSIONS FALSE) option(ENABLE_DEBUG_LOG "Enable debug messages (very verbose)") @@ -23,6 +24,8 @@ if(ENABLE_DEBUG_LOG) add_definitions(-DENABLE_DEBUG) endif() +add_definitions(-D_POSIX_C_SOURCE=200809L) + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Asan UBsan." FORCE) @@ -59,6 +62,15 @@ set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_DEBUG} \ set(CMAKE_C_FLAGS_UBSAN "${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined" CACHE STRING "Flags used by the C compiler during UndefinedBehaviorSanitizer builds." FORCE) +find_program(IWYU NAMES include-what-you-use iwyu) + +if(IWYU) + set(IWYU_CMD ${IWYU} -Xiwyu --no_comments) + set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_CMD}) +else() + message(WARNING "IWYU not found, skipping") +endif() + # Required for clock_gettime() in glibc <= 2.17 include(CheckLibraryExists) check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME) diff --git a/src/common.c b/src/common.c index 14f3ab8..40440a5 100644 --- a/src/common.c +++ b/src/common.c @@ -7,6 +7,7 @@ #include #include #include +#include char *progname = NULL; diff --git a/src/common.h b/src/common.h index 42b9caf..a289985 100644 --- a/src/common.h +++ b/src/common.h @@ -5,7 +5,6 @@ #define COMMON_H #include -#include /* Debug macros */ diff --git a/src/emu/bay.c b/src/emu/bay.c index a0e5440..1f5a400 100644 --- a/src/emu/bay.c +++ b/src/emu/bay.c @@ -4,7 +4,9 @@ //#define ENABLE_DEBUG #include "bay.h" - +#include +#include +#include "chan.h" #include "common.h" #include "uthash.h" #include "utlist.h" diff --git a/src/emu/bay.h b/src/emu/bay.h index ff89dab..6384733 100644 --- a/src/emu/bay.h +++ b/src/emu/bay.h @@ -4,15 +4,12 @@ #ifndef BAY_H #define BAY_H -#include "chan.h" +#include "common.h" #include "uthash.h" +struct chan; /* Handle connections between channels and callbacks */ -struct bay; -struct bay_cb; -struct bay_chan; - enum bay_cb_type { BAY_CB_DIRTY = 0, BAY_CB_EMIT, diff --git a/src/emu/chan.c b/src/emu/chan.c index e92a913..1c1f8c7 100644 --- a/src/emu/chan.c +++ b/src/emu/chan.c @@ -4,9 +4,10 @@ //#define ENABLE_DEBUG #include "chan.h" -#include "common.h" -#include #include +#include +#include +#include "common.h" void chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...) diff --git a/src/emu/chan.h b/src/emu/chan.h index 7b6a63d..500fe60 100644 --- a/src/emu/chan.h +++ b/src/emu/chan.h @@ -4,8 +4,9 @@ #ifndef CHAN_H #define CHAN_H -#include +#include "common.h" #include "value.h" +struct chan; #define MAX_CHAN_STACK 512 #define MAX_CHAN_NAME 512 @@ -39,8 +40,6 @@ union chan_data { struct value value; }; -struct chan; - typedef int (*chan_cb_t)(struct chan *chan, void *ptr); struct chan { diff --git a/src/emu/clkoff.c b/src/emu/clkoff.c index 72ca195..76a6325 100644 --- a/src/emu/clkoff.c +++ b/src/emu/clkoff.c @@ -2,9 +2,10 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "clkoff.h" - -#include "common.h" #include +#include +#include +#include "common.h" static struct clkoff_entry * cfind(struct clkoff *off, const char *name) diff --git a/src/emu/clkoff.h b/src/emu/clkoff.h index 74dd3f4..816b29d 100644 --- a/src/emu/clkoff.h +++ b/src/emu/clkoff.h @@ -4,12 +4,12 @@ #ifndef CLKOFF_H #define CLKOFF_H +#include +#include +#include #include "common.h" #include "uthash.h" -#include -#include - struct clkoff_entry { int64_t index; char name[PATH_MAX]; diff --git a/src/emu/cpu.c b/src/emu/cpu.c index 0f979bb..e2cab19 100644 --- a/src/emu/cpu.c +++ b/src/emu/cpu.c @@ -2,13 +2,20 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "cpu.h" - -#include "loom.h" +#include +#include +#include "bay.h" #include "chan.h" -#include "value.h" -#include "utlist.h" -#include "pv/pvt.h" #include "emu_prv.h" +#include "loom.h" +#include "proc.h" +#include "pv/pcf.h" +#include "pv/prv.h" +#include "pv/pvt.h" +#include "recorder.h" +#include "thread.h" +#include "utlist.h" +#include "value.h" static const char chan_fmt[] = "cpu%ld.%s"; static const char *chan_name[] = { diff --git a/src/emu/cpu.h b/src/emu/cpu.h index e7abb85..64ed896 100644 --- a/src/emu/cpu.h +++ b/src/emu/cpu.h @@ -4,17 +4,18 @@ #ifndef CPU_H #define CPU_H -struct cpu; /* Needed for thread and loom */ -struct loom; - -#include "thread.h" +#include +#include +#include #include "chan.h" -#include "track.h" -#include "bay.h" -#include "uthash.h" -#include "recorder.h" +#include "common.h" #include "extend.h" -#include +#include "uthash.h" +struct bay; +struct loom; +struct pcf_type; +struct recorder; +struct thread; enum cpu_chan { CPU_CHAN_NRUN = 0, diff --git a/src/emu/emu.c b/src/emu/emu.c index ab2ab5a..3634b05 100644 --- a/src/emu/emu.c +++ b/src/emu/emu.c @@ -1,14 +1,13 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _POSIX_C_SOURCE 2 - //#define ENABLE_DEBUG #include "emu.h" - -#include +#include +#include "emu_ev.h" #include "models.h" +#include "stream.h" int emu_init(struct emu *emu, int argc, char *argv[]) diff --git a/src/emu/emu.h b/src/emu/emu.h index 2bf16d9..ba3ec1b 100644 --- a/src/emu/emu.h +++ b/src/emu/emu.h @@ -5,14 +5,14 @@ #define EMU_H #include "bay.h" -#include "trace.h" +#include "common.h" #include "emu_args.h" -#include "system.h" -#include "player.h" -#include "model.h" -#include "emu_ev.h" -#include "recorder.h" #include "emu_stat.h" +#include "model.h" +#include "player.h" +#include "recorder.h" +#include "system.h" +#include "trace.h" struct emu { struct bay bay; diff --git a/src/emu/emu_args.c b/src/emu/emu_args.c index 26b5349..c044db6 100644 --- a/src/emu/emu_args.c +++ b/src/emu/emu_args.c @@ -1,14 +1,13 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _POSIX_C_SOURCE 2 - #include "emu_args.h" #include "common.h" #include "path.h" #include #include +#include static char progname[] = "ovniemu"; static char version[] = "1.0.0"; diff --git a/src/emu/emu_ev.c b/src/emu/emu_ev.c index 62acfec..1702144 100644 --- a/src/emu/emu_ev.c +++ b/src/emu/emu_ev.c @@ -2,6 +2,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "emu_ev.h" +#include "ovni.h" void emu_ev(struct emu_ev *ev, const struct ovni_ev *oev, diff --git a/src/emu/emu_ev.h b/src/emu/emu_ev.h index 3278d4c..dce7739 100644 --- a/src/emu/emu_ev.h +++ b/src/emu/emu_ev.h @@ -4,8 +4,9 @@ #ifndef EMU_EV_H #define EMU_EV_H -#include "ovni.h" +#include #include +struct ovni_ev; /* Easier to parse emulation event */ struct emu_ev { diff --git a/src/emu/emu_stat.c b/src/emu/emu_stat.c index f5dd636..ea3b4fc 100644 --- a/src/emu/emu_stat.c +++ b/src/emu/emu_stat.c @@ -1,12 +1,11 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _POSIX_C_SOURCE 200112L - #include "emu_stat.h" - -#include #include +#include +#include "common.h" +#include "player.h" static double get_time(void) diff --git a/src/emu/emu_stat.h b/src/emu/emu_stat.h index cb41495..c44c55e 100644 --- a/src/emu/emu_stat.h +++ b/src/emu/emu_stat.h @@ -4,7 +4,8 @@ #ifndef EMU_STAT_H #define EMU_STAT_H -#include "player.h" +#include +struct player; /* Easier to parse emulation event */ struct emu_stat { diff --git a/src/emu/kernel/event.c b/src/emu/kernel/event.c index 77badbc..3919897 100644 --- a/src/emu/kernel/event.c +++ b/src/emu/kernel/event.c @@ -2,11 +2,19 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "kernel_priv.h" +#include "chan.h" +#include "common.h" +#include "emu.h" +#include "emu_ev.h" +#include "extend.h" +#include "model_thread.h" +#include "thread.h" +#include "value.h" static int context_switch(struct emu *emu) { - struct kernel_thread *th = EXT(emu->thread, 'K'); + struct kernel_thread *th = extend_get(&emu->thread->ext, 'K'); struct chan *ch = &th->m.ch[CH_CS]; switch (emu->ev->v) { diff --git a/src/emu/kernel/setup.c b/src/emu/kernel/setup.c index 0c91166..2a70286 100644 --- a/src/emu/kernel/setup.c +++ b/src/emu/kernel/setup.c @@ -2,8 +2,19 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "kernel_priv.h" - +#include +#include "common.h" +#include "emu.h" #include "emu_prv.h" +#include "model.h" +#include "model_chan.h" +#include "model_cpu.h" +#include "model_pvt.h" +#include "model_thread.h" +#include "pv/pcf.h" +#include "pv/prv.h" +#include "system.h" +#include "track.h" static const char model_name[] = "kernel"; enum { model_id = 'K' }; diff --git a/src/emu/loom.c b/src/emu/loom.c index 9868e79..fdce75e 100644 --- a/src/emu/loom.c +++ b/src/emu/loom.c @@ -2,14 +2,13 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "loom.h" - +#include +#include #include #include "cpu.h" -#include "proc.h" -#include "thread.h" -#include "uthash.h" -#include "utlist.h" #include "path.h" +#include "proc.h" +#include "uthash.h" static const char *loom_prefix = "loom."; diff --git a/src/emu/loom.h b/src/emu/loom.h index cd53f35..4381538 100644 --- a/src/emu/loom.h +++ b/src/emu/loom.h @@ -4,16 +4,14 @@ #ifndef LOOM_H #define LOOM_H -struct loom; - +#include #include #include -#include #include -#include "cpu.h" -#include "proc.h" -#include "thread.h" #include "common.h" +#include "cpu.h" +#include "extend.h" +struct proc; struct loom { size_t gindex; diff --git a/src/emu/metadata.c b/src/emu/metadata.c index a376b7c..b28253b 100644 --- a/src/emu/metadata.c +++ b/src/emu/metadata.c @@ -2,9 +2,13 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "metadata.h" - +#include +#include +#include "cpu.h" +#include "loom.h" #include "ovni.h" #include "parson.h" +#include "proc.h" static JSON_Object * load_json(const char *path) diff --git a/src/emu/metadata.h b/src/emu/metadata.h index 244d9bf..a604660 100644 --- a/src/emu/metadata.h +++ b/src/emu/metadata.h @@ -4,9 +4,9 @@ #ifndef METADATA_H #define METADATA_H -#include "loom.h" -#include "proc.h" #include "common.h" +struct loom; +struct proc; USE_RET int metadata_load(const char *path, struct loom *loom, struct proc *proc); diff --git a/src/emu/model.c b/src/emu/model.c index f69869c..b44203f 100644 --- a/src/emu/model.c +++ b/src/emu/model.c @@ -4,9 +4,9 @@ //#define ENABLE_DEBUG #include "model.h" - -#include "common.h" #include +#include "common.h" +struct emu; void model_init(struct model *model) diff --git a/src/emu/model.h b/src/emu/model.h index 5533001..21c707b 100644 --- a/src/emu/model.h +++ b/src/emu/model.h @@ -4,8 +4,9 @@ #ifndef MODEL_H #define MODEL_H -#include "emu_hook.h" #include "common.h" +#include "emu_hook.h" +struct emu; struct model_spec { const char *name; diff --git a/src/emu/model_chan.h b/src/emu/model_chan.h index a4fd1d0..d0649c7 100644 --- a/src/emu/model_chan.h +++ b/src/emu/model_chan.h @@ -4,7 +4,7 @@ #ifndef MODEL_CHAN_H #define MODEL_CHAN_H -#include "model_pvt.h" +struct model_pvt_spec; struct model_chan_spec { int nch; diff --git a/src/emu/model_cpu.c b/src/emu/model_cpu.c index cda75c4..6fdebf2 100644 --- a/src/emu/model_cpu.c +++ b/src/emu/model_cpu.c @@ -2,8 +2,21 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "model_cpu.h" - +#include +#include +#include "chan.h" +#include "common.h" +#include "cpu.h" +#include "emu.h" +#include "extend.h" +#include "model.h" +#include "model_chan.h" +#include "model_pvt.h" #include "model_thread.h" +#include "system.h" +#include "thread.h" +#include "track.h" +struct bay; static struct model_cpu * get_model_cpu(struct cpu *cpu, int id) diff --git a/src/emu/model_cpu.h b/src/emu/model_cpu.h index 7a4813b..80c8b3e 100644 --- a/src/emu/model_cpu.h +++ b/src/emu/model_cpu.h @@ -4,14 +4,9 @@ #ifndef MODEL_CPU_H #define MODEL_CPU_H -struct model_cpu_spec; - -#include "emu.h" -#include "bay.h" -#include "track.h" -#include "model.h" -#include "model_chan.h" +#include #include "common.h" +struct emu; struct model_cpu_spec { size_t size; diff --git a/src/emu/model_pvt.c b/src/emu/model_pvt.c index b082416..e87f49b 100644 --- a/src/emu/model_pvt.c +++ b/src/emu/model_pvt.c @@ -2,6 +2,22 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "model_pvt.h" +#include +#include "common.h" +#include "cpu.h" +#include "emu.h" +#include "extend.h" +#include "model.h" +#include "model_chan.h" +#include "model_cpu.h" +#include "model_thread.h" +#include "pv/pcf.h" +#include "pv/prv.h" +#include "pv/pvt.h" +#include "recorder.h" +#include "system.h" +#include "thread.h" +#include "track.h" static const char *pcf_suffix[TRACK_TH_MAX] = { [TRACK_TH_ANY] = "", diff --git a/src/emu/model_pvt.h b/src/emu/model_pvt.h index 77a7e37..4aaadff 100644 --- a/src/emu/model_pvt.h +++ b/src/emu/model_pvt.h @@ -4,9 +4,10 @@ #ifndef MODEL_PRV_H #define MODEL_PRV_H -#include "emu.h" -#include "pv/pcf.h" #include "common.h" +struct emu; +struct model_cpu_spec; +struct model_thread_spec; struct model_pvt_spec { const int *type; @@ -16,9 +17,6 @@ struct model_pvt_spec { const struct pcf_value_label **label; }; -#include "model_cpu.h" -#include "model_thread.h" - USE_RET int model_pvt_connect_cpu(struct emu *emu, const struct model_cpu_spec *spec); USE_RET int model_pvt_connect_thread(struct emu *emu, const struct model_thread_spec *spec); diff --git a/src/emu/model_thread.c b/src/emu/model_thread.c index 5f5139a..ef7faaf 100644 --- a/src/emu/model_thread.c +++ b/src/emu/model_thread.c @@ -2,8 +2,19 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "model_thread.h" - +#include +#include +#include "bay.h" +#include "chan.h" +#include "common.h" +#include "emu.h" +#include "extend.h" +#include "model.h" +#include "model_chan.h" #include "model_pvt.h" +#include "system.h" +#include "thread.h" +#include "track.h" static int init_chan(struct model_thread *th, const struct model_chan_spec *spec, int64_t gindex) diff --git a/src/emu/model_thread.h b/src/emu/model_thread.h index cfe7f23..1539653 100644 --- a/src/emu/model_thread.h +++ b/src/emu/model_thread.h @@ -4,14 +4,9 @@ #ifndef MODEL_THREAD_H #define MODEL_THREAD_H -struct model_thread_spec; - -#include "emu.h" -#include "bay.h" -#include "track.h" -#include "model.h" -#include "model_chan.h" +#include #include "common.h" +struct emu; struct model_thread_spec { size_t size; diff --git a/src/emu/models.c b/src/emu/models.c index ac8116e..4488598 100644 --- a/src/emu/models.c +++ b/src/emu/models.c @@ -4,6 +4,7 @@ #include "models.h" #include "common.h" +#include "model.h" #include extern struct model_spec model_ovni; diff --git a/src/emu/models.h b/src/emu/models.h index eaf3972..e89ac63 100644 --- a/src/emu/models.h +++ b/src/emu/models.h @@ -4,7 +4,8 @@ #ifndef MODELS_H #define MODELS_H -#include "model.h" +#include "common.h" +struct model; USE_RET int models_register(struct model *model); diff --git a/src/emu/mux.c b/src/emu/mux.c index aa574db..b6acf71 100644 --- a/src/emu/mux.c +++ b/src/emu/mux.c @@ -4,6 +4,10 @@ //#define ENABLE_DEBUG #include "mux.h" +#include +#include +#include "bay.h" +#include "chan.h" static int default_select(struct mux *mux, diff --git a/src/emu/mux.h b/src/emu/mux.h index 89aca52..d9735a7 100644 --- a/src/emu/mux.h +++ b/src/emu/mux.h @@ -5,9 +5,10 @@ #define MUX_H #include -#include "bay.h" -#include "uthash.h" - +#include "common.h" +#include "value.h" +struct bay; +struct chan; struct mux; struct mux_input { diff --git a/src/emu/nanos6/event.c b/src/emu/nanos6/event.c index 3bec89c..d5186ea 100644 --- a/src/emu/nanos6/event.c +++ b/src/emu/nanos6/event.c @@ -2,6 +2,19 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "nanos6_priv.h" +#include +#include +#include "chan.h" +#include "common.h" +#include "emu.h" +#include "emu_ev.h" +#include "extend.h" +#include "model_thread.h" +#include "ovni.h" +#include "proc.h" +#include "task.h" +#include "thread.h" +#include "value.h" enum { PUSH = 1, POP = 2, IGN = 3 }; diff --git a/src/emu/nanos6/setup.c b/src/emu/nanos6/setup.c index 3f301c3..c5dc32f 100644 --- a/src/emu/nanos6/setup.c +++ b/src/emu/nanos6/setup.c @@ -2,8 +2,29 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "nanos6_priv.h" - +#include +#include +#include "chan.h" +#include "common.h" +#include "emu.h" +#include "emu_args.h" #include "emu_prv.h" +#include "extend.h" +#include "model.h" +#include "model_chan.h" +#include "model_cpu.h" +#include "model_pvt.h" +#include "model_thread.h" +#include "proc.h" +#include "pv/pcf.h" +#include "pv/prv.h" +#include "pv/pvt.h" +#include "recorder.h" +#include "system.h" +#include "task.h" +#include "thread.h" +#include "track.h" +#include "value.h" static const char model_name[] = "nanos6"; enum { model_id = '6' }; diff --git a/src/emu/nodes/event.c b/src/emu/nodes/event.c index 6b2bd2a..2b6a7a4 100644 --- a/src/emu/nodes/event.c +++ b/src/emu/nodes/event.c @@ -2,6 +2,14 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "nodes_priv.h" +#include "chan.h" +#include "common.h" +#include "emu.h" +#include "emu_ev.h" +#include "extend.h" +#include "model_thread.h" +#include "thread.h" +#include "value.h" enum { PUSH = 1, POP = 2, IGN = 3 }; diff --git a/src/emu/nodes/setup.c b/src/emu/nodes/setup.c index c50d214..a0989bf 100644 --- a/src/emu/nodes/setup.c +++ b/src/emu/nodes/setup.c @@ -2,8 +2,24 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "nodes_priv.h" - +#include +#include "chan.h" +#include "common.h" +#include "emu.h" +#include "emu_args.h" #include "emu_prv.h" +#include "extend.h" +#include "model.h" +#include "model_chan.h" +#include "model_cpu.h" +#include "model_pvt.h" +#include "model_thread.h" +#include "pv/pcf.h" +#include "pv/prv.h" +#include "system.h" +#include "thread.h" +#include "track.h" +#include "value.h" static const char model_name[] = "nodes"; enum { model_id = 'D' }; diff --git a/src/emu/nosv/event.c b/src/emu/nosv/event.c index cfb2005..e3691eb 100644 --- a/src/emu/nosv/event.c +++ b/src/emu/nosv/event.c @@ -2,6 +2,19 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "nosv_priv.h" +#include +#include +#include "chan.h" +#include "common.h" +#include "emu.h" +#include "emu_ev.h" +#include "extend.h" +#include "model_thread.h" +#include "ovni.h" +#include "proc.h" +#include "task.h" +#include "thread.h" +#include "value.h" enum { PUSH = 1, POP = 2, IGN = 3 }; diff --git a/src/emu/nosv/setup.c b/src/emu/nosv/setup.c index a52a9f0..2e1f245 100644 --- a/src/emu/nosv/setup.c +++ b/src/emu/nosv/setup.c @@ -2,8 +2,29 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "nosv_priv.h" - +#include +#include +#include "chan.h" +#include "common.h" +#include "emu.h" +#include "emu_args.h" #include "emu_prv.h" +#include "extend.h" +#include "model.h" +#include "model_chan.h" +#include "model_cpu.h" +#include "model_pvt.h" +#include "model_thread.h" +#include "proc.h" +#include "pv/pcf.h" +#include "pv/prv.h" +#include "pv/pvt.h" +#include "recorder.h" +#include "system.h" +#include "task.h" +#include "thread.h" +#include "track.h" +#include "value.h" static const char model_name[] = "nosv"; enum { model_id = 'V' }; diff --git a/src/emu/ovni/event.c b/src/emu/ovni/event.c index bdc32b6..9d197fd 100644 --- a/src/emu/ovni/event.c +++ b/src/emu/ovni/event.c @@ -4,10 +4,20 @@ //#define ENABLE_DEBUG #include "ovni_priv.h" - -#include "emu.h" -#include "loom.h" +#include +#include +#include "chan.h" #include "common.h" +#include "cpu.h" +#include "emu.h" +#include "emu_ev.h" +#include "extend.h" +#include "loom.h" +#include "model_thread.h" +#include "ovni.h" +#include "proc.h" +#include "thread.h" +#include "value.h" static int pre_thread_execute(struct emu *emu, struct thread *th) diff --git a/src/emu/ovni/setup.c b/src/emu/ovni/setup.c index 8326c33..331b4e9 100644 --- a/src/emu/ovni/setup.c +++ b/src/emu/ovni/setup.c @@ -2,8 +2,20 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "ovni_priv.h" - +#include +#include "common.h" +#include "emu.h" #include "emu_prv.h" +#include "model.h" +#include "model_chan.h" +#include "model_cpu.h" +#include "model_pvt.h" +#include "model_thread.h" +#include "pv/pcf.h" +#include "pv/prv.h" +#include "system.h" +#include "thread.h" +#include "track.h" static const char model_name[] = "ovni"; enum { model_id = 'O' }; diff --git a/src/emu/ovnidump.c b/src/emu/ovnidump.c index 1ebff11..10a36dc 100644 --- a/src/emu/ovnidump.c +++ b/src/emu/ovnidump.c @@ -1,11 +1,15 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _GNU_SOURCE - +#include +#include +#include #include - +#include "common.h" +#include "emu_ev.h" +#include "ovni.h" #include "player.h" +#include "stream.h" #include "trace.h" char *tracedir; diff --git a/src/emu/ovnisort.c b/src/emu/ovnisort.c index 2235baf..86c07d1 100644 --- a/src/emu/ovnisort.c +++ b/src/emu/ovnisort.c @@ -11,23 +11,14 @@ * that we will look back is limited by N. */ -#define _GNU_SOURCE - -#include -#include #include -#include -#include #include -#include #include #include -#include -#include #include - -#include "emu.h" +#include "common.h" #include "ovni.h" +#include "stream.h" #include "trace.h" struct ring { diff --git a/src/emu/ovnisync.c b/src/emu/ovnisync.c index ef58ce1..eeaf1ef 100644 --- a/src/emu/ovnisync.c +++ b/src/emu/ovnisync.c @@ -1,20 +1,16 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _POSIX_C_SOURCE 200809L - #include -#include #include #include +#include #include #include #include #include -#include #include #include - #include "ovni.h" const char progname[] = "ovnisync"; diff --git a/src/emu/player.c b/src/emu/player.c index 3161026..d7c4254 100644 --- a/src/emu/player.c +++ b/src/emu/player.c @@ -2,8 +2,11 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "player.h" - +#include +#include #include "heap.h" +#include "stream.h" +#include "trace.h" #include "utlist.h" /* diff --git a/src/emu/player.h b/src/emu/player.h index 837343d..6d17a21 100644 --- a/src/emu/player.h +++ b/src/emu/player.h @@ -4,10 +4,11 @@ #ifndef EMU_PLAYER_H #define EMU_PLAYER_H -#include "trace.h" +#include +#include "common.h" #include "emu_ev.h" - -#include +#include "heap.h" +struct trace; struct player { struct trace *trace; diff --git a/src/emu/proc.c b/src/emu/proc.c index 36dbc32..a521d4e 100644 --- a/src/emu/proc.c +++ b/src/emu/proc.c @@ -2,10 +2,11 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "proc.h" - -#include "utlist.h" +#include +#include +#include #include "path.h" -#include +#include "thread.h" static int get_pid(const char *id, int *pid) diff --git a/src/emu/proc.h b/src/emu/proc.h index af43b0e..892e798 100644 --- a/src/emu/proc.h +++ b/src/emu/proc.h @@ -4,14 +4,14 @@ #ifndef PROC_H #define PROC_H -/* No loom dependency here */ -#include "thread.h" +#include +#include +#include "common.h" +#include "extend.h" #include "parson.h" #include "uthash.h" -#include "extend.h" -#include -#include -#include +struct loom; +struct thread; struct proc { int64_t gindex; diff --git a/src/emu/pv/cfg.c b/src/emu/pv/cfg.c index b25cefc..29ac7bb 100644 --- a/src/emu/pv/cfg.c +++ b/src/emu/pv/cfg.c @@ -1,17 +1,13 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _POSIX_C_SOURCE 200112L - #include "cfg.h" - #include -#include +#include #include -#include -#include +#include #include - +#include #include "common.h" #include "config.h" diff --git a/src/emu/pv/pcf.c b/src/emu/pv/pcf.c index bf86178..52f6d06 100644 --- a/src/emu/pv/pcf.c +++ b/src/emu/pv/pcf.c @@ -2,11 +2,11 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "pcf.h" - -#include "common.h" -#include #include #include +#include +#include +#include "common.h" /* clang-format off */ diff --git a/src/emu/pv/pcf.h b/src/emu/pv/pcf.h index e5c9c43..512c12d 100644 --- a/src/emu/pv/pcf.h +++ b/src/emu/pv/pcf.h @@ -4,15 +4,12 @@ #ifndef PCF_H #define PCF_H +#include #include "common.h" #include "uthash.h" -#include #define MAX_PCF_LABEL 512 -struct pcf_value; -struct pcf_type; - struct pcf_value { int value; char label[MAX_PCF_LABEL]; diff --git a/src/emu/pv/prf.c b/src/emu/pv/prf.c index 6eb473b..0414457 100644 --- a/src/emu/pv/prf.c +++ b/src/emu/pv/prf.c @@ -4,6 +4,7 @@ #include "prf.h" #include +#include #include "common.h" int diff --git a/src/emu/pv/prv.c b/src/emu/pv/prv.c index b28088a..1d757c2 100644 --- a/src/emu/pv/prv.c +++ b/src/emu/pv/prv.c @@ -5,7 +5,11 @@ #include "prv.h" #include -#include +#include +#include +#include "bay.h" +#include "chan.h" +#include "common.h" static void write_header(FILE *f, long long duration, int nrows) diff --git a/src/emu/pv/prv.h b/src/emu/pv/prv.h index f45375c..67f503c 100644 --- a/src/emu/pv/prv.h +++ b/src/emu/pv/prv.h @@ -4,12 +4,13 @@ #ifndef PRV_H #define PRV_H -#include "chan.h" -#include "bay.h" -#include "uthash.h" +#include #include - -struct prv; +#include "common.h" +#include "uthash.h" +#include "value.h" +struct bay; +struct chan; enum prv_flags { PRV_EMITDUP = 1<<0, /* Emit duplicates (no error, emit) */ diff --git a/src/emu/pv/pvt.c b/src/emu/pv/pvt.c index 94dc681..6c4bcd6 100644 --- a/src/emu/pv/pvt.c +++ b/src/emu/pv/pvt.c @@ -2,6 +2,11 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "pvt.h" +#include +#include +#include "pv/pcf.h" +#include "pv/prf.h" +#include "pv/prv.h" int pvt_open(struct pvt *pvt, long nrows, const char *dir, const char *name) diff --git a/src/emu/pv/pvt.h b/src/emu/pv/pvt.h index ade1c49..11bd849 100644 --- a/src/emu/pv/pvt.h +++ b/src/emu/pv/pvt.h @@ -4,11 +4,13 @@ #ifndef PVT_H #define PVT_H -#include "prv.h" +#include +#include +#include "common.h" #include "pcf.h" #include "prf.h" +#include "prv.h" #include "uthash.h" -#include struct pvt { char dir[PATH_MAX]; diff --git a/src/emu/recorder.c b/src/emu/recorder.c index 411fd5a..b66fb92 100644 --- a/src/emu/recorder.c +++ b/src/emu/recorder.c @@ -1,11 +1,13 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define ENABLE_DEBUG - #include "recorder.h" - +#include +#include +#include #include "pv/cfg.h" +#include "pv/pvt.h" +#include "uthash.h" int recorder_init(struct recorder *rec, const char *dir) diff --git a/src/emu/recorder.h b/src/emu/recorder.h index f3178b6..99e9004 100644 --- a/src/emu/recorder.h +++ b/src/emu/recorder.h @@ -6,9 +6,9 @@ /* Records data into files (Paraver traces only for now) */ -#include "pv/pvt.h" - -#include +#include +#include +#include "common.h" struct recorder { char dir[PATH_MAX]; /* To place the traces */ diff --git a/src/emu/stream.c b/src/emu/stream.c index b92d21f..76715b6 100644 --- a/src/emu/stream.c +++ b/src/emu/stream.c @@ -2,13 +2,14 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "stream.h" - +#include +#include +#include +#include +#include +#include #include "ovni.h" #include "path.h" -#include -#include -#include -#include static int check_stream_header(struct stream *stream) diff --git a/src/emu/stream.h b/src/emu/stream.h index e0ce36b..93463da 100644 --- a/src/emu/stream.h +++ b/src/emu/stream.h @@ -4,12 +4,11 @@ #ifndef STREAM_H #define STREAM_H -#include "ovni.h" -#include "heap.h" +#include #include -#include - -struct stream; +#include "common.h" +#include "heap.h" +struct ovni_ev; struct stream { struct ovni_ev *cur_ev; diff --git a/src/emu/system.c b/src/emu/system.c index 02c7df0..37032d6 100644 --- a/src/emu/system.c +++ b/src/emu/system.c @@ -2,9 +2,26 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "system.h" -#include "utlist.h" -#include "metadata.h" #include +#include +#include +#include +#include +#include +#include "cpu.h" +#include "emu_args.h" +#include "loom.h" +#include "metadata.h" +#include "proc.h" +#include "pv/prf.h" +#include "pv/pvt.h" +#include "recorder.h" +#include "stream.h" +#include "thread.h" +#include "trace.h" +#include "uthash.h" +#include "utlist.h" +struct bay; static struct thread * create_thread(struct proc *proc, const char *relpath) diff --git a/src/emu/system.h b/src/emu/system.h index 0da1571..f040549 100644 --- a/src/emu/system.h +++ b/src/emu/system.h @@ -4,16 +4,14 @@ #ifndef EMU_SYSTEM_H #define EMU_SYSTEM_H -#include "emu_args.h" -#include "trace.h" -#include "stream.h" -#include "loom.h" -#include "proc.h" -#include "thread.h" -#include "cpu.h" -#include "clkoff.h" -#include "recorder.h" #include +#include "clkoff.h" +#include "common.h" +struct bay; +struct emu_args; +struct recorder; +struct stream; +struct trace; /* Map from stream to lpt */ struct lpt { diff --git a/src/emu/task.c b/src/emu/task.c index 92faef6..0bf4458 100644 --- a/src/emu/task.c +++ b/src/emu/task.c @@ -2,7 +2,10 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "task.h" - +#include +#include +#include +#include "thread.h" #include "utlist.h" struct task * diff --git a/src/emu/task.h b/src/emu/task.h index 8eebe1d..54c90f6 100644 --- a/src/emu/task.h +++ b/src/emu/task.h @@ -5,9 +5,9 @@ #define TASK_H #include -#include "uthash.h" +#include "common.h" #include "pv/pcf.h" -#include "thread.h" +#include "uthash.h" enum task_state { TASK_ST_CREATED, diff --git a/src/emu/thread.c b/src/emu/thread.c index 07e5ecd..c046c6c 100644 --- a/src/emu/thread.c +++ b/src/emu/thread.c @@ -2,11 +2,21 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "thread.h" - -#include "emu_prv.h" -#include "path.h" -#include "bay.h" #include +#include +#include +#include +#include "bay.h" +#include "cpu.h" +#include "emu_prv.h" +#include "mux.h" +#include "path.h" +#include "pv/pcf.h" +#include "pv/prv.h" +#include "pv/pvt.h" +#include "recorder.h" +#include "value.h" +struct proc; static const char chan_fmt[] = "thread%lu.%s"; static const char *chan_name[] = { diff --git a/src/emu/thread.h b/src/emu/thread.h index b69d110..2cfb78d 100644 --- a/src/emu/thread.h +++ b/src/emu/thread.h @@ -4,18 +4,21 @@ #ifndef THREAD_H #define THREAD_H -struct thread; /* Needed for cpu */ - -#include "cpu.h" -#include "proc.h" -#include "chan.h" -#include "bay.h" -#include "uthash.h" -#include "recorder.h" -#include "extend.h" -#include "mux.h" +#include #include -#include +#include +#include "chan.h" +#include "common.h" +#include "extend.h" +#include "uthash.h" +struct bay; +struct cpu; +struct mux; +struct mux_input; +struct pcf; +struct proc; +struct recorder; +struct value; /* Emulated thread runtime status */ enum thread_state { diff --git a/src/emu/trace.c b/src/emu/trace.c index 50fbeac..4ba0ca9 100644 --- a/src/emu/trace.c +++ b/src/emu/trace.c @@ -4,11 +4,14 @@ #define _XOPEN_SOURCE 500 #include "trace.h" -#include "utlist.h" -#include "path.h" +#include +#include #include #include -#include +#include "ovni.h" +#include "path.h" +#include "stream.h" +#include "utlist.h" /* See the nftw(3) manual to see why we need a global variable here: * https://pubs.opengroup.org/onlinepubs/9699919799/functions/nftw.html */ diff --git a/src/emu/trace.h b/src/emu/trace.h index 8a5352a..c25f98e 100644 --- a/src/emu/trace.h +++ b/src/emu/trace.h @@ -4,9 +4,8 @@ #ifndef EMU_TRACE_H #define EMU_TRACE_H -#include "stream.h" - -#include +#include +#include "common.h" struct trace { char tracedir[PATH_MAX]; diff --git a/src/emu/track.c b/src/emu/track.c index 499f3dc..f7d313c 100644 --- a/src/emu/track.c +++ b/src/emu/track.c @@ -2,9 +2,10 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "track.h" - -#include "thread.h" #include +#include +#include "bay.h" +#include "thread.h" static const char *th_suffix[TRACK_TH_MAX] = { [TRACK_TH_ANY] = ".any", diff --git a/src/emu/track.h b/src/emu/track.h index 0dc514a..09d006b 100644 --- a/src/emu/track.h +++ b/src/emu/track.h @@ -4,7 +4,11 @@ #ifndef TRACK_H #define TRACK_H +#include +#include "chan.h" +#include "common.h" #include "mux.h" +struct bay; enum track_type { TRACK_TYPE_TH = 0, diff --git a/src/include/compat.h b/src/include/compat.h index 94bf264..b7f2418 100644 --- a/src/include/compat.h +++ b/src/include/compat.h @@ -4,19 +4,49 @@ #ifndef COMPAT_H #define COMPAT_H -#define _GNU_SOURCE -#include -#include +#include +pid_t gettid(void); /* Define gettid for older glibc versions (below 2.30) */ #if defined(__GLIBC__) #if !__GLIBC_PREREQ(2, 30) + +#include +#include + static inline pid_t gettid(void) { return (pid_t) syscall(SYS_gettid); } + #endif /* !__GLIBC_PREREQ(2, 30) */ #endif /* defined(__GLIBC__) */ +/* usleep is deprecated */ + +#include +#include + +static inline int +sleep_us(long usec) +{ + struct timespec ts; + int res; + + if (usec < 0) { + errno = EINVAL; + return -1; + } + + ts.tv_sec = usec / 1000000L; + ts.tv_nsec = (usec % 1000000L) * 1000L; + + do { + res = nanosleep(&ts, &ts); + } while (res && errno == EINTR); + + return res; +} + #endif /* COMPAT_H */ diff --git a/src/include/version.h b/src/include/version.h index 1a3bd92..82085e4 100644 --- a/src/include/version.h +++ b/src/include/version.h @@ -1,8 +1,6 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: MIT */ -#define _GNU_SOURCE - #include #include #include diff --git a/src/rt/ovni.c b/src/rt/ovni.c index c0b8fca..ea21704 100644 --- a/src/rt/ovni.c +++ b/src/rt/ovni.c @@ -1,20 +1,18 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: MIT */ -#define _GNU_SOURCE - #include -#include #include +#include #include #include -#include +#include +#include #include #include #include #include "common.h" -#include "compat.h" #include "ovni.h" #include "parson.h" #include "version.h" diff --git a/test/emu/CMakeLists.txt b/test/emu/CMakeLists.txt index cdc3cc4..d87efb3 100644 --- a/test/emu/CMakeLists.txt +++ b/test/emu/CMakeLists.txt @@ -1,6 +1,13 @@ -# Copyright (c) 2022 Barcelona Supercomputing Center (BSC) +# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC) # SPDX-License-Identifier: GPL-3.0-or-later +function(test_emu) + ovni_test(${ARGN}) + target_link_libraries("${OVNI_TEST_NAME}" + PRIVATE instr-static) +endfunction() + +add_subdirectory(common) add_subdirectory(ovni) add_subdirectory(nosv) add_subdirectory(nanos6) diff --git a/test/emu/common/CMakeLists.txt b/test/emu/common/CMakeLists.txt new file mode 100644 index 0000000..265f7f2 --- /dev/null +++ b/test/emu/common/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2023 Barcelona Supercomputing Center (BSC) +# SPDX-License-Identifier: GPL-3.0-or-later + +add_library(instr-static STATIC instr.c) +target_include_directories(instr-static + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" + PRIVATE "${CMAKE_SOURCE_DIR}/src" + PRIVATE "${CMAKE_SOURCE_DIR}/src/include" + PRIVATE "${CMAKE_SOURCE_DIR}/include" +) +target_link_libraries(ovni-static parson-static common-static) diff --git a/test/emu/instr.c b/test/emu/common/instr.c similarity index 100% rename from test/emu/instr.c rename to test/emu/common/instr.c diff --git a/test/emu/instr.h b/test/emu/common/instr.h similarity index 95% rename from test/emu/instr.h rename to test/emu/common/instr.h index fccdba4..58479f5 100644 --- a/test/emu/instr.h +++ b/test/emu/common/instr.h @@ -4,20 +4,13 @@ #ifndef INSTR_H #define INSTR_H -#define _GNU_SOURCE /* For gethostname() */ - +#include +#include +#include #include "common.h" #include "compat.h" #include "ovni.h" -#include -#include -#include -#include -#include -#include -#include - extern int first_clock_set; extern int64_t first_clock; extern int64_t last_clock; @@ -88,7 +81,7 @@ instr_start(int rank, int nranks) char hostname[OVNI_MAX_HOSTNAME]; char rankname[OVNI_MAX_HOSTNAME + 64]; - if (gethostname(hostname, HOST_NAME_MAX) != 0) + if (gethostname(hostname, OVNI_MAX_HOSTNAME) != 0) die("gethostname failed"); sprintf(rankname, "%s.%d", hostname, rank); diff --git a/test/emu/nanos6/CMakeLists.txt b/test/emu/nanos6/CMakeLists.txt index 2ca2108..5411544 100644 --- a/test/emu/nanos6/CMakeLists.txt +++ b/test/emu/nanos6/CMakeLists.txt @@ -1,12 +1,12 @@ -# Copyright (c) 2022 Barcelona Supercomputing Center (BSC) +# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC) # SPDX-License-Identifier: GPL-3.0-or-later -ovni_test(nested-tasks.c) -ovni_test(nested-tasks-bad.c SHOULD_FAIL +test_emu(nested-tasks.c) +test_emu(nested-tasks-bad.c SHOULD_FAIL REGEX "cannot execute task 1: state is not created") -ovni_test(task-types.c MP) -ovni_test(blocking.c MP) -ovni_test(ss-mismatch.c SHOULD_FAIL +test_emu(task-types.c MP) +test_emu(blocking.c MP) +test_emu(ss-mismatch.c SHOULD_FAIL REGEX "thread [0-9]\\+ ended with 1 stacked nanos6 subsystems") -ovni_test(delayed-connect-ss.c) -ovni_test(switch-same-type.c) +test_emu(delayed-connect-ss.c) +test_emu(switch-same-type.c) diff --git a/test/emu/nanos6/blocking.c b/test/emu/nanos6/blocking.c index 5187505..3c3f8b3 100644 --- a/test/emu/nanos6/blocking.c +++ b/test/emu/nanos6/blocking.c @@ -1,6 +1,10 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +#include +#include +#include "compat.h" +#include "instr.h" #include "instr_nanos6.h" int @@ -17,13 +21,13 @@ main(void) instr_nanos6_type_create(typeid); instr_nanos6_task_create_and_execute(taskid, typeid); - usleep(us); + sleep_us(us); instr_nanos6_block_enter(); instr_nanos6_task_pause(taskid); - usleep(us); + sleep_us(us); instr_nanos6_task_resume(taskid); instr_nanos6_block_exit(); - usleep(us); + sleep_us(us); instr_nanos6_task_end(taskid); instr_nanos6_task_body_exit(); diff --git a/test/emu/nanos6/delayed-connect-ss.c b/test/emu/nanos6/delayed-connect-ss.c index 3b1bf9b..400b350 100644 --- a/test/emu/nanos6/delayed-connect-ss.c +++ b/test/emu/nanos6/delayed-connect-ss.c @@ -1,9 +1,12 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#include "instr_nanos6.h" - +#include +#include +#include "common.h" #include "emu_prv.h" +#include "instr.h" +#include "instr_nanos6.h" #include "nanos6/nanos6_priv.h" int diff --git a/test/emu/nanos6/instr_nanos6.h b/test/emu/nanos6/instr_nanos6.h index 8a14e9f..6c5c621 100644 --- a/test/emu/nanos6/instr_nanos6.h +++ b/test/emu/nanos6/instr_nanos6.h @@ -4,7 +4,7 @@ #ifndef INSTR_NANOS6_H #define INSTR_NANOS6_H -#include "../instr.h" +#include "instr.h" #include "task.h" diff --git a/test/emu/nanos6/nested-tasks-bad.c b/test/emu/nanos6/nested-tasks-bad.c index 6d28044..4624aef 100644 --- a/test/emu/nanos6/nested-tasks-bad.c +++ b/test/emu/nanos6/nested-tasks-bad.c @@ -1,6 +1,8 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +#include +#include "instr.h" #include "instr_nanos6.h" int diff --git a/test/emu/nanos6/nested-tasks.c b/test/emu/nanos6/nested-tasks.c index c006cea..1c5c443 100644 --- a/test/emu/nanos6/nested-tasks.c +++ b/test/emu/nanos6/nested-tasks.c @@ -1,6 +1,9 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +#include +#include "compat.h" +#include "instr.h" #include "instr_nanos6.h" int @@ -17,7 +20,7 @@ main(void) for (int i = 0; i < ntasks; i++) { instr_nanos6_handle_task_enter(); instr_nanos6_task_create_and_execute(i + 1, typeid); - usleep(500); + sleep_us(500); } /* End the tasks in the opposite order */ diff --git a/test/emu/nanos6/ss-mismatch.c b/test/emu/nanos6/ss-mismatch.c index 5d53f44..17b9090 100644 --- a/test/emu/nanos6/ss-mismatch.c +++ b/test/emu/nanos6/ss-mismatch.c @@ -1,6 +1,7 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +#include "instr.h" #include "instr_nanos6.h" int diff --git a/test/emu/nanos6/switch-same-type.c b/test/emu/nanos6/switch-same-type.c index 98c6cc7..19dcf99 100644 --- a/test/emu/nanos6/switch-same-type.c +++ b/test/emu/nanos6/switch-same-type.c @@ -1,9 +1,12 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#include "instr_nanos6.h" - +#include +#include +#include "common.h" #include "emu_prv.h" +#include "instr.h" +#include "instr_nanos6.h" int main(void) diff --git a/test/emu/nanos6/task-types.c b/test/emu/nanos6/task-types.c index dab7727..35d9b4c 100644 --- a/test/emu/nanos6/task-types.c +++ b/test/emu/nanos6/task-types.c @@ -1,6 +1,9 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +#include +#include "compat.h" +#include "instr.h" #include "instr_nanos6.h" int @@ -19,7 +22,7 @@ main(void) for (int i = 0; i < ntasks; i++) { instr_nanos6_task_create_and_execute(i + 1, (i % ntypes) + 1); - usleep(500); + sleep_us(500); instr_nanos6_task_end(i + 1); instr_nanos6_task_body_exit(); } diff --git a/test/emu/nosv/CMakeLists.txt b/test/emu/nosv/CMakeLists.txt index 4bed229..987761d 100644 --- a/test/emu/nosv/CMakeLists.txt +++ b/test/emu/nosv/CMakeLists.txt @@ -1,10 +1,10 @@ -# Copyright (c) 2022 Barcelona Supercomputing Center (BSC) +# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC) # SPDX-License-Identifier: GPL-3.0-or-later -ovni_test(nested-tasks.c) -ovni_test(nested-tasks-bad.c SHOULD_FAIL +test_emu(nested-tasks.c) +test_emu(nested-tasks-bad.c SHOULD_FAIL REGEX "cannot execute task 1: state is not created") -ovni_test(task-types.c MP) -ovni_test(pause.c MP) -ovni_test(mp-rank.c MP) -ovni_test(switch-same-type.c) +test_emu(task-types.c MP) +test_emu(pause.c MP) +test_emu(mp-rank.c MP) +test_emu(switch-same-type.c) diff --git a/test/emu/nosv/instr_nosv.h b/test/emu/nosv/instr_nosv.h index 0046838..6b903f0 100644 --- a/test/emu/nosv/instr_nosv.h +++ b/test/emu/nosv/instr_nosv.h @@ -4,7 +4,7 @@ #ifndef INSTR_NOSV_H #define INSTR_NOSV_H -#include "../instr.h" +#include "instr.h" #include "task.h" diff --git a/test/emu/nosv/mp-rank.c b/test/emu/nosv/mp-rank.c index e99a896..34831db 100644 --- a/test/emu/nosv/mp-rank.c +++ b/test/emu/nosv/mp-rank.c @@ -1,19 +1,13 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _GNU_SOURCE - -#include "compat.h" -#include "ovni.h" - -#include -#include #include #include #include #include -#include #include +#include "compat.h" +#include "ovni.h" static void fail(const char *msg) @@ -52,9 +46,9 @@ instr_thread_end(void) static inline void instr_start(int rank, int nranks) { - char hostname[HOST_NAME_MAX]; + char hostname[OVNI_MAX_HOSTNAME]; - if (gethostname(hostname, HOST_NAME_MAX) != 0) + if (gethostname(hostname, OVNI_MAX_HOSTNAME) != 0) fail("gethostname failed"); ovni_proc_init(1, hostname, getpid()); @@ -125,7 +119,7 @@ task(int32_t id, uint32_t typeid, int us) ovni_payload_add(&ev, (uint8_t *) &id, sizeof(id)); ovni_ev_emit(&ev); - usleep(us); + sleep_us(us); memset(&ev, 0, sizeof(ev)); diff --git a/test/emu/nosv/nested-tasks-bad.c b/test/emu/nosv/nested-tasks-bad.c index 70dfcd9..e73d995 100644 --- a/test/emu/nosv/nested-tasks-bad.c +++ b/test/emu/nosv/nested-tasks-bad.c @@ -1,6 +1,8 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +#include +#include "instr.h" #include "instr_nosv.h" int diff --git a/test/emu/nosv/nested-tasks.c b/test/emu/nosv/nested-tasks.c index 147337e..db7ed29 100644 --- a/test/emu/nosv/nested-tasks.c +++ b/test/emu/nosv/nested-tasks.c @@ -1,6 +1,9 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +#include +#include "compat.h" +#include "instr.h" #include "instr_nosv.h" static void @@ -10,7 +13,7 @@ create_and_run(int32_t id, uint32_t typeid, int us) /* Change subsystem to prevent duplicates */ instr_nosv_submit_enter(); instr_nosv_task_execute(id); - usleep(us); + sleep_us(us); } int diff --git a/test/emu/nosv/pause.c b/test/emu/nosv/pause.c index 5cddf1f..23692d0 100644 --- a/test/emu/nosv/pause.c +++ b/test/emu/nosv/pause.c @@ -1,6 +1,10 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +#include +#include +#include "compat.h" +#include "instr.h" #include "instr_nosv.h" int @@ -16,11 +20,11 @@ main(void) instr_nosv_type_create(typeid); instr_nosv_task_create(1, typeid); instr_nosv_task_execute(1); - usleep(us); + sleep_us(us); instr_nosv_task_pause(1); - usleep(us); + sleep_us(us); instr_nosv_task_resume(1); - usleep(us); + sleep_us(us); instr_nosv_task_end(1); instr_end(); diff --git a/test/emu/nosv/switch-same-type.c b/test/emu/nosv/switch-same-type.c index 92d581a..563cf40 100644 --- a/test/emu/nosv/switch-same-type.c +++ b/test/emu/nosv/switch-same-type.c @@ -1,9 +1,12 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#include "instr_nosv.h" - +#include +#include +#include "common.h" #include "emu_prv.h" +#include "instr.h" +#include "instr_nosv.h" int main(void) diff --git a/test/emu/nosv/task-types.c b/test/emu/nosv/task-types.c index e76f2ae..87e21af 100644 --- a/test/emu/nosv/task-types.c +++ b/test/emu/nosv/task-types.c @@ -1,6 +1,9 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +#include +#include "compat.h" +#include "instr.h" #include "instr_nosv.h" int @@ -20,7 +23,7 @@ main(void) for (int i = 0; i < ntasks; i++) { instr_nosv_task_create(i + 1, (i % ntypes) + 1); instr_nosv_task_execute(i + 1); - usleep(500); + sleep_us(500); instr_nosv_task_end(i + 1); } diff --git a/test/emu/ovni/CMakeLists.txt b/test/emu/ovni/CMakeLists.txt index 053755a..85929ab 100644 --- a/test/emu/ovni/CMakeLists.txt +++ b/test/emu/ovni/CMakeLists.txt @@ -3,17 +3,17 @@ # Only run performance sensitive tests on Release builds if(CMAKE_BUILD_TYPE STREQUAL "Release") - ovni_test(flush-overhead.c) + test_emu(flush-overhead.c) endif() -ovni_test(flush.c) -ovni_test(sort.c SORT) -ovni_test(empty-sort.c SORT) -ovni_test(sort-first-and-full-ring.c SORT +test_emu(flush.c) +test_emu(sort.c SORT) +test_emu(empty-sort.c SORT) +test_emu(sort-first-and-full-ring.c SORT SHOULD_FAIL REGEX "cannot find a event previous to clock") -ovni_test(burst-stats.c REGEX "burst stats: median/avg/max = 33/ 33/ 33 ns") -ovni_test(mp-simple.c MP) -ovni_test(version-good.c) -ovni_test(version-bad.c SHOULD_FAIL REGEX "version mismatch") -ovni_test(clockgate.c MP SHOULD_FAIL REGEX "detected large clock gate") -ovni_test(no-cpus.c SHOULD_FAIL REGEX "loom .* has no physical CPUs") +test_emu(burst-stats.c REGEX "burst stats: median/avg/max = 33/ 33/ 33 ns") +test_emu(mp-simple.c MP) +test_emu(version-good.c) +test_emu(version-bad.c SHOULD_FAIL REGEX "version mismatch") +test_emu(clockgate.c MP SHOULD_FAIL REGEX "detected large clock gate") +test_emu(no-cpus.c SHOULD_FAIL REGEX "loom .* has no physical CPUs") diff --git a/test/emu/ovni/burst-stats.c b/test/emu/ovni/burst-stats.c index 84c8cb4..2ae381c 100644 --- a/test/emu/ovni/burst-stats.c +++ b/test/emu/ovni/burst-stats.c @@ -1,21 +1,10 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _POSIX_C_SOURCE 200112L -#define _GNU_SOURCE - -#include -#include -#include #include -#include -#include -#include -#include - #include "compat.h" +#include "instr.h" #include "ovni.h" -#include "../instr.h" static void emit(char *mcv, uint64_t clock) @@ -41,7 +30,7 @@ main(void) /* Sleep a bit to prevent unsorted events */ while (ovni_clock_now() < t) - usleep(10); + sleep_us(10); instr_end(); diff --git a/test/emu/ovni/clockgate.c b/test/emu/ovni/clockgate.c index 56d7ea4..e6e6a0a 100644 --- a/test/emu/ovni/clockgate.c +++ b/test/emu/ovni/clockgate.c @@ -1,18 +1,10 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _POSIX_C_SOURCE 200112L -#define _GNU_SOURCE - -#include -#include -#include #include #include -#include -#include +#include #include - #include "common.h" #include "compat.h" #include "ovni.h" @@ -37,7 +29,7 @@ start_delayed(int rank, int nranks) char hostname[OVNI_MAX_HOSTNAME]; char rankname[OVNI_MAX_HOSTNAME + 64]; - if (gethostname(hostname, HOST_NAME_MAX) != 0) + if (gethostname(hostname, OVNI_MAX_HOSTNAME) != 0) die("gethostname failed"); sprintf(rankname, "%s.%d", hostname, rank); diff --git a/test/emu/ovni/empty-sort.c b/test/emu/ovni/empty-sort.c index 8015f74..72c5536 100644 --- a/test/emu/ovni/empty-sort.c +++ b/test/emu/ovni/empty-sort.c @@ -1,9 +1,10 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _GNU_SOURCE - -#include "instr_ovni.h" +#include +#include "compat.h" +#include "instr.h" +#include "ovni.h" static void emit(char *mcv, int64_t clock) @@ -20,7 +21,7 @@ main(void) instr_start(0, 1); /* Leave some room to prevent clashes */ - usleep(100); /* 100000 us */ + sleep_us(100); /* 100000 us */ int64_t t0 = ovni_clock_now(); diff --git a/test/emu/ovni/flush-overhead.c b/test/emu/ovni/flush-overhead.c index f7539dc..ac54a0f 100644 --- a/test/emu/ovni/flush-overhead.c +++ b/test/emu/ovni/flush-overhead.c @@ -1,9 +1,11 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _GNU_SOURCE - -#include "instr_ovni.h" +#include +#include +#include +#include "instr.h" +#include "ovni.h" static void emit(uint8_t *buf, size_t size) diff --git a/test/emu/ovni/flush.c b/test/emu/ovni/flush.c index 583ca58..4883684 100644 --- a/test/emu/ovni/flush.c +++ b/test/emu/ovni/flush.c @@ -1,9 +1,11 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _GNU_SOURCE - -#include "instr_ovni.h" +#include +#include +#include +#include "instr.h" +#include "ovni.h" static void emit(uint8_t *buf, size_t size) diff --git a/test/emu/ovni/instr_ovni.h b/test/emu/ovni/instr_ovni.h deleted file mode 100644 index 9f6a07e..0000000 --- a/test/emu/ovni/instr_ovni.h +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) - * SPDX-License-Identifier: GPL-3.0-or-later */ - -#ifndef INSTR_OVNI_H -#define INSTR_OVNI_H - -#include "../instr.h" - -#endif /* INSTR_OVNI_H */ diff --git a/test/emu/ovni/mp-simple.c b/test/emu/ovni/mp-simple.c index ed0de14..d3748b8 100644 --- a/test/emu/ovni/mp-simple.c +++ b/test/emu/ovni/mp-simple.c @@ -1,112 +1,19 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _GNU_SOURCE - -#include "compat.h" -#include "ovni.h" - -#include -#include -#include -#include -#include #include -#include -#include -#include - -static void -fail(const char *msg) -{ - fprintf(stderr, "%s\n", msg); - abort(); -} - -#define INSTR_3ARG(name, mcv, ta, a, tb, b, tc, c) \ - static inline void name(ta a, tb b, tc c) \ - { \ - struct ovni_ev ev = {0}; \ - ovni_ev_set_mcv(&ev, mcv); \ - ovni_ev_set_clock(&ev, ovni_clock_now()); \ - ovni_payload_add(&ev, (uint8_t *) &a, sizeof(a)); \ - ovni_payload_add(&ev, (uint8_t *) &b, sizeof(b)); \ - ovni_payload_add(&ev, (uint8_t *) &c, sizeof(c)); \ - ovni_ev_emit(&ev); \ - } - -INSTR_3ARG(instr_thread_execute, "OHx", int32_t, cpu, int32_t, creator_tid, uint64_t, tag) - -static inline void -instr_thread_end(void) -{ - struct ovni_ev ev = {0}; - - ovni_ev_set_mcv(&ev, "OHe"); - ovni_ev_set_clock(&ev, ovni_clock_now()); - ovni_ev_emit(&ev); - - // Flush the events to disk before killing the thread - ovni_flush(); -} - -static inline void -instr_start(int rank) -{ - cpu_set_t mask; - char hostname[HOST_NAME_MAX]; - int i, j = 0, curcpu = -1; - int last_phy = 0; - - if (gethostname(hostname, HOST_NAME_MAX) != 0) - fail("gethostname failed"); - - if (sched_getaffinity(0, sizeof(mask), &mask) < 0) - fail("sched_getaffinity failed"); - - ovni_proc_init(1, hostname, getpid()); - ovni_thread_init(gettid()); - - /* Only the rank 0 inform about all CPUs */ - if (rank == 0) { - for (i = 0; i < CPU_SETSIZE; i++) { - if (CPU_ISSET(i, &mask)) { - last_phy = i; - - if (rank == 0) - ovni_add_cpu(j++, i); - } - } - } - - if (CPU_COUNT(&mask) == 1) - curcpu = last_phy; - else - curcpu = -1; - - fprintf(stderr, "thread %d has cpu %d (ncpus=%d)\n", - gettid(), curcpu, CPU_COUNT(&mask)); - - instr_thread_execute(curcpu, -1, 0); -} - -static inline void -instr_end(void) -{ - instr_thread_end(); - ovni_thread_free(); - ovni_proc_fini(); -} +#include "compat.h" +#include "instr.h" int main(void) { int rank = atoi(getenv("OVNI_RANK")); - // int nranks = atoi(getenv("OVNI_NRANKS")); + int nranks = atoi(getenv("OVNI_NRANKS")); - instr_start(rank); + instr_start(rank, nranks); - usleep(50 * 1000); + sleep_us(50 * 1000); instr_end(); diff --git a/test/emu/ovni/no-cpus.c b/test/emu/ovni/no-cpus.c index 1d446a2..2891f13 100644 --- a/test/emu/ovni/no-cpus.c +++ b/test/emu/ovni/no-cpus.c @@ -1,7 +1,7 @@ /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#include "instr_ovni.h" +#include "instr.h" int main(void) diff --git a/test/emu/ovni/sort-first-and-full-ring.c b/test/emu/ovni/sort-first-and-full-ring.c index 171404c..0131563 100644 --- a/test/emu/ovni/sort-first-and-full-ring.c +++ b/test/emu/ovni/sort-first-and-full-ring.c @@ -1,28 +1,20 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _POSIX_C_SOURCE 200112L -#define _GNU_SOURCE - -#include -#include -#include #include #include -#include -#include +#include #include - -#include "compat.h" #include "common.h" +#include "compat.h" #include "ovni.h" static inline void init(void) { - char hostname[HOST_NAME_MAX]; + char hostname[OVNI_MAX_HOSTNAME]; - if (gethostname(hostname, HOST_NAME_MAX) != 0) { + if (gethostname(hostname, OVNI_MAX_HOSTNAME) != 0) { perror("gethostname failed"); exit(EXIT_FAILURE); } @@ -49,7 +41,7 @@ main(void) int64_t t0 = ovni_clock_now(); /* Leave some room to prevent clashes */ - usleep(100000); /* 100000000 ns */ + sleep_us(100000); /* 100000000 ns */ int64_t t1 = ovni_clock_now(); diff --git a/test/emu/ovni/sort.c b/test/emu/ovni/sort.c index 209e200..67242d5 100644 --- a/test/emu/ovni/sort.c +++ b/test/emu/ovni/sort.c @@ -1,21 +1,11 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _POSIX_C_SOURCE 200112L -#define _GNU_SOURCE - -#include -#include #include #include -#include -#include -#include -#include - #include "compat.h" +#include "instr.h" #include "ovni.h" -#include "../instr.h" static void emit_jumbo(uint8_t *buf, size_t size, int64_t clock) @@ -44,7 +34,7 @@ main(void) instr_start(0, 1); /* Leave some room to prevent clashes */ - usleep(100); /* 100000 us */ + sleep_us(100); /* 100000 us */ int64_t t0 = ovni_clock_now(); @@ -64,7 +54,7 @@ main(void) /* Sleep a bit to prevent early OU] */ while ((int64_t) ovni_clock_now() < t) - usleep(10); + sleep_us(10); emit("OU]", ovni_clock_now()); diff --git a/test/emu/ovni/version-good.c b/test/emu/ovni/version-good.c index d160200..bcf2c3e 100644 --- a/test/emu/ovni/version-good.c +++ b/test/emu/ovni/version-good.c @@ -1,7 +1,8 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#include "instr_ovni.h" +#include "instr.h" +#include "ovni.h" int main(void) diff --git a/test/macros.cmake b/test/macros.cmake index 15d8fa9..d73baed 100644 --- a/test/macros.cmake +++ b/test/macros.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Barcelona Supercomputing Center (BSC) +# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC) # SPDX-License-Identifier: GPL-3.0-or-later include(CMakeParseArguments) @@ -109,10 +109,7 @@ function(ovni_test source) "${CMAKE_SOURCE_DIR}/include" ) - add_executable("${OVNI_TEST_NAME}" - "${OVNI_TEST_SOURCE}" - "${CMAKE_SOURCE_DIR}/test/emu/instr.c" - ) + add_executable("${OVNI_TEST_NAME}" "${OVNI_TEST_SOURCE}") target_link_libraries("${OVNI_TEST_NAME}" PRIVATE ovni emu) diff --git a/test/unit/bay.c b/test/unit/bay.c index 868eccd..dd6068b 100644 --- a/test/unit/bay.c +++ b/test/unit/bay.c @@ -1,9 +1,13 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#include "emu/bay.h" +#include +#include #include "common.h" +#include "emu/bay.h" +#include "emu/chan.h" #include "unittest.h" +#include "value.h" static void test_duplicate(struct bay *bay) diff --git a/test/unit/cfg.c b/test/unit/cfg.c index b1933b4..9b09a8e 100644 --- a/test/unit/cfg.c +++ b/test/unit/cfg.c @@ -1,15 +1,12 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _GNU_SOURCE - #include "emu/pv/cfg.h" -#include "common.h" - +#include #include -#include +#include #include -#include +#include "common.h" int main(void) { diff --git a/test/unit/cpu.c b/test/unit/cpu.c index ee41f88..ba99a63 100644 --- a/test/unit/cpu.c +++ b/test/unit/cpu.c @@ -2,8 +2,10 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "emu/cpu.h" -#include "emu/loom.h" #include "common.h" +#include "emu/loom.h" +#include "emu/proc.h" +#include "emu/thread.h" #include "unittest.h" static void diff --git a/test/unit/loom.c b/test/unit/loom.c index 482fd3c..fdd621a 100644 --- a/test/unit/loom.c +++ b/test/unit/loom.c @@ -2,10 +2,10 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "emu/loom.h" +#include +#include "common.h" #include "emu/cpu.h" #include "emu/proc.h" -#include "common.h" -#include "utlist.h" #include "unittest.h" char testloom[] = "loom.0"; diff --git a/test/unit/mux.c b/test/unit/mux.c index 040dde9..5c600a8 100644 --- a/test/unit/mux.c +++ b/test/unit/mux.c @@ -2,7 +2,10 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include "emu/mux.h" +#include #include "common.h" +#include "emu/bay.h" +#include "emu/chan.h" #include "unittest.h" #define N 10 diff --git a/test/unit/prv.c b/test/unit/prv.c index e775220..4a1f54e 100644 --- a/test/unit/prv.c +++ b/test/unit/prv.c @@ -1,15 +1,16 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _GNU_SOURCE - -#include "unittest.h" - -#include "emu/pv/prv.h" -#include "common.h" - +#include #include +#include #include +#include "common.h" +#include "emu/bay.h" +#include "emu/chan.h" +#include "emu/pv/prv.h" +#include "unittest.h" +#include "value.h" #define NROWS 10 diff --git a/test/unit/stream.c b/test/unit/stream.c index 18d451d..67546f4 100644 --- a/test/unit/stream.c +++ b/test/unit/stream.c @@ -1,14 +1,14 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#define _GNU_SOURCE - -#include "emu/emu.h" -#include "common.h" -#include "unittest.h" - #include +#include +#include #include +#include "common.h" +#include "emu/stream.h" +#include "ovni.h" +#include "unittest.h" static void test_ok(char *fname) diff --git a/test/unit/thread.c b/test/unit/thread.c index c27be1b..05fe8ef 100644 --- a/test/unit/thread.c +++ b/test/unit/thread.c @@ -1,8 +1,9 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ -#include "unittest.h" +#include "common.h" #include "emu/thread.h" +#include "unittest.h" /* Ensure we can load the old trace format */ static void