reorganize tests

This commit is contained in:
Licai Guo 2014-03-24 18:21:45 -07:00
parent 667bfe2657
commit f26bb57415
23 changed files with 68 additions and 43 deletions

View File

@ -78,9 +78,7 @@ GTEST_INCLUDES += \
CODEC_UNITTEST_INCLUDES += \
-Igtest/include \
-Icodec/processing/interface \
-Icodec/common/inc \
-Icodec/encoder/core/inc
H264DEC_INCLUDES = $(DECODER_INCLUDES) -Icodec/console/dec/inc
H264DEC_LDFLAGS = -L. $(call LINK_LIB,decoder) $(call LINK_LIB,common)
@ -92,7 +90,9 @@ H264ENC_DEPS = $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFF
CODEC_UNITTEST_LDFLAGS = -L. $(call LINK_LIB,gtest) $(call LINK_LIB,decoder) $(call LINK_LIB,encoder) $(call LINK_LIB,processing) $(call LINK_LIB,common) $(CODEC_UNITTEST_LDFLAGS_SUFFIX)
CODEC_UNITTEST_DEPS = $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
DECODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(DECODER_INCLUDES) -Itest -Itest/decoder
ENCODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(ENCODER_INCLUDES) -Itest -Itest/encoder
API_TEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) -Itest -Itest/api
.PHONY: test gtest-bootstrap clean
all: libraries binaries
@ -155,7 +155,14 @@ install: install-static install-shared
ifeq ($(HAVE_GTEST),Yes)
include build/gtest-targets.mk
include test/targets.mk
include test/api/targets.mk
include test/decoder/targets.mk
include test/encoder/targets.mk
endif
binaries: codec_unittest
BINARIES += codec_unittest
codec_unittest: $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(API_TEST_OBJS)
$(QUIE)rm -f $@
$(QUIET_CXX)$(CXX) -o $@ $+ $(CODEC_UNITTEST_LDFLAGS) $(LDFLAGS)
-include $(OBJS:.$(OBJ)=.d)

View File

@ -7,6 +7,7 @@ parser = argparse.ArgumentParser(description="Make helper parser")
parser.add_argument("--directory", dest="directory", required=True)
parser.add_argument("--library", dest="library", help="Make a library")
parser.add_argument("--binary", dest="binary", help="Make a binary")
parser.add_argument("--prefix", dest="prefix", help="Make a set of objs")
parser.add_argument("--exclude", dest="exclude", help="Exclude file", action="append")
parser.add_argument("--include", dest="include", help="Include file", action="append")
parser.add_argument("--out", dest="out", help="Output file")
@ -81,8 +82,10 @@ if args.library is not None:
PREFIX=args.library.upper()
elif args.binary is not None:
PREFIX=args.binary.upper()
elif args.prefix is not None:
PREFIX=args.prefix.upper()
else:
sys.stderr.write("Must provide either library or binary")
sys.stderr.write("Must provide either library, binary or prefix")
sys.exit(1)
if args.exclude is not None:

View File

@ -6,5 +6,7 @@ python build/mktargets.py --directory codec/processing --library processing
python build/mktargets.py --directory codec/console/dec --binary h264dec
python build/mktargets.py --directory codec/console/enc --binary h264enc
python build/mktargets.py --directory test --binary codec_unittest
python build/mktargets.py --directory test/encoder --prefix encoder_unittest
python build/mktargets.py --directory test/decoder --prefix decoder_unittest
python build/mktargets.py --directory test/api --prefix api_test
python build/mktargets.py --directory gtest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc

26
test/api/targets.mk Normal file
View File

@ -0,0 +1,26 @@
API_TEST_SRCDIR=test/api
API_TEST_CPP_SRCS=\
$(API_TEST_SRCDIR)/BaseDecoderTest.cpp\
$(API_TEST_SRCDIR)/BaseEncoderTest.cpp\
$(API_TEST_SRCDIR)/cpp_interface_test.cpp\
$(API_TEST_SRCDIR)/DataGenerator.cpp\
$(API_TEST_SRCDIR)/decode_encode_test.cpp\
$(API_TEST_SRCDIR)/decoder_test.cpp\
$(API_TEST_SRCDIR)/encoder_test.cpp\
$(API_TEST_SRCDIR)/simple_test.cpp\
API_TEST_OBJS += $(API_TEST_CPP_SRCS:.cpp=.$(OBJ))
API_TEST_C_SRCS=\
$(API_TEST_SRCDIR)/c_interface_test.c\
$(API_TEST_SRCDIR)/sha1.c\
API_TEST_OBJS += $(API_TEST_C_SRCS:.c=.$(OBJ))
OBJS += $(API_TEST_OBJS)
$(API_TEST_SRCDIR)/%.$(OBJ): $(API_TEST_SRCDIR)/%.cpp
$(QUIET_CXX)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(API_TEST_CFLAGS) $(API_TEST_INCLUDES) -c $(CXX_O) $<
$(API_TEST_SRCDIR)/%.$(OBJ): $(API_TEST_SRCDIR)/%.c
$(QUIET_CC)$(CC) $(CFLAGS) $(INCLUDES) $(API_TEST_CFLAGS) $(API_TEST_INCLUDES) -c $(CXX_O) $<

13
test/decoder/targets.mk Normal file
View File

@ -0,0 +1,13 @@
DECODER_UNITTEST_SRCDIR=test/decoder
DECODER_UNITTEST_CPP_SRCS=\
$(DECODER_UNITTEST_SRCDIR)/DecUT_ExpandPicture.cpp\
$(DECODER_UNITTEST_SRCDIR)/DecUT_IdctResAddPred.cpp\
$(DECODER_UNITTEST_SRCDIR)/DecUT_IntraPrediction.cpp\
$(DECODER_UNITTEST_SRCDIR)/DecUT_PredMv.cpp\
DECODER_UNITTEST_OBJS += $(DECODER_UNITTEST_CPP_SRCS:.cpp=.$(OBJ))
OBJS += $(DECODER_UNITTEST_OBJS)
$(DECODER_UNITTEST_SRCDIR)/%.$(OBJ): $(DECODER_UNITTEST_SRCDIR)/%.cpp
$(QUIET_CXX)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(DECODER_UNITTEST_CFLAGS) $(DECODER_UNITTEST_INCLUDES) -c $(CXX_O) $<

11
test/encoder/targets.mk Normal file
View File

@ -0,0 +1,11 @@
ENCODER_UNITTEST_SRCDIR=test/encoder
ENCODER_UNITTEST_CPP_SRCS=\
$(ENCODER_UNITTEST_SRCDIR)/EncUT_MemoryAlloc.cpp\
$(ENCODER_UNITTEST_SRCDIR)/EncUT_MotionEstimate.cpp\
ENCODER_UNITTEST_OBJS += $(ENCODER_UNITTEST_CPP_SRCS:.cpp=.$(OBJ))
OBJS += $(ENCODER_UNITTEST_OBJS)
$(ENCODER_UNITTEST_SRCDIR)/%.$(OBJ): $(ENCODER_UNITTEST_SRCDIR)/%.cpp
$(QUIET_CXX)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(ENCODER_UNITTEST_CFLAGS) $(ENCODER_UNITTEST_INCLUDES) -c $(CXX_O) $<

View File

@ -1,37 +0,0 @@
CODEC_UNITTEST_SRCDIR=test
CODEC_UNITTEST_CPP_SRCS=\
$(CODEC_UNITTEST_SRCDIR)/BaseDecoderTest.cpp\
$(CODEC_UNITTEST_SRCDIR)/BaseEncoderTest.cpp\
$(CODEC_UNITTEST_SRCDIR)/cpp_interface_test.cpp\
$(CODEC_UNITTEST_SRCDIR)/DataGenerator.cpp\
$(CODEC_UNITTEST_SRCDIR)/decode_encode_test.cpp\
$(CODEC_UNITTEST_SRCDIR)/decoder_test.cpp\
$(CODEC_UNITTEST_SRCDIR)/DecUT_ExpandPicture.cpp\
$(CODEC_UNITTEST_SRCDIR)/DecUT_IdctResAddPred.cpp\
$(CODEC_UNITTEST_SRCDIR)/DecUT_IntraPrediction.cpp\
$(CODEC_UNITTEST_SRCDIR)/DecUT_PredMv.cpp\
$(CODEC_UNITTEST_SRCDIR)/encoder_test.cpp\
$(CODEC_UNITTEST_SRCDIR)/EncUT_MemoryAlloc.cpp\
$(CODEC_UNITTEST_SRCDIR)/EncUT_MotionEstimate.cpp\
$(CODEC_UNITTEST_SRCDIR)/simple_test.cpp\
CODEC_UNITTEST_OBJS += $(CODEC_UNITTEST_CPP_SRCS:.cpp=.$(OBJ))
CODEC_UNITTEST_C_SRCS=\
$(CODEC_UNITTEST_SRCDIR)/c_interface_test.c\
$(CODEC_UNITTEST_SRCDIR)/sha1.c\
CODEC_UNITTEST_OBJS += $(CODEC_UNITTEST_C_SRCS:.c=.$(OBJ))
OBJS += $(CODEC_UNITTEST_OBJS)
$(CODEC_UNITTEST_SRCDIR)/%.$(OBJ): $(CODEC_UNITTEST_SRCDIR)/%.cpp
$(QUIET_CXX)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(CODEC_UNITTEST_CFLAGS) $(CODEC_UNITTEST_INCLUDES) -c $(CXX_O) $<
$(CODEC_UNITTEST_SRCDIR)/%.$(OBJ): $(CODEC_UNITTEST_SRCDIR)/%.c
$(QUIET_CC)$(CC) $(CFLAGS) $(INCLUDES) $(CODEC_UNITTEST_CFLAGS) $(CODEC_UNITTEST_INCLUDES) -c $(CXX_O) $<
codec_unittest$(EXEEXT): $(CODEC_UNITTEST_OBJS) $(LIBS) $(CODEC_UNITTEST_LIBS) $(CODEC_UNITTEST_DEPS)
$(QUIET_CXX)$(CXX) $(CXX_LINK_O) $(CODEC_UNITTEST_OBJS) $(CODEC_UNITTEST_LDFLAGS) $(CODEC_UNITTEST_LIBS) $(LDFLAGS) $(LIBS)
binaries: codec_unittest$(EXEEXT)
BINARIES += codec_unittest$(EXEEXT)