blob: 719a4898a8aeb6e437fd21b09496b88d40f733ed [file] [log] [blame]
# SPDX-License-Identifier: BSD-2
# Copyright (c) 2019 Intel Corporation
# All rights reserved.
TEST_EXTENSIONS += .fuzz
FUZZ_LOG_COMPILER = $(srcdir)/script/fuzz-log-compiler.sh
INCLUDE_DIRS += -I$(srcdir)/test/fuzz/tcti
TESTS_LIBADD = $(lib_LTLIBRARIES) $(libtss2_mu) $(libtss2_sys) $(libutil)
# tcti library used for fuzzing
if ENABLE_TCTI_FUZZING
libtss2_tcti_fuzzing = test/fuzz/tcti/libtss2-tcti-fuzzing.la
noinst_LTLIBRARIES += $(libtss2_tcti_fuzzing)
test_fuzz_tcti_libtss2_tcti_fuzzing_la_CFLAGS = $(AM_CFLAGS)
test_fuzz_tcti_libtss2_tcti_fuzzing_la_LIBADD = $(TESTS_LIBADD)
test_fuzz_tcti_libtss2_tcti_fuzzing_la_SOURCES = \
src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
test/fuzz/tcti/tcti-fuzzing.c test/fuzz/tcti/tcti-fuzzing.h
endif # ENABLE_TCTI_FUZZING
if ENABLE_FUZZING
FUZZ_CFLAGS = $(TESTS_CFLAGS) -I$(srcdir)/test/integration
FUZZ_CPPFLAGS = $(INCLUDE_DIRS) -I$(srcdir)/test/integration $(LIB_FUZZING_ENGINE)
libtss2_utils_fuzzing = test/fuzz/libfuzz_utils.la
noinst_LTLIBRARIES += $(libtss2_utils_fuzzing)
test_fuzz_libfuzz_utils_la_LDFLAGS = $(TESTS_LDFLAGS)
test_fuzz_libfuzz_utils_la_LIBADD = $(TESTS_LIBADD)
test_fuzz_libfuzz_utils_la_CFLAGS = $(AM_CFLAGS) $(FUZZ_CFLAGS)
test_fuzz_libfuzz_utils_la_SOURCES = \
test/integration/sapi-context-util.c test/integration/context-util.h \
test/integration/sapi-test-options.c test/integration/test-options.h
TESTS_LDADD += $(libtss2_utils_fuzzing)
FUZZ_LDADD = $(TESTS_LDADD) $(TESTS_LDFLAGS) $(FUZZ_LDFLAGS)
fuzzdir = $(srcdir)
fuzz-targets: $(fuzz_PROGRAMS)
check_PROGRAMS += $(TESTS_FUZZ)
fuzz_PROGRAMS = $(TESTS_FUZZ)
FUZZ = $(check_PROGRAMS)
DISTCLEANFILES = Makefile-fuzz-generated.am
include Makefile-fuzz-generated.am
endif # ENABLE_FUZZING