Files
OpenCellular/test/tpm_test/Makefile
Vadim Bendebury 0309b55817 tpmtest: make the test work again
The TPM test directory has bitrotted and does not compile any more,
leave alone pass tests. This patch updates the tests to match changed
EC codebase:

 test/tpm_test/Makefile - look for include files in more directories

 test/tpm_test/bn_test.c - add implementation of always_memset() which
  for the EC tree now comes from a different tree and provide a plug
  for watchdog_reload() which is no used by dcrypto code (which in
  fact is not a good idea, but an issue for another day).

 test/tpm_test/hash_test.py - update to match new format of return messages

 test/tpm_test/upgrade_test.py - update to match the new format of
  return messages and limit the test to installing just 2K worth of
  data

BRANCH=cr50
BUG=none
TEST=./test/tpmtest/tpmtest.py now passes

Change-Id: Ibcd7fcfba06cd83023e35a2ac4f37ec896492ad4
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/665322
Reviewed-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-09-26 16:14:05 -07:00

83 lines
1.8 KiB
Makefile

# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# V unset for normal output, V=1 for verbose output, V=0 for silent build
# (warnings/errors only). Use echo thus: $(call echo,"stuff to echo")
ifeq ($(V),0)
Q := @
echo = echo -n;
else
echo = echo $(1);
ifeq ($(V),)
Q := @
else
Q :=
endif
endif
obj = ../../build/tpm_test
src = .
SWIG = /usr/bin/swig
vpath %c $(src) ../../chip/g/dcrypto $(src)/testlib
CFLAGS = -fPIC
CFLAGS += -I /usr/include/python2.7
CFLAGS += -I../../../../third_party/cryptoc/include
CFLAGS += -I../../board/cr50
CFLAGS += -I../../chip/g
CFLAGS += -I../../chip/g/dcrypto
CFLAGS += -I../../include
CFLAGS += -I..
CFLAGS += -I../..
CFLAGS += -I.
CFLAGS += -Itestlib
CFLAGS += -DLIBFTDI1=1
CFLAGS += -c
CFLAGS += -DCR50_NO_BN_ASM
TARGET = ftdi_spi_tpm
.PRECIOUS: $(obj)/ftdi_spi_tpm_wrap.c
all: $(obj)/_$(TARGET).so $(obj)/bn_test
BN_OBJS = $(obj)/bn_test.o $(obj)/common.o $(obj)/bn.o
OBJS = $(obj)/$(TARGET).o $(obj)/$(TARGET)_wrap.o $(obj)/mpsse.o \
$(obj)/support.o
DEPS := $(OBJS:.o=.o.d) $(BN_OBJS:.o=.o.d)
$(OBJS) $(BN_OBJS): | $(obj)
$(obj)/%.o: $(obj)/%.c
$(call echo," CC $(notdir $@)")
$(Q)gcc $(CFLAGS) -o $@ $<
$(obj)/%.o: %.c
$(call echo," CC $(notdir $@)")
$(Q)gcc $(CFLAGS) -Wall -Werror -MMD -MF $@.d -o $@ $<
$(obj)/_$(TARGET).so: $(OBJS) $(obj)/$(TARGET).py
$(call echo," LD $(notdir $@)")
$(Q)rm -f $@
$(Q)gcc -shared $(OBJS) -lftdi1 -o $@
$(obj)/%_wrap.c: $(src)/%.i
$(call echo," SWIG $(notdir $@)")
$(Q)swig -python -outdir $(obj) -o $@ $<
clean:
@rm -rf $(obj)/
$(obj):
$(call echo," MKDIR $(obj)")
$(Q)mkdir -p $(obj)
$(obj)/bn_test: $(BN_OBJS)
$(call echo," LD $(notdir $@)")
$(Q)$(CC) -o $@ $^ -lcrypto
-include $(DEPS)