Add unit tests for emu and emu_trace

This commit is contained in:
Rodrigo Arias 2023-01-17 19:24:01 +01:00 committed by Rodrigo Arias Mallo
parent aafc3471cc
commit b3e6c21b7c
4 changed files with 47 additions and 3 deletions

View File

@ -3,20 +3,27 @@
include_directories( include_directories(
"${CMAKE_SOURCE_DIR}/src/include" "${CMAKE_SOURCE_DIR}/src/include"
"${CMAKE_SOURCE_DIR}/src/emu"
"${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src"
"${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/include"
) )
add_library(trace STATIC trace.c) #add_library(trace STATIC trace.c)
target_link_libraries(trace parson ovni-static) #target_link_libraries(trace parson ovni-static)
add_library(chan STATIC add_library(emu STATIC
emu.c
emu_stream.c
emu_trace.c
emu_system.c
chan.c chan.c
bay.c bay.c
mux.c mux.c
prv.c prv.c
) )
add_subdirectory(ovni)
#add_library(emu STATIC #add_library(emu STATIC
# chan.c # chan.c
# emu.c # emu.c

View File

@ -14,3 +14,6 @@ unit_test(bay-hash-speed.c)
unit_test(mux.c) unit_test(mux.c)
unit_test(value.c) unit_test(value.c)
unit_test(prv.c) unit_test(prv.c)
#unit_test(ovni_model.c)
unit_test(emu_trace.c)
unit_test(emu.c)

20
test/unit/emu.c Normal file
View File

@ -0,0 +1,20 @@
#include "emu/emu.h"
#include "common.h"
int main(void)
{
char *argv[] = {
"ovniemu",
"/home/ram/bsc/ovni/traces/test/ovni",
NULL
};
int argc = 2;
struct emu emu;
if (emu_init(&emu, argc, argv) != 0)
die("emu_init failed\n");
return 0;
}

14
test/unit/emu_trace.c Normal file
View File

@ -0,0 +1,14 @@
#include "emu/emu_trace.h"
#include "common.h"
int main(void)
{
char *tracedir = "/home/ram/bsc/ovni/traces/test/ovni";
struct emu_trace trace;
if (emu_trace_load(&trace, tracedir) != 0)
die("emu_trace_load failed\n");
return 0;
}