forked from tpm2-software/tpm2-tss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile-fuzz.am
50 lines (40 loc) · 1.7 KB
/
Makefile-fuzz.am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# SPDX-License-Identifier: BSD-2-Clause
# 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)
EXTRA_DIST += test/fuzz/main-sys.cpp
# tcti library used for fuzzing
if ENABLE_TCTI_FUZZING
libtss2_tcti_fuzzing = test/fuzz/tcti/libtss2-tcti-fuzzing.la
check_LTLIBRARIES += $(libtss2_tcti_fuzzing)
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 \
test/fuzz/tcti/tss2_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
check_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/sys-context-util.c \
test/integration/sys-test-options.c
TESTS_LDADD += $(libtss2_utils_fuzzing)
FUZZLDADD = $(TESTS_LDADD) $(TESTS_LDFLAGS) $(FUZZ_LDFLAGS)
fuzzdir = $(srcdir)
fuzz-targets: $(fuzz_PROGRAMS)
check_PROGRAMS += $(TESTS_FUZZ)
TESTS += $(TESTS_FUZZ)
fuzz_PROGRAMS = $(TESTS_FUZZ)
FUZZ = $(check_PROGRAMS)
DISTCLEANFILES += Makefile-fuzz-generated.am
include Makefile-fuzz-generated.am
endif # ENABLE_FUZZING