From 12844170ad33d96cb0c5fa411f4eb62fea6e3d5d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Mar 2014 01:49:37 +0100 Subject: support very long mtab entries in mountpoint discovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Old code limited lines to 250 characters which is probably enough for everybody, but who knows… It also takes care of device nodes which start with the same prefix. --- test/libapt/makefile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/libapt/makefile') diff --git a/test/libapt/makefile b/test/libapt/makefile index a8e053d6e..66d6ea783 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -94,6 +94,12 @@ SLIBS = -lapt-pkg SOURCE = cdromreducesourcelist_test.cc include $(PROGRAM_H) +# test cdroms FindMountPointForDevice for udev autodetection +PROGRAM = CdromFindMountPointForDevice${BASENAME} +SLIBS = -lapt-pkg +SOURCE = cdromfindmountpointfordevice_test.cc +include $(PROGRAM_H) + # test IndexCopy::ConvertToSourceList PROGRAM = IndexCopyToSourceList${BASENAME} SLIBS = -lapt-pkg -- cgit v1.2.3 From fa211e2d3b0305cfdd184cdba9750259f6d9c98e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 27 Mar 2014 07:56:42 +0100 Subject: Add progressbar to "Dpkg::Progress-Fancy" A text progressbar is now displayed in the Dpkg::Progress-Fancy mode. It can be turned off via the apt option Dpkg::Progress-Fancy::Progress-Bar=false --- test/libapt/makefile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/libapt/makefile') diff --git a/test/libapt/makefile b/test/libapt/makefile index 66d6ea783..e03b5e6aa 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -123,3 +123,9 @@ SLIBS = -lapt-pkg SOURCE = sourcelist_test.cc include $(PROGRAM_H) +# test install-progress +PROGRAM = InstallProgress${BASENAME} +SLIBS = -lapt-pkg +SOURCE = install_progress_test.cc +include $(PROGRAM_H) + -- cgit v1.2.3 From f00832cc273e52a47fb88e49849891b771de4e17 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 16 Apr 2014 17:09:37 +0200 Subject: use Google C++ Testing Framework for libapt tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit My commit 45df0ad2 from 26. Nov 2009 had a little remark: "The commit also includes a very very simple testapp." This was never intended to be permanent, but as usually… The commit adds the needed make magic to compile gtest statically as it is required and links it against a small runner. All previous testcase binaries are reimplemented in gtest and combined in this runner. While most code is a 1:1 translation some had to be rewritten like compareversion_test.cc, but the coverage remains the same. --- test/libapt/makefile | 184 ++++++++++++++++++--------------------------------- 1 file changed, 63 insertions(+), 121 deletions(-) (limited to 'test/libapt/makefile') diff --git a/test/libapt/makefile b/test/libapt/makefile index e03b5e6aa..69a13fd92 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -8,124 +8,66 @@ APT_DOMAIN=none include ../../buildlib/defaults.mak .PHONY: test -test: - ./run-tests - -# Program for testing getLanguageCode -PROGRAM = getLanguages${BASENAME} -SLIBS = -lapt-pkg -SOURCE = getlanguages_test.cc -include $(PROGRAM_H) - -PROGRAM = getArchitectures${BASENAME} -SLIBS = -lapt-pkg -SOURCE = getarchitectures_test.cc -include $(PROGRAM_H) - -# Program for testing ParseDepends -PROGRAM = ParseDepends${BASENAME} -SLIBS = -lapt-pkg -SOURCE = parsedepends_test.cc -include $(PROGRAM_H) - -# Program for testing GetListOfFilesInDir -PROGRAM = GetListOfFilesInDir${BASENAME} -SLIBS = -lapt-pkg -SOURCE = getlistoffilesindir_test.cc -include $(PROGRAM_H) - -# Program for testing CommandLine reconstruction -PROGRAM = Commandline${BASENAME} -SLIBS = -lapt-pkg -SOURCE = commandline_test.cc -include $(PROGRAM_H) - -# Program for testing CommandLine reconstruction -PROGRAM = CommandlineAsString${BASENAME} -SLIBS = -lapt-pkg -SOURCE = commandlineasstring_test.cc -include $(PROGRAM_H) - -# Program for testing debians version comparing -PROGRAM = CompareVersion${BASENAME} -SLIBS = -lapt-pkg -SOURCE = compareversion_test.cc -include $(PROGRAM_H) - -# test the GlobalError stack class -PROGRAM = GlobalError${BASENAME} -SLIBS = -lapt-pkg -SOURCE = globalerror_test.cc -include $(PROGRAM_H) - -# test the different Hashsum classes -PROGRAM = HashSums${BASENAME} -SLIBS = -lapt-pkg -SOURCE = hashsums_test.cc -include $(PROGRAM_H) - -# test the strutils stuff -PROGRAM = StrUtil${BASENAME} -SLIBS = -lapt-pkg -SOURCE = strutil_test.cc -include $(PROGRAM_H) - -# test the URI parsing stuff -PROGRAM = URI${BASENAME} -SLIBS = -lapt-pkg -SOURCE = uri_test.cc -include $(PROGRAM_H) - -# test the Configuration class -PROGRAM = Configuration${BASENAME} -SLIBS = -lapt-pkg -SOURCE = configuration_test.cc -include $(PROGRAM_H) - -# test cdroms core FindPackages -PROGRAM = CdromFindPackages${BASENAME} -SLIBS = -lapt-pkg -SOURCE = cdromfindpackages_test.cc -include $(PROGRAM_H) - -# test cdroms index reduction for source.list -PROGRAM = CdromReduceSourceList${BASENAME} -SLIBS = -lapt-pkg -SOURCE = cdromreducesourcelist_test.cc -include $(PROGRAM_H) - -# test cdroms FindMountPointForDevice for udev autodetection -PROGRAM = CdromFindMountPointForDevice${BASENAME} -SLIBS = -lapt-pkg -SOURCE = cdromfindmountpointfordevice_test.cc -include $(PROGRAM_H) - -# test IndexCopy::ConvertToSourceList -PROGRAM = IndexCopyToSourceList${BASENAME} -SLIBS = -lapt-pkg -SOURCE = indexcopytosourcelist_test.cc - -# test fileutls -PROGRAM = FileUtl${BASENAME} -SLIBS = -lapt-pkg -SOURCE = fileutl_test.cc -include $(PROGRAM_H) - -# test tagfile -PROGRAM = PkgTagFile${BASENAME} -SLIBS = -lapt-pkg -SOURCE = tagfile_test.cc -include $(PROGRAM_H) - -# test sourcelist -PROGRAM = SourceList${BASENAME} -SLIBS = -lapt-pkg -SOURCE = sourcelist_test.cc -include $(PROGRAM_H) - -# test install-progress -PROGRAM = InstallProgress${BASENAME} -SLIBS = -lapt-pkg -SOURCE = install_progress_test.cc -include $(PROGRAM_H) - +test: $(BIN)/gtest$(BASENAME) + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=$(LIB) $(BIN)/gtest$(BASENAME) + +$(BIN)/gtest$(BASENAME): $(LIB)/gtest.a + +PROGRAM = gtest${BASENAME} +SLIBS = -lapt-pkg -pthread $(LIB)/gtest.a +LIB_MAKES = apt-pkg/makefile +SOURCE = gtest_runner.cc $(wildcard *-helpers.cc *_test.cc) +include $(PROGRAM_H) + + +MKDIRS += $(OBJ) $(LIB) +LOCAL=gtest +SOURCE=gtest-all +gtest-OBJS := $(addprefix $(OBJ)/,$(addsuffix .o,$(SOURCE))) + +# The rest of the file is based on the example found in +# /usr/share/doc/libgtest-dev/examples/make/Makefile +GTEST_DIR = /usr/src/gtest + +# Flags passed to the preprocessor. +# Set Google Test's header directory as a system directory, such that +# the compiler doesn't generate warnings in Google Test headers. +CPPFLAGS += -isystem $(GTEST_DIR)/include + +# Flags passed to the C++ compiler. +CXXFLAGS += -pthread +# disable some flags for gtest again +CXXFLAGS+= -Wno-missing-declarations +CXXFLAGS+= -Wno-missing-field-initializers +CXXFLAGS+= -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wno-suggest-attribute=noreturn + +# All Google Test headers. Usually you shouldn't change this definition. +GTEST_HEADERS = /usr/include/gtest/*.h \ + /usr/include/gtest/internal/*.h + +# House-keeping build targets. +.PHONY: clean/gtest veryclean/gtest +clean: clean/gtest +clean/gtest: + rm -f $(gtest-OBJS) +veryclean: veryclean/gtest +veryclean/gtest: clean/gtest + rm -f $(LIB)/gtest.a + +# Usually you shouldn't tweak such internal variables, indicated by a +# trailing _. +GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS) + +# Builds gtest.a +# For simplicity and to avoid depending on Google Test's +# implementation details, the dependencies specified below are +# conservative and not optimized. This is fine as Google Test +# compiles fast and for ordinary users its source rarely changes. +$(gtest-OBJS): $(GTEST_SRCS_) + echo Compiling $@ + $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c -o $@ $(GTEST_DIR)/src/$(notdir $(basename $@)).cc + +$(LIB)/gtest.a: $(OBJ)/gtest-all.o + echo Building static library $@ + -rm -f $@ + $(AR) $(ARFLAGS) $@ $^ -- cgit v1.2.3