add: coverage in cmake
fix: remove unsed cli call 'test'
This commit is contained in:
parent
d5f4820196
commit
251389a454
4 changed files with 27 additions and 32 deletions
|
@ -5,8 +5,7 @@ add_executable(core main.c)
|
|||
|
||||
option(WIRING_PI_DEBUG "Use WiringPi Debugging Tool (OFF)" OFF)
|
||||
|
||||
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Werror -Wpedantic -lwiringPi -lwiringPiDev -luuid -llmdb -g")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wpedantic -Werror -Wall -Wextra -luuid -lsqlite3 -g")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wpedantic -Werror -Wall -Wextra -luuid -lsqlite3 -g -fprofile-arcs -ftest-coverage")
|
||||
|
||||
string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE)
|
||||
add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}")
|
||||
|
@ -61,3 +60,8 @@ add_custom_target(test
|
|||
DEPENDS core
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||
)
|
||||
add_custom_target(coverage
|
||||
COMMAND gcovr -s --root ${CMAKE_SOURCE_DIR} -e ${CMAKE_SOURCE_DIR}/vendor --html-details ${CMAKE_BINARY_DIR}/coverage.html --html-title "Emgauwa Core Coverage" ${CMAKE_BINARY_DIR}/CMakeFiles/core.dir
|
||||
DEPENDS test
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
|
|
@ -8,15 +8,11 @@
|
|||
#include <helpers.h>
|
||||
|
||||
static const char *const usage[] = {
|
||||
"controller [options] [[--] args]",
|
||||
"controller [options]",
|
||||
"core [options] [[--] args]",
|
||||
"core [options]",
|
||||
NULL,
|
||||
};
|
||||
|
||||
#define PERM_READ (1<<0)
|
||||
#define PERM_WRITE (1<<1)
|
||||
#define PERM_EXEC (1<<2)
|
||||
|
||||
void
|
||||
helper_parse_cli(int argc, const char **argv, config_t *config)
|
||||
{
|
||||
|
@ -40,22 +36,18 @@ helper_parse_cli(int argc, const char **argv, config_t *config)
|
|||
|
||||
if(argc == 1)
|
||||
{
|
||||
config->run_type = RUN_TYPE_INVALID;
|
||||
if(strcmp(argv[0], "start") == 0)
|
||||
{
|
||||
config->run_type = RUN_TYPE_START;
|
||||
return;
|
||||
}
|
||||
if(strcmp(argv[0], "test") == 0)
|
||||
{
|
||||
config->run_type = RUN_TYPE_TEST;
|
||||
return;
|
||||
}
|
||||
LOG_FATAL("bad action '%s' given ('start', 'test')\n", argv[0]);
|
||||
LOG_FATAL("bad action '%s' given ('start')\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_FATAL("no action given ('start', 'test')\n");
|
||||
LOG_FATAL("no action given ('start')\n");
|
||||
exit(1);
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -4,7 +4,22 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include <confini.h>
|
||||
#include <enums.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RUN_TYPE_START,
|
||||
RUN_TYPE_INVALID,
|
||||
} run_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LOG_LEVEL_TRACE = 5,
|
||||
LOG_LEVEL_DEBUG = 4,
|
||||
LOG_LEVEL_INFO = 3,
|
||||
LOG_LEVEL_WARN = 2,
|
||||
LOG_LEVEL_ERROR = 1,
|
||||
LOG_LEVEL_FATAL = 0,
|
||||
} log_level_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -37,20 +37,4 @@ typedef enum
|
|||
RELAY_DRIVER_PIFACE,
|
||||
} relay_driver_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RUN_TYPE_START,
|
||||
RUN_TYPE_TEST,
|
||||
} run_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LOG_LEVEL_TRACE = 5,
|
||||
LOG_LEVEL_DEBUG = 4,
|
||||
LOG_LEVEL_INFO = 3,
|
||||
LOG_LEVEL_WARN = 2,
|
||||
LOG_LEVEL_ERROR = 1,
|
||||
LOG_LEVEL_FATAL = 0,
|
||||
} log_level_t;
|
||||
|
||||
#endif /* CORE_ENUMS_H */
|
||||
|
|
Loading…
Reference in a new issue