feat(testsuite): autotools working, testsuite and debug implemented and working

This commit is contained in:
matteo 2026-01-17 17:53:37 +01:00 committed by william.valenduc
parent acbcb860a4
commit e8d10523ae
4 changed files with 125 additions and 63 deletions

View file

@ -1,4 +1,3 @@
# define the subdirectories
SUBDIRS = \
parser \
lexer \
@ -9,6 +8,8 @@ SUBDIRS = \
bin_PROGRAMS = 42sh
42sh_CFLAGS = -std=c99 -Werror -Wall -Wextra -Wvla
42sh_SOURCES = main.c
42sh_CPPFLAGS = -I%D%
@ -21,18 +22,31 @@ bin_PROGRAMS = 42sh
execution/libexecution.a \
utils/libutils.a
# ================ TESTS ================
################################################# Test
#
#42sh_asan_SOURCES = main.c
#
#42sh_asan_CPPFLAGS = -I%D%
#
#42sh_asan_LDADD = \
# ast/lib_asan_ast.a \
# parser/lib_asan_parser.a \
# lexer/lib_asan_lexer.a \
# io_backend/lib_asan_io_backend.a \
# expansion/lib_asan_expansion.a \
# execution/lib_asan_execution.a \
# utils/lib_asan_utils.a
# ------------- Unit tests --------------
check_PROGRAMS = testsuite
testsuite_CFLAGS = $(42sh_CFLAGS)
testsuite_CFLAGS += $(CRITERION_CFLAGS)
testsuite_SOURCES = ../tests/unit/lexer/lexer_tests.c \
../tests/unit/utils/utils_tests.c
testsuite_CPPFLAGS = $(42sh_CPPFLAGS)
testsuite_LDADD = $(42sh_LDADD) $(CRITERION_LIBS)
# ------------- asan debug --------------
check_PROGRAMS += debug
debug_CFLAGS = $(42sh_CFLAGS)
debug_CFLAGS += -fsanitize=address -g
debug_SOURCES = $(42sh_SOURCES)
debug_CPPFLAGS = $(42sh_CPPFLAGS)
debug_LDADD = $(42sh_LDADD)

View file

@ -1,5 +1,5 @@
// === Includes
#include <cstddef>
//#include <cstddef>
#include <stdio.h>
#include <stdlib.h>