Skip to content

Commit

Permalink
Disable fuzzer targets in CI and fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
branw committed Sep 30, 2023
1 parent 5201620 commit c49e738
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
14 changes: 9 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ target_link_options(test-ssb PRIVATE -fsanitize=address,undefined)
target_link_libraries(test-ssb PRIVATE unofficial::sqlite3::sqlite3)

# Fuzzer targets
add_executable(fuzz-ssb-terminal-parse src/fuzzers/fuzz_terminal_parse.cpp ${SOURCES})
target_include_directories(fuzz-ssb-terminal-parse PRIVATE src ext/baro)
if(DEFINED ENV{GITHUB_ACTIONS})
message(STATUS "Skipping fuzzer target build because we are in GitHub Actions")
else()
add_executable(fuzz-ssb-terminal-parse src/fuzzers/fuzz_terminal_parse.cpp ${SOURCES})
target_include_directories(fuzz-ssb-terminal-parse PRIVATE src ext/baro)

target_compile_options(fuzz-ssb-terminal-parse PRIVATE -g -O0 -fsanitize=fuzzer,address)
target_link_libraries(fuzz-ssb-terminal-parse PRIVATE -fsanitize=fuzzer,address)
target_compile_options(fuzz-ssb-terminal-parse PRIVATE -g -O0 -fsanitize=fuzzer,address)
target_link_libraries(fuzz-ssb-terminal-parse PRIVATE -fsanitize=fuzzer,address)

target_link_libraries(fuzz-ssb-terminal-parse PRIVATE unofficial::sqlite3::sqlite3)
target_link_libraries(fuzz-ssb-terminal-parse PRIVATE unofficial::sqlite3::sqlite3)
endif()

enable_testing()
add_test(ssb test-ssb)
4 changes: 0 additions & 4 deletions src/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ void log_printf(enum log_level level, char const *file, int line, char const *fu
#define LOG_ERROR(...) log_printf(LOG_LEVEL_ERROR, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define LOG_FATAL(...) log_printf(LOG_LEVEL_FATAL, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)

#if !defined(MINIMUM_LOG_LEVEL)
#define MINIMUM_LOG_LEVEL LOG_LEVEL_TRACE
#endif

#ifdef __cplusplus
}
#endif
Expand Down
5 changes: 4 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ int run_standalone(struct db *db) {
// Flush and send output data
size_t write_len;
while (terminal_flush(&state.terminal, buf, 512, &write_len)) {
write(STDOUT_FILENO, buf, write_len);
size_t const written_len = write(STDOUT_FILENO, buf, write_len);
if (written_len != write_len) {
LOG_ERROR("Tried writing %d, but only wrote %d", write_len, written_len);
}
}
}

Expand Down

0 comments on commit c49e738

Please sign in to comment.