blob: 719a4898a8aeb6e437fd21b09496b88d40f733ed [file] [log] [blame]
John Andersen443455b2019-01-16 12:58:36 -08001# SPDX-License-Identifier: BSD-2
2# Copyright (c) 2019 Intel Corporation
3# All rights reserved.
4
John Andersen4eab6da2019-01-16 13:59:16 -08005TEST_EXTENSIONS += .fuzz
6FUZZ_LOG_COMPILER = $(srcdir)/script/fuzz-log-compiler.sh
John Andersen443455b2019-01-16 12:58:36 -08007INCLUDE_DIRS += -I$(srcdir)/test/fuzz/tcti
Tadeusz Struk39d1aed2019-03-01 08:47:56 -08008TESTS_LIBADD = $(lib_LTLIBRARIES) $(libtss2_mu) $(libtss2_sys) $(libutil)
John Andersen443455b2019-01-16 12:58:36 -08009
10# tcti library used for fuzzing
11if ENABLE_TCTI_FUZZING
12libtss2_tcti_fuzzing = test/fuzz/tcti/libtss2-tcti-fuzzing.la
13noinst_LTLIBRARIES += $(libtss2_tcti_fuzzing)
14
15test_fuzz_tcti_libtss2_tcti_fuzzing_la_CFLAGS = $(AM_CFLAGS)
Tadeusz Struk39d1aed2019-03-01 08:47:56 -080016test_fuzz_tcti_libtss2_tcti_fuzzing_la_LIBADD = $(TESTS_LIBADD)
John Andersen443455b2019-01-16 12:58:36 -080017test_fuzz_tcti_libtss2_tcti_fuzzing_la_SOURCES = \
18 src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
19 test/fuzz/tcti/tcti-fuzzing.c test/fuzz/tcti/tcti-fuzzing.h
20endif # ENABLE_TCTI_FUZZING
John Andersen4eab6da2019-01-16 13:59:16 -080021
22if ENABLE_FUZZING
23FUZZ_CFLAGS = $(TESTS_CFLAGS) -I$(srcdir)/test/integration
Tadeusz Struk39d1aed2019-03-01 08:47:56 -080024FUZZ_CPPFLAGS = $(INCLUDE_DIRS) -I$(srcdir)/test/integration $(LIB_FUZZING_ENGINE)
John Andersen4eab6da2019-01-16 13:59:16 -080025
Tadeusz Struk39d1aed2019-03-01 08:47:56 -080026libtss2_utils_fuzzing = test/fuzz/libfuzz_utils.la
27noinst_LTLIBRARIES += $(libtss2_utils_fuzzing)
28test_fuzz_libfuzz_utils_la_LDFLAGS = $(TESTS_LDFLAGS)
29test_fuzz_libfuzz_utils_la_LIBADD = $(TESTS_LIBADD)
John Andersen4eab6da2019-01-16 13:59:16 -080030test_fuzz_libfuzz_utils_la_CFLAGS = $(AM_CFLAGS) $(FUZZ_CFLAGS)
31test_fuzz_libfuzz_utils_la_SOURCES = \
32 test/integration/sapi-context-util.c test/integration/context-util.h \
33 test/integration/sapi-test-options.c test/integration/test-options.h
34
Tadeusz Struk39d1aed2019-03-01 08:47:56 -080035TESTS_LDADD += $(libtss2_utils_fuzzing)
36FUZZ_LDADD = $(TESTS_LDADD) $(TESTS_LDFLAGS) $(FUZZ_LDFLAGS)
37
John Andersen4eab6da2019-01-16 13:59:16 -080038fuzzdir = $(srcdir)
39fuzz-targets: $(fuzz_PROGRAMS)
40
41check_PROGRAMS += $(TESTS_FUZZ)
42fuzz_PROGRAMS = $(TESTS_FUZZ)
43FUZZ = $(check_PROGRAMS)
44
Tadeusz Struk39d1aed2019-03-01 08:47:56 -080045DISTCLEANFILES = Makefile-fuzz-generated.am
46
John Andersen4eab6da2019-01-16 13:59:16 -080047include Makefile-fuzz-generated.am
48endif # ENABLE_FUZZING