diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 09:40:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 09:40:31 +0000 |
commit | b86570f63e533abcbcb97c2572e0e5732a96307b (patch) | |
tree | cabc83be691530ae685c45a8bc7620ccc0e1ebdf /t | |
parent | Initial commit. (diff) | |
download | dpkg-b86570f63e533abcbcb97c2572e0e5732a96307b.tar.xz dpkg-b86570f63e533abcbcb97c2572e0e5732a96307b.zip |
Adding upstream version 1.20.13.upstream/1.20.13upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
721 files changed, 13979 insertions, 0 deletions
diff --git a/t-func/Makefile.am b/t-func/Makefile.am new file mode 100644 index 0000000..817a0c8 --- /dev/null +++ b/t-func/Makefile.am @@ -0,0 +1,44 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = + +EXTRA_DIST += $(srcdir)/package.m4 + +TESTSUITE_AT = $(srcdir)/testsuite.at +TESTSUITE_AT += $(srcdir)/local.at +TESTSUITE_AT += $(srcdir)/deb-format.at +TESTSUITE_AT += $(srcdir)/deb-fields.at +TESTSUITE_AT += $(srcdir)/deb-content.at +TESTSUITE_AT += $(srcdir)/deb-split.at +EXTRA_DIST += $(TESTSUITE_AT) + +TESTSUITE = $(srcdir)/testsuite +EXTRA_DIST += $(TESTSUITE) + +DISTCLEANFILES = atconfig + +# The ":;" works around a Bash 3.2 bug when the output is not writable. +$(srcdir)/package.m4: $(top_srcdir)/configure.ac + :;{ \ + echo '# Signature of the current package.' && \ + echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \ + echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \ + echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \ + echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \ + echo 'm4_define([AT_PACKAGE_URL], [$(PACKAGE_URL)])' && \ + echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \ + } >'$(srcdir)/package.m4' + +check-local: atconfig atlocal $(TESTSUITE) + $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) + +installcheck-local: atconfig atlocal $(TESTSUITE) + $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' $(TESTSUITEFLAGS) + +clean-local: + test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' --clean + +AUTOTEST = $(AUTOM4TE) --language=autotest +$(TESTSUITE): $(srcdir)/package.m4 $(TESTSUITE_AT) + $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at + mv $@.tmp $@ diff --git a/t-func/Makefile.in b/t-func/Makefile.in new file mode 100644 index 0000000..41f27ae --- /dev/null +++ b/t-func/Makefile.in @@ -0,0 +1,550 @@ +# Makefile.in generated by automake 1.16.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = t-func +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/dpkg-arch.m4 \ + $(top_srcdir)/m4/dpkg-build.m4 \ + $(top_srcdir)/m4/dpkg-compiler.m4 \ + $(top_srcdir)/m4/dpkg-coverage.m4 \ + $(top_srcdir)/m4/dpkg-funcs.m4 $(top_srcdir)/m4/dpkg-libs.m4 \ + $(top_srcdir)/m4/dpkg-linker.m4 $(top_srcdir)/m4/dpkg-progs.m4 \ + $(top_srcdir)/m4/dpkg-types.m4 \ + $(top_srcdir)/m4/dpkg-unicode.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = atlocal +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/atlocal.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOM4TE = @AUTOM4TE@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_DEVEL_DOCS = @BUILD_DEVEL_DOCS@ +BZ2_LIBS = @BZ2_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSES_LIBS = @CURSES_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCOV = @GCOV@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +HAVE_DOT = @HAVE_DOT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KVM_LIBS = @KVM_LIBS@ +LCOV = @LCOV@ +LCOV_GENHTML = @LCOV_GENHTML@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LZMA_LIBS = @LZMA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MD_LIBS = @MD_LIBS@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_BUG_WEB = @PACKAGE_BUG_WEB@ +PACKAGE_COPYRIGHT_HOLDER = @PACKAGE_COPYRIGHT_HOLDER@ +PACKAGE_CPAN_NAME = @PACKAGE_CPAN_NAME@ +PACKAGE_DIST_IS_RELEASE = @PACKAGE_DIST_IS_RELEASE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_RELEASE_DATE = @PACKAGE_RELEASE_DATE@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VCS_TYPE = @PACKAGE_VCS_TYPE@ +PACKAGE_VCS_URL = @PACKAGE_VCS_URL@ +PACKAGE_VCS_WEB = @PACKAGE_VCS_WEB@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATCH = @PATCH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_COVER = @PERL_COVER@ +PERL_COVERAGE = @PERL_COVERAGE@ +PERL_LIBDIR = @PERL_LIBDIR@ +PERL_MIN_VERSION = @PERL_MIN_VERSION@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PO4A = @PO4A@ +POD2MAN = @POD2MAN@ +POSUB = @POSUB@ +PS_LIBS = @PS_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TAR = @TAR@ +USE_NLS = @USE_NLS@ +USE_PO4A = @USE_PO4A@ +USE_UNICODE = @USE_UNICODE@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +admindir = @admindir@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +devlibdir = @devlibdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfdir = @pkgconfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = $(srcdir)/package.m4 $(TESTSUITE_AT) $(TESTSUITE) +TESTSUITE_AT = $(srcdir)/testsuite.at $(srcdir)/local.at \ + $(srcdir)/deb-format.at $(srcdir)/deb-fields.at \ + $(srcdir)/deb-content.at $(srcdir)/deb-split.at +TESTSUITE = $(srcdir)/testsuite +DISTCLEANFILES = atconfig +AUTOTEST = $(AUTOM4TE) --language=autotest +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign t-func/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign t-func/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +atlocal: $(top_builddir)/config.status $(srcdir)/atlocal.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: installcheck-local + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am check check-am check-local clean clean-generic \ + clean-libtool clean-local cscopelist-am ctags-am distclean \ + distclean-generic distclean-libtool distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installcheck-local installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# The ":;" works around a Bash 3.2 bug when the output is not writable. +$(srcdir)/package.m4: $(top_srcdir)/configure.ac + :;{ \ + echo '# Signature of the current package.' && \ + echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \ + echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \ + echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \ + echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \ + echo 'm4_define([AT_PACKAGE_URL], [$(PACKAGE_URL)])' && \ + echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \ + } >'$(srcdir)/package.m4' + +check-local: atconfig atlocal $(TESTSUITE) + $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) + +installcheck-local: atconfig atlocal $(TESTSUITE) + $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' $(TESTSUITEFLAGS) + +clean-local: + test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' --clean +$(TESTSUITE): $(srcdir)/package.m4 $(TESTSUITE_AT) + $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at + mv $@.tmp $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/t-func/atlocal.in b/t-func/atlocal.in new file mode 100644 index 0000000..1e77669 --- /dev/null +++ b/t-func/atlocal.in @@ -0,0 +1,27 @@ +# Global shell definitions for the autotest test suite + +PATH="@abs_top_builddir@/dpkg-deb:@abs_top_builddir@/dpkg-split:@abs_top_builddir@/src:@abs_top_builddir@/utils:$PATH" +export PATH + +TESTDATA="@abs_top_srcdir@/t-func" +export TESTDATA + +# Setup a sane environment + +umask 0022 + +LC_ALL=C +export LC_ALL + +TZ=UTC0 +export TZ + +SOURCE_DATE_EPOCH=0 +export SOURCE_DATE_EPOCH + +# Cleanup variables that might affect the tests. +unset GZIP +unset BZIP +unset XZ_OPT +unset XZ_DEFAULTS + diff --git a/t-func/deb-content.at b/t-func/deb-content.at new file mode 100644 index 0000000..e2b7749 --- /dev/null +++ b/t-func/deb-content.at @@ -0,0 +1,131 @@ +AT_TESTED([dpkg-deb]) + +AT_SETUP([dpkg-deb .deb conffiles]) +AT_KEYWORDS([dpkg-deb deb conffiles]) + +DPKG_GEN_CONTROL([pkg-conff-duped]) +DPKG_GEN_FILE([pkg-conff-duped], [conffiles], [/test-conffile-1 +/test-conffile-2 +/test-conffile-1]) +AT_DATA([pkg-conff-duped/test-conffile-1], [test init +]) +AT_DATA([pkg-conff-duped/test-conffile-2], [test init +]) +AT_CHECK([ +# Duplicate conffile entries should produce a warning. +dpkg-deb -b pkg-conff-duped +], [0], [ignore], [dpkg-deb: warning: conffile name '/test-conffile-1' is duplicated +dpkg-deb: warning: ignoring 1 warning about the control file(s) +]) + +DPKG_GEN_CONTROL([pkg-conff-noeol]) +printf "/test-conffile-1" >"pkg-conff-noeol/DEBIAN/conffiles" +AT_DATA([pkg-conff-noeol/test-conffile-1], [test init +]) +AT_CHECK([ +# Conffiles need a final newline to guarantee there's been no accidental +# file truncation. +dpkg-deb -b pkg-conff-noeol pkg-conff-noeol.deb +], [2], [ignore], [dpkg-deb: error: conffile name '/test-conffile-1' is too long, or missing final newline +]) + +DPKG_GEN_CONTROL([pkg-conff-noabs]) +DPKG_GEN_FILE([pkg-conff-noabs], [conffiles], [test-conffile-rel]) +AT_DATA([pkg-conff-noabs/test-conffile-rel], [test init +]) +AT_CHECK([ +# Conffiles must use absolute pathnames. +dpkg-deb -b pkg-conff-noabs pkg-conff-noabs.deb +], [2], [ignore], [dpkg-deb: error: conffile name 'test-conffile-rel' is not an absolute pathname +]) + +DPKG_GEN_CONTROL([pkg-conff-empty]) +printf " \n" >"pkg-conff-empty/DEBIAN/conffiles" +AT_CHECK([ +# Conffiles must not contain empty lines. +dpkg-deb -b pkg-conff-empty pkg-conff-empty.deb +], [2], [ignore], [dpkg-deb: error: empty and whitespace-only lines are not allowed in conffiles +]) + +DPKG_GEN_CONTROL([pkg-conff-space-prefix]) +DPKG_GEN_FILE([pkg-conff-space-prefix], [conffiles], [ /test-conffile]) +AT_CHECK([ +# Conffiles must not contain prefixed spaces. +dpkg-deb -b pkg-conff-space-prefix pkg-conff-space-prefix.deb +], [2], [ignore], [dpkg-deb: error: line with conffile filename '/test-conffile' has leading white spaces +]) + +DPKG_GEN_CONTROL([pkg-conff-unknown-flag]) +DPKG_GEN_FILE([pkg-conff-unknown-flag], [conffiles], [unknown-flag /test-conffile]) +AT_CHECK([ +# Conffiles marked with an unknown flag. +dpkg-deb -b pkg-conff-unknown-flag pkg-conff-unknown-flag.deb +], [2], [ignore], [dpkg-deb: error: unknown flag 'unknown-flag' for conffile '/test-conffile' +]) + +DPKG_GEN_CONTROL([pkg-conff-missing-pathname]) +printf "unknown-flag \n" >"pkg-conff-missing-pathname/DEBIAN/conffiles" +AT_CHECK([ +# Conffiles need a pathname, in addition to a flag. +dpkg-deb -b pkg-conff-missing-pathname pkg-conff-missing-pathname.deb +], [2], [ignore], [dpkg-deb: error: conffile name missing after flag 'unknown-flag' +]) + +DPKG_GEN_CONTROL([pkg-conff-removed-missing]) +DPKG_GEN_FILE([pkg-conff-removed-missing], [conffiles], [remove-on-upgrade /test-conffile-missing]) +AT_CHECK([ +# Conffiles marked for removal must not be present. +dpkg-deb -b pkg-conff-removed-missing pkg-conff-removed-missing.deb +], [0], [ignore], []) + +DPKG_GEN_CONTROL([pkg-conff-removed-duped]) +DPKG_GEN_FILE([pkg-conff-removed-duped], [conffiles], [remove-on-upgrade /test-conffile-1 +remove-on-upgrade /test-conffile-2 +remove-on-upgrade /test-conffile-1]) +AT_CHECK([ +# Duplicate conffile entries should produce a warning. +dpkg-deb -b pkg-conff-removed-duped +], [0], [ignore], [dpkg-deb: warning: conffile name '/test-conffile-1' is duplicated +dpkg-deb: warning: ignoring 1 warning about the control file(s) +]) + +DPKG_GEN_CONTROL([pkg-conff-removed-noeol]) +printf "remove-on-upgrade /test-conffile-1" >"pkg-conff-removed-noeol/DEBIAN/conffiles" +AT_CHECK([ +# Conffiles need a final newline to guarantee there has been no accidental +# file truncation. +dpkg-deb -b pkg-conff-removed-noeol pkg-conff-removed-noeol.deb +], [2], [ignore], [dpkg-deb: error: conffile name 'remove-on-upgrade /test-conffile-1' is too long, or missing final newline +]) + +DPKG_GEN_CONTROL([pkg-conff-removed-noabs]) +DPKG_GEN_FILE([pkg-conff-removed-noabs], [conffiles], [remove-on-upgrade test-conffile-rel]) +AT_DATA([pkg-conff-removed-noabs/test-conffile-rel], [test init +]) +AT_CHECK([ +# Conffiles must use absolute pathnames. +dpkg-deb -b pkg-conff-removed-noabs pkg-conff-removed-noabs.deb +], [2], [ignore], [dpkg-deb: error: conffile name 'test-conffile-rel' is not an absolute pathname +]) + +DPKG_GEN_CONTROL([pkg-conff-removed-present]) +DPKG_GEN_FILE([pkg-conff-removed-present], [conffiles], [remove-on-upgrade /test-conffile-present]) +AT_DATA([pkg-conff-removed-present/test-conffile-present], [test init +]) +AT_CHECK([ +# Conffiles marked for removal must not be present. +dpkg-deb -b pkg-conff-removed-present pkg-conff-removed-present.deb +], [2], [ignore], [dpkg-deb: error: conffile '/test-conffile-present' is present but is requested to be removed +]) + +DPKG_GEN_CONTROL([pkg-deb-newline]) +touch 'pkg-deb-newline/file +newline' +AT_CHECK([ +# Cannot create package with newlines in filenames. +dpkg-deb -b pkg-deb-newline +], [2], [ignore], [dpkg-deb: error: newline not allowed in pathname './file +newline' +]) + +AT_CLEANUP diff --git a/t-func/deb-fields.at b/t-func/deb-fields.at new file mode 100644 index 0000000..6de4b92 --- /dev/null +++ b/t-func/deb-fields.at @@ -0,0 +1,21 @@ +AT_TESTED([dpkg-deb]) + +AT_SETUP([dpkg-deb .deb fields]) +AT_KEYWORDS([dpkg-deb deb fields]) + +DPKG_GEN_CONTROL([pkg-package-type-void]) +AT_CHECK([ +dpkg-deb -b pkg-package-type-void +# Test absence of Package-Type field. +test -z "$(dpkg-deb -f pkg-package-type-void.deb Package-Type)" +], [0], [ignore]) + +DPKG_GEN_CONTROL([pkg-package-type-use]) +DPKG_MOD_CONTROL([pkg-package-type-use], [/^Package:/aPackage-Type: udeb]) +AT_CHECK([ +dpkg-deb -b pkg-package-type-use +# Test presence of Package-Type field. +test -n "$(dpkg-deb -f pkg-package-type-use.deb Package-Type)" +], [0], [ignore]) + +AT_CLEANUP diff --git a/t-func/deb-format.at b/t-func/deb-format.at new file mode 100644 index 0000000..89b54ad --- /dev/null +++ b/t-func/deb-format.at @@ -0,0 +1,344 @@ +AT_TESTED([dpkg-deb]) + +AT_SETUP([dpkg-deb options]) +AT_KEYWORDS([dpkg-deb command-line]) +AT_CHECK([dpkg-deb --help], [], [ignore]) +AT_CLEANUP + +AT_SETUP([dpkg-deb .deb format]) +AT_KEYWORDS([dpkg-deb deb]) + +AT_DATA([pkg-deb-bogus-empty.deb], []) +AT_CHECK([ +# Check truncated deb w/ 0 size +dpkg-deb --info pkg-deb-bogus-empty.deb +], [2], [], [dpkg-deb: error: unexpected end of file in archive magic version number in pkg-deb-bogus-empty.deb +]) + +AT_DATA([pkg-deb-old-bogus-only-version.deb], [0.93 +]) +AT_CHECK([ +# Check truncated old deb w/ only version magic +dpkg-deb --info pkg-deb-old-bogus-only-version.deb +], [2], [], [dpkg-deb: error: unexpected end of file in archive control member size in pkg-deb-old-bogus-only-version.deb +]) + +DPKG_GEN_CONTROL([pkg-deb-format]) +DPKG_MOD_CONTROL([pkg-deb-format], + [s/^Description:.*$/& - deb format support/]) +AT_DATA([pkg-deb-format/file-templ], [test +]) +AT_CHECK([ +# Initialize the template package +mv pkg-deb-format pkg-templ +chmod -R u+w pkg-templ +find pkg-templ | xargs touch -t 197001010100.00 +dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null + +# Extract the base members +ar x pkg-templ.deb +gzip -c control.tar >control.tar.gz +gzip -c data.tar >data.tar.gz +xz -c control.tar >control.tar.xz +xz -c data.tar >data.tar.xz +bzip2 -c data.tar >data.tar.bz2 +lzma -c data.tar >data.tar.lzma +touch _ignore +touch unknown +]) + +AT_CHECK([ +# Test debian-binary with 2.x versions +cp pkg-templ.deb pkg-version-2x.deb +echo 2.999 >debian-binary +ar rc pkg-version-2x.deb debian-binary +ar t pkg-version-2x.deb +ar x pkg-templ.deb debian-binary +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-version-2x.deb | sed -e 's/ *$//' +], [], [debian-binary +control.tar +data.tar + new Debian package, version 2.999. + size 20674 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +]) + +AT_CHECK([ +# Test debian-binary with extra lines +cp pkg-templ.deb pkg-magic-extra.deb +echo "extra line" >>debian-binary +ar rc pkg-magic-extra.deb debian-binary +ar t pkg-magic-extra.deb +ar x pkg-templ.deb debian-binary +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-magic-extra.deb | sed -e 's/ *$//' +], [], [debian-binary +control.tar +data.tar + new Debian package, version 2.0. + size 20684 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +]) + +AT_CHECK([ +# Test missing debian-binary member +cp pkg-templ.deb pkg-missing-magic.deb +ar d pkg-missing-magic.deb debian-binary +ar t pkg-missing-magic.deb +dpkg-deb -I pkg-missing-magic.deb +], [2], [control.tar +data.tar +], [dpkg-deb: error: file 'pkg-missing-magic.deb' is not a Debian binary archive (try dpkg-split?) +]) + +AT_CHECK([ +# Test missing control member +cp pkg-templ.deb pkg-missing-control.deb +ar d pkg-missing-control.deb control.tar +ar t pkg-missing-control.deb +dpkg-deb -I pkg-missing-control.deb +], [2], [debian-binary +data.tar +], [dpkg-deb: error: archive 'pkg-missing-control.deb' has premature member 'data.tar' before 'control.tar', giving up +]) + +AT_CHECK([ +# Test missing data member +cp pkg-templ.deb pkg-missing-data.deb +ar d pkg-missing-data.deb data.tar +ar t pkg-missing-data.deb +dpkg-deb -c pkg-missing-data.deb +], [2], [debian-binary +control.tar +], [dpkg-deb: error: unexpected end of file in archive member header in pkg-missing-data.deb +]) + +AT_CHECK([ +# Test mixed member (index 1) +cp pkg-templ.deb pkg-mixed-1-member.deb +ar ra debian-binary pkg-mixed-1-member.deb unknown +ar t pkg-mixed-1-member.deb +dpkg-deb -I pkg-mixed-1-member.deb +], [2], [debian-binary +unknown +control.tar +data.tar +], [dpkg-deb: error: archive 'pkg-mixed-1-member.deb' has premature member 'unknown' before 'control.tar', giving up +]) + +AT_CHECK([ +# Test mixed member (index 2) +cp pkg-templ.deb pkg-mixed-2-member.deb +ar ra control.tar pkg-mixed-2-member.deb unknown +ar t pkg-mixed-2-member.deb +dpkg-deb -c pkg-mixed-2-member.deb +], [2], [debian-binary +control.tar +unknown +data.tar +], [dpkg-deb: error: archive 'pkg-mixed-2-member.deb' has premature member 'unknown' before 'data.tar', giving up +]) + +AT_CHECK([ +# Test swapped control and data members +cp pkg-templ.deb pkg-swap-members.deb +ar ma data.tar pkg-swap-members.deb control.tar +ar t pkg-swap-members.deb +dpkg-deb -I pkg-swap-members.deb +], [2], [debian-binary +data.tar +control.tar +], [dpkg-deb: error: archive 'pkg-swap-members.deb' has premature member 'data.tar' before 'control.tar', giving up +]) + +AT_CHECK([ +# Test extra member +cp pkg-templ.deb pkg-extra-member.deb +ar q pkg-extra-member.deb unknown +ar t pkg-extra-member.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-extra-member.deb | sed -e 's/ *$//' +], [], [debian-binary +control.tar +data.tar +unknown + new Debian package, version 2.0. + size 20732 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +]) + +AT_CHECK([ +# Test _ member +cp pkg-templ.deb pkg-under-member.deb +ar ra debian-binary pkg-under-member.deb _ignore +ar t pkg-under-member.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-under-member.deb | sed -e 's/ *$//' +], [], [debian-binary +_ignore +control.tar +data.tar + new Debian package, version 2.0. + size 20732 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +]) + +AT_CHECK([ +# Test data.tar.bad member +dd if=/dev/zero of=data.tar.bad bs=1K count=4 status=none +ar rc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad +ar t pkg-data-bad.deb +dpkg-deb -c pkg-data-bad.deb +], [2], [debian-binary +control.tar.gz +data.tar.bad +], [dpkg-deb: error: archive 'pkg-data-bad.deb' uses unknown compression for member 'data.tar.bad', giving up +]) + +AT_CHECK([ +# Test control.tar member +ar rc pkg-control-none.deb debian-binary control.tar data.tar +ar t pkg-control-none.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-control-none.deb | sed -e 's/ *$//' +], [], [debian-binary +control.tar +data.tar + new Debian package, version 2.0. + size 20672 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +]) + +AT_CHECK([ +# Test control.tar.xz member +ar rc pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz +ar t pkg-control-xz.deb +dpkg-deb -c pkg-control-xz.deb +], [], [debian-binary +control.tar.xz +data.tar.xz +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +]) + +AT_CHECK([ +# Test data.tar member +ar rc pkg-data-none.deb debian-binary control.tar.gz data.tar +ar t pkg-data-none.deb +dpkg-deb -c pkg-data-none.deb +], [], [debian-binary +control.tar.gz +data.tar +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +]) + +AT_CHECK([ +# Test data.tar.gz member +ar rc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz +ar t pkg-data-gz.deb +dpkg-deb -c pkg-data-gz.deb +], [], [debian-binary +control.tar.gz +data.tar.gz +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +]) + +AT_CHECK([ +# Test data.tar.xz member +ar rc pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz +ar t pkg-data-xz.deb +dpkg-deb -c pkg-data-xz.deb +], [], [debian-binary +control.tar.gz +data.tar.xz +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +]) + +AT_CHECK([ +# Test data.tar.bz2 member +ar rc pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2 +ar t pkg-data-bz2.deb +dpkg-deb -c pkg-data-bz2.deb +], [], [debian-binary +control.tar.gz +data.tar.bz2 +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +]) + +AT_CHECK([ +# Test data.tar.lzma member +ar rc pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma +ar t pkg-data-lzma.deb +dpkg-deb -c pkg-data-lzma.deb +], [], [debian-binary +control.tar.gz +data.tar.lzma +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +]) + +AT_CHECK([ +# Test non-uniform data.tar/control.tar member compression +ar rc pkg-mixed-comp.deb debian-binary control.tar.xz data.tar.gz +ar t pkg-mixed-comp.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-mixed-comp.deb | sed -e 's/ *$//' +dpkg-deb -c pkg-mixed-comp.deb +], [], [debian-binary +control.tar.xz +data.tar.gz + new Debian package, version 2.0. + size 682 bytes: control archive=336 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +]) + +AT_CLEANUP diff --git a/t-func/deb-split.at b/t-func/deb-split.at new file mode 100644 index 0000000..33f9e60 --- /dev/null +++ b/t-func/deb-split.at @@ -0,0 +1,116 @@ +AT_TESTED([dpkg-split]) + +AT_SETUP([dpkg-split options]) +AT_KEYWORDS([dpkg-split command-line]) +AT_CHECK([dpkg-split --help], [], [ignore]) +AT_CLEANUP + +AT_SETUP([dpkg-split .deb format]) +AT_KEYWORDS([dpkg-split deb-split]) + +DPKG_GEN_CONTROL([pkg-split]) +DPKG_MOD_CONTROL([pkg-split], + [s/^Description:.*$/& - normal package to be split/]) +AT_CHECK([ +# Initialize the template package +chmod -R u+w pkg-split +# XXX: Some environments set SIGPIPE to ignore which we cannot reset, and 'yes' +# does check print error conditions, so we ignore its error message here. +yes 2>/dev/null | dd of=pkg-split/data-file bs=1024 count=2048 status=none +find pkg-split | xargs touch -t 197001010100.00 +dpkg-deb --root-owner-group -Znone -b pkg-split >/dev/null +]) + +AT_CHECK([ +# Test splitting a package (in 10 parts: 9 * 210 KiB B + 158 KiB) +dpkg-split -S 210 -s pkg-split.deb pkg-split-part +for p in $(seq 10); do + test -f pkg-split-part.${p}of10.deb +done +], [], [Splitting package pkg-split into 10 parts: 1 2 3 4 5 6 7 8 9 10 done +]) + +DEB_SPLIT_MD5SUM=0a4dfee0e57e273cd260ece947ce6bde +DEB_SPLIT_LENGTH=2109632 +DEB_SPLIT_PART_LENGTH=214016 +DEB_SPLIT_PART_SIZE=214222 +DEB_SPLIT_LAST_LENGTH=183488 +DEB_SPLIT_LAST_SIZE=183694 + +AT_CHECK_UNQUOTED([ +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.1of10.deb +], [], [pkg-split-part.1of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 1/10 + Part length: $DEB_SPLIT_PART_LENGTH bytes + Part offset: 0 bytes + Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes + +]) +AT_CHECK_UNQUOTED([ +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.2of10.deb +], [], [pkg-split-part.2of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 2/10 + Part length: $DEB_SPLIT_PART_LENGTH bytes + Part offset: 214016 bytes + Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes + +]) +AT_CHECK_UNQUOTED([ +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.9of10.deb +], [], [pkg-split-part.9of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 9/10 + Part length: $DEB_SPLIT_PART_LENGTH bytes + Part offset: 1712128 bytes + Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes + +]) +AT_CHECK_UNQUOTED([ +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.10of10.deb +], [], [pkg-split-part.10of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 10/10 + Part length: $DEB_SPLIT_LAST_LENGTH bytes + Part offset: 1926144 bytes + Part file size (used portion): $DEB_SPLIT_LAST_SIZE bytes + +]) + +AT_CHECK([ +# Test joining the split parts back together +dpkg-split -o pkg-joined.deb -j pkg-split-part.*.deb +cmp pkg-split.deb pkg-joined.deb +], [], [Putting package pkg-split together from 10 parts: 1 2 3 4 5 6 7 8 9 10 done +]) + +AT_CLEANUP diff --git a/t-func/local.at b/t-func/local.at new file mode 100644 index 0000000..3a221c1 --- /dev/null +++ b/t-func/local.at @@ -0,0 +1,32 @@ +# Dpkg helper macros + +m4_pattern_forbid([^DPKG_]) + +# DPKG_GEN_CONTROL([$pkgname]) +m4_define([DPKG_GEN_CONTROL], [ + mkdir -p '$1/DEBIAN' + + cat >'$1/DEBIAN/control' <<CTRL_TEMPL +Package: $1 +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL +]) + +# DPKG_MOD_CONTROL([$pkgname], [$sedexpr]) +m4_define([DPKG_MOD_CONTROL], [ + sed -i -e '$2' '$1/DEBIAN/control' +]) + +# DPKG_GEN_FILE([$pkgname], [$file], [$contents]) +m4_define([DPKG_GEN_FILE], [ + mkdir -p '$1/DEBIAN' + + cat >'$1/DEBIAN/$2' <<CTRL_TEMPL +$3 +CTRL_TEMPL +]) diff --git a/t-func/package.m4 b/t-func/package.m4 new file mode 100644 index 0000000..ad567e0 --- /dev/null +++ b/t-func/package.m4 @@ -0,0 +1,7 @@ +# Signature of the current package. +m4_define([AT_PACKAGE_NAME], [dpkg]) +m4_define([AT_PACKAGE_TARNAME], [dpkg]) +m4_define([AT_PACKAGE_VERSION], [1.20.13]) +m4_define([AT_PACKAGE_STRING], [dpkg 1.20.13]) +m4_define([AT_PACKAGE_URL], [https://wiki.debian.org/Teams/Dpkg]) +m4_define([AT_PACKAGE_BUGREPORT], [debian-dpkg@lists.debian.org]) diff --git a/t-func/testsuite b/t-func/testsuite new file mode 100755 index 0000000..e71f30f --- /dev/null +++ b/t-func/testsuite @@ -0,0 +1,3754 @@ +#! /bin/sh +# Generated from testsuite.at by GNU Autoconf 2.69. +# +# Copyright (C) 2009-2012 Free Software Foundation, Inc. +# +# This test suite is free software; the Free Software Foundation gives +# unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + + + +SHELL=${CONFIG_SHELL-/bin/sh} + +# How were we run? +at_cli_args="$@" + + +# Not all shells have the 'times' builtin; the subshell is needed to make +# sure we discard the 'times: not found' message from the shell. +at_times_p=false +(times) >/dev/null 2>&1 && at_times_p=: + +# CLI Arguments to pass to the debugging scripts. +at_debug_args= +# -e sets to true +at_errexit_p=false +# Shall we be verbose? ':' means no, empty means yes. +at_verbose=: +at_quiet= +# Running several jobs in parallel, 0 means as many as test groups. +at_jobs=1 +at_traceon=: +at_trace_echo=: +at_check_filter_trace=: + +# Shall we keep the debug scripts? Must be `:' when the suite is +# run by a debug script, so that the script doesn't remove itself. +at_debug_p=false +# Display help message? +at_help_p=false +# Display the version message? +at_version_p=false +# List test groups? +at_list_p=false +# --clean +at_clean=false +# Test groups to run +at_groups= +# Whether to rerun failed tests. +at_recheck= +# Whether a write failure occurred +at_write_fail=0 + +# The directory we run the suite in. Default to . if no -C option. +at_dir=`pwd` +# An absolute reference to this testsuite script. +case $as_myself in + [\\/]* | ?:[\\/]* ) at_myself=$as_myself ;; + * ) at_myself=$at_dir/$as_myself ;; +esac +# Whether -C is in effect. +at_change_dir=false + +# Whether to enable colored test results. +at_color=auto +# List of the tested programs. +at_tested='dpkg-deb +dpkg-split' +# As many question marks as there are digits in the last test group number. +# Used to normalize the test group numbers so that `ls' lists them in +# numerical order. +at_format='?' +# Description of all the test groups. +at_help_all="1;deb-format.at:3;dpkg-deb options;dpkg-deb command-line; +2;deb-format.at:8;dpkg-deb .deb format;dpkg-deb deb; +3;deb-content.at:3;dpkg-deb .deb conffiles;dpkg-deb deb conffiles; +4;deb-fields.at:3;dpkg-deb .deb fields;dpkg-deb deb fields; +5;deb-split.at:3;dpkg-split options;dpkg-split command-line; +6;deb-split.at:8;dpkg-split .deb format;dpkg-split deb-split; +" +# List of the all the test groups. +at_groups_all=`$as_echo "$at_help_all" | sed 's/;.*//'` + +# at_fn_validate_ranges NAME... +# ----------------------------- +# Validate and normalize the test group number contained in each variable +# NAME. Leading zeroes are treated as decimal. +at_fn_validate_ranges () +{ + for at_grp + do + eval at_value=\$$at_grp + if test $at_value -lt 1 || test $at_value -gt 6; then + $as_echo "invalid test group: $at_value" >&2 + exit 1 + fi + case $at_value in + 0*) # We want to treat leading 0 as decimal, like expr and test, but + # AS_VAR_ARITH treats it as octal if it uses $(( )). + # With XSI shells, ${at_value#${at_value%%[1-9]*}} avoids the + # expr fork, but it is not worth the effort to determine if the + # shell supports XSI when the user can just avoid leading 0. + eval $at_grp='`expr $at_value + 0`' ;; + esac + done +} + +at_prev= +for at_option +do + # If the previous option needs an argument, assign it. + if test -n "$at_prev"; then + at_option=$at_prev=$at_option + at_prev= + fi + + case $at_option in + *=?*) at_optarg=`expr "X$at_option" : '[^=]*=\(.*\)'` ;; + *) at_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $at_option in + --help | -h ) + at_help_p=: + ;; + + --list | -l ) + at_list_p=: + ;; + + --version | -V ) + at_version_p=: + ;; + + --clean | -c ) + at_clean=: + ;; + + --color ) + at_color=always + ;; + --color=* ) + case $at_optarg in + no | never | none) at_color=never ;; + auto | tty | if-tty) at_color=auto ;; + always | yes | force) at_color=always ;; + *) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'` + as_fn_error $? "unrecognized argument to $at_optname: $at_optarg" ;; + esac + ;; + + --debug | -d ) + at_debug_p=: + ;; + + --errexit | -e ) + at_debug_p=: + at_errexit_p=: + ;; + + --verbose | -v ) + at_verbose=; at_quiet=: + ;; + + --trace | -x ) + at_traceon='set -x' + at_trace_echo=echo + at_check_filter_trace=at_fn_filter_trace + ;; + + [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]) + at_fn_validate_ranges at_option + as_fn_append at_groups "$at_option$as_nl" + ;; + + # Ranges + [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-) + at_range_start=`echo $at_option |tr -d X-` + at_fn_validate_ranges at_range_start + at_range=`$as_echo "$at_groups_all" | \ + sed -ne '/^'$at_range_start'$/,$p'` + as_fn_append at_groups "$at_range$as_nl" + ;; + + -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]) + at_range_end=`echo $at_option |tr -d X-` + at_fn_validate_ranges at_range_end + at_range=`$as_echo "$at_groups_all" | \ + sed -ne '1,/^'$at_range_end'$/p'` + as_fn_append at_groups "$at_range$as_nl" + ;; + + [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \ + [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \ + [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \ + [0-9][0-9][0-9]-[0-9][0-9][0-9] | \ + [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \ + [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] ) + at_range_start=`expr $at_option : '\(.*\)-'` + at_range_end=`expr $at_option : '.*-\(.*\)'` + if test $at_range_start -gt $at_range_end; then + at_tmp=$at_range_end + at_range_end=$at_range_start + at_range_start=$at_tmp + fi + at_fn_validate_ranges at_range_start at_range_end + at_range=`$as_echo "$at_groups_all" | \ + sed -ne '/^'$at_range_start'$/,/^'$at_range_end'$/p'` + as_fn_append at_groups "$at_range$as_nl" + ;; + + # Directory selection. + --directory | -C ) + at_prev=--directory + ;; + --directory=* ) + at_change_dir=: + at_dir=$at_optarg + if test x- = "x$at_dir" ; then + at_dir=./- + fi + ;; + + # Parallel execution. + --jobs | -j ) + at_jobs=0 + ;; + --jobs=* | -j[0-9]* ) + if test -n "$at_optarg"; then + at_jobs=$at_optarg + else + at_jobs=`expr X$at_option : 'X-j\(.*\)'` + fi + case $at_jobs in *[!0-9]*) + at_optname=`echo " $at_option" | sed 's/^ //; s/[0-9=].*//'` + as_fn_error $? "non-numeric argument to $at_optname: $at_jobs" ;; + esac + ;; + + # Keywords. + --keywords | -k ) + at_prev=--keywords + ;; + --keywords=* ) + at_groups_selected=$at_help_all + at_save_IFS=$IFS + IFS=, + set X $at_optarg + shift + IFS=$at_save_IFS + for at_keyword + do + at_invert= + case $at_keyword in + '!'*) + at_invert="-v" + at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'` + ;; + esac + # It is on purpose that we match the test group titles too. + at_groups_selected=`$as_echo "$at_groups_selected" | + grep -i $at_invert "^[1-9][^;]*;.*[; ]$at_keyword[ ;]"` + done + # Smash the keywords. + at_groups_selected=`$as_echo "$at_groups_selected" | sed 's/;.*//'` + as_fn_append at_groups "$at_groups_selected$as_nl" + ;; + --recheck) + at_recheck=: + ;; + + *=*) + at_envvar=`expr "x$at_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $at_envvar in + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$at_envvar'" ;; + esac + at_value=`$as_echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"` + # Export now, but save eval for later and for debug scripts. + export $at_envvar + as_fn_append at_debug_args " $at_envvar='$at_value'" + ;; + + *) $as_echo "$as_me: invalid option: $at_option" >&2 + $as_echo "Try \`$0 --help' for more information." >&2 + exit 1 + ;; + esac +done + +# Verify our last option didn't require an argument +if test -n "$at_prev"; then : + as_fn_error $? "\`$at_prev' requires an argument" +fi + +# The file containing the suite. +at_suite_log=$at_dir/$as_me.log + +# Selected test groups. +if test -z "$at_groups$at_recheck"; then + at_groups=$at_groups_all +else + if test -n "$at_recheck" && test -r "$at_suite_log"; then + at_oldfails=`sed -n ' + /^Failed tests:$/,/^Skipped tests:$/{ + s/^[ ]*\([1-9][0-9]*\):.*/\1/p + } + /^Unexpected passes:$/,/^## Detailed failed tests/{ + s/^[ ]*\([1-9][0-9]*\):.*/\1/p + } + /^## Detailed failed tests/q + ' "$at_suite_log"` + as_fn_append at_groups "$at_oldfails$as_nl" + fi + # Sort the tests, removing duplicates. + at_groups=`$as_echo "$at_groups" | sort -nu | sed '/^$/d'` +fi + +if test x"$at_color" = xalways \ + || { test x"$at_color" = xauto && test -t 1; }; then + at_red=`printf '\033[0;31m'` + at_grn=`printf '\033[0;32m'` + at_lgn=`printf '\033[1;32m'` + at_blu=`printf '\033[1;34m'` + at_std=`printf '\033[m'` +else + at_red= at_grn= at_lgn= at_blu= at_std= +fi + +# Help message. +if $at_help_p; then + cat <<_ATEOF || at_write_fail=1 +Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS] + +Run all the tests, or the selected TESTS, given by numeric ranges, and +save a detailed log file. Upon failure, create debugging scripts. + +Do not change environment variables directly. Instead, set them via +command line arguments. Set \`AUTOTEST_PATH' to select the executables +to exercise. Each relative directory is expanded as build and source +directories relative to the top level of this distribution. +E.g., from within the build directory /tmp/foo-1.0, invoking this: + + $ $0 AUTOTEST_PATH=bin + +is equivalent to the following, assuming the source directory is /src/foo-1.0: + + PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH $0 +_ATEOF +cat <<_ATEOF || at_write_fail=1 + +Operation modes: + -h, --help print the help message, then exit + -V, --version print version number, then exit + -c, --clean remove all the files this test suite might create and exit + -l, --list describes all the tests, or the selected TESTS +_ATEOF +cat <<_ATEOF || at_write_fail=1 + +Execution tuning: + -C, --directory=DIR + change to directory DIR before starting + --color[=never|auto|always] + disable colored test results, or enable even without terminal + -j, --jobs[=N] + Allow N jobs at once; infinite jobs with no arg (default 1) + -k, --keywords=KEYWORDS + select the tests matching all the comma-separated KEYWORDS + multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD + --recheck select all tests that failed or passed unexpectedly last time + -e, --errexit abort as soon as a test fails; implies --debug + -v, --verbose force more detailed output + default for debugging scripts + -d, --debug inhibit clean up and top-level logging + default for debugging scripts + -x, --trace enable tests shell tracing +_ATEOF +cat <<_ATEOF || at_write_fail=1 + +Report bugs to <debian-dpkg@lists.debian.org>. +dpkg home page: <https://wiki.debian.org/Teams/Dpkg>. +_ATEOF + exit $at_write_fail +fi + +# List of tests. +if $at_list_p; then + cat <<_ATEOF || at_write_fail=1 +dpkg 1.20.13 test suite: dpkg tools functional test suite test groups: + + NUM: FILE-NAME:LINE TEST-GROUP-NAME + KEYWORDS + +_ATEOF + # Pass an empty line as separator between selected groups and help. + $as_echo "$at_groups$as_nl$as_nl$at_help_all" | + awk 'NF == 1 && FS != ";" { + selected[$ 1] = 1 + next + } + /^$/ { FS = ";" } + NF > 0 { + if (selected[$ 1]) { + printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3 + if ($ 4) { + lmax = 79 + indent = " " + line = indent + len = length (line) + n = split ($ 4, a, " ") + for (i = 1; i <= n; i++) { + l = length (a[i]) + 1 + if (i > 1 && len + l > lmax) { + print line + line = indent " " a[i] + len = length (line) + } else { + line = line " " a[i] + len += l + } + } + if (n) + print line + } + } + }' || at_write_fail=1 + exit $at_write_fail +fi +if $at_version_p; then + $as_echo "$as_me (dpkg 1.20.13)" && + cat <<\_ATEOF || at_write_fail=1 + +Copyright (C) 2012 Free Software Foundation, Inc. +This test suite is free software; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. +_ATEOF + exit $at_write_fail +fi + +# Should we print banners? Yes if more than one test is run. +case $at_groups in #( + *$as_nl* ) + at_print_banners=: ;; #( + * ) at_print_banners=false ;; +esac +# Text for banner N, set to a single space once printed. +# Banner 1. testsuite.at:4 +# Category starts at test group 1. +at_banner_text_1="Binary .deb packages" +# Banner 2. testsuite.at:9 +# Category starts at test group 5. +at_banner_text_2="Split .deb packages" + +# Take any -C into account. +if $at_change_dir ; then + test x != "x$at_dir" && cd "$at_dir" \ + || as_fn_error $? "unable to change directory" + at_dir=`pwd` +fi + +# Load the config files for any default variable assignments. +for at_file in atconfig atlocal +do + test -r $at_file || continue + . ./$at_file || as_fn_error $? "invalid content: $at_file" +done + +# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix: +: "${at_top_build_prefix=$at_top_builddir}" + +# Perform any assignments requested during argument parsing. +eval "$at_debug_args" + +# atconfig delivers names relative to the directory the test suite is +# in, but the groups themselves are run in testsuite-dir/group-dir. +if test -n "$at_top_srcdir"; then + builddir=../.. + for at_dir_var in srcdir top_srcdir top_build_prefix + do + eval at_val=\$at_$at_dir_var + case $at_val in + [\\/$]* | ?:[\\/]* ) at_prefix= ;; + *) at_prefix=../../ ;; + esac + eval "$at_dir_var=\$at_prefix\$at_val" + done +fi + +## -------------------- ## +## Directory structure. ## +## -------------------- ## + +# This is the set of directories and files used by this script +# (non-literals are capitalized): +# +# TESTSUITE - the testsuite +# TESTSUITE.log - summarizes the complete testsuite run +# TESTSUITE.dir/ - created during a run, remains after -d or failed test +# + at-groups/ - during a run: status of all groups in run +# | + NNN/ - during a run: meta-data about test group NNN +# | | + check-line - location (source file and line) of current AT_CHECK +# | | + status - exit status of current AT_CHECK +# | | + stdout - stdout of current AT_CHECK +# | | + stder1 - stderr, including trace +# | | + stderr - stderr, with trace filtered out +# | | + test-source - portion of testsuite that defines group +# | | + times - timestamps for computing duration +# | | + pass - created if group passed +# | | + xpass - created if group xpassed +# | | + fail - created if group failed +# | | + xfail - created if group xfailed +# | | + skip - created if group skipped +# + at-stop - during a run: end the run if this file exists +# + at-source-lines - during a run: cache of TESTSUITE line numbers for extraction +# + 0..NNN/ - created for each group NNN, remains after -d or failed test +# | + TESTSUITE.log - summarizes the group results +# | + ... - files created during the group + +# The directory the whole suite works in. +# Should be absolute to let the user `cd' at will. +at_suite_dir=$at_dir/$as_me.dir +# The file containing the suite ($at_dir might have changed since earlier). +at_suite_log=$at_dir/$as_me.log +# The directory containing helper files per test group. +at_helper_dir=$at_suite_dir/at-groups +# Stop file: if it exists, do not start new jobs. +at_stop_file=$at_suite_dir/at-stop +# The fifo used for the job dispatcher. +at_job_fifo=$at_suite_dir/at-job-fifo + +if $at_clean; then + test -d "$at_suite_dir" && + find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; + rm -f -r "$at_suite_dir" "$at_suite_log" + exit $? +fi + +# Don't take risks: use only absolute directories in PATH. +# +# For stand-alone test suites (ie. atconfig was not found), +# AUTOTEST_PATH is relative to `.'. +# +# For embedded test suites, AUTOTEST_PATH is relative to the top level +# of the package. Then expand it into build/src parts, since users +# may create executables in both places. +AUTOTEST_PATH=`$as_echo "$AUTOTEST_PATH" | sed "s|:|$PATH_SEPARATOR|g"` +at_path= +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $AUTOTEST_PATH $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -n "$at_path" && as_fn_append at_path $PATH_SEPARATOR +case $as_dir in + [\\/]* | ?:[\\/]* ) + as_fn_append at_path "$as_dir" + ;; + * ) + if test -z "$at_top_build_prefix"; then + # Stand-alone test suite. + as_fn_append at_path "$as_dir" + else + # Embedded test suite. + as_fn_append at_path "$at_top_build_prefix$as_dir$PATH_SEPARATOR" + as_fn_append at_path "$at_top_srcdir/$as_dir" + fi + ;; +esac + done +IFS=$as_save_IFS + + +# Now build and simplify PATH. +# +# There might be directories that don't exist, but don't redirect +# builtins' (eg., cd) stderr directly: Ultrix's sh hates that. +at_new_path= +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $at_path +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -d "$as_dir" || continue +case $as_dir in + [\\/]* | ?:[\\/]* ) ;; + * ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;; +esac +case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in + *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;; + $PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;; + *) as_fn_append at_new_path "$PATH_SEPARATOR$as_dir" ;; +esac + done +IFS=$as_save_IFS + +PATH=$at_new_path +export PATH + +# Setting up the FDs. + + + +# 5 is the log file. Not to be overwritten if `-d'. +if $at_debug_p; then + at_suite_log=/dev/null +else + : >"$at_suite_log" +fi +exec 5>>"$at_suite_log" + +# Banners and logs. +$as_echo "## ---------------------------------------------------------- ## +## dpkg 1.20.13 test suite: dpkg tools functional test suite. ## +## ---------------------------------------------------------- ##" +{ + $as_echo "## ---------------------------------------------------------- ## +## dpkg 1.20.13 test suite: dpkg tools functional test suite. ## +## ---------------------------------------------------------- ##" + echo + + $as_echo "$as_me: command line was:" + $as_echo " \$ $0 $at_cli_args" + echo + + # If ChangeLog exists, list a few lines in case it might help determining + # the exact version. + if test -n "$at_top_srcdir" && test -f "$at_top_srcdir/ChangeLog"; then + $as_echo "## ---------- ## +## ChangeLog. ## +## ---------- ##" + echo + sed 's/^/| /;10q' "$at_top_srcdir/ChangeLog" + echo + fi + + { +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} + echo + + # Contents of the config files. + for at_file in atconfig atlocal + do + test -r $at_file || continue + $as_echo "$as_me: $at_file:" + sed 's/^/| /' $at_file + echo + done +} >&5 + + +## ------------------------- ## +## Autotest shell functions. ## +## ------------------------- ## + +# at_fn_banner NUMBER +# ------------------- +# Output banner NUMBER, provided the testsuite is running multiple groups and +# this particular banner has not yet been printed. +at_fn_banner () +{ + $at_print_banners || return 0 + eval at_banner_text=\$at_banner_text_$1 + test "x$at_banner_text" = "x " && return 0 + eval "at_banner_text_$1=\" \"" + if test -z "$at_banner_text"; then + $at_first || echo + else + $as_echo "$as_nl$at_banner_text$as_nl" + fi +} # at_fn_banner + +# at_fn_check_prepare_notrace REASON LINE +# --------------------------------------- +# Perform AT_CHECK preparations for the command at LINE for an untraceable +# command; REASON is the reason for disabling tracing. +at_fn_check_prepare_notrace () +{ + $at_trace_echo "Not enabling shell tracing (command contains $1)" + $as_echo "$2" >"$at_check_line_file" + at_check_trace=: at_check_filter=: + : >"$at_stdout"; : >"$at_stderr" +} + +# at_fn_check_prepare_trace LINE +# ------------------------------ +# Perform AT_CHECK preparations for the command at LINE for a traceable +# command. +at_fn_check_prepare_trace () +{ + $as_echo "$1" >"$at_check_line_file" + at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace + : >"$at_stdout"; : >"$at_stderr" +} + +# at_fn_check_prepare_dynamic COMMAND LINE +# ---------------------------------------- +# Decide if COMMAND at LINE is traceable at runtime, and call the appropriate +# preparation function. +at_fn_check_prepare_dynamic () +{ + case $1 in + *$as_nl*) + at_fn_check_prepare_notrace 'an embedded newline' "$2" ;; + *) + at_fn_check_prepare_trace "$2" ;; + esac +} + +# at_fn_filter_trace +# ------------------ +# Remove the lines in the file "$at_stderr" generated by "set -x" and print +# them to stderr. +at_fn_filter_trace () +{ + mv "$at_stderr" "$at_stder1" + grep '^ *+' "$at_stder1" >&2 + grep -v '^ *+' "$at_stder1" >"$at_stderr" +} + +# at_fn_log_failure FILE-LIST +# --------------------------- +# Copy the files in the list on stdout with a "> " prefix, and exit the shell +# with a failure exit code. +at_fn_log_failure () +{ + for file + do $as_echo "$file:"; sed 's/^/> /' "$file"; done + echo 1 > "$at_status_file" + exit 1 +} + +# at_fn_check_skip EXIT-CODE LINE +# ------------------------------- +# Check whether EXIT-CODE is a special exit code (77 or 99), and if so exit +# the test group subshell with that same exit code. Use LINE in any report +# about test failure. +at_fn_check_skip () +{ + case $1 in + 99) echo 99 > "$at_status_file"; at_failed=: + $as_echo "$2: hard failure"; exit 99;; + 77) echo 77 > "$at_status_file"; exit 77;; + esac +} + +# at_fn_check_status EXPECTED EXIT-CODE LINE +# ------------------------------------------ +# Check whether EXIT-CODE is the EXPECTED exit code, and if so do nothing. +# Otherwise, if it is 77 or 99, exit the test group subshell with that same +# exit code; if it is anything else print an error message referring to LINE, +# and fail the test. +at_fn_check_status () +{ + case $2 in + $1 ) ;; + 77) echo 77 > "$at_status_file"; exit 77;; + 99) echo 99 > "$at_status_file"; at_failed=: + $as_echo "$3: hard failure"; exit 99;; + *) $as_echo "$3: exit code was $2, expected $1" + at_failed=:;; + esac +} + +# at_fn_diff_devnull FILE +# ----------------------- +# Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless diff +# invocations. +at_fn_diff_devnull () +{ + test -s "$1" || return 0 + $at_diff "$at_devnull" "$1" +} + +# at_fn_test NUMBER +# ----------------- +# Parse out test NUMBER from the tail of this file. +at_fn_test () +{ + eval at_sed=\$at_sed$1 + sed "$at_sed" "$at_myself" > "$at_test_source" +} + +# at_fn_create_debugging_script +# ----------------------------- +# Create the debugging script $at_group_dir/run which will reproduce the +# current test group. +at_fn_create_debugging_script () +{ + { + echo "#! /bin/sh" && + echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\''' && + $as_echo "cd '$at_dir'" && + $as_echo "exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d $at_debug_args $at_group \${1+\"\$@\"}" && + echo 'exit 1' + } >"$at_group_dir/run" && + chmod +x "$at_group_dir/run" +} + +## -------------------------------- ## +## End of autotest shell functions. ## +## -------------------------------- ## +{ + $as_echo "## ---------------- ## +## Tested programs. ## +## ---------------- ##" + echo +} >&5 + +# Report what programs are being tested. +for at_program in : $at_tested +do + test "$at_program" = : && continue + case $at_program in + [\\/]* | ?:[\\/]* ) $at_program_=$at_program ;; + * ) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -f "$as_dir/$at_program" && break + done +IFS=$as_save_IFS + + at_program_=$as_dir/$at_program ;; + esac + if test -f "$at_program_"; then + { + $as_echo "$at_srcdir/testsuite.at:1: $at_program_ --version" + "$at_program_" --version </dev/null + echo + } >&5 2>&1 + else + as_fn_error $? "cannot find $at_program" "$LINENO" 5 + fi +done + +{ + $as_echo "## ------------------ ## +## Running the tests. ## +## ------------------ ##" +} >&5 + +at_start_date=`date` +at_start_time=`date +%s 2>/dev/null` +$as_echo "$as_me: starting at: $at_start_date" >&5 + +# Create the master directory if it doesn't already exist. +as_dir="$at_suite_dir"; as_fn_mkdir_p || + as_fn_error $? "cannot create \`$at_suite_dir'" "$LINENO" 5 + +# Can we diff with `/dev/null'? DU 5.0 refuses. +if diff /dev/null /dev/null >/dev/null 2>&1; then + at_devnull=/dev/null +else + at_devnull=$at_suite_dir/devnull + >"$at_devnull" +fi + +# Use `diff -u' when possible. +if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff" +then + at_diff='diff -u' +else + at_diff=diff +fi + +# Get the last needed group. +for at_group in : $at_groups; do :; done + +# Extract the start and end lines of each test group at the tail +# of this file +awk ' +BEGIN { FS="" } +/^#AT_START_/ { + start = NR +} +/^#AT_STOP_/ { + test = substr ($ 0, 10) + print "at_sed" test "=\"1," start "d;" (NR-1) "q\"" + if (test == "'"$at_group"'") exit +}' "$at_myself" > "$at_suite_dir/at-source-lines" && +. "$at_suite_dir/at-source-lines" || + as_fn_error $? "cannot create test line number cache" "$LINENO" 5 +rm -f "$at_suite_dir/at-source-lines" + +# Set number of jobs for `-j'; avoid more jobs than test groups. +set X $at_groups; shift; at_max_jobs=$# +if test $at_max_jobs -eq 0; then + at_jobs=1 +fi +if test $at_jobs -ne 1 && + { test $at_jobs -eq 0 || test $at_jobs -gt $at_max_jobs; }; then + at_jobs=$at_max_jobs +fi + +# If parallel mode, don't output banners, don't split summary lines. +if test $at_jobs -ne 1; then + at_print_banners=false + at_quiet=: +fi + +# Set up helper dirs. +rm -rf "$at_helper_dir" && +mkdir "$at_helper_dir" && +cd "$at_helper_dir" && +{ test -z "$at_groups" || mkdir $at_groups; } || +as_fn_error $? "testsuite directory setup failed" "$LINENO" 5 + +# Functions for running a test group. We leave the actual +# test group execution outside of a shell function in order +# to avoid hitting zsh 4.x exit status bugs. + +# at_fn_group_prepare +# ------------------- +# Prepare for running a test group. +at_fn_group_prepare () +{ + # The directory for additional per-group helper files. + at_job_dir=$at_helper_dir/$at_group + # The file containing the location of the last AT_CHECK. + at_check_line_file=$at_job_dir/check-line + # The file containing the exit status of the last command. + at_status_file=$at_job_dir/status + # The files containing the output of the tested commands. + at_stdout=$at_job_dir/stdout + at_stder1=$at_job_dir/stder1 + at_stderr=$at_job_dir/stderr + # The file containing the code for a test group. + at_test_source=$at_job_dir/test-source + # The file containing dates. + at_times_file=$at_job_dir/times + + # Be sure to come back to the top test directory. + cd "$at_suite_dir" + + # Clearly separate the test groups when verbose. + $at_first || $at_verbose echo + + at_group_normalized=$at_group + + eval 'while :; do + case $at_group_normalized in #( + '"$at_format"'*) break;; + esac + at_group_normalized=0$at_group_normalized + done' + + + # Create a fresh directory for the next test group, and enter. + # If one already exists, the user may have invoked ./run from + # within that directory; we remove the contents, but not the + # directory itself, so that we aren't pulling the rug out from + # under the shell's notion of the current directory. + at_group_dir=$at_suite_dir/$at_group_normalized + at_group_log=$at_group_dir/$as_me.log + if test -d "$at_group_dir"; then + find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx {} \; + rm -fr "$at_group_dir"/* "$at_group_dir"/.[!.] "$at_group_dir"/.??* +fi || + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test directory for $at_group_normalized could not be cleaned" >&5 +$as_echo "$as_me: WARNING: test directory for $at_group_normalized could not be cleaned" >&2;} + # Be tolerant if the above `rm' was not able to remove the directory. + as_dir="$at_group_dir"; as_fn_mkdir_p + + echo 0 > "$at_status_file" + + # In verbose mode, append to the log file *and* show on + # the standard output; in quiet mode only write to the log. + if test -z "$at_verbose"; then + at_tee_pipe='tee -a "$at_group_log"' + else + at_tee_pipe='cat >> "$at_group_log"' + fi +} + +# at_fn_group_banner ORDINAL LINE DESC PAD [BANNER] +# ------------------------------------------------- +# Declare the test group ORDINAL, located at LINE with group description DESC, +# and residing under BANNER. Use PAD to align the status column. +at_fn_group_banner () +{ + at_setup_line="$2" + test -n "$5" && at_fn_banner $5 + at_desc="$3" + case $1 in + [0-9]) at_desc_line=" $1: ";; + [0-9][0-9]) at_desc_line=" $1: " ;; + *) at_desc_line="$1: " ;; + esac + as_fn_append at_desc_line "$3$4" + $at_quiet $as_echo_n "$at_desc_line" + echo "# -*- compilation -*-" >> "$at_group_log" +} + +# at_fn_group_postprocess +# ----------------------- +# Perform cleanup after running a test group. +at_fn_group_postprocess () +{ + # Be sure to come back to the suite directory, in particular + # since below we might `rm' the group directory we are in currently. + cd "$at_suite_dir" + + if test ! -f "$at_check_line_file"; then + sed "s/^ */$as_me: WARNING: /" <<_ATEOF + A failure happened in a test group before any test could be + run. This means that test suite is improperly designed. Please + report this failure to <debian-dpkg@lists.debian.org>. +_ATEOF + $as_echo "$at_setup_line" >"$at_check_line_file" + at_status=99 + fi + $at_verbose $as_echo_n "$at_group. $at_setup_line: " + $as_echo_n "$at_group. $at_setup_line: " >> "$at_group_log" + case $at_xfail:$at_status in + yes:0) + at_msg="UNEXPECTED PASS" + at_res=xpass + at_errexit=$at_errexit_p + at_color=$at_red + ;; + no:0) + at_msg="ok" + at_res=pass + at_errexit=false + at_color=$at_grn + ;; + *:77) + at_msg='skipped ('`cat "$at_check_line_file"`')' + at_res=skip + at_errexit=false + at_color=$at_blu + ;; + no:* | *:99) + at_msg='FAILED ('`cat "$at_check_line_file"`')' + at_res=fail + at_errexit=$at_errexit_p + at_color=$at_red + ;; + yes:*) + at_msg='expected failure ('`cat "$at_check_line_file"`')' + at_res=xfail + at_errexit=false + at_color=$at_lgn + ;; + esac + echo "$at_res" > "$at_job_dir/$at_res" + # In parallel mode, output the summary line only afterwards. + if test $at_jobs -ne 1 && test -n "$at_verbose"; then + $as_echo "$at_desc_line $at_color$at_msg$at_std" + else + # Make sure there is a separator even with long titles. + $as_echo " $at_color$at_msg$at_std" + fi + at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg" + case $at_status in + 0|77) + # $at_times_file is only available if the group succeeded. + # We're not including the group log, so the success message + # is written in the global log separately. But we also + # write to the group log in case they're using -d. + if test -f "$at_times_file"; then + at_log_msg="$at_log_msg ("`sed 1d "$at_times_file"`')' + rm -f "$at_times_file" + fi + $as_echo "$at_log_msg" >> "$at_group_log" + $as_echo "$at_log_msg" >&5 + + # Cleanup the group directory, unless the user wants the files + # or the success was unexpected. + if $at_debug_p || test $at_res = xpass; then + at_fn_create_debugging_script + if test $at_res = xpass && $at_errexit; then + echo stop > "$at_stop_file" + fi + else + if test -d "$at_group_dir"; then + find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; + rm -fr "$at_group_dir" + fi + rm -f "$at_test_source" + fi + ;; + *) + # Upon failure, include the log into the testsuite's global + # log. The failure message is written in the group log. It + # is later included in the global log. + $as_echo "$at_log_msg" >> "$at_group_log" + + # Upon failure, keep the group directory for autopsy, and create + # the debugging script. With -e, do not start any further tests. + at_fn_create_debugging_script + if $at_errexit; then + echo stop > "$at_stop_file" + fi + ;; + esac +} + + +## ------------ ## +## Driver loop. ## +## ------------ ## + + +if (set -m && set +m && set +b) >/dev/null 2>&1; then + set +b + at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=- +else + at_job_control_on=: at_job_control_off=: at_job_group= +fi + +for at_signal in 1 2 15; do + trap 'set +x; set +e + $at_job_control_off + at_signal='"$at_signal"' + echo stop > "$at_stop_file" + trap "" $at_signal + at_pgids= + for at_pgid in `jobs -p 2>/dev/null`; do + at_pgids="$at_pgids $at_job_group$at_pgid" + done + test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null + wait + if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then + echo >&2 + fi + at_signame=`kill -l $at_signal 2>&1 || echo $at_signal` + set x $at_signame + test 1 -gt 2 && at_signame=$at_signal + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: caught signal $at_signame, bailing out" >&5 +$as_echo "$as_me: WARNING: caught signal $at_signame, bailing out" >&2;} + as_fn_arith 128 + $at_signal && exit_status=$as_val + as_fn_exit $exit_status' $at_signal +done + +rm -f "$at_stop_file" +at_first=: + +if test $at_jobs -ne 1 && + rm -f "$at_job_fifo" && + test -n "$at_job_group" && + ( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null +then + # FIFO job dispatcher. + + trap 'at_pids= + for at_pid in `jobs -p`; do + at_pids="$at_pids $at_job_group$at_pid" + done + if test -n "$at_pids"; then + at_sig=TSTP + test "${TMOUT+set}" = set && at_sig=STOP + kill -$at_sig $at_pids 2>/dev/null + fi + kill -STOP $$ + test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP + + echo + # Turn jobs into a list of numbers, starting from 1. + at_joblist=`$as_echo "$at_groups" | sed -n 1,${at_jobs}p` + + set X $at_joblist + shift + for at_group in $at_groups; do + $at_job_control_on 2>/dev/null + ( + # Start one test group. + $at_job_control_off + if $at_first; then + exec 7>"$at_job_fifo" + else + exec 6<&- + fi + trap 'set +x; set +e + trap "" PIPE + echo stop > "$at_stop_file" + echo >&7 + as_fn_exit 141' PIPE + at_fn_group_prepare + if cd "$at_group_dir" && + at_fn_test $at_group && + . "$at_test_source" + then :; else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5 +$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;} + at_failed=: + fi + at_fn_group_postprocess + echo >&7 + ) & + $at_job_control_off + if $at_first; then + at_first=false + exec 6<"$at_job_fifo" 7>"$at_job_fifo" + fi + shift # Consume one token. + if test $# -gt 0; then :; else + read at_token <&6 || break + set x $* + fi + test -f "$at_stop_file" && break + done + exec 7>&- + # Read back the remaining ($at_jobs - 1) tokens. + set X $at_joblist + shift + if test $# -gt 0; then + shift + for at_job + do + read at_token + done <&6 + fi + exec 6<&- + wait +else + # Run serially, avoid forks and other potential surprises. + for at_group in $at_groups; do + at_fn_group_prepare + if cd "$at_group_dir" && + at_fn_test $at_group && + . "$at_test_source"; then :; else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5 +$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;} + at_failed=: + fi + at_fn_group_postprocess + test -f "$at_stop_file" && break + at_first=false + done +fi + +# Wrap up the test suite with summary statistics. +cd "$at_helper_dir" + +# Use ?..???? when the list must remain sorted, the faster * otherwise. +at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'` +at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'` +at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'` +at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do + echo $f; done | sed '/?/d; s,/xpass,,'` +at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do + echo $f; done | sed '/?/d; s,/fail,,'` + +set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list +shift; at_group_count=$# +set X $at_xpass_list; shift; at_xpass_count=$#; at_xpass_list=$* +set X $at_xfail_list; shift; at_xfail_count=$# +set X $at_fail_list; shift; at_fail_count=$#; at_fail_list=$* +set X $at_skip_list; shift; at_skip_count=$# + +as_fn_arith $at_group_count - $at_skip_count && at_run_count=$as_val +as_fn_arith $at_xpass_count + $at_fail_count && at_unexpected_count=$as_val +as_fn_arith $at_xfail_count + $at_fail_count && at_total_fail_count=$as_val + +# Back to the top directory. +cd "$at_dir" +rm -rf "$at_helper_dir" + +# Compute the duration of the suite. +at_stop_date=`date` +at_stop_time=`date +%s 2>/dev/null` +$as_echo "$as_me: ending at: $at_stop_date" >&5 +case $at_start_time,$at_stop_time in + [0-9]*,[0-9]*) + as_fn_arith $at_stop_time - $at_start_time && at_duration_s=$as_val + as_fn_arith $at_duration_s / 60 && at_duration_m=$as_val + as_fn_arith $at_duration_m / 60 && at_duration_h=$as_val + as_fn_arith $at_duration_s % 60 && at_duration_s=$as_val + as_fn_arith $at_duration_m % 60 && at_duration_m=$as_val + at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s" + $as_echo "$as_me: test suite duration: $at_duration" >&5 + ;; +esac + +echo +$as_echo "## ------------- ## +## Test results. ## +## ------------- ##" +echo +{ + echo + $as_echo "## ------------- ## +## Test results. ## +## ------------- ##" + echo +} >&5 + +if test $at_run_count = 1; then + at_result="1 test" + at_were=was +else + at_result="$at_run_count tests" + at_were=were +fi +if $at_errexit_p && test $at_unexpected_count != 0; then + if test $at_xpass_count = 1; then + at_result="$at_result $at_were run, one passed" + else + at_result="$at_result $at_were run, one failed" + fi + at_result="$at_result unexpectedly and inhibited subsequent tests." + at_color=$at_red +else + # Don't you just love exponential explosion of the number of cases? + at_color=$at_red + case $at_xpass_count:$at_fail_count:$at_xfail_count in + # So far, so good. + 0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;; + 0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;; + + # Some unexpected failures + 0:*:0) at_result="$at_result $at_were run, +$at_fail_count failed unexpectedly." ;; + + # Some failures, both expected and unexpected + 0:*:1) at_result="$at_result $at_were run, +$at_total_fail_count failed ($at_xfail_count expected failure)." ;; + 0:*:*) at_result="$at_result $at_were run, +$at_total_fail_count failed ($at_xfail_count expected failures)." ;; + + # No unexpected failures, but some xpasses + *:0:*) at_result="$at_result $at_were run, +$at_xpass_count passed unexpectedly." ;; + + # No expected failures, but failures and xpasses + *:1:0) at_result="$at_result $at_were run, +$at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;; + *:*:0) at_result="$at_result $at_were run, +$at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;; + + # All of them. + *:*:1) at_result="$at_result $at_were run, +$at_xpass_count passed unexpectedly, +$at_total_fail_count failed ($at_xfail_count expected failure)." ;; + *:*:*) at_result="$at_result $at_were run, +$at_xpass_count passed unexpectedly, +$at_total_fail_count failed ($at_xfail_count expected failures)." ;; + esac + + if test $at_skip_count = 0 && test $at_run_count -gt 1; then + at_result="All $at_result" + fi +fi + +# Now put skips in the mix. +case $at_skip_count in + 0) ;; + 1) at_result="$at_result +1 test was skipped." ;; + *) at_result="$at_result +$at_skip_count tests were skipped." ;; +esac + +if test $at_unexpected_count = 0; then + echo "$at_color$at_result$at_std" + echo "$at_result" >&5 +else + echo "${at_color}ERROR: $at_result$at_std" >&2 + echo "ERROR: $at_result" >&5 + { + echo + $as_echo "## ------------------------ ## +## Summary of the failures. ## +## ------------------------ ##" + + # Summary of failed and skipped tests. + if test $at_fail_count != 0; then + echo "Failed tests:" + $SHELL "$at_myself" $at_fail_list --list + echo + fi + if test $at_skip_count != 0; then + echo "Skipped tests:" + $SHELL "$at_myself" $at_skip_list --list + echo + fi + if test $at_xpass_count != 0; then + echo "Unexpected passes:" + $SHELL "$at_myself" $at_xpass_list --list + echo + fi + if test $at_fail_count != 0; then + $as_echo "## ---------------------- ## +## Detailed failed tests. ## +## ---------------------- ##" + echo + for at_group in $at_fail_list + do + at_group_normalized=$at_group + + eval 'while :; do + case $at_group_normalized in #( + '"$at_format"'*) break;; + esac + at_group_normalized=0$at_group_normalized + done' + + cat "$at_suite_dir/$at_group_normalized/$as_me.log" + echo + done + echo + fi + if test -n "$at_top_srcdir"; then + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## ${at_top_build_prefix}config.log ## +_ASBOX + sed 's/^/| /' ${at_top_build_prefix}config.log + echo + fi + } >&5 + + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## $as_me.log was created. ## +_ASBOX + + echo + if $at_debug_p; then + at_msg='per-test log files' + else + at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'" + fi + $as_echo "Please send $at_msg and all information you think might help: + + To: <debian-dpkg@lists.debian.org> + Subject: [dpkg 1.20.13] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly} + +You may investigate any problem if you feel able to do so, in which +case the test suite provides a good starting point. Its output may +be found below \`${at_testdir+${at_testdir}/}$as_me.dir'. +" + exit 1 +fi + +exit 0 + +## ------------- ## +## Actual tests. ## +## ------------- ## +#AT_START_1 +at_fn_group_banner 1 'deb-format.at:3' \ + "dpkg-deb options" " " 1 +at_xfail=no +( + $as_echo "1. $at_setup_line: testing $at_desc ..." + $at_traceon + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:5: dpkg-deb --help" +at_fn_check_prepare_trace "deb-format.at:5" +( $at_check_trace; dpkg-deb --help +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:5" +$at_failed && at_fn_log_failure +$at_traceon; } + + set +x + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 7>&- | eval $at_tee_pipe +read at_status <"$at_status_file" +#AT_STOP_1 +#AT_START_2 +at_fn_group_banner 2 'deb-format.at:8' \ + "dpkg-deb .deb format" " " 1 +at_xfail=no +( + $as_echo "2. $at_setup_line: testing $at_desc ..." + $at_traceon + + + +: >pkg-deb-bogus-empty.deb +{ set +x +$as_echo "$at_srcdir/deb-format.at:12: +# Check truncated deb w/ 0 size +dpkg-deb --info pkg-deb-bogus-empty.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:12" +( $at_check_trace; +# Check truncated deb w/ 0 size +dpkg-deb --info pkg-deb-bogus-empty.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: unexpected end of file in archive magic version number in pkg-deb-bogus-empty.deb +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_fn_diff_devnull "$at_stdout" || at_failed=: +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:12" +$at_failed && at_fn_log_failure +$at_traceon; } + + +cat >pkg-deb-old-bogus-only-version.deb <<'_ATEOF' +0.93 +_ATEOF + +{ set +x +$as_echo "$at_srcdir/deb-format.at:20: +# Check truncated old deb w/ only version magic +dpkg-deb --info pkg-deb-old-bogus-only-version.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:20" +( $at_check_trace; +# Check truncated old deb w/ only version magic +dpkg-deb --info pkg-deb-old-bogus-only-version.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: unexpected end of file in archive control member size in pkg-deb-old-bogus-only-version.deb +" | \ + $at_diff - "$at_stderr" || at_failed=: +at_fn_diff_devnull "$at_stdout" || at_failed=: +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:20" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-deb-format/DEBIAN' + + cat >'pkg-deb-format/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-deb-format +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + sed -i -e 's/^Description:.*$/& - deb format support/' 'pkg-deb-format/DEBIAN/control' + +cat >pkg-deb-format/file-templ <<'_ATEOF' +test +_ATEOF + +{ set +x +$as_echo "$at_srcdir/deb-format.at:31: +# Initialize the template package +mv pkg-deb-format pkg-templ +chmod -R u+w pkg-templ +find pkg-templ | xargs touch -t 197001010100.00 +dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null + +# Extract the base members +ar x pkg-templ.deb +gzip -c control.tar >control.tar.gz +gzip -c data.tar >data.tar.gz +xz -c control.tar >control.tar.xz +xz -c data.tar >data.tar.xz +bzip2 -c data.tar >data.tar.bz2 +lzma -c data.tar >data.tar.lzma +touch _ignore +touch unknown +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:31" +( $at_check_trace; +# Initialize the template package +mv pkg-deb-format pkg-templ +chmod -R u+w pkg-templ +find pkg-templ | xargs touch -t 197001010100.00 +dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null + +# Extract the base members +ar x pkg-templ.deb +gzip -c control.tar >control.tar.gz +gzip -c data.tar >data.tar.gz +xz -c control.tar >control.tar.xz +xz -c data.tar >data.tar.xz +bzip2 -c data.tar >data.tar.bz2 +lzma -c data.tar >data.tar.lzma +touch _ignore +touch unknown + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +at_fn_diff_devnull "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:31" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:50: +# Test debian-binary with 2.x versions +cp pkg-templ.deb pkg-version-2x.deb +echo 2.999 >debian-binary +ar rc pkg-version-2x.deb debian-binary +ar t pkg-version-2x.deb +ar x pkg-templ.deb debian-binary +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-version-2x.deb | sed -e 's/ *\$//' +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:50" +( $at_check_trace; +# Test debian-binary with 2.x versions +cp pkg-templ.deb pkg-version-2x.deb +echo 2.999 >debian-binary +ar rc pkg-version-2x.deb debian-binary +ar t pkg-version-2x.deb +ar x pkg-templ.deb debian-binary +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-version-2x.deb | sed -e 's/ *$//' + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar +data.tar + new Debian package, version 2.999. + size 20674 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:50" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:74: +# Test debian-binary with extra lines +cp pkg-templ.deb pkg-magic-extra.deb +echo \"extra line\" >>debian-binary +ar rc pkg-magic-extra.deb debian-binary +ar t pkg-magic-extra.deb +ar x pkg-templ.deb debian-binary +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-magic-extra.deb | sed -e 's/ *\$//' +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:74" +( $at_check_trace; +# Test debian-binary with extra lines +cp pkg-templ.deb pkg-magic-extra.deb +echo "extra line" >>debian-binary +ar rc pkg-magic-extra.deb debian-binary +ar t pkg-magic-extra.deb +ar x pkg-templ.deb debian-binary +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-magic-extra.deb | sed -e 's/ *$//' + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar +data.tar + new Debian package, version 2.0. + size 20684 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:74" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:98: +# Test missing debian-binary member +cp pkg-templ.deb pkg-missing-magic.deb +ar d pkg-missing-magic.deb debian-binary +ar t pkg-missing-magic.deb +dpkg-deb -I pkg-missing-magic.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:98" +( $at_check_trace; +# Test missing debian-binary member +cp pkg-templ.deb pkg-missing-magic.deb +ar d pkg-missing-magic.deb debian-binary +ar t pkg-missing-magic.deb +dpkg-deb -I pkg-missing-magic.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: file 'pkg-missing-magic.deb' is not a Debian binary archive (try dpkg-split?) +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "control.tar +data.tar +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:98" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:109: +# Test missing control member +cp pkg-templ.deb pkg-missing-control.deb +ar d pkg-missing-control.deb control.tar +ar t pkg-missing-control.deb +dpkg-deb -I pkg-missing-control.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:109" +( $at_check_trace; +# Test missing control member +cp pkg-templ.deb pkg-missing-control.deb +ar d pkg-missing-control.deb control.tar +ar t pkg-missing-control.deb +dpkg-deb -I pkg-missing-control.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-missing-control.deb' has premature member 'data.tar' before 'control.tar', giving up +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +data.tar +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:109" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:120: +# Test missing data member +cp pkg-templ.deb pkg-missing-data.deb +ar d pkg-missing-data.deb data.tar +ar t pkg-missing-data.deb +dpkg-deb -c pkg-missing-data.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:120" +( $at_check_trace; +# Test missing data member +cp pkg-templ.deb pkg-missing-data.deb +ar d pkg-missing-data.deb data.tar +ar t pkg-missing-data.deb +dpkg-deb -c pkg-missing-data.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: unexpected end of file in archive member header in pkg-missing-data.deb +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:120" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:131: +# Test mixed member (index 1) +cp pkg-templ.deb pkg-mixed-1-member.deb +ar ra debian-binary pkg-mixed-1-member.deb unknown +ar t pkg-mixed-1-member.deb +dpkg-deb -I pkg-mixed-1-member.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:131" +( $at_check_trace; +# Test mixed member (index 1) +cp pkg-templ.deb pkg-mixed-1-member.deb +ar ra debian-binary pkg-mixed-1-member.deb unknown +ar t pkg-mixed-1-member.deb +dpkg-deb -I pkg-mixed-1-member.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-mixed-1-member.deb' has premature member 'unknown' before 'control.tar', giving up +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +unknown +control.tar +data.tar +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:131" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:144: +# Test mixed member (index 2) +cp pkg-templ.deb pkg-mixed-2-member.deb +ar ra control.tar pkg-mixed-2-member.deb unknown +ar t pkg-mixed-2-member.deb +dpkg-deb -c pkg-mixed-2-member.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:144" +( $at_check_trace; +# Test mixed member (index 2) +cp pkg-templ.deb pkg-mixed-2-member.deb +ar ra control.tar pkg-mixed-2-member.deb unknown +ar t pkg-mixed-2-member.deb +dpkg-deb -c pkg-mixed-2-member.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-mixed-2-member.deb' has premature member 'unknown' before 'data.tar', giving up +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar +unknown +data.tar +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:144" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:157: +# Test swapped control and data members +cp pkg-templ.deb pkg-swap-members.deb +ar ma data.tar pkg-swap-members.deb control.tar +ar t pkg-swap-members.deb +dpkg-deb -I pkg-swap-members.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:157" +( $at_check_trace; +# Test swapped control and data members +cp pkg-templ.deb pkg-swap-members.deb +ar ma data.tar pkg-swap-members.deb control.tar +ar t pkg-swap-members.deb +dpkg-deb -I pkg-swap-members.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-swap-members.deb' has premature member 'data.tar' before 'control.tar', giving up +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +data.tar +control.tar +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:157" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:169: +# Test extra member +cp pkg-templ.deb pkg-extra-member.deb +ar q pkg-extra-member.deb unknown +ar t pkg-extra-member.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-extra-member.deb | sed -e 's/ *\$//' +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:169" +( $at_check_trace; +# Test extra member +cp pkg-templ.deb pkg-extra-member.deb +ar q pkg-extra-member.deb unknown +ar t pkg-extra-member.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-extra-member.deb | sed -e 's/ *$//' + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar +data.tar +unknown + new Debian package, version 2.0. + size 20732 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:169" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:192: +# Test _ member +cp pkg-templ.deb pkg-under-member.deb +ar ra debian-binary pkg-under-member.deb _ignore +ar t pkg-under-member.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-under-member.deb | sed -e 's/ *\$//' +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:192" +( $at_check_trace; +# Test _ member +cp pkg-templ.deb pkg-under-member.deb +ar ra debian-binary pkg-under-member.deb _ignore +ar t pkg-under-member.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-under-member.deb | sed -e 's/ *$//' + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +_ignore +control.tar +data.tar + new Debian package, version 2.0. + size 20732 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:192" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:215: +# Test data.tar.bad member +dd if=/dev/zero of=data.tar.bad bs=1K count=4 status=none +ar rc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad +ar t pkg-data-bad.deb +dpkg-deb -c pkg-data-bad.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:215" +( $at_check_trace; +# Test data.tar.bad member +dd if=/dev/zero of=data.tar.bad bs=1K count=4 status=none +ar rc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad +ar t pkg-data-bad.deb +dpkg-deb -c pkg-data-bad.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: archive 'pkg-data-bad.deb' uses unknown compression for member 'data.tar.bad', giving up +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar.gz +data.tar.bad +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:215" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:227: +# Test control.tar member +ar rc pkg-control-none.deb debian-binary control.tar data.tar +ar t pkg-control-none.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-control-none.deb | sed -e 's/ *\$//' +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:227" +( $at_check_trace; +# Test control.tar member +ar rc pkg-control-none.deb debian-binary control.tar data.tar +ar t pkg-control-none.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-control-none.deb | sed -e 's/ *$//' + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar +data.tar + new Debian package, version 2.0. + size 20672 bytes: control archive=10240 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:227" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:248: +# Test control.tar.xz member +ar rc pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz +ar t pkg-control-xz.deb +dpkg-deb -c pkg-control-xz.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:248" +( $at_check_trace; +# Test control.tar.xz member +ar rc pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz +ar t pkg-control-xz.deb +dpkg-deb -c pkg-control-xz.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar.xz +data.tar.xz +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:248" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:260: +# Test data.tar member +ar rc pkg-data-none.deb debian-binary control.tar.gz data.tar +ar t pkg-data-none.deb +dpkg-deb -c pkg-data-none.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:260" +( $at_check_trace; +# Test data.tar member +ar rc pkg-data-none.deb debian-binary control.tar.gz data.tar +ar t pkg-data-none.deb +dpkg-deb -c pkg-data-none.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar.gz +data.tar +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:260" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:272: +# Test data.tar.gz member +ar rc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz +ar t pkg-data-gz.deb +dpkg-deb -c pkg-data-gz.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:272" +( $at_check_trace; +# Test data.tar.gz member +ar rc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz +ar t pkg-data-gz.deb +dpkg-deb -c pkg-data-gz.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar.gz +data.tar.gz +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:272" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:284: +# Test data.tar.xz member +ar rc pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz +ar t pkg-data-xz.deb +dpkg-deb -c pkg-data-xz.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:284" +( $at_check_trace; +# Test data.tar.xz member +ar rc pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz +ar t pkg-data-xz.deb +dpkg-deb -c pkg-data-xz.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar.gz +data.tar.xz +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:284" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:296: +# Test data.tar.bz2 member +ar rc pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2 +ar t pkg-data-bz2.deb +dpkg-deb -c pkg-data-bz2.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:296" +( $at_check_trace; +# Test data.tar.bz2 member +ar rc pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2 +ar t pkg-data-bz2.deb +dpkg-deb -c pkg-data-bz2.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar.gz +data.tar.bz2 +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:296" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:308: +# Test data.tar.lzma member +ar rc pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma +ar t pkg-data-lzma.deb +dpkg-deb -c pkg-data-lzma.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:308" +( $at_check_trace; +# Test data.tar.lzma member +ar rc pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma +ar t pkg-data-lzma.deb +dpkg-deb -c pkg-data-lzma.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar.gz +data.tar.lzma +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:308" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-format.at:320: +# Test non-uniform data.tar/control.tar member compression +ar rc pkg-mixed-comp.deb debian-binary control.tar.xz data.tar.gz +ar t pkg-mixed-comp.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-mixed-comp.deb | sed -e 's/ *\$//' +dpkg-deb -c pkg-mixed-comp.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:320" +( $at_check_trace; +# Test non-uniform data.tar/control.tar member compression +ar rc pkg-mixed-comp.deb debian-binary control.tar.xz data.tar.gz +ar t pkg-mixed-comp.deb +# XXX: Ideally we would have no need to strip trailing spaces. +dpkg-deb -I pkg-mixed-comp.deb | sed -e 's/ *$//' +dpkg-deb -c pkg-mixed-comp.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "debian-binary +control.tar.xz +data.tar.gz + new Debian package, version 2.0. + size 682 bytes: control archive=336 bytes. + 193 bytes, 7 lines control + Package: pkg-deb-format + Version: 0.0-1 + Section: test + Priority: extra + Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> + Architecture: all + Description: test package - deb format support +drwxr-xr-x root/root 0 1970-01-01 00:00 ./ +-rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:320" +$at_failed && at_fn_log_failure +$at_traceon; } + + + set +x + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 7>&- | eval $at_tee_pipe +read at_status <"$at_status_file" +#AT_STOP_2 +#AT_START_3 +at_fn_group_banner 3 'deb-content.at:3' \ + "dpkg-deb .deb conffiles" " " 1 +at_xfail=no +( + $as_echo "3. $at_setup_line: testing $at_desc ..." + $at_traceon + + + + + mkdir -p 'pkg-conff-duped/DEBIAN' + + cat >'pkg-conff-duped/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-duped +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + mkdir -p 'pkg-conff-duped/DEBIAN' + + cat >'pkg-conff-duped/DEBIAN/conffiles' <<CTRL_TEMPL +/test-conffile-1 +/test-conffile-2 +/test-conffile-1 +CTRL_TEMPL + +cat >pkg-conff-duped/test-conffile-1 <<'_ATEOF' +test init +_ATEOF + +cat >pkg-conff-duped/test-conffile-2 <<'_ATEOF' +test init +_ATEOF + +{ set +x +$as_echo "$at_srcdir/deb-content.at:14: +# Duplicate conffile entries should produce a warning. +dpkg-deb -b pkg-conff-duped +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:14" +( $at_check_trace; +# Duplicate conffile entries should produce a warning. +dpkg-deb -b pkg-conff-duped + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: warning: conffile name '/test-conffile-1' is duplicated +dpkg-deb: warning: ignoring 1 warning about the control file(s) +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 0 $at_status "$at_srcdir/deb-content.at:14" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-noeol/DEBIAN' + + cat >'pkg-conff-noeol/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-noeol +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + +printf "/test-conffile-1" >"pkg-conff-noeol/DEBIAN/conffiles" +cat >pkg-conff-noeol/test-conffile-1 <<'_ATEOF' +test init +_ATEOF + +{ set +x +$as_echo "$at_srcdir/deb-content.at:25: +# Conffiles need a final newline to guarantee there's been no accidental +# file truncation. +dpkg-deb -b pkg-conff-noeol pkg-conff-noeol.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:25" +( $at_check_trace; +# Conffiles need a final newline to guarantee there's been no accidental +# file truncation. +dpkg-deb -b pkg-conff-noeol pkg-conff-noeol.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: conffile name '/test-conffile-1' is too long, or missing final newline +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:25" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-noabs/DEBIAN' + + cat >'pkg-conff-noabs/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-noabs +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + mkdir -p 'pkg-conff-noabs/DEBIAN' + + cat >'pkg-conff-noabs/DEBIAN/conffiles' <<CTRL_TEMPL +test-conffile-rel +CTRL_TEMPL + +cat >pkg-conff-noabs/test-conffile-rel <<'_ATEOF' +test init +_ATEOF + +{ set +x +$as_echo "$at_srcdir/deb-content.at:36: +# Conffiles must use absolute pathnames. +dpkg-deb -b pkg-conff-noabs pkg-conff-noabs.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:36" +( $at_check_trace; +# Conffiles must use absolute pathnames. +dpkg-deb -b pkg-conff-noabs pkg-conff-noabs.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: conffile name 'test-conffile-rel' is not an absolute pathname +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:36" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-empty/DEBIAN' + + cat >'pkg-conff-empty/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-empty +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + +printf " \n" >"pkg-conff-empty/DEBIAN/conffiles" +{ set +x +$as_echo "$at_srcdir/deb-content.at:44: +# Conffiles must not contain empty lines. +dpkg-deb -b pkg-conff-empty pkg-conff-empty.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:44" +( $at_check_trace; +# Conffiles must not contain empty lines. +dpkg-deb -b pkg-conff-empty pkg-conff-empty.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: empty and whitespace-only lines are not allowed in conffiles +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:44" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-space-prefix/DEBIAN' + + cat >'pkg-conff-space-prefix/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-space-prefix +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + mkdir -p 'pkg-conff-space-prefix/DEBIAN' + + cat >'pkg-conff-space-prefix/DEBIAN/conffiles' <<CTRL_TEMPL + /test-conffile +CTRL_TEMPL + +{ set +x +$as_echo "$at_srcdir/deb-content.at:52: +# Conffiles must not contain prefixed spaces. +dpkg-deb -b pkg-conff-space-prefix pkg-conff-space-prefix.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:52" +( $at_check_trace; +# Conffiles must not contain prefixed spaces. +dpkg-deb -b pkg-conff-space-prefix pkg-conff-space-prefix.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: line with conffile filename '/test-conffile' has leading white spaces +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:52" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-unknown-flag/DEBIAN' + + cat >'pkg-conff-unknown-flag/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-unknown-flag +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + mkdir -p 'pkg-conff-unknown-flag/DEBIAN' + + cat >'pkg-conff-unknown-flag/DEBIAN/conffiles' <<CTRL_TEMPL +unknown-flag /test-conffile +CTRL_TEMPL + +{ set +x +$as_echo "$at_srcdir/deb-content.at:60: +# Conffiles marked with an unknown flag. +dpkg-deb -b pkg-conff-unknown-flag pkg-conff-unknown-flag.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:60" +( $at_check_trace; +# Conffiles marked with an unknown flag. +dpkg-deb -b pkg-conff-unknown-flag pkg-conff-unknown-flag.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: unknown flag 'unknown-flag' for conffile '/test-conffile' +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:60" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-missing-pathname/DEBIAN' + + cat >'pkg-conff-missing-pathname/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-missing-pathname +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + +printf "unknown-flag \n" >"pkg-conff-missing-pathname/DEBIAN/conffiles" +{ set +x +$as_echo "$at_srcdir/deb-content.at:68: +# Conffiles need a pathname, in addition to a flag. +dpkg-deb -b pkg-conff-missing-pathname pkg-conff-missing-pathname.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:68" +( $at_check_trace; +# Conffiles need a pathname, in addition to a flag. +dpkg-deb -b pkg-conff-missing-pathname pkg-conff-missing-pathname.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: conffile name missing after flag 'unknown-flag' +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:68" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-removed-missing/DEBIAN' + + cat >'pkg-conff-removed-missing/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-removed-missing +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + mkdir -p 'pkg-conff-removed-missing/DEBIAN' + + cat >'pkg-conff-removed-missing/DEBIAN/conffiles' <<CTRL_TEMPL +remove-on-upgrade /test-conffile-missing +CTRL_TEMPL + +{ set +x +$as_echo "$at_srcdir/deb-content.at:76: +# Conffiles marked for removal must not be present. +dpkg-deb -b pkg-conff-removed-missing pkg-conff-removed-missing.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:76" +( $at_check_trace; +# Conffiles marked for removal must not be present. +dpkg-deb -b pkg-conff-removed-missing pkg-conff-removed-missing.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 0 $at_status "$at_srcdir/deb-content.at:76" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-removed-duped/DEBIAN' + + cat >'pkg-conff-removed-duped/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-removed-duped +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + mkdir -p 'pkg-conff-removed-duped/DEBIAN' + + cat >'pkg-conff-removed-duped/DEBIAN/conffiles' <<CTRL_TEMPL +remove-on-upgrade /test-conffile-1 +remove-on-upgrade /test-conffile-2 +remove-on-upgrade /test-conffile-1 +CTRL_TEMPL + +{ set +x +$as_echo "$at_srcdir/deb-content.at:85: +# Duplicate conffile entries should produce a warning. +dpkg-deb -b pkg-conff-removed-duped +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:85" +( $at_check_trace; +# Duplicate conffile entries should produce a warning. +dpkg-deb -b pkg-conff-removed-duped + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: warning: conffile name '/test-conffile-1' is duplicated +dpkg-deb: warning: ignoring 1 warning about the control file(s) +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 0 $at_status "$at_srcdir/deb-content.at:85" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-removed-noeol/DEBIAN' + + cat >'pkg-conff-removed-noeol/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-removed-noeol +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + +printf "remove-on-upgrade /test-conffile-1" >"pkg-conff-removed-noeol/DEBIAN/conffiles" +{ set +x +$as_echo "$at_srcdir/deb-content.at:94: +# Conffiles need a final newline to guarantee there has been no accidental +# file truncation. +dpkg-deb -b pkg-conff-removed-noeol pkg-conff-removed-noeol.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:94" +( $at_check_trace; +# Conffiles need a final newline to guarantee there has been no accidental +# file truncation. +dpkg-deb -b pkg-conff-removed-noeol pkg-conff-removed-noeol.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: conffile name 'remove-on-upgrade /test-conffile-1' is too long, or missing final newline +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:94" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-removed-noabs/DEBIAN' + + cat >'pkg-conff-removed-noabs/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-removed-noabs +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + mkdir -p 'pkg-conff-removed-noabs/DEBIAN' + + cat >'pkg-conff-removed-noabs/DEBIAN/conffiles' <<CTRL_TEMPL +remove-on-upgrade test-conffile-rel +CTRL_TEMPL + +cat >pkg-conff-removed-noabs/test-conffile-rel <<'_ATEOF' +test init +_ATEOF + +{ set +x +$as_echo "$at_srcdir/deb-content.at:105: +# Conffiles must use absolute pathnames. +dpkg-deb -b pkg-conff-removed-noabs pkg-conff-removed-noabs.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:105" +( $at_check_trace; +# Conffiles must use absolute pathnames. +dpkg-deb -b pkg-conff-removed-noabs pkg-conff-removed-noabs.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: conffile name 'test-conffile-rel' is not an absolute pathname +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:105" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-conff-removed-present/DEBIAN' + + cat >'pkg-conff-removed-present/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-conff-removed-present +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + mkdir -p 'pkg-conff-removed-present/DEBIAN' + + cat >'pkg-conff-removed-present/DEBIAN/conffiles' <<CTRL_TEMPL +remove-on-upgrade /test-conffile-present +CTRL_TEMPL + +cat >pkg-conff-removed-present/test-conffile-present <<'_ATEOF' +test init +_ATEOF + +{ set +x +$as_echo "$at_srcdir/deb-content.at:115: +# Conffiles marked for removal must not be present. +dpkg-deb -b pkg-conff-removed-present pkg-conff-removed-present.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:115" +( $at_check_trace; +# Conffiles marked for removal must not be present. +dpkg-deb -b pkg-conff-removed-present pkg-conff-removed-present.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: conffile '/test-conffile-present' is present but is requested to be removed +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:115" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-deb-newline/DEBIAN' + + cat >'pkg-deb-newline/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-deb-newline +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + +touch 'pkg-deb-newline/file +newline' +{ set +x +$as_echo "$at_srcdir/deb-content.at:124: +# Cannot create package with newlines in filenames. +dpkg-deb -b pkg-deb-newline +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-content.at:124" +( $at_check_trace; +# Cannot create package with newlines in filenames. +dpkg-deb -b pkg-deb-newline + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +echo >>"$at_stderr"; $as_echo "dpkg-deb: error: newline not allowed in pathname './file +newline' +" | \ + $at_diff - "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 2 $at_status "$at_srcdir/deb-content.at:124" +$at_failed && at_fn_log_failure +$at_traceon; } + + + set +x + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 7>&- | eval $at_tee_pipe +read at_status <"$at_status_file" +#AT_STOP_3 +#AT_START_4 +at_fn_group_banner 4 'deb-fields.at:3' \ + "dpkg-deb .deb fields" " " 1 +at_xfail=no +( + $as_echo "4. $at_setup_line: testing $at_desc ..." + $at_traceon + + + + + mkdir -p 'pkg-package-type-void/DEBIAN' + + cat >'pkg-package-type-void/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-package-type-void +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + +{ set +x +$as_echo "$at_srcdir/deb-fields.at:7: +dpkg-deb -b pkg-package-type-void +# Test absence of Package-Type field. +test -z \"\$(dpkg-deb -f pkg-package-type-void.deb Package-Type)\" +" +at_fn_check_prepare_notrace 'a $(...) command substitution' "deb-fields.at:7" +( $at_check_trace; +dpkg-deb -b pkg-package-type-void +# Test absence of Package-Type field. +test -z "$(dpkg-deb -f pkg-package-type-void.deb Package-Type)" + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 0 $at_status "$at_srcdir/deb-fields.at:7" +$at_failed && at_fn_log_failure +$at_traceon; } + + + + mkdir -p 'pkg-package-type-use/DEBIAN' + + cat >'pkg-package-type-use/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-package-type-use +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + sed -i -e '/^Package:/aPackage-Type: udeb' 'pkg-package-type-use/DEBIAN/control' + +{ set +x +$as_echo "$at_srcdir/deb-fields.at:15: +dpkg-deb -b pkg-package-type-use +# Test presence of Package-Type field. +test -n \"\$(dpkg-deb -f pkg-package-type-use.deb Package-Type)\" +" +at_fn_check_prepare_notrace 'a $(...) command substitution' "deb-fields.at:15" +( $at_check_trace; +dpkg-deb -b pkg-package-type-use +# Test presence of Package-Type field. +test -n "$(dpkg-deb -f pkg-package-type-use.deb Package-Type)" + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 0 $at_status "$at_srcdir/deb-fields.at:15" +$at_failed && at_fn_log_failure +$at_traceon; } + + + set +x + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 7>&- | eval $at_tee_pipe +read at_status <"$at_status_file" +#AT_STOP_4 +#AT_START_5 +at_fn_group_banner 5 'deb-split.at:3' \ + "dpkg-split options" " " 2 +at_xfail=no +( + $as_echo "5. $at_setup_line: testing $at_desc ..." + $at_traceon + + +{ set +x +$as_echo "$at_srcdir/deb-split.at:5: dpkg-split --help" +at_fn_check_prepare_trace "deb-split.at:5" +( $at_check_trace; dpkg-split --help +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo stdout:; cat "$at_stdout" +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:5" +$at_failed && at_fn_log_failure +$at_traceon; } + + set +x + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 7>&- | eval $at_tee_pipe +read at_status <"$at_status_file" +#AT_STOP_5 +#AT_START_6 +at_fn_group_banner 6 'deb-split.at:8' \ + "dpkg-split .deb format" " " 2 +at_xfail=no +( + $as_echo "6. $at_setup_line: testing $at_desc ..." + $at_traceon + + + + + mkdir -p 'pkg-split/DEBIAN' + + cat >'pkg-split/DEBIAN/control' <<CTRL_TEMPL +Package: pkg-split +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package +CTRL_TEMPL + + + sed -i -e 's/^Description:.*$/& - normal package to be split/' 'pkg-split/DEBIAN/control' + +{ set +x +$as_echo "$at_srcdir/deb-split.at:14: +# Initialize the template package +chmod -R u+w pkg-split +# XXX: Some environments set SIGPIPE to ignore which we cannot reset, and 'yes' +# does check print error conditions, so we ignore its error message here. +yes 2>/dev/null | dd of=pkg-split/data-file bs=1024 count=2048 status=none +find pkg-split | xargs touch -t 197001010100.00 +dpkg-deb --root-owner-group -Znone -b pkg-split >/dev/null +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:14" +( $at_check_trace; +# Initialize the template package +chmod -R u+w pkg-split +# XXX: Some environments set SIGPIPE to ignore which we cannot reset, and 'yes' +# does check print error conditions, so we ignore its error message here. +yes 2>/dev/null | dd of=pkg-split/data-file bs=1024 count=2048 status=none +find pkg-split | xargs touch -t 197001010100.00 +dpkg-deb --root-owner-group -Znone -b pkg-split >/dev/null + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +at_fn_diff_devnull "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:14" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-split.at:24: +# Test splitting a package (in 10 parts: 9 * 210 KiB B + 158 KiB) +dpkg-split -S 210 -s pkg-split.deb pkg-split-part +for p in \$(seq 10); do + test -f pkg-split-part.\${p}of10.deb +done +" +at_fn_check_prepare_notrace 'a $(...) command substitution' "deb-split.at:24" +( $at_check_trace; +# Test splitting a package (in 10 parts: 9 * 210 KiB B + 158 KiB) +dpkg-split -S 210 -s pkg-split.deb pkg-split-part +for p in $(seq 10); do + test -f pkg-split-part.${p}of10.deb +done + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Splitting package pkg-split into 10 parts: 1 2 3 4 5 6 7 8 9 10 done +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:24" +$at_failed && at_fn_log_failure +$at_traceon; } + + +DEB_SPLIT_MD5SUM=0a4dfee0e57e273cd260ece947ce6bde +DEB_SPLIT_LENGTH=2109632 +DEB_SPLIT_PART_LENGTH=214016 +DEB_SPLIT_PART_SIZE=214222 +DEB_SPLIT_LAST_LENGTH=183488 +DEB_SPLIT_LAST_SIZE=183694 + +{ set +x +$as_echo "$at_srcdir/deb-split.at:40: +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.1of10.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:40" +( $at_check_trace; +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.1of10.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "pkg-split-part.1of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 1/10 + Part length: $DEB_SPLIT_PART_LENGTH bytes + Part offset: 0 bytes + Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes + +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:40" +$at_failed && at_fn_log_failure +$at_traceon; } + +{ set +x +$as_echo "$at_srcdir/deb-split.at:57: +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.2of10.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:57" +( $at_check_trace; +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.2of10.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "pkg-split-part.2of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 2/10 + Part length: $DEB_SPLIT_PART_LENGTH bytes + Part offset: 214016 bytes + Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes + +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:57" +$at_failed && at_fn_log_failure +$at_traceon; } + +{ set +x +$as_echo "$at_srcdir/deb-split.at:74: +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.9of10.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:74" +( $at_check_trace; +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.9of10.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "pkg-split-part.9of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 9/10 + Part length: $DEB_SPLIT_PART_LENGTH bytes + Part offset: 1712128 bytes + Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes + +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:74" +$at_failed && at_fn_log_failure +$at_traceon; } + +{ set +x +$as_echo "$at_srcdir/deb-split.at:91: +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.10of10.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:91" +( $at_check_trace; +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.10of10.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "pkg-split-part.10of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 10/10 + Part length: $DEB_SPLIT_LAST_LENGTH bytes + Part offset: 1926144 bytes + Part file size (used portion): $DEB_SPLIT_LAST_SIZE bytes + +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:91" +$at_failed && at_fn_log_failure +$at_traceon; } + + +{ set +x +$as_echo "$at_srcdir/deb-split.at:109: +# Test joining the split parts back together +dpkg-split -o pkg-joined.deb -j pkg-split-part.*.deb +cmp pkg-split.deb pkg-joined.deb +" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:109" +( $at_check_trace; +# Test joining the split parts back together +dpkg-split -o pkg-joined.deb -j pkg-split-part.*.deb +cmp pkg-split.deb pkg-joined.deb + +) >>"$at_stdout" 2>>"$at_stderr" 5>&- +at_status=$? at_failed=false +$at_check_filter +at_fn_diff_devnull "$at_stderr" || at_failed=: +echo >>"$at_stdout"; $as_echo "Putting package pkg-split together from 10 parts: 1 2 3 4 5 6 7 8 9 10 done +" | \ + $at_diff - "$at_stdout" || at_failed=: +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:109" +$at_failed && at_fn_log_failure +$at_traceon; } + + + set +x + $at_times_p && times >"$at_times_file" +) 5>&1 2>&1 7>&- | eval $at_tee_pipe +read at_status <"$at_status_file" +#AT_STOP_6 diff --git a/t-func/testsuite.at b/t-func/testsuite.at new file mode 100644 index 0000000..6b19bcf --- /dev/null +++ b/t-func/testsuite.at @@ -0,0 +1,10 @@ +AT_INIT([dpkg tools functional test suite]) +AT_COLOR_TESTS + +AT_BANNER([Binary .deb packages]) +m4_include([deb-format.at]) +m4_include([deb-content.at]) +m4_include([deb-fields.at]) + +AT_BANNER([Split .deb packages]) +m4_include([deb-split.at]) diff --git a/t/codespell.t b/t/codespell.t new file mode 100644 index 0000000..13d66ee --- /dev/null +++ b/t/codespell.t @@ -0,0 +1,75 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_author(); +test_needs_command('codespell'); +test_needs_srcdir_switch(); + +plan tests => 1; + +my @codespell_skip = qw( + .git + *.po + *.pot + *.gmo + *.add + *.cache + *~ + .libs + .deps + ChangeLog + Makefile.in + Makefile + configure + config.* + libtool + libtool.m4 + aclocal.m4 + autom4te.cache + _build + build-aux + build-tree + tmp +); +my $codespell_skip = join ',', @codespell_skip; + +my @codespell_opts = (qw( + --ignore-words=t/codespell/stopwords +), ( + "--skip=$codespell_skip" +)); +my $tags = qx(codespell @codespell_opts 2>&1); + +# Fixup the output: +$tags =~ s/^WARNING: Binary file:.*\n//mg; +$tags =~ s{^\./build-aux/.*\n}{}mg; +$tags =~ s{^\./man/[a-zA-Z_]+/.*\n}{}mg; +# XXX: Ignore python-3.8 runtime warnings: +$tags =~ s{^.*: RuntimeWarning: line buffering .*\n}{}mg; +$tags =~ s{^\s*file = builtins.open.*\n}{}mg; +chomp $tags; + +my $ok = length $tags == 0; + +ok($ok, 'codespell'); +if (not $ok) { + diag($tags); +} diff --git a/t/codespell/stopwords b/t/codespell/stopwords new file mode 100644 index 0000000..41c9bc0 --- /dev/null +++ b/t/codespell/stopwords @@ -0,0 +1,31 @@ +accreting +ba +cas +chage +chang +claus +cmo +creat +dof +files' +finitel +fo +iff +isnt +ist +ists +lowercased +mitre +msdos +objext +od +packages' +process' +rcall +readded +rela +synopsys +te +thru +ths +troup diff --git a/t/cppcheck.t b/t/cppcheck.t new file mode 100644 index 0000000..9e8108a --- /dev/null +++ b/t/cppcheck.t @@ -0,0 +1,49 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_author(); +test_needs_command('cppcheck'); +test_needs_srcdir_switch(); + +plan tests => 1; + +# XXX: We should add the following to @cppcheck_opts, but then cppcheck emits +# tons of false positives due to not understanding non-returning functions. +# -DLIBDPKG_VOLATILE_API=1 +# -Ilib +my @cppcheck_opts = (qw( + -q --force --error-exitcode=2 + --suppressions-list=t/cppcheck/cppcheck.supp +), ( + '--enable=warning,performance,portability,style', + '--template=\'{file}:{line}: {severity} ({id}): {message}\'' +)); +my $tags = qx(cppcheck @cppcheck_opts . 2>&1); + +# Fixup the output: +chomp $tags; + +my $ok = length $tags == 0; + +ok($ok, 'cppcheck'); +if (not $ok) { + diag($tags); +} diff --git a/t/cppcheck/cppcheck.supp b/t/cppcheck/cppcheck.supp new file mode 100644 index 0000000..fbe17dd --- /dev/null +++ b/t/cppcheck/cppcheck.supp @@ -0,0 +1,63 @@ +// +// Suppression file for cppcheck. +/// + +// We assume that the system has a sane NULL definition. +varFuncNullUB + +// TODO: While perhaps valid there are many to handle right away. +variableScope + +// Ignore, this is an imported module. +unusedStructMember:lib/compat/obstack.c +nullPointerArithmetic:lib/compat/obstack.c +nullPointerRedundantCheck:lib/compat/obstack.c +nullPointerArithmeticRedundantCheck:lib/compat/obstack.c + +// Ignore, we are testing the functions. +knownConditionTrueFalse:lib/dpkg/t/t-macros.c + +// Ignore, we use our own test assertions macros. +literalWithCharPtrCompare:lib/dpkg/t/t-test.c + +// Ignore, the code is used only for its binary artifacts. +uninitMemberVar:*/Dpkg_Shlibs/patterns.cpp + +// BUG: False positive, it gets triggered even with -Ilib. +unknownMacro + +// BUG: False positive, the function returns a pointer within a local. +returnDanglingLifetime:lib/dpkg/pkg-hash.c + +// BUG: False positive, the variable uses operator() which writes to it. +constVariable:dselect/pkgsublist.cc:111 + +// BUG: False positive. +syntaxError:lib/dpkg/t/*.c + +// BUG: False positive, the loop does an early exit. +identicalInnerCondition:lib/dpkg/fsys-hash.c:96 + +// BUG: False positive, the macros from lib/dpkg/dlist.h use the tail member. +unusedStructMember:lib/dpkg/triglib.c:378 + +// BUG: False positive, does not understand non-returning functors. +negativeIndex:dpkg-deb/build.c +nullPointerArithmeticRedundantCheck:lib/dpkg/db-fsys-files.c +nullPointerArithmeticRedundantCheck:lib/dpkg/db-fsys-override.c +nullPointerRedundantCheck:dpkg-deb/build.c +nullPointerRedundantCheck:lib/dpkg/db-fsys-override.c +nullPointerRedundantCheck:lib/dpkg/ehandle.c +nullPointerRedundantCheck:src/enquiry.c +nullPointerRedundantCheck:src/unpack.c +nullPointerRedundantCheck:utils/update-alternatives.c:1193 +doubleFree:utils/update-alternatives.c:1248 + +// BUG: False positive, does not understand non-returning functions + vaargs. +va_end_missing:lib/dpkg/parsehelp.c:68 + +// BUG: False positive, due to our local va_copy(). +va_list_usedBeforeStarted:lib/compat/vasprintf.c + +// BUG: False positive, SIGWINCH is not a fatal signal. +unreachableCode:dselect/basecmds.cc:130 diff --git a/t/critic.t b/t/critic.t new file mode 100644 index 0000000..acb841f --- /dev/null +++ b/t/critic.t @@ -0,0 +1,131 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_author(); +test_needs_module('Test::Perl::Critic'); +test_needs_srcdir_switch(); + +my @policies = qw( + BuiltinFunctions::ProhibitBooleanGrep + BuiltinFunctions::ProhibitLvalueSubstr + BuiltinFunctions::ProhibitReverseSortBlock + BuiltinFunctions::ProhibitSleepViaSelect + BuiltinFunctions::ProhibitStringySplit + BuiltinFunctions::ProhibitUniversalCan + BuiltinFunctions::ProhibitUniversalIsa + BuiltinFunctions::ProhibitUselessTopic + BuiltinFunctions::ProhibitVoidGrep + BuiltinFunctions::ProhibitVoidMap + BuiltinFunctions::RequireBlockGrep + BuiltinFunctions::RequireBlockMap + BuiltinFunctions::RequireGlobFunction + BuiltinFunctions::RequireSimpleSortBlock + ClassHierarchies::ProhibitAutoloading + ClassHierarchies::ProhibitExplicitISA + ClassHierarchies::ProhibitOneArgBless + CodeLayout::ProhibitHardTabs + CodeLayout::ProhibitQuotedWordLists + CodeLayout::ProhibitTrailingWhitespace + CodeLayout::RequireConsistentNewlines + ControlStructures::ProhibitCStyleForLoops + ControlStructures::ProhibitLabelsWithSpecialBlockNames + ControlStructures::ProhibitMutatingListFunctions + ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions + ControlStructures::ProhibitUntilBlocks + Documentation::RequirePackageMatchesPodName + Documentation::RequirePodSections + InputOutput::ProhibitBarewordFileHandles + InputOutput::ProhibitInteractiveTest + InputOutput::ProhibitJoinedReadline + InputOutput::ProhibitOneArgSelect + InputOutput::ProhibitReadlineInForLoop + InputOutput::ProhibitTwoArgOpen + InputOutput::RequireBracedFileHandleWithPrint + InputOutput::RequireCheckedOpen + InputOutput::RequireEncodingWithUTF8Layer + Miscellanea::ProhibitFormats + Miscellanea::ProhibitTies + Miscellanea::ProhibitUnrestrictedNoCritic + Miscellanea::ProhibitUselessNoCritic + Modules::ProhibitConditionalUseStatements + Modules::ProhibitEvilModules + Modules::RequireBarewordIncludes + Modules::RequireEndWithOne + Modules::RequireExplicitPackage + Modules::RequireFilenameMatchesPackage + NamingConventions::Capitalization + Objects::ProhibitIndirectSyntax + RegularExpressions::ProhibitSingleCharAlternation + RegularExpressions::ProhibitUnusedCapture + RegularExpressions::ProhibitUnusualDelimiters + RegularExpressions::ProhibitUselessTopic + RegularExpressions::RequireBracesForMultiline + RegularExpressions::RequireExtendedFormatting + Subroutines::ProhibitAmpersandSigils + Subroutines::ProhibitExplicitReturnUndef + Subroutines::ProhibitManyArgs + Subroutines::ProhibitNestedSubs + Subroutines::ProhibitReturnSort + Subroutines::ProhibitUnusedPrivateSubroutines + Subroutines::ProtectPrivateSubs + TestingAndDebugging::ProhibitNoStrict + TestingAndDebugging::ProhibitNoWarnings + TestingAndDebugging::RequireTestLabels + TestingAndDebugging::RequireUseStrict + TestingAndDebugging::RequireUseWarnings + ValuesAndExpressions::ProhibitCommaSeparatedStatements + ValuesAndExpressions::ProhibitComplexVersion + ValuesAndExpressions::ProhibitInterpolationOfLiterals + ValuesAndExpressions::ProhibitLongChainsOfMethodCalls + ValuesAndExpressions::ProhibitMismatchedOperators + ValuesAndExpressions::ProhibitMixedBooleanOperators + ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters + ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator + ValuesAndExpressions::ProhibitVersionStrings + ValuesAndExpressions::RequireConstantVersion + ValuesAndExpressions::RequireQuotedHeredocTerminator + ValuesAndExpressions::RequireUpperCaseHeredocTerminator + Variables::ProhibitAugmentedAssignmentInDeclaration + Variables::ProhibitConditionalDeclarations + Variables::ProhibitLocalVars + Variables::ProhibitMatchVars + Variables::ProhibitPackageVars + Variables::ProhibitPerl4PackageNames + Variables::ProhibitUnusedVariables + Variables::ProtectPrivateVars + Variables::RequireLexicalLoopIterators + Variables::RequireNegativeIndices +); + +Test::Perl::Critic->import( + -profile => 't/critic/perlcriticrc', + -verbose => 8, + -include => \@policies, + -only => 1, +); + +my @files = Test::Dpkg::all_perl_files(); + +plan tests => scalar @files; + +for my $file (@files) { + critic_ok($file); +} diff --git a/t/critic/perlcriticrc b/t/critic/perlcriticrc new file mode 100644 index 0000000..e368954 --- /dev/null +++ b/t/critic/perlcriticrc @@ -0,0 +1,126 @@ +## Perl Critic configuration file +severity = 1 +verbose = %f %l:%c (Severity: %s)\n %P (%s)\n near '%r'\n%d\n +program-extensions = .pl .t + +## +## Tune tests +## + +[Documentation::RequirePodSections] +lib_sections = NAME | DESCRIPTION | CHANGES +script_sections = NAME | SYNOPSIS | DESCRIPTION + +[RegularExpressions::ProhibitUnusualDelimiters] +allow_all_brackets = 1 + +[RegularExpressions::RequireBracesForMultiline] +allow_all_brackets = 1 + +[RegularExpressions::RequireExtendedFormatting] +minimum_regex_length_to_complain_about = 60 + +[ValuesAndExpressions::ProhibitInterpolationOfLiterals] +# TODO: switch these to q{} ? +allow_if_string_contains_single_quote = 1 + +## +## Disable tests +## + +# Here complex is meant as long, but long is not necessarily complex. +[-BuiltinFunctions::ProhibitComplexMappings] + +# Needed when generating code. +[-BuiltinFunctions::ProhibitStringyEval] + +# BUG: Bogus check. +[-Documentation::PodSpelling] + +# While this might be good for performance, it is bad for keeping docs updated. +[-Documentation::RequirePodAtEnd] + +# Too many false positives. +[-CodeLayout::RequireTidyCode] + +# Forcing this just turns into noise (depending on the context, it makes sense). +[-CodeLayout::RequireTrailingCommas] + +# These are fine. +[-ControlStructures::ProhibitCascadingIfElse] + +# These are fine, too many in the code base anyway. +[-ControlStructures::ProhibitPostfixControls] + +# These are fine, usually as long as they are not double negations. +[-ControlStructures::ProhibitUnlessBlocks] + +# BUG: Too many false positives. +[-ControlStructures::ProhibitUnreachableCode] + +# TODO: Check it out, add new Dpkg::Program module? +[-InputOutput::ProhibitBacktickOperators] + +# Needed, using <>/<@ARGV> is not correct, Prompt is not a core module. +[-InputOutput::ProhibitExplicitStdin] + +# TODO: Maybe, some of these are part of the public/current API. +[-Modules::ProhibitAutomaticExportation] + +# Here complex is meant as long, but long is not necessarily complex. +[-Modules::ProhibitExcessMainComplexity] + +# BUG: Too many false positives; non-modules all trigger. +[-Modules::RequireVersionVar] + +# These are fine. +[-NamingConventions::ProhibitAmbiguousNames] + +# We work primarily with ASCII, so we need to specify the exact characters +# to match. +[-RegularExpressions::ProhibitEnumeratedClasses] + +# When . is used in the code it means what it does. +[-RegularExpressions::RequireDotMatchAnything] + +# When ^ or $ are used in the code they mean what they do. +[-RegularExpressions::RequireLineBoundaryMatching] + +# TODO: While valid, these are part of the public/current API. +[-Subroutines::ProhibitBuiltinHomonyms] + +# Needed. +[-Subroutines::ProhibitSubroutinePrototypes] + +# Adding these seems like more noise. +[-Subroutines::RequireFinalReturn] + +# Readers need to know perl, English module is worse. +[-Variables::ProhibitPunctuationVars] + +# Readers need to know perl. +[-Variables::RequireInitializationForLocalVars] + +# BUG: Too many false positives; on ::main and for $ENV, $SIG, $?, $a, $b. +[-Variables::RequireLocalizedPunctuationVars] + +# Readonly is not a core module. +[-ValuesAndExpressions::ProhibitConstantPragma] + +# TODO: Check it out, using other quotes might be less readable and uniform. +[-ValuesAndExpressions::ProhibitEmptyQuotes] + +# Using charnames is less clear. +[-ValuesAndExpressions::ProhibitEscapedCharacters] + +# Used for help output. +[-ValuesAndExpressions::ProhibitImplicitNewlines] + +# Octals are fine. +[-ValuesAndExpressions::ProhibitLeadingZeros] + +# TODO: Check it out, some magic numbers are fine, octals for example. +[-ValuesAndExpressions::ProhibitMagicNumbers] + +# BUG: False positives on long hex numbers, even when separated. +[-ValuesAndExpressions::RequireNumberSeparators] diff --git a/t/minimum-version.t b/t/minimum-version.t new file mode 100644 index 0000000..f3484db --- /dev/null +++ b/t/minimum-version.t @@ -0,0 +1,32 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_author(); +test_needs_module('Test::MinimumVersion'); +test_needs_srcdir_switch(); + +my @files = Test::Dpkg::all_perl_files(); + +plan tests => scalar @files; + +for my $file (@files) { + minimum_version_ok($file, '5.24.1'); +} diff --git a/t/module-version.t b/t/module-version.t new file mode 100644 index 0000000..401f373 --- /dev/null +++ b/t/module-version.t @@ -0,0 +1,73 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); +use Module::Metadata; + +test_needs_srcdir_switch(); + +my @files = Test::Dpkg::all_perl_modules(); + +plan tests => scalar @files; + +sub module_version_ok +{ + my $file = shift; + + my $mod = Module::Metadata->new_from_file($file, collect_pod => 1); + my $modver = $mod->version(); + my $podver; + + SKIP: { + if ($mod->contains_pod()) { + my $in_changes = 0; + + foreach my $sect ($mod->pod_inside) { + if ($sect eq 'CHANGES') { + $in_changes = 1; + next; + } + + if ($in_changes and $sect =~ m/^Version ([0-9x.]+)/) { + $podver = $1; + last; + } + } + + if (not $in_changes) { + fail("module $file does not contain a CHANGES POD section"); + return; + } + } else { + skip("module $file does not contain POD", 1); + } + + if (defined $podver and $podver eq '0.xx') { + ok($modver =~ m/^0.\d\d$/, + "module $file version $modver is POD version 0.xx"); + } else { + ok($modver eq $podver, + "module $file version $modver == POD version $podver"); + } + } +} + +foreach my $file (@files) { + module_version_ok($file); +}; @@ -0,0 +1,51 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_author(); +test_needs_command('i18nspector'); +test_needs_srcdir_switch(); + +my @files = Test::Dpkg::all_po_files(); + +plan skip_all => 'no PO files distributed' if @files == 0; +plan tests => scalar @files; + +sub po_ok { + my $file = shift; + + my $tags = qx(i18nspector \"$file\" 2>&1); + + # Fixup the output: + $tags =~ s/^.*\.pot: boilerplate-in-initial-comments .*\n//mg; + $tags =~ s/^.*\.po: duplicate-header-field X-POFile-SpellExtra\n//mg; + chomp $tags; + + my $ok = length $tags == 0; + + ok($ok, "PO check $file"); + if (not $ok) { + diag($tags); + } +} + +for my $file (@files) { + po_ok($file); +} diff --git a/t/pod-coverage.t b/t/pod-coverage.t new file mode 100644 index 0000000..113feb2 --- /dev/null +++ b/t/pod-coverage.t @@ -0,0 +1,77 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use List::Util qw(any); +use File::Find; +use Module::Metadata; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_author(); +test_needs_module('Test::Pod::Coverage'); +test_needs_srcdir_switch(); + +sub all_pod_modules +{ + my @modules_todo = @_; + my @modules; + my $scan_perl_modules = sub { + my $module = $File::Find::name; + + # Only check modules, scripts are documented in man pages. + return unless $module =~ s/\.pm$//; + + my $mod = Module::Metadata->new_from_file($File::Find::name); + + # As a first step just check public modules (version > 0.xx). + return if $mod->version() =~ m/^0\.\d\d$/; + + $module =~ s{^\Q$File::Find::topdir\E/}{}; + $module =~ s{/}{::}g; + + return if any { $module eq $_ } @modules_todo; + + push @modules, $module; + }; + + my %options = ( + wanted => $scan_perl_modules, + no_chdir => 1, + ); + find(\%options, Test::Dpkg::test_get_perl_dirs()); + + return @modules; +} + +my @modules_todo = qw(Dpkg::Arch Dpkg::Source::Package); +my @modules = all_pod_modules(@modules_todo); + +plan tests => scalar @modules + scalar @modules_todo; + +for my $module (@modules) { + pod_coverage_ok($module); +} + +TODO: { + local $TODO = 'modules partially documented'; + + for my $module (@modules_todo) { + pod_coverage_ok($module); + } +} diff --git a/t/pod-spell.t b/t/pod-spell.t new file mode 100644 index 0000000..13b5383 --- /dev/null +++ b/t/pod-spell.t @@ -0,0 +1,97 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_author(); +test_needs_module('Test::Spelling'); +test_needs_command('aspell'); + +if (qx(aspell dicts) !~ m/en_US/) { + plan skip_all => 'aspell en_US dictionary required for spell checking POD'; +} + +test_needs_srcdir_switch(); + +my @files = Test::Dpkg::all_perl_files(); + +plan tests => scalar @files; + +set_spell_cmd('aspell list --encoding UTF-8 -l en_US -p /dev/null'); +add_stopwords(<DATA>); + +for my $file (@files) { + pod_file_spelling_ok($file); +} + +__DATA__ +CVS +DSC +Dpkg +IPC +ORed +OpenPGP +RCS +XDG +archqual +buildinfo +bzip2 +canonicalized +checksum +checksums +cmdline +debian +decompressor +dep +deps +dpkg +dpkg-buildflags +dpkg-buildpackage +dpkg-checkbuilddeps +dpkg-dev +dpkg-genbuildinfo +dpkg-gencontrol +dpkg-parsechangelog +dsc +dup'ed +env +envvar +fieldnames +forceplugin +ge +getters +gettext +hurd +keyrings +le +libdir +lzma +modelines +multiarch +nocheck +qa +quiesced +reportfile +rfc822 +sig +substvar +substvars +unparsed +update-buildflags +xz @@ -0,0 +1,27 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs :paths); + +test_needs_module('Test::Pod', '1.00'); +test_needs_srcdir_switch(); + +my @files = Test::Dpkg::all_perl_files(); + +all_pod_files_ok(@files); diff --git a/t/shellcheck.t b/t/shellcheck.t new file mode 100644 index 0000000..6872ea9 --- /dev/null +++ b/t/shellcheck.t @@ -0,0 +1,71 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_author(); +test_needs_command('shellcheck'); +test_needs_srcdir_switch(); + +my @todofiles = qw( + dselect/methods/disk/install + dselect/methods/disk/setup + dselect/methods/disk/update + dselect/methods/multicd/install + dselect/methods/multicd/setup + dselect/methods/multicd/update +); +my @files = qw( + autogen + get-version + run-script + debian/dpkg.cron.daily + debian/dpkg.postrm + scripts/dpkg-maintscript-helper.sh + scripts/dpkg-realpath.sh +); +my @shellcheck_opts = ( + '--exclude=SC1090', # Allow non-constant source. + '--exclude=SC2039', # Allow local keyword. + '--exclude=SC2166', # Allow -a and -o. + '--exclude=SC2034', # Allow unused variables for colors. +); + +plan tests => scalar @files; + +sub shell_syntax_ok +{ + my $file = shift; + + my $tags = qx(shellcheck @shellcheck_opts $file 2>&1); + + # Fixup the output: + chomp $tags; + + my $ok = length $tags == 0; + + ok($ok, 'shellcheck'); + if (not $ok) { + diag($tags); + } +} + +foreach my $file (@files) { + shell_syntax_ok($file); +} diff --git a/t/strict.t b/t/strict.t new file mode 100644 index 0000000..62c792f --- /dev/null +++ b/t/strict.t @@ -0,0 +1,34 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_module('Test::Strict'); +test_needs_srcdir_switch(); + +eval '$Test::Strict::TEST_WARNINGS = 1'; + +my @files = Test::Dpkg::all_perl_files(); + +plan tests => scalar @files * 2; + +for my $file (@files) { + strict_ok($file); + warnings_ok($file); +} diff --git a/t/synopsis.t b/t/synopsis.t new file mode 100644 index 0000000..99835b6 --- /dev/null +++ b/t/synopsis.t @@ -0,0 +1,32 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_author(); +test_needs_module('Test::Synopsis'); +test_needs_srcdir_switch(); + +my @files = Test::Dpkg::all_perl_files(); + +plan tests => scalar @files; + +for my $file (@files) { + synopsis_ok($file); +} diff --git a/t/syntax.t b/t/syntax.t new file mode 100644 index 0000000..fc20f6c --- /dev/null +++ b/t/syntax.t @@ -0,0 +1,48 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use strict; +use warnings; + +use Test::More; +use Test::Dpkg qw(:needs); + +test_needs_srcdir_switch(); + +my @files = Test::Dpkg::all_perl_files(); + +plan tests => scalar @files; + +my $PERL = $ENV{PERL} // $^X // 'perl'; + +# Detect compilation warnings that are not found with just «use warnings», +# such as redefinition of symbols from multiple imports. We cannot use +# Test::Strict::syntax_ok because it does not pass -w to perl, and does not +# check for other issues whenever perl states the syntax is ok. +sub syntax_ok { + my $file = shift; + + my $eval = qx($PERL -cw \"$file\" 2>&1); + my $ok = ($eval =~ s{^\Q$file\E syntax OK\n$}{}ms) && length $eval == 0; + + ok($ok, "Compilation check $file"); + if (not $ok) { + diag($eval); + } +} + +for my $file (@files) { + syntax_ok($file); +} diff --git a/tests/Feature.mk b/tests/Feature.mk new file mode 100644 index 0000000..da4e8d6 --- /dev/null +++ b/tests/Feature.mk @@ -0,0 +1,19 @@ +# +# Dpkg functional testsuite (kind of) +# +# Copyright © 2015 Guillem Jover <guillem@debian.org> +# + +## Feature checks setup ## + +ifneq ($(DPKG_FEATURE_CHECKS),yes) +export DPKG_FEATURE_CHECKS := yes + +# XXX: once apt is fixed: +#export DPKG_HAS_CONFIGURE_WITH_IMPLICIT_TRIGGER_PENDING ?= 1 + +ifneq (,$(filter as-root,$(DPKG_TESTSUITE_OPTIONS))) +export DPKG_AS_ROOT = 1 +endif + +endif diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..3b885f0 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,155 @@ +# +# Dpkg functional testsuite (kind of) +# +# Copyright © 2008-2015 Guillem Jover <guillem@debian.org> +# + + +-include .pkg-tests.conf + +## Feature checks setup ## + +include Feature.mk + +## Test cases ## + +TESTS_MANUAL := +TESTS_MANUAL += t-deb-lfs +TESTS_MANUAL += t-conffile-prompt + +TESTS_FAIL := +TESTS_FAIL += t-dir-leftover-deadlock +TESTS_FAIL += t-dir-shared-replaces-lost +TESTS_FAIL += t-disappear-depended +TESTS_FAIL += t-conffile-divert-conffile +TESTS_FAIL += t-breaks-multiarch + +TESTS_PASS := +TESTS_PASS += t-db +TESTS_PASS += t-normal +TESTS_PASS += t-field-priority +TESTS_PASS += t-option-dry-run +TESTS_PASS += t-option-recursive +TESTS_PASS += t-control-bogus +TESTS_PASS += t-control-no-arch +TESTS_PASS += t-unpack-symlink +TESTS_PASS += t-unpack-hardlink +TESTS_PASS += t-unpack-divert-hardlink +TESTS_PASS += t-unpack-divert-nowarn +TESTS_PASS += t-unpack-fifo +ifdef DPKG_AS_ROOT +# No permissions for devices +TESTS_PASS += t-unpack-device +endif +TESTS_PASS += t-maintscript-leak +TESTS_PASS += t-filtering +TESTS_PASS += t-depends +TESTS_PASS += t-dir-leftover-parents +TESTS_PASS += t-dir-leftover-conffile +TESTS_PASS += t-disappear +TESTS_PASS += t-disappear-empty +TESTS_PASS += t-provides +TESTS_PASS += t-provides-self +TESTS_PASS += t-provides-arch-implicit +TESTS_PASS += t-provides-arch-qualified +TESTS_PASS += t-breaks +TESTS_PASS += t-breaks-protected +TESTS_PASS += t-breaks-essential +TESTS_PASS += t-conflicts +TESTS_PASS += t-conflict-provide-replace-real +TESTS_PASS += t-conflict-provide-replace-virtual +TESTS_PASS += t-conflict-provide-replace-virtual-multiarch +TESTS_PASS += t-conflict-provide-replace-interface +TESTS_PASS += t-predepends-no-triggers +TESTS_PASS += t-triggers +TESTS_PASS += t-triggers-configure +TESTS_PASS += t-triggers-path +TESTS_PASS += t-triggers-depends +TESTS_PASS += t-triggers-depcycle +TESTS_PASS += t-triggers-depfarcycle +TESTS_PASS += t-triggers-selfcycle +TESTS_PASS += t-triggers-cycle +TESTS_PASS += t-triggers-halt +TESTS_PASS += t-file-conflicts +TESTS_PASS += t-file-replaces +TESTS_PASS += t-file-replaces-disappear +TESTS_PASS += t-file-replaces-versioned +TESTS_PASS += t-conffile-normal +TESTS_PASS += t-conffile-obsolete +TESTS_PASS += t-conffile-orphan +TESTS_PASS += t-conffile-forcemiss +TESTS_PASS += t-conffile-forcenew +TESTS_PASS += t-conffile-forceask +TESTS_PASS += t-conffile-root-option +TESTS_PASS += t-conffile-divert-normal +TESTS_PASS += t-conffile-conflict +TESTS_PASS += t-conffile-replaces +TESTS_PASS += t-conffile-replaces-upgrade +TESTS_PASS += t-conffile-replaces-downgrade +TESTS_PASS += t-conffile-replaces-existing +TESTS_PASS += t-conffile-replaces-existing-and-upgrade +TESTS_PASS += t-conffile-replaces-disappear +TESTS_PASS += t-conffile-replaces-diverted +TESTS_PASS += t-conffile-versioned-replaces-downgrade +TESTS_PASS += t-conffile-rename +TESTS_PASS += t-conffile-declarative-removal +TESTS_PASS += t-queue-process-deconf-dupe +TESTS_PASS += t-symlink-dir +TESTS_PASS += t-switch-symlink-abs-to-dir +TESTS_PASS += t-switch-symlink-rel-to-dir +TESTS_PASS += t-switch-dir-to-symlink-abs +TESTS_PASS += t-switch-dir-to-symlink-rel +TESTS_PASS += t-failinst-failrm +TESTS_PASS += t-dir-extension-check +TESTS_PASS += t-multiarch + +ifneq (,$(filter test-all,$(DPKG_TESTSUITE_OPTIONS))) +TESTS := $(TESTS_PASS) $(TESTS_FAIL) $(TESTS_MANUAL) +else +TESTS := $(TESTS_PASS) +endif + + +# By default do nothing +all help:: + @echo "Run 'make test' to run all the tests" + @echo "Run 'make <test-id>-test' to run a specifict test" + @echo "Run 'make clean' to remove all intermediary files" + @echo "" + @echo "The available tests are: $(TESTS)" + +build_targets = $(addsuffix -build,$(TESTS)) + +build:: $(build_targets) +$(build_targets):: + $(MAKE) -C $(subst -build,,$@) build + +.PHONY: build $(build_targets) + + +test_targets = $(addsuffix -test,$(TESTS)) + +test:: $(test_targets) +$(test_targets):: + $(MAKE) -C $(subst -test,,$@) test + +.PHONY: test $(test_targets) + + +test_clean_targets = $(addsuffix -test-clean,$(TESTS)) + +test-clean:: $(test_clean_targets) +$(test_clean_targets):: + $(MAKE) -C $(subst -test-clean,,$@) test-clean + +.PHONY: test-clean $(test_clean_targets) + + +clean_targets = $(addsuffix -clean,$(TESTS)) + +clean:: $(clean_targets) +$(clean_targets):: + $(MAKE) -C $(subst -clean,,$@) clean + +.PHONY: clean $(clean_targets) + diff --git a/tests/README b/tests/README new file mode 100644 index 0000000..62c8b75 --- /dev/null +++ b/tests/README @@ -0,0 +1,57 @@ +dpkg functional test-suite +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +How to run +---------- + +After cloning the repository, you will need to run «./db-regen». + +There's a brief usage information when invoking “make” on the topdir. + +You probably want to use something like eatmydata to run the tests, it +affects the performance significantly. + +To use the tools from the dpkg build-tree, set DPKG_BUILDTREE accordingly. + +The DPKG_TESTSUITE_OPTIONS environment/make variable can be used to change +the behaviour of the test runs, the following options are currently +supported: + +* as-root + + WARNING: This runs the tests in privileged mode, and will write to your + current root filesystem. If you are uncertain of the consequences, run + it at least on a chroot, or isolated in a virtual machine. + +* test-all + + This runs all tests, including manual and failing ones. + +* debug + + This makes dpkg print lots of debug output. + +The configuration file ‘.pkg-tests.conf’ can be used to set permanent +parameters. For example: + + ,-- .pkg-tests.conf -- + |DPKG_TESTSUITE_OPTIONS := debug + `-- + +Test-suite layout +----------------- + +The tests are split into logical units, testing a specific characteristic. +To add a new test please check Test.mk and Makefile on the topdir, and some +of the current tests. Patches welcome! + +Future plans +------------ + +There's lots of tests that are still missing, we are adding new ones when +we stumble over regressions, when adding new functionality, and as time +permits for existing functionality. + +The idea is for this to progressively be integrated into the autotools +autotest suite under t-func/, and be run as part of “make check”. Some +changes to dpkg would need to be implemented first. diff --git a/tests/Test.mk b/tests/Test.mk new file mode 100644 index 0000000..606e6f8 --- /dev/null +++ b/tests/Test.mk @@ -0,0 +1,124 @@ +# +# Dpkg functional testsuite (kind of) +# +# Copyright © 2008-2012 Guillem Jover <guillem@debian.org> +# + +-include ../.pkg-tests.conf + +## Feature checks setup ## + +include ../Feature.mk + +## Test case support ## + +ifneq (,$(filter debug,$(DPKG_TESTSUITE_OPTIONS))) +DPKG_MAINTSCRIPT_DEBUG = DPKG_DEBUG=1 +endif + +DPKG_PATH := $(PATH):/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ifdef DPKG_BUILDTREE +DPKG_PATH := $(DPKG_BUILDTREE)/dpkg-deb:$(DPKG_BUILDTREE)/dpkg-split:$(DPKG_BUILDTREE)/src:$(DPKG_BUILDTREE)/utils:$(DPKG_BUILDTREE)/scripts:$(DPKG_PATH) +endif + +DPKG_ENV = \ + PATH=$(DPKG_PATH) \ + $(DPKG_MAINTSCRIPT_DEBUG) + +ifdef DPKG_BUILDTREE +export DPKG_DATADIR := $(DPKG_BUILDTREE)/scripts +DPKG_ENV += \ + DPKG_DATADIR="$(DPKG_DATADIR)" +endif + +export PATH +PATH = $(DPKG_PATH) + +DPKG_OPTIONS = +DPKG_DIVERT_OPTIONS = + +ifdef DPKG_AS_ROOT +DPKG_INSTDIR = / +ifeq ($(shell id -u),0) +BEROOT := env $(DPKG_ENV) +else +DPKG_ENV += \ + LD_PRELOAD="$(LD_PRELOAD)" \ + LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" +BEROOT := sudo -E env $(DPKG_ENV) +endif +else +DPKG_INSTDIR = $(CURDIR)/../dpkginst +DPKG_OPTIONS += \ + --force-script-chrootless \ + --force-not-root \ + # EOL +BEROOT := env $(DPKG_ENV) + +DPKG_DIVERT_OPTIONS += \ + --instdir="$(DPKG_INSTDIR)" \ + # EOL +endif + +DPKG_OPTIONS += \ + --force-unsafe-io \ + --instdir="$(DPKG_INSTDIR)" \ + --no-debsig --log=/dev/null \ + # EOL + +ifneq (,$(filter debug,$(DPKG_TESTSUITE_OPTIONS))) +DPKG_OPTIONS += -D77777 +endif + +# Always use a local db. +DPKG_ADMINDIR = $(CURDIR)/../dpkgdb +DPKG_COMMON_OPTIONS = --admindir="$(DPKG_ADMINDIR)" + +DPKG = dpkg $(DPKG_COMMON_OPTIONS) $(DPKG_OPTIONS) +DPKG_INSTALL = $(BEROOT) $(DPKG) -i +DPKG_UNPACK = $(BEROOT) $(DPKG) --unpack +DPKG_CONFIGURE = $(BEROOT) $(DPKG) --configure +DPKG_REMOVE = $(BEROOT) $(DPKG) -r +DPKG_PURGE = $(BEROOT) $(DPKG) -P +DPKG_VERIFY = $(DPKG) -V +DPKG_DEB = dpkg-deb $(DPKG_DEB_OPTIONS) +DPKG_DIVERT = dpkg-divert $(DPKG_COMMON_OPTIONS) $(DPKG_DIVERT_OPTIONS) +DPKG_DIVERT_ADD = $(BEROOT) $(DPKG_DIVERT) --add +DPKG_DIVERT_DEL = $(BEROOT) $(DPKG_DIVERT) --remove +DPKG_SPLIT = dpkg-split $(DPKG_SPLIT_OPTIONS) +DPKG_BUILD_DEB = $(DPKG_DEB) -b +DPKG_QUERY = dpkg-query $(DPKG_COMMON_OPTIONS) $(DPKG_QUERY_OPTIONS) +DPKG_TRIGGER = dpkg-trigger $(DPKG_COMMON_OPTIONS) $(DPKG_TRIGGER_OPTIONS) + +PKG_STATUS = $(DPKG_QUERY) -f '$${Status}' -W + +DEB = $(addsuffix .deb,$(TESTS_DEB)) + +# Common test patterns to use with $(call foo,args...) +stdout_is = test "`$(1)`" = "$(2)" +stdout_has = $(1) | grep -qE "$(2)" +stderr_is = test "`$(1) 2>&1 1>/dev/null`" = "$(2)" +stderr_has = $(1) 2>&1 1>/dev/null | grep -qE "$(2)" +pkg_is_installed = $(call stdout_is,$(PKG_STATUS) $(1),install ok installed) +pkg_is_not_installed = $(call stdout_has,$(PKG_STATUS) $(1) 2>/dev/null, ok not-installed) || ! $(PKG_STATUS) $(1) >/dev/null 2>&1 +pkg_status_is = $(call stdout_is,$(PKG_STATUS) $(1),$(2)) +pkg_field_is = $(call stdout_is,$(DPKG_QUERY) -f '$${$(2)}' -W $(1),$(3)) + +%.deb: % + $(DPKG_BUILD_DEB) $< $@ + +TEST_CASES := + +build: build-hook $(DEB) + +test: build test-case test-clean + +clean: clean-hook + $(RM) $(DEB) + +.PHONY: build-hook build test test-case test-clean clean-hook clean + +# Most of the tests are serial in nature, as they perform package database +# changes, and the Makefile are written with that in mind. Avoid any +# surprises by explicitly disallowing parallel executions. +.NOTPARALLEL: diff --git a/tests/db-regen b/tests/db-regen new file mode 100755 index 0000000..f4e83f2 --- /dev/null +++ b/tests/db-regen @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Regenerate the local dpkg db +# +# Copyright © 2011-2012 Guillem Jover <guillem@debian.org> +# + +dbdir=${1:-dpkgdb} +instdir=${2:-dpkginst} + +mkdir -p $instdir + +rm -f $dbdir/arch +rm -f $dbdir/status* +rm -f $dbdir/available* +rm -f $dbdir/diversions* +rm -f $dbdir/statoverride* +rm -f $dbdir/info/format +rm -rf $dbdir/parts +rm -rf $dbdir/updates +rm -rf $dbdir/triggers + +mkdir -p $dbdir +touch $dbdir/lock +touch $dbdir/status +touch $dbdir/available +touch $dbdir/diversions +touch $dbdir/statoverride +mkdir -p $dbdir/info +mkdir $dbdir/parts +mkdir $dbdir/updates +mkdir $dbdir/triggers +touch $dbdir/triggers/Lock +touch $dbdir/triggers/Unincorp diff --git a/tests/dpkgdb/available b/tests/dpkgdb/available new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/dpkgdb/available diff --git a/tests/dpkgdb/diversions b/tests/dpkgdb/diversions new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/dpkgdb/diversions diff --git a/tests/dpkgdb/lock b/tests/dpkgdb/lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/dpkgdb/lock diff --git a/tests/dpkgdb/lock-frontend b/tests/dpkgdb/lock-frontend new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/dpkgdb/lock-frontend diff --git a/tests/dpkgdb/statoverride b/tests/dpkgdb/statoverride new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/dpkgdb/statoverride diff --git a/tests/dpkgdb/status b/tests/dpkgdb/status new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/dpkgdb/status diff --git a/tests/dpkgdb/triggers/Lock b/tests/dpkgdb/triggers/Lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/dpkgdb/triggers/Lock diff --git a/tests/dpkgdb/triggers/Unincorp b/tests/dpkgdb/triggers/Unincorp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/dpkgdb/triggers/Unincorp diff --git a/tests/t-breaks-essential/Makefile b/tests/t-breaks-essential/Makefile new file mode 100644 index 0000000..ace63f0 --- /dev/null +++ b/tests/t-breaks-essential/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := lib-a-0 lib-a-1 pkg-b + +include ../Test.mk + +DPKG_OPTIONS += --auto-deconfigure + +test-case: + $(DPKG_INSTALL) lib-a-0.deb + $(DPKG_INSTALL) pkg-b.deb lib-a-1.deb + +test-clean: + $(DPKG_PURGE) pkg-b + $(DPKG_PURGE) --force-remove-essential lib-a diff --git a/tests/t-breaks-essential/lib-a-0/DEBIAN/control b/tests/t-breaks-essential/lib-a-0/DEBIAN/control new file mode 100644 index 0000000..7643fd8 --- /dev/null +++ b/tests/t-breaks-essential/lib-a-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Essential: yes +Description: test package - broken package diff --git a/tests/t-breaks-essential/lib-a-1/DEBIAN/control b/tests/t-breaks-essential/lib-a-1/DEBIAN/control new file mode 100644 index 0000000..5c37c03 --- /dev/null +++ b/tests/t-breaks-essential/lib-a-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Essential: yes +Description: test package - broken package diff --git a/tests/t-breaks-essential/pkg-b/DEBIAN/control b/tests/t-breaks-essential/pkg-b/DEBIAN/control new file mode 100644 index 0000000..c0da700 --- /dev/null +++ b/tests/t-breaks-essential/pkg-b/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: lib-a (<< 1) +Description: test package - breaking package diff --git a/tests/t-breaks-multiarch/Makefile b/tests/t-breaks-multiarch/Makefile new file mode 100644 index 0000000..344e05a --- /dev/null +++ b/tests/t-breaks-multiarch/Makefile @@ -0,0 +1,22 @@ +TESTS_DEB := lib-a-0-amd64 lib-a-0-i386 \ + lib-a-1-amd64 lib-a-1-i386 \ + lib-b-0-amd64 lib-b-0-i386 \ + lib-b-1-amd64 lib-b-1-i386 \ + pkg-c + +include ../Test.mk + +DPKG_OPTIONS += --auto-deconfigure + +test-case: + $(DPKG) --add-architecture i386 + $(DPKG_INSTALL) lib-a-0-amd64.deb lib-a-0-i386.deb + $(DPKG_INSTALL) lib-b-0-amd64.deb lib-b-0-i386.deb + $(DPKG_INSTALL) pkg-c.deb \ + lib-a-1-amd64.deb lib-a-1-i386.deb \ + lib-b-1-amd64.deb lib-b-1-i386.deb + +test-clean: + $(DPKG_PURGE) lib-a:amd64 lib-a:i386 lib-b:amd64 lib-b:i386 pkg-c + $(DPKG) --remove-architecture i386 + rm -f $(DPKG_ADMINDIR)/arch diff --git a/tests/t-breaks-multiarch/lib-a-0-amd64/DEBIAN/control b/tests/t-breaks-multiarch/lib-a-0-amd64/DEBIAN/control new file mode 100644 index 0000000..8f91a57 --- /dev/null +++ b/tests/t-breaks-multiarch/lib-a-0-amd64/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Description: test package - broken package diff --git a/tests/t-breaks-multiarch/lib-a-0-i386/DEBIAN/control b/tests/t-breaks-multiarch/lib-a-0-i386/DEBIAN/control new file mode 100644 index 0000000..0a8db71 --- /dev/null +++ b/tests/t-breaks-multiarch/lib-a-0-i386/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Description: test package - broken package diff --git a/tests/t-breaks-multiarch/lib-a-1-amd64/DEBIAN/control b/tests/t-breaks-multiarch/lib-a-1-amd64/DEBIAN/control new file mode 100644 index 0000000..dca3d18 --- /dev/null +++ b/tests/t-breaks-multiarch/lib-a-1-amd64/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Description: test package - broken package diff --git a/tests/t-breaks-multiarch/lib-a-1-i386/DEBIAN/control b/tests/t-breaks-multiarch/lib-a-1-i386/DEBIAN/control new file mode 100644 index 0000000..2af8f28 --- /dev/null +++ b/tests/t-breaks-multiarch/lib-a-1-i386/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Description: test package - broken package diff --git a/tests/t-breaks-multiarch/lib-b-0-amd64/DEBIAN/control b/tests/t-breaks-multiarch/lib-b-0-amd64/DEBIAN/control new file mode 100644 index 0000000..ebfcac3 --- /dev/null +++ b/tests/t-breaks-multiarch/lib-b-0-amd64/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Description: test package - broken package diff --git a/tests/t-breaks-multiarch/lib-b-0-i386/DEBIAN/control b/tests/t-breaks-multiarch/lib-b-0-i386/DEBIAN/control new file mode 100644 index 0000000..52dd252 --- /dev/null +++ b/tests/t-breaks-multiarch/lib-b-0-i386/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Description: test package - broken package diff --git a/tests/t-breaks-multiarch/lib-b-1-amd64/DEBIAN/control b/tests/t-breaks-multiarch/lib-b-1-amd64/DEBIAN/control new file mode 100644 index 0000000..970a873 --- /dev/null +++ b/tests/t-breaks-multiarch/lib-b-1-amd64/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-b +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Description: test package - broken package diff --git a/tests/t-breaks-multiarch/lib-b-1-i386/DEBIAN/control b/tests/t-breaks-multiarch/lib-b-1-i386/DEBIAN/control new file mode 100644 index 0000000..7ceb7d4 --- /dev/null +++ b/tests/t-breaks-multiarch/lib-b-1-i386/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-b +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Description: test package - broken package diff --git a/tests/t-breaks-multiarch/pkg-c/DEBIAN/control b/tests/t-breaks-multiarch/pkg-c/DEBIAN/control new file mode 100644 index 0000000..95ebbac --- /dev/null +++ b/tests/t-breaks-multiarch/pkg-c/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-c +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: lib-b (<< 1) +Description: test package - breaking package diff --git a/tests/t-breaks-protected/Makefile b/tests/t-breaks-protected/Makefile new file mode 100644 index 0000000..3f85436 --- /dev/null +++ b/tests/t-breaks-protected/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := lib-a-0 lib-a-1 pkg-b + +include ../Test.mk + +DPKG_OPTIONS += --auto-deconfigure + +test-case: + $(DPKG_INSTALL) lib-a-0.deb + $(DPKG_INSTALL) pkg-b.deb lib-a-1.deb + +test-clean: + $(DPKG_PURGE) pkg-b + $(DPKG_PURGE) --force-remove-protected lib-a diff --git a/tests/t-breaks-protected/lib-a-0/DEBIAN/control b/tests/t-breaks-protected/lib-a-0/DEBIAN/control new file mode 100644 index 0000000..7ca516e --- /dev/null +++ b/tests/t-breaks-protected/lib-a-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Protected: yes +Description: test package - broken package diff --git a/tests/t-breaks-protected/lib-a-1/DEBIAN/control b/tests/t-breaks-protected/lib-a-1/DEBIAN/control new file mode 100644 index 0000000..1320318 --- /dev/null +++ b/tests/t-breaks-protected/lib-a-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Protected: yes +Description: test package - broken package diff --git a/tests/t-breaks-protected/pkg-b/DEBIAN/control b/tests/t-breaks-protected/pkg-b/DEBIAN/control new file mode 100644 index 0000000..c0da700 --- /dev/null +++ b/tests/t-breaks-protected/pkg-b/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: lib-a (<< 1) +Description: test package - breaking package diff --git a/tests/t-breaks/Makefile b/tests/t-breaks/Makefile new file mode 100644 index 0000000..9ffd02c --- /dev/null +++ b/tests/t-breaks/Makefile @@ -0,0 +1,12 @@ +TESTS_DEB := lib-a-0 lib-a-1 lib-b-0 lib-b-1 pkg-c + +include ../Test.mk + +DPKG_OPTIONS += --auto-deconfigure + +test-case: + $(DPKG_INSTALL) lib-a-0.deb lib-b-0.deb + $(DPKG_INSTALL) pkg-c.deb lib-a-1.deb lib-b-1.deb + +test-clean: + $(DPKG_PURGE) lib-a lib-b pkg-c diff --git a/tests/t-breaks/lib-a-0/DEBIAN/control b/tests/t-breaks/lib-a-0/DEBIAN/control new file mode 100644 index 0000000..241a6fc --- /dev/null +++ b/tests/t-breaks/lib-a-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: lib-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - broken package diff --git a/tests/t-breaks/lib-a-1/DEBIAN/control b/tests/t-breaks/lib-a-1/DEBIAN/control new file mode 100644 index 0000000..e0f19ec --- /dev/null +++ b/tests/t-breaks/lib-a-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: lib-a +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - broken package diff --git a/tests/t-breaks/lib-b-0/DEBIAN/control b/tests/t-breaks/lib-b-0/DEBIAN/control new file mode 100644 index 0000000..2b34688 --- /dev/null +++ b/tests/t-breaks/lib-b-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: lib-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - broken package diff --git a/tests/t-breaks/lib-b-1/DEBIAN/control b/tests/t-breaks/lib-b-1/DEBIAN/control new file mode 100644 index 0000000..7c423ca --- /dev/null +++ b/tests/t-breaks/lib-b-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: lib-b +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - broken package diff --git a/tests/t-breaks/pkg-c/DEBIAN/control b/tests/t-breaks/pkg-c/DEBIAN/control new file mode 100644 index 0000000..95ebbac --- /dev/null +++ b/tests/t-breaks/pkg-c/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-c +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: lib-b (<< 1) +Description: test package - breaking package diff --git a/tests/t-buildinfo/Makefile b/tests/t-buildinfo/Makefile new file mode 100644 index 0000000..019d850 --- /dev/null +++ b/tests/t-buildinfo/Makefile @@ -0,0 +1,11 @@ +OPTS = --admindir=$(CURDIR)/db-buildinfo + +test: + touch test-binary-a_1.0_amd64.deb + dpkg-source -b pkg-source + cd pkg-source && DEB_HOST_ARCH=amd64 dpkg-checkbuilddeps $(OPTS) + cd pkg-source && DEB_HOST_ARCH=amd64 dpkg-genbuildinfo $(OPTS) + +test-clean: + rm -f *.dsc *.deb *.buildinfo + rm -f *.tar.xz diff --git a/tests/t-buildinfo/db-buildinfo/status b/tests/t-buildinfo/db-buildinfo/status new file mode 100644 index 0000000..96c0e2a --- /dev/null +++ b/tests/t-buildinfo/db-buildinfo/status @@ -0,0 +1,28 @@ +Package: pkg-depender +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Version: 1.0 +Depends: pkg-virtual +Description: test package + +Package: pkg-provider +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Version: 2.0 +Provides: pkg-virtual +Description: test package + +Package: build-essential +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Version: 10.0 +Description: fake package diff --git a/tests/t-buildinfo/db-buildinfo/updates/.keep b/tests/t-buildinfo/db-buildinfo/updates/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-buildinfo/db-buildinfo/updates/.keep diff --git a/tests/t-buildinfo/pkg-source/debian/changelog b/tests/t-buildinfo/pkg-source/debian/changelog new file mode 100644 index 0000000..104fb70 --- /dev/null +++ b/tests/t-buildinfo/pkg-source/debian/changelog @@ -0,0 +1,5 @@ +test-source (1.0) UNRELEASED; urgency=medium + + * Initial release. + + -- Dpkg Developers <debian-dpkg@lists.debian.org> Fri, 09 Dec 2016 18:48:32 +0100 diff --git a/tests/t-buildinfo/pkg-source/debian/control b/tests/t-buildinfo/pkg-source/debian/control new file mode 100644 index 0000000..e2ff1e1 --- /dev/null +++ b/tests/t-buildinfo/pkg-source/debian/control @@ -0,0 +1,13 @@ +Source: test-source +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Build-Depends: + pkg-depender:i386, + pkg-virtual:i386, +Standards-Version: 3.9.8 + +Package: pkg-binary-a +Architecture: amd64 +Multi-Arch: foreign +Description: test binary a diff --git a/tests/t-buildinfo/pkg-source/debian/source/format b/tests/t-buildinfo/pkg-source/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/tests/t-buildinfo/pkg-source/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/tests/t-conffile-conflict/Makefile b/tests/t-conffile-conflict/Makefile new file mode 100644 index 0000000..c7af965 --- /dev/null +++ b/tests/t-conffile-conflict/Makefile @@ -0,0 +1,44 @@ +TESTS_DEB := pkg-conff-a pkg-conff-b pkg-conff-c + +include ../Test.mk + +TEST_CASES += test-conflict-installed-implicit +TEST_CASES += test-conflict-removed-implicit +TEST_CASES += test-conflict-removed-explicit + +test-case: $(TEST_CASES) + +test-conflict-installed-implicit: + # test if packages fail on install due to conflicting conffile + $(DPKG_INSTALL) pkg-conff-a.deb + ! $(DPKG_INSTALL) pkg-conff-b.deb + -$(DPKG_PURGE) pkg-conff-b + $(DPKG_PURGE) pkg-conff-a + +test-conflict-removed-implicit: + # test that conffile of removed package can be taken over + $(DPKG_INSTALL) pkg-conff-a.deb + $(DPKG_REMOVE) pkg-conff-a + $(DPKG_INSTALL) pkg-conff-b.deb + # Verify the new conffile has been installed + grep -q pkg-conff-b "$(DPKG_INSTDIR)/test-conffile" + # Verify it's kept after purge of old package + $(DPKG_PURGE) pkg-conff-a + test -e "$(DPKG_INSTDIR)/test-conffile" + $(DPKG_PURGE) pkg-conff-b + +test-conflict-removed-explicit: + # test that conffile of removed package can be taken over even if + # the new package is conflicting with the old one + $(DPKG_INSTALL) pkg-conff-a.deb + $(DPKG_REMOVE) pkg-conff-a + $(DPKG_INSTALL) pkg-conff-c.deb + # Verify the new conffile has been installed + grep -q pkg-conff-c "$(DPKG_INSTDIR)/test-conffile" + # Verify it's kept after purge of old package + $(DPKG_PURGE) pkg-conff-a + test -e "$(DPKG_INSTDIR)/test-conffile" + $(DPKG_PURGE) pkg-conff-c + +test-clean: + -$(DPKG_PURGE) pkg-conff-a pkg-conff-b pkg-conff-c diff --git a/tests/t-conffile-conflict/pkg-conff-a/DEBIAN/conffiles b/tests/t-conffile-conflict/pkg-conff-a/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-conflict/pkg-conff-a/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-conflict/pkg-conff-a/DEBIAN/control b/tests/t-conffile-conflict/pkg-conff-a/DEBIAN/control new file mode 100644 index 0000000..a346bae --- /dev/null +++ b/tests/t-conffile-conflict/pkg-conff-a/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conflicting conffile + diff --git a/tests/t-conffile-conflict/pkg-conff-a/test-conffile b/tests/t-conffile-conflict/pkg-conff-a/test-conffile new file mode 100644 index 0000000..024da49 --- /dev/null +++ b/tests/t-conffile-conflict/pkg-conff-a/test-conffile @@ -0,0 +1 @@ +pkg-conff-a diff --git a/tests/t-conffile-conflict/pkg-conff-b/DEBIAN/conffiles b/tests/t-conffile-conflict/pkg-conff-b/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-conflict/pkg-conff-b/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-conflict/pkg-conff-b/DEBIAN/control b/tests/t-conffile-conflict/pkg-conff-b/DEBIAN/control new file mode 100644 index 0000000..e3f6951 --- /dev/null +++ b/tests/t-conffile-conflict/pkg-conff-b/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conflicting conffile + diff --git a/tests/t-conffile-conflict/pkg-conff-b/test-conffile b/tests/t-conffile-conflict/pkg-conff-b/test-conffile new file mode 100644 index 0000000..006fbc7 --- /dev/null +++ b/tests/t-conffile-conflict/pkg-conff-b/test-conffile @@ -0,0 +1 @@ +pkg-conff-b diff --git a/tests/t-conffile-conflict/pkg-conff-c/DEBIAN/conffiles b/tests/t-conffile-conflict/pkg-conff-c/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-conflict/pkg-conff-c/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-conflict/pkg-conff-c/DEBIAN/control b/tests/t-conffile-conflict/pkg-conff-c/DEBIAN/control new file mode 100644 index 0000000..a94ef2e --- /dev/null +++ b/tests/t-conffile-conflict/pkg-conff-c/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-c +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-conff-a +Description: test package - conflicting conffile + diff --git a/tests/t-conffile-conflict/pkg-conff-c/test-conffile b/tests/t-conffile-conflict/pkg-conff-c/test-conffile new file mode 100644 index 0000000..a6cfe38 --- /dev/null +++ b/tests/t-conffile-conflict/pkg-conff-c/test-conffile @@ -0,0 +1 @@ +pkg-conff-c diff --git a/tests/t-conffile-declarative-removal/Makefile b/tests/t-conffile-declarative-removal/Makefile new file mode 100644 index 0000000..0d0e77b --- /dev/null +++ b/tests/t-conffile-declarative-removal/Makefile @@ -0,0 +1,101 @@ +TESTS_DEB := pkg-conffile-v1 pkg-conffile-v2 \ + pkg-conffile-owns-filename pkg-conffile-owns-symlink + +include ../Test.mk + +build-hook: + ln -sf test-conffile-owned \ + pkg-conffile-owns-symlink/test-dir/test-conffile-to-be-removed + +clean-hook: + $(RM) pkg-conffile-owns-symlink/test-dir/test-conffile-to-be-removed + $(RM) pkg-conffile-removal-present.deb + +test-case: + # Conffile marked for removal but present, cannot be installed. + $(DPKG_BUILD_DEB) --nocheck pkg-conffile-removal-present + ! $(DPKG_INSTALL) pkg-conffile-removal-present.deb + $(call pkg_is_not_installed,pkg-conffile-removal-present) + $(DPKG_PURGE) pkg-conffile-removal-present + + # Unmodified case, one invocation. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + $(DPKG_INSTALL) pkg-conffile-v2.deb + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Reset. + $(DPKG_PURGE) pkg-conffile + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Unmodified case; but force it to happen via two invocations. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + $(DPKG_UNPACK) pkg-conffile-v2.deb + # The old conffile is removed during unpack. + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + # After configure, the file is still removed. + $(DPKG_CONFIGURE) pkg-conffile + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Reset. + $(DPKG_PURGE) pkg-conffile + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Modified; should store .dpkg-old. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + echo "modify this" >"$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(DPKG_INSTALL) pkg-conffile-v2.deb + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Reset. + $(DPKG_PURGE) pkg-conffile + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(RM) "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Queue a remove on upgrade, and move ownership. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(DPKG_INSTALL) pkg-conffile-v2.deb + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(DPKG_INSTALL) pkg-conffile-owns-filename.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + # Upgrade the package again, should not remove unowned conffile. + $(DPKG_INSTALL) pkg-conffile-v2.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Reset. + $(DPKG_PURGE) pkg-conffile + $(DPKG_PURGE) pkg-conffile-owns + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Queue a remove on upgrade, and move ownership via symlink. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(DPKG_INSTALL) pkg-conffile-v2.deb + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + $(DPKG_INSTALL) pkg-conffile-owns-symlink.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-owned" + test -L "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + # Upgrade the package again, should not remove unowned conffile. + $(DPKG_INSTALL) pkg-conffile-v2.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-owned" + test -L "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + +test-clean: + $(DPKG_PURGE) pkg-conffile-removal-present + $(DPKG_PURGE) pkg-conffile-owns + $(DPKG_PURGE) pkg-conffile + $(BEROOT) $(RM) -rf "$(DPKG_INSTDIR)/test-dir" diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/conffiles new file mode 100644 index 0000000..c4138c4 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/control new file mode 100644 index 0000000..1f5b771 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile-owns +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - owns conffile to be removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/test-dir/test-conffile-to-be-removed b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/test-dir/test-conffile-to-be-removed new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/conffiles new file mode 100644 index 0000000..298a4dc --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-dir/test-conffile-owned diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/control new file mode 100644 index 0000000..53862ca --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile-owns +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - owns conffile to be removed via symlink diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/test-dir/test-conffile-owned b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/test-dir/test-conffile-owned new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/test-dir/test-conffile-owned diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/conffiles new file mode 100644 index 0000000..587753b --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/conffiles @@ -0,0 +1 @@ +remove-on-upgrade /test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/control new file mode 100644 index 0000000..78d5ee4 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile-removal-present +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile to be removed but present diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/test-dir/test-conffile-to-be-removed b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/test-dir/test-conffile-to-be-removed new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/conffiles new file mode 100644 index 0000000..c4138c4 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/control new file mode 100644 index 0000000..5626d2a --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile to be removed v1 diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v1/test-dir/test-conffile-to-be-removed b/tests/t-conffile-declarative-removal/pkg-conffile-v1/test-dir/test-conffile-to-be-removed new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-v1/test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/conffiles new file mode 100644 index 0000000..587753b --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/conffiles @@ -0,0 +1 @@ +remove-on-upgrade /test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/control new file mode 100644 index 0000000..7057432 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile +Version: 2 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile to be removed v2 diff --git a/tests/t-conffile-divert-conffile/Makefile b/tests/t-conffile-divert-conffile/Makefile new file mode 100644 index 0000000..8cb88e4 --- /dev/null +++ b/tests/t-conffile-divert-conffile/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := pkg-conff pkg-conff-divert + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-conff.deb + # test if the other package can divert the conffile w/o prompt + $(DPKG_INSTALL) pkg-conff-divert.deb + +test-clean: + $(DPKG_PURGE) pkg-conff-divert + $(DPKG_PURGE) pkg-conff + diff --git a/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/conffiles b/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/control b/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/control new file mode 100644 index 0000000..4e72fc0 --- /dev/null +++ b/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-divert +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - divert a conffile + diff --git a/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/postrm b/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/postrm new file mode 100755 index 0000000..adf47cb --- /dev/null +++ b/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/postrm @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +if [ "$1" = "purge" ]; then + dpkg-divert --remove --rename /test-conffile +fi + diff --git a/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/preinst b/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/preinst new file mode 100755 index 0000000..bd85329 --- /dev/null +++ b/tests/t-conffile-divert-conffile/pkg-conff-divert/DEBIAN/preinst @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then + dpkg-divert --package pkg-conff-divert --rename \ + --divert /test-conffile.diverted --add /test-conffile +fi + diff --git a/tests/t-conffile-divert-conffile/pkg-conff-divert/test-conffile b/tests/t-conffile-divert-conffile/pkg-conff-divert/test-conffile new file mode 100644 index 0000000..94e47d3 --- /dev/null +++ b/tests/t-conffile-divert-conffile/pkg-conff-divert/test-conffile @@ -0,0 +1 @@ +test diverted diff --git a/tests/t-conffile-divert-conffile/pkg-conff/DEBIAN/conffiles b/tests/t-conffile-divert-conffile/pkg-conff/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-divert-conffile/pkg-conff/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-divert-conffile/pkg-conff/DEBIAN/control b/tests/t-conffile-divert-conffile/pkg-conff/DEBIAN/control new file mode 100644 index 0000000..8a3a6f5 --- /dev/null +++ b/tests/t-conffile-divert-conffile/pkg-conff/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-divert-conffile/pkg-conff/test-conffile b/tests/t-conffile-divert-conffile/pkg-conff/test-conffile new file mode 100644 index 0000000..6fbc8b5 --- /dev/null +++ b/tests/t-conffile-divert-conffile/pkg-conff/test-conffile @@ -0,0 +1 @@ +test init diff --git a/tests/t-conffile-divert-normal/Makefile b/tests/t-conffile-divert-normal/Makefile new file mode 100644 index 0000000..8cb88e4 --- /dev/null +++ b/tests/t-conffile-divert-normal/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := pkg-conff pkg-conff-divert + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-conff.deb + # test if the other package can divert the conffile w/o prompt + $(DPKG_INSTALL) pkg-conff-divert.deb + +test-clean: + $(DPKG_PURGE) pkg-conff-divert + $(DPKG_PURGE) pkg-conff + diff --git a/tests/t-conffile-divert-normal/pkg-conff-divert/DEBIAN/control b/tests/t-conffile-divert-normal/pkg-conff-divert/DEBIAN/control new file mode 100644 index 0000000..570b396 --- /dev/null +++ b/tests/t-conffile-divert-normal/pkg-conff-divert/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-divert +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - divert a conffile with a normal file + diff --git a/tests/t-conffile-divert-normal/pkg-conff-divert/DEBIAN/postrm b/tests/t-conffile-divert-normal/pkg-conff-divert/DEBIAN/postrm new file mode 100755 index 0000000..adf47cb --- /dev/null +++ b/tests/t-conffile-divert-normal/pkg-conff-divert/DEBIAN/postrm @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +if [ "$1" = "purge" ]; then + dpkg-divert --remove --rename /test-conffile +fi + diff --git a/tests/t-conffile-divert-normal/pkg-conff-divert/DEBIAN/preinst b/tests/t-conffile-divert-normal/pkg-conff-divert/DEBIAN/preinst new file mode 100755 index 0000000..bd85329 --- /dev/null +++ b/tests/t-conffile-divert-normal/pkg-conff-divert/DEBIAN/preinst @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then + dpkg-divert --package pkg-conff-divert --rename \ + --divert /test-conffile.diverted --add /test-conffile +fi + diff --git a/tests/t-conffile-divert-normal/pkg-conff-divert/test-conffile b/tests/t-conffile-divert-normal/pkg-conff-divert/test-conffile new file mode 100644 index 0000000..94e47d3 --- /dev/null +++ b/tests/t-conffile-divert-normal/pkg-conff-divert/test-conffile @@ -0,0 +1 @@ +test diverted diff --git a/tests/t-conffile-divert-normal/pkg-conff/DEBIAN/conffiles b/tests/t-conffile-divert-normal/pkg-conff/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-divert-normal/pkg-conff/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-divert-normal/pkg-conff/DEBIAN/control b/tests/t-conffile-divert-normal/pkg-conff/DEBIAN/control new file mode 100644 index 0000000..8a3a6f5 --- /dev/null +++ b/tests/t-conffile-divert-normal/pkg-conff/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-divert-normal/pkg-conff/test-conffile b/tests/t-conffile-divert-normal/pkg-conff/test-conffile new file mode 100644 index 0000000..6fbc8b5 --- /dev/null +++ b/tests/t-conffile-divert-normal/pkg-conff/test-conffile @@ -0,0 +1 @@ +test init diff --git a/tests/t-conffile-forceask/Makefile b/tests/t-conffile-forceask/Makefile new file mode 100644 index 0000000..c40e2fe --- /dev/null +++ b/tests/t-conffile-forceask/Makefile @@ -0,0 +1,16 @@ +TESTS_DEB := pkg-conff-forceask-0 pkg-conff-forceask-1 + +include ../Test.mk + +test-case: + + # Test that we get the new conffile after a modified one. + $(DPKG_INSTALL) pkg-conff-forceask-0.deb + $(BEROOT) cp mod-conffile "$(DPKG_INSTDIR)/test-conffile" + $(DPKG_INSTALL) --force-confask --force-confnew pkg-conff-forceask-1.deb + cmp mod-conffile "$(DPKG_INSTDIR)/test-conffile.dpkg-old" + cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" + $(DPKG_PURGE) pkg-conff-forceask + +test-clean: + $(DPKG_PURGE) pkg-conff-forceask diff --git a/tests/t-conffile-forceask/mod-conffile b/tests/t-conffile-forceask/mod-conffile new file mode 100644 index 0000000..73f8903 --- /dev/null +++ b/tests/t-conffile-forceask/mod-conffile @@ -0,0 +1 @@ +test modified diff --git a/tests/t-conffile-forceask/pkg-conff-forceask-0/DEBIAN/conffiles b/tests/t-conffile-forceask/pkg-conff-forceask-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-forceask/pkg-conff-forceask-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-forceask/pkg-conff-forceask-0/DEBIAN/control b/tests/t-conffile-forceask/pkg-conff-forceask-0/DEBIAN/control new file mode 100644 index 0000000..e817b0b --- /dev/null +++ b/tests/t-conffile-forceask/pkg-conff-forceask-0/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-forceask +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - force-confask behaviour + Debbug: ?? + diff --git a/tests/t-conffile-forceask/pkg-conff-forceask-0/test-conffile b/tests/t-conffile-forceask/pkg-conff-forceask-0/test-conffile new file mode 100644 index 0000000..ee5a694 --- /dev/null +++ b/tests/t-conffile-forceask/pkg-conff-forceask-0/test-conffile @@ -0,0 +1 @@ +test ref diff --git a/tests/t-conffile-forceask/pkg-conff-forceask-1/DEBIAN/conffiles b/tests/t-conffile-forceask/pkg-conff-forceask-1/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-forceask/pkg-conff-forceask-1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-forceask/pkg-conff-forceask-1/DEBIAN/control b/tests/t-conffile-forceask/pkg-conff-forceask-1/DEBIAN/control new file mode 100644 index 0000000..be39ec8 --- /dev/null +++ b/tests/t-conffile-forceask/pkg-conff-forceask-1/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-forceask +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - force-confask behaviour + Debbug: ?? + diff --git a/tests/t-conffile-forceask/pkg-conff-forceask-1/test-conffile b/tests/t-conffile-forceask/pkg-conff-forceask-1/test-conffile new file mode 100644 index 0000000..ee5a694 --- /dev/null +++ b/tests/t-conffile-forceask/pkg-conff-forceask-1/test-conffile @@ -0,0 +1 @@ +test ref diff --git a/tests/t-conffile-forceask/ref-conffile b/tests/t-conffile-forceask/ref-conffile new file mode 100644 index 0000000..ee5a694 --- /dev/null +++ b/tests/t-conffile-forceask/ref-conffile @@ -0,0 +1 @@ +test ref diff --git a/tests/t-conffile-forcemiss/Makefile b/tests/t-conffile-forcemiss/Makefile new file mode 100644 index 0000000..ab36890 --- /dev/null +++ b/tests/t-conffile-forcemiss/Makefile @@ -0,0 +1,16 @@ +TESTS_DEB := pkg-conff-forcemiss-0 pkg-conff-forcemiss-1 + +include ../Test.mk + +test-case: + # Test if we get the new conffile after a missing one. + $(DPKG_INSTALL) pkg-conff-forcemiss-0.deb + $(BEROOT) rm "$(DPKG_INSTDIR)/test-conffile" + $(DPKG_INSTALL) pkg-conff-forcemiss-1.deb + ! test -f "$(DPKG_INSTDIR)/test-conffile" + $(DPKG_INSTALL) --force-confmiss pkg-conff-forcemiss-1.deb + cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" + $(DPKG_PURGE) pkg-conff-forcemiss + +test-clean: + $(DPKG_PURGE) pkg-conff-forcemiss diff --git a/tests/t-conffile-forcemiss/pkg-conff-forcemiss-0/DEBIAN/conffiles b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-forcemiss/pkg-conff-forcemiss-0/DEBIAN/control b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-0/DEBIAN/control new file mode 100644 index 0000000..becabd9 --- /dev/null +++ b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conff-forcemiss +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - force-confmiss behaviour diff --git a/tests/t-conffile-forcemiss/pkg-conff-forcemiss-0/test-conffile b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-0/test-conffile new file mode 100644 index 0000000..ee5a694 --- /dev/null +++ b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-0/test-conffile @@ -0,0 +1 @@ +test ref diff --git a/tests/t-conffile-forcemiss/pkg-conff-forcemiss-1/DEBIAN/conffiles b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-1/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-forcemiss/pkg-conff-forcemiss-1/DEBIAN/control b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-1/DEBIAN/control new file mode 100644 index 0000000..63e8ae3 --- /dev/null +++ b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conff-forcemiss +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - force-confmiss behaviour diff --git a/tests/t-conffile-forcemiss/pkg-conff-forcemiss-1/test-conffile b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-1/test-conffile new file mode 100644 index 0000000..ee5a694 --- /dev/null +++ b/tests/t-conffile-forcemiss/pkg-conff-forcemiss-1/test-conffile @@ -0,0 +1 @@ +test ref diff --git a/tests/t-conffile-forcemiss/ref-conffile b/tests/t-conffile-forcemiss/ref-conffile new file mode 100644 index 0000000..ee5a694 --- /dev/null +++ b/tests/t-conffile-forcemiss/ref-conffile @@ -0,0 +1 @@ +test ref diff --git a/tests/t-conffile-forcenew/Makefile b/tests/t-conffile-forcenew/Makefile new file mode 100644 index 0000000..c492c6c --- /dev/null +++ b/tests/t-conffile-forcenew/Makefile @@ -0,0 +1,17 @@ +TESTS_DEB := pkg-conff-forcenew-0 pkg-conff-forcenew-1 + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-conff-forcenew-0.deb + # Modify the conffile. + $(BEROOT) cp mod-conffile "$(DPKG_INSTDIR)/test-conffile" + # Test that we do not get the new conffile. + $(DPKG_INSTALL) pkg-conff-forcenew-0.deb + cmp mod-conffile "$(DPKG_INSTDIR)/test-conffile" + # Test that we get the new conffile. + $(DPKG_INSTALL) --force-confnew pkg-conff-forcenew-1.deb + cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" + +test-clean: + $(DPKG_PURGE) pkg-conff-forcenew diff --git a/tests/t-conffile-forcenew/mod-conffile b/tests/t-conffile-forcenew/mod-conffile new file mode 100644 index 0000000..73f8903 --- /dev/null +++ b/tests/t-conffile-forcenew/mod-conffile @@ -0,0 +1 @@ +test modified diff --git a/tests/t-conffile-forcenew/pkg-conff-forcenew-0/DEBIAN/conffiles b/tests/t-conffile-forcenew/pkg-conff-forcenew-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-forcenew/pkg-conff-forcenew-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-forcenew/pkg-conff-forcenew-0/DEBIAN/control b/tests/t-conffile-forcenew/pkg-conff-forcenew-0/DEBIAN/control new file mode 100644 index 0000000..02d528e --- /dev/null +++ b/tests/t-conffile-forcenew/pkg-conff-forcenew-0/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-forcenew +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - force-confnew behaviour + Debbug: 391818 + diff --git a/tests/t-conffile-forcenew/pkg-conff-forcenew-0/test-conffile b/tests/t-conffile-forcenew/pkg-conff-forcenew-0/test-conffile new file mode 100644 index 0000000..6fbc8b5 --- /dev/null +++ b/tests/t-conffile-forcenew/pkg-conff-forcenew-0/test-conffile @@ -0,0 +1 @@ +test init diff --git a/tests/t-conffile-forcenew/pkg-conff-forcenew-1/DEBIAN/conffiles b/tests/t-conffile-forcenew/pkg-conff-forcenew-1/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-forcenew/pkg-conff-forcenew-1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-forcenew/pkg-conff-forcenew-1/DEBIAN/control b/tests/t-conffile-forcenew/pkg-conff-forcenew-1/DEBIAN/control new file mode 100644 index 0000000..fcc03d9 --- /dev/null +++ b/tests/t-conffile-forcenew/pkg-conff-forcenew-1/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-forcenew +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - force-confnew behaviour + Debbug: 391818 + diff --git a/tests/t-conffile-forcenew/pkg-conff-forcenew-1/test-conffile b/tests/t-conffile-forcenew/pkg-conff-forcenew-1/test-conffile new file mode 100644 index 0000000..35f4da8 --- /dev/null +++ b/tests/t-conffile-forcenew/pkg-conff-forcenew-1/test-conffile @@ -0,0 +1 @@ +test end diff --git a/tests/t-conffile-forcenew/ref-conffile b/tests/t-conffile-forcenew/ref-conffile new file mode 100644 index 0000000..35f4da8 --- /dev/null +++ b/tests/t-conffile-forcenew/ref-conffile @@ -0,0 +1 @@ +test end diff --git a/tests/t-conffile-normal/Makefile b/tests/t-conffile-normal/Makefile new file mode 100644 index 0000000..52f29c7 --- /dev/null +++ b/tests/t-conffile-normal/Makefile @@ -0,0 +1,15 @@ +TESTS_DEB := pkg-conffile + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-conffile.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile" + $(DPKG_REMOVE) pkg-conffile + $(DPKG_PURGE) pkg-conffile + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile" + test ! -d "$(DPKG_INSTDIR)/test-dir" + +test-clean: + $(DPKG_PURGE) pkg-conffile + $(BEROOT) $(RM) -rf "$(DPKG_INSTDIR)/test-dir" diff --git a/tests/t-conffile-normal/pkg-conffile/DEBIAN/conffiles b/tests/t-conffile-normal/pkg-conffile/DEBIAN/conffiles new file mode 100644 index 0000000..6d57c35 --- /dev/null +++ b/tests/t-conffile-normal/pkg-conffile/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-dir/test-conffile diff --git a/tests/t-conffile-normal/pkg-conffile/DEBIAN/control b/tests/t-conffile-normal/pkg-conffile/DEBIAN/control new file mode 100644 index 0000000..6dcdeb8 --- /dev/null +++ b/tests/t-conffile-normal/pkg-conffile/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile inside directory diff --git a/tests/t-conffile-normal/pkg-conffile/test-dir/test-conffile b/tests/t-conffile-normal/pkg-conffile/test-dir/test-conffile new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-normal/pkg-conffile/test-dir/test-conffile diff --git a/tests/t-conffile-obsolete/Makefile b/tests/t-conffile-obsolete/Makefile new file mode 100644 index 0000000..55d9477 --- /dev/null +++ b/tests/t-conffile-obsolete/Makefile @@ -0,0 +1,42 @@ +TESTS_DEB := pkg-conff-obsolete-0 pkg-conff-obsolete-1 pkg-conff-obsolete-2 + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-conff-obsolete-0.deb + $(DPKG_INSTALL) pkg-conff-obsolete-1.deb + test -f '$(DPKG_INSTDIR)/test-conffile' + $(DPKG_PURGE) pkg-conff-obsolete + test ! -f '$(DPKG_INSTDIR)/test-conffile' + # Unmodified conffile is autoremoved for the user + $(DPKG_INSTALL) pkg-conff-obsolete-0.deb + $(DPKG_UNPACK) pkg-conff-obsolete-2.deb + test -f '$(DPKG_INSTDIR)/test-conffile.dpkg-remove' + test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-backup' + $(DPKG_CONFIGURE) pkg-conff-obsolete + test ! -f '$(DPKG_INSTDIR)/test-conffile' + test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-bak' + test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-backup' + test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-remove' + $(DPKG_PURGE) pkg-conff-obsolete + # Modified conffile is moved away in .dpkg-bak for the user + $(DPKG_INSTALL) pkg-conff-obsolete-0.deb + $(BEROOT) sh -c "echo foo >>'$(DPKG_INSTDIR)/test-conffile'" + $(DPKG_INSTALL) pkg-conff-obsolete-2.deb + test ! -f '$(DPKG_INSTDIR)/test-conffile' + test -f '$(DPKG_INSTDIR)/test-conffile.dpkg-bak' + $(DPKG_PURGE) pkg-conff-obsolete + test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-bak' + # Abort-upgrade restores the to-be-removed conffile + $(DPKG_INSTALL) pkg-conff-obsolete-0.deb + $(BEROOT) touch '$(DPKG_INSTDIR)/fail-preinst' + $(DPKG_INSTALL) pkg-conff-obsolete-2.deb || true + $(BEROOT) rm -f '$(DPKG_INSTDIR)/fail-preinst' + test -f '$(DPKG_INSTDIR)/test-conffile' + test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-remove' + test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-bak' + test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-backup' + +test-clean: + $(DPKG_PURGE) pkg-conff-obsolete + diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/conffiles b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/control b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/control new file mode 100644 index 0000000..664592c --- /dev/null +++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-obsolete +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile obsolete + diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-0/test-conffile b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/test-conffile new file mode 100644 index 0000000..6fbc8b5 --- /dev/null +++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/test-conffile @@ -0,0 +1 @@ +test init diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-1/DEBIAN/control b/tests/t-conffile-obsolete/pkg-conff-obsolete-1/DEBIAN/control new file mode 100644 index 0000000..b7e111e --- /dev/null +++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-obsolete +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile obsolete + diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/control b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/control new file mode 100644 index 0000000..b7e111e --- /dev/null +++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-obsolete +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile obsolete + diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postinst b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postinst new file mode 100755 index 0000000..c6b0782 --- /dev/null +++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postinst @@ -0,0 +1,4 @@ +#!/bin/sh +if dpkg-maintscript-helper supports rm_conffile; then + dpkg-maintscript-helper rm_conffile /test-conffile 0 -- "$@" +fi diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postrm b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postrm new file mode 100755 index 0000000..c6b0782 --- /dev/null +++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postrm @@ -0,0 +1,4 @@ +#!/bin/sh +if dpkg-maintscript-helper supports rm_conffile; then + dpkg-maintscript-helper rm_conffile /test-conffile 0 -- "$@" +fi diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/preinst b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/preinst new file mode 100755 index 0000000..c0e592b --- /dev/null +++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/preinst @@ -0,0 +1,9 @@ +#!/bin/sh +if dpkg-maintscript-helper supports rm_conffile; then + dpkg-maintscript-helper rm_conffile /test-conffile 0 -- "$@" +fi + +if [ -e "$DPKG_ROOT/fail-preinst" ]; then + exit 1 +fi + diff --git a/tests/t-conffile-orphan/Makefile b/tests/t-conffile-orphan/Makefile new file mode 100644 index 0000000..1f51ccb --- /dev/null +++ b/tests/t-conffile-orphan/Makefile @@ -0,0 +1,14 @@ +TESTS_DEB := pkg-conff-orphan-0 pkg-conff-orphan-1 pkg-conff-takeover + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-conff-orphan-0.deb + $(DPKG_INSTALL) pkg-conff-orphan-1.deb + # test if the other package can takeover the orphan conffile + $(DPKG_INSTALL) pkg-conff-takeover.deb + +test-clean: + $(DPKG_PURGE) pkg-conff-orphan + $(DPKG_PURGE) pkg-conff-takeover + diff --git a/tests/t-conffile-orphan/pkg-conff-orphan-0/DEBIAN/conffiles b/tests/t-conffile-orphan/pkg-conff-orphan-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-orphan/pkg-conff-orphan-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-orphan/pkg-conff-orphan-0/DEBIAN/control b/tests/t-conffile-orphan/pkg-conff-orphan-0/DEBIAN/control new file mode 100644 index 0000000..e147450 --- /dev/null +++ b/tests/t-conffile-orphan/pkg-conff-orphan-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-orphan +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile oprhan + diff --git a/tests/t-conffile-orphan/pkg-conff-orphan-0/test-conffile b/tests/t-conffile-orphan/pkg-conff-orphan-0/test-conffile new file mode 100644 index 0000000..6fbc8b5 --- /dev/null +++ b/tests/t-conffile-orphan/pkg-conff-orphan-0/test-conffile @@ -0,0 +1 @@ +test init diff --git a/tests/t-conffile-orphan/pkg-conff-orphan-1/DEBIAN/control b/tests/t-conffile-orphan/pkg-conff-orphan-1/DEBIAN/control new file mode 100644 index 0000000..691051b --- /dev/null +++ b/tests/t-conffile-orphan/pkg-conff-orphan-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-orphan +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile orphan + diff --git a/tests/t-conffile-orphan/pkg-conff-takeover/DEBIAN/conffiles b/tests/t-conffile-orphan/pkg-conff-takeover/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-orphan/pkg-conff-takeover/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-orphan/pkg-conff-takeover/DEBIAN/control b/tests/t-conffile-orphan/pkg-conff-takeover/DEBIAN/control new file mode 100644 index 0000000..d5dd7f1 --- /dev/null +++ b/tests/t-conffile-orphan/pkg-conff-takeover/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile oprhan takeover + diff --git a/tests/t-conffile-orphan/pkg-conff-takeover/test-conffile b/tests/t-conffile-orphan/pkg-conff-takeover/test-conffile new file mode 100644 index 0000000..35f4da8 --- /dev/null +++ b/tests/t-conffile-orphan/pkg-conff-takeover/test-conffile @@ -0,0 +1 @@ +test end diff --git a/tests/t-conffile-prompt/Makefile b/tests/t-conffile-prompt/Makefile new file mode 100644 index 0000000..1f413bb --- /dev/null +++ b/tests/t-conffile-prompt/Makefile @@ -0,0 +1,20 @@ +TESTS_DEB := pkg-conff-prompt-0 pkg-conff-prompt-1 + +include ../Test.mk + +build-hook: + touch "pkg-conff-prompt-0/test-conffile with spaces" + touch "pkg-conff-prompt-1/test-conffile with spaces" + +clean-hook: + $(RM) "pkg-conff-prompt-0/test-conffile with spaces" + $(RM) "pkg-conff-prompt-1/test-conffile with spaces" + +test-case: + $(DPKG_INSTALL) pkg-conff-prompt-0.deb + # test if package prompts on install + $(DPKG_INSTALL) pkg-conff-prompt-1.deb + +test-clean: + $(DPKG_PURGE) pkg-conff-prompt + diff --git a/tests/t-conffile-prompt/pkg-conff-prompt-0/DEBIAN/conffiles b/tests/t-conffile-prompt/pkg-conff-prompt-0/DEBIAN/conffiles new file mode 100644 index 0000000..ef41b42 --- /dev/null +++ b/tests/t-conffile-prompt/pkg-conff-prompt-0/DEBIAN/conffiles @@ -0,0 +1,2 @@ +/test-conffile +/test-conffile with spaces diff --git a/tests/t-conffile-prompt/pkg-conff-prompt-0/DEBIAN/control b/tests/t-conffile-prompt/pkg-conff-prompt-0/DEBIAN/control new file mode 100644 index 0000000..3aeb1b2 --- /dev/null +++ b/tests/t-conffile-prompt/pkg-conff-prompt-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-prompt +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile prompt + diff --git a/tests/t-conffile-prompt/pkg-conff-prompt-0/DEBIAN/postinst b/tests/t-conffile-prompt/pkg-conff-prompt-0/DEBIAN/postinst new file mode 100755 index 0000000..27be638 --- /dev/null +++ b/tests/t-conffile-prompt/pkg-conff-prompt-0/DEBIAN/postinst @@ -0,0 +1,3 @@ +#!/bin/sh +echo "test modified" >"$DPKG_ROOT/test-conffile" +echo "test modified spaces" >"$DPKG_ROOT/test-conffile with spaces" diff --git a/tests/t-conffile-prompt/pkg-conff-prompt-0/test-conffile b/tests/t-conffile-prompt/pkg-conff-prompt-0/test-conffile new file mode 100644 index 0000000..6fbc8b5 --- /dev/null +++ b/tests/t-conffile-prompt/pkg-conff-prompt-0/test-conffile @@ -0,0 +1 @@ +test init diff --git a/tests/t-conffile-prompt/pkg-conff-prompt-1/DEBIAN/conffiles b/tests/t-conffile-prompt/pkg-conff-prompt-1/DEBIAN/conffiles new file mode 100644 index 0000000..ef41b42 --- /dev/null +++ b/tests/t-conffile-prompt/pkg-conff-prompt-1/DEBIAN/conffiles @@ -0,0 +1,2 @@ +/test-conffile +/test-conffile with spaces diff --git a/tests/t-conffile-prompt/pkg-conff-prompt-1/DEBIAN/control b/tests/t-conffile-prompt/pkg-conff-prompt-1/DEBIAN/control new file mode 100644 index 0000000..8bd3f1e --- /dev/null +++ b/tests/t-conffile-prompt/pkg-conff-prompt-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-prompt +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile prompt + diff --git a/tests/t-conffile-prompt/pkg-conff-prompt-1/test-conffile b/tests/t-conffile-prompt/pkg-conff-prompt-1/test-conffile new file mode 100644 index 0000000..35f4da8 --- /dev/null +++ b/tests/t-conffile-prompt/pkg-conff-prompt-1/test-conffile @@ -0,0 +1 @@ +test end diff --git a/tests/t-conffile-rename/Makefile b/tests/t-conffile-rename/Makefile new file mode 100644 index 0000000..a8d0272 --- /dev/null +++ b/tests/t-conffile-rename/Makefile @@ -0,0 +1,34 @@ +TESTS_DEB := pkg-conff-rename-0 pkg-conff-rename-1 + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-conff-rename-0.deb + $(DPKG_INSTALL) pkg-conff-rename-1.deb + test -f '$(DPKG_INSTDIR)/test-conffile-new' + test ! -f '$(DPKG_INSTDIR)/test-conffile-old' + test ! -f '$(DPKG_INSTDIR)/test-conffile-old.dpkg-remove' + test ! -f '$(DPKG_INSTDIR)/test-conffile-old.dpkg-bak' + $(DPKG_PURGE) pkg-conff-rename + # Same upgrade but with modified conffile, should still not prompt + $(DPKG_INSTALL) pkg-conff-rename-0.deb + $(BEROOT) sh -c "echo foo >>'$(DPKG_INSTDIR)/test-conffile-old'" + $(DPKG_INSTALL) pkg-conff-rename-1.deb + test -f '$(DPKG_INSTDIR)/test-conffile-new' + test ! -f '$(DPKG_INSTDIR)/test-conffile-old' + test ! -f '$(DPKG_INSTDIR)/test-conffile-old.dpkg-remove' + test ! -f '$(DPKG_INSTDIR)/test-conffile-old.dpkg-bak' + $(DPKG_PURGE) pkg-conff-rename + # Abort-upgrade restores the to-be-renamed conffile + $(DPKG_INSTALL) pkg-conff-rename-0.deb + $(BEROOT) touch '$(DPKG_INSTDIR)/fail-preinst' + $(DPKG_INSTALL) pkg-conff-rename-1.deb || true + $(BEROOT) rm -f '$(DPKG_INSTDIR)/fail-preinst' + test -f '$(DPKG_INSTDIR)/test-conffile-old' + test ! -f '$(DPKG_INSTDIR)/test-conffile-new' + test ! -f '$(DPKG_INSTDIR)/test-conffile-old.dpkg-remove' + test ! -f '$(DPKG_INSTDIR)/test-conffile-old.dpkg-bak' + $(DPKG_PURGE) pkg-conff-rename + +test-clean: + diff --git a/tests/t-conffile-rename/pkg-conff-rename-0/DEBIAN/conffiles b/tests/t-conffile-rename/pkg-conff-rename-0/DEBIAN/conffiles new file mode 100644 index 0000000..3ba6940 --- /dev/null +++ b/tests/t-conffile-rename/pkg-conff-rename-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile-old diff --git a/tests/t-conffile-rename/pkg-conff-rename-0/DEBIAN/control b/tests/t-conffile-rename/pkg-conff-rename-0/DEBIAN/control new file mode 100644 index 0000000..b38b9b7 --- /dev/null +++ b/tests/t-conffile-rename/pkg-conff-rename-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-rename +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile rename + diff --git a/tests/t-conffile-rename/pkg-conff-rename-0/test-conffile-old b/tests/t-conffile-rename/pkg-conff-rename-0/test-conffile-old new file mode 100644 index 0000000..6fbc8b5 --- /dev/null +++ b/tests/t-conffile-rename/pkg-conff-rename-0/test-conffile-old @@ -0,0 +1 @@ +test init diff --git a/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/conffiles b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/conffiles new file mode 100644 index 0000000..e3d713a --- /dev/null +++ b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile-new diff --git a/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/control b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/control new file mode 100644 index 0000000..ffd083c --- /dev/null +++ b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-rename +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conffile rename + diff --git a/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/postinst b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/postinst new file mode 100755 index 0000000..89c1f0b --- /dev/null +++ b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/postinst @@ -0,0 +1,4 @@ +#!/bin/sh +if dpkg-maintscript-helper supports mv_conffile; then + dpkg-maintscript-helper mv_conffile /test-conffile-old /test-conffile-new 0 -- "$@" +fi diff --git a/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/postrm b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/postrm new file mode 100755 index 0000000..89c1f0b --- /dev/null +++ b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/postrm @@ -0,0 +1,4 @@ +#!/bin/sh +if dpkg-maintscript-helper supports mv_conffile; then + dpkg-maintscript-helper mv_conffile /test-conffile-old /test-conffile-new 0 -- "$@" +fi diff --git a/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/preinst b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/preinst new file mode 100755 index 0000000..775093f --- /dev/null +++ b/tests/t-conffile-rename/pkg-conff-rename-1/DEBIAN/preinst @@ -0,0 +1,9 @@ +#!/bin/sh +if dpkg-maintscript-helper supports mv_conffile; then + dpkg-maintscript-helper mv_conffile /test-conffile-old /test-conffile-new 0 -- "$@" +fi + +if [ -e "$DPKG_ROOT/fail-preinst" ]; then + exit 1 +fi + diff --git a/tests/t-conffile-rename/pkg-conff-rename-1/test-conffile-new b/tests/t-conffile-rename/pkg-conff-rename-1/test-conffile-new new file mode 100644 index 0000000..39c0014 --- /dev/null +++ b/tests/t-conffile-rename/pkg-conff-rename-1/test-conffile-new @@ -0,0 +1 @@ +this is the new conffile diff --git a/tests/t-conffile-replaces-disappear/Makefile b/tests/t-conffile-replaces-disappear/Makefile new file mode 100644 index 0000000..f5bc087 --- /dev/null +++ b/tests/t-conffile-replaces-disappear/Makefile @@ -0,0 +1,51 @@ +TESTS_DEB := pkg-conff-original pkg-conff-takeover + +include ../Test.mk + +TEST_CASES += test-two-run-ordered +TEST_CASES += test-one-run-ordered +TEST_CASES += test-two-run-reverse +TEST_CASES += test-one-run-reverse + +test-case: $(TEST_CASES) + +define VERIFY +$(call pkg_is_installed,pkg-conff-takeover) +test "`$(DPKG_QUERY) -S /test-conffile`" = "pkg-conff-takeover: /test-conffile" +cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" +endef + +test-two-run-ordered: + # test-two-run-ordered + $(DPKG_INSTALL) pkg-conff-original.deb + $(DPKG_INSTALL) pkg-conff-takeover.deb + $(call pkg_is_not_installed,pkg-conff-original) + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + test ! -f "$(DPKG_INSTDIR)/test-conffile" + +test-one-run-ordered: + # test-one-run-ordered + $(DPKG_INSTALL) pkg-conff-original.deb pkg-conff-takeover.deb + $(call pkg_is_not_installed,pkg-conff-original) + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + test ! -f "$(DPKG_INSTDIR)/test-conffile" + +test-two-run-reverse: + # test-two-run-reverse + $(DPKG_INSTALL) pkg-conff-takeover.deb + $(DPKG_INSTALL) pkg-conff-original.deb + $(call pkg_is_installed,pkg-conff-original) + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + test ! -f "$(DPKG_INSTDIR)/test-conffile" + +test-one-run-reverse: + # test-one-run-reverse + $(DPKG_INSTALL) pkg-conff-takeover.deb pkg-conff-original.deb + $(call pkg_is_installed,pkg-conff-original) + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + test ! -f "$(DPKG_INSTDIR)/test-conffile" + diff --git a/tests/t-conffile-replaces-disappear/pkg-conff-original/DEBIAN/conffiles b/tests/t-conffile-replaces-disappear/pkg-conff-original/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-disappear/pkg-conff-original/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-disappear/pkg-conff-original/DEBIAN/control b/tests/t-conffile-replaces-disappear/pkg-conff-original/DEBIAN/control new file mode 100644 index 0000000..523e417 --- /dev/null +++ b/tests/t-conffile-replaces-disappear/pkg-conff-original/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-replaces-disappear/pkg-conff-original/test-conffile b/tests/t-conffile-replaces-disappear/pkg-conff-original/test-conffile new file mode 100644 index 0000000..7e3c47b --- /dev/null +++ b/tests/t-conffile-replaces-disappear/pkg-conff-original/test-conffile @@ -0,0 +1 @@ +test original diff --git a/tests/t-conffile-replaces-disappear/pkg-conff-takeover/DEBIAN/conffiles b/tests/t-conffile-replaces-disappear/pkg-conff-takeover/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-disappear/pkg-conff-takeover/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-disappear/pkg-conff-takeover/DEBIAN/control b/tests/t-conffile-replaces-disappear/pkg-conff-takeover/DEBIAN/control new file mode 100644 index 0000000..1f1e038 --- /dev/null +++ b/tests/t-conffile-replaces-disappear/pkg-conff-takeover/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff-original +Description: test package - conffile replaces takeover + diff --git a/tests/t-conffile-replaces-disappear/pkg-conff-takeover/test-conffile b/tests/t-conffile-replaces-disappear/pkg-conff-takeover/test-conffile new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-conffile-replaces-disappear/pkg-conff-takeover/test-conffile @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-conffile-replaces-disappear/ref-conffile b/tests/t-conffile-replaces-disappear/ref-conffile new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-conffile-replaces-disappear/ref-conffile @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-conffile-replaces-diverted/Makefile b/tests/t-conffile-replaces-diverted/Makefile new file mode 100644 index 0000000..5e9b176 --- /dev/null +++ b/tests/t-conffile-replaces-diverted/Makefile @@ -0,0 +1,18 @@ +TESTS_DEB := pkg-conff-0 pkg-conff-1 pkg-conff-move + +include ../Test.mk + +DPKG_DIVERT_OPTIONS += --local --rename --divert /test/conffile.moved + +test-case: + $(DPKG_INSTALL) pkg-conff-0.deb + $(DPKG_DIVERT_ADD) /test/conffile + test -f '$(DPKG_INSTDIR)/test/conffile.moved' + # Test if the other package can takeover a diverted conffile w/o error. + $(DPKG_INSTALL) pkg-conff-1.deb + $(DPKG_INSTALL) pkg-conff-move.deb + +test-clean: + $(DPKG_DIVERT_DEL) /test/conffile + $(DPKG_PURGE) pkg-conff + $(DPKG_PURGE) pkg-conff-move diff --git a/tests/t-conffile-replaces-diverted/pkg-conff-0/DEBIAN/conffiles b/tests/t-conffile-replaces-diverted/pkg-conff-0/DEBIAN/conffiles new file mode 100644 index 0000000..e2b8681 --- /dev/null +++ b/tests/t-conffile-replaces-diverted/pkg-conff-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test/conffile diff --git a/tests/t-conffile-replaces-diverted/pkg-conff-0/DEBIAN/control b/tests/t-conffile-replaces-diverted/pkg-conff-0/DEBIAN/control new file mode 100644 index 0000000..13bd5aa --- /dev/null +++ b/tests/t-conffile-replaces-diverted/pkg-conff-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conff +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile diff --git a/tests/t-conffile-replaces-diverted/pkg-conff-0/test/conffile b/tests/t-conffile-replaces-diverted/pkg-conff-0/test/conffile new file mode 100644 index 0000000..08db759 --- /dev/null +++ b/tests/t-conffile-replaces-diverted/pkg-conff-0/test/conffile @@ -0,0 +1 @@ +This is a conffile. diff --git a/tests/t-conffile-replaces-diverted/pkg-conff-1/DEBIAN/control b/tests/t-conffile-replaces-diverted/pkg-conff-1/DEBIAN/control new file mode 100644 index 0000000..bd499f5 --- /dev/null +++ b/tests/t-conffile-replaces-diverted/pkg-conff-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conff +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provided a conffile, not anymore diff --git a/tests/t-conffile-replaces-diverted/pkg-conff-move/DEBIAN/conffiles b/tests/t-conffile-replaces-diverted/pkg-conff-move/DEBIAN/conffiles new file mode 100644 index 0000000..e2b8681 --- /dev/null +++ b/tests/t-conffile-replaces-diverted/pkg-conff-move/DEBIAN/conffiles @@ -0,0 +1 @@ +/test/conffile diff --git a/tests/t-conffile-replaces-diverted/pkg-conff-move/DEBIAN/control b/tests/t-conffile-replaces-diverted/pkg-conff-move/DEBIAN/control new file mode 100644 index 0000000..bcbdffa --- /dev/null +++ b/tests/t-conffile-replaces-diverted/pkg-conff-move/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-move +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff (<< 1) +Description: test package - takeover a conffile diff --git a/tests/t-conffile-replaces-diverted/pkg-conff-move/test/conffile b/tests/t-conffile-replaces-diverted/pkg-conff-move/test/conffile new file mode 100644 index 0000000..08db759 --- /dev/null +++ b/tests/t-conffile-replaces-diverted/pkg-conff-move/test/conffile @@ -0,0 +1 @@ +This is a conffile. diff --git a/tests/t-conffile-replaces-downgrade/Makefile b/tests/t-conffile-replaces-downgrade/Makefile new file mode 100644 index 0000000..df08bd6 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/Makefile @@ -0,0 +1,20 @@ +TESTS_DEB := pkg-conff-original-0 pkg-conff-original-1 pkg-conff-takeover + +include ../Test.mk + +define VERIFY +$(call pkg_is_installed,pkg-conff-original) +$(call pkg_is_installed,pkg-conff-takeover) +test "`$(DPKG_QUERY) -S /test-conffile`" = "pkg-conff-takeover: /test-conffile" +cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" +endef + +test-case: + # Install packages + $(DPKG_INSTALL) pkg-conff-original-1.deb + $(DPKG_INSTALL) pkg-conff-takeover.deb + # Downgrade to test versioned Replaces + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/DEBIAN/conffiles b/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/DEBIAN/control b/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/DEBIAN/control new file mode 100644 index 0000000..523e417 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/test-conffile b/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/test-conffile new file mode 100644 index 0000000..995e78d --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/test-conffile @@ -0,0 +1 @@ +test original 0 diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/test-original b/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-original-0/test-original diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-original-1/DEBIAN/control b/tests/t-conffile-replaces-downgrade/pkg-conff-original-1/DEBIAN/control new file mode 100644 index 0000000..6cb5a69 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-original-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - stop provinding a conffile + diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-original-1/test-original b/tests/t-conffile-replaces-downgrade/pkg-conff-original-1/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-original-1/test-original diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/DEBIAN/conffiles b/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/DEBIAN/control b/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/DEBIAN/control new file mode 100644 index 0000000..f323304 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-takeover +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff-original +Description: test package - conffile replaces takeover + diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/test-conffile b/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/test-conffile new file mode 100644 index 0000000..1bc4643 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/test-conffile @@ -0,0 +1 @@ +test takeover 1 diff --git a/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/test-takeover b/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/pkg-conff-takeover/test-takeover diff --git a/tests/t-conffile-replaces-downgrade/ref-conffile b/tests/t-conffile-replaces-downgrade/ref-conffile new file mode 100644 index 0000000..1bc4643 --- /dev/null +++ b/tests/t-conffile-replaces-downgrade/ref-conffile @@ -0,0 +1 @@ +test takeover 1 diff --git a/tests/t-conffile-replaces-existing-and-upgrade/Makefile b/tests/t-conffile-replaces-existing-and-upgrade/Makefile new file mode 100644 index 0000000..18ff9dd --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/Makefile @@ -0,0 +1,61 @@ +TESTS_DEB := pkg-conff-original-0 pkg-conff-original-1 \ + pkg-conff-takeover-0 pkg-conff-takeover-1 + +include ../Test.mk + +TEST_CASES += test-two-run-ordered +TEST_CASES += test-one-run-ordered +TEST_CASES += test-two-run-reverse +TEST_CASES += test-one-run-reverse + +test-case: $(TEST_CASES) + +define CONFFILES +$(DPKG_QUERY) -f '$${Package} @ $${Conffiles}\n' +endef + +define VERIFY +$(call pkg_is_installed,pkg-conff-original) +$(call pkg_is_installed,pkg-conff-takeover) +test "`$(DPKG_QUERY) -S /test-conffile`" = "pkg-conff-takeover: /test-conffile" +test "`$(CONFFILES) -W pkg-conff-original | grep obsolete | wc -l`" = "1" +test "`$(CONFFILES) -W pkg-conff-takeover | grep -v obsolete | wc -l`" = "1" +cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" +endef + +test-two-run-ordered: + # test-two-run-ordered + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(DPKG_INSTALL) pkg-conff-original-1.deb + $(DPKG_INSTALL) pkg-conff-takeover-0.deb + $(DPKG_INSTALL) pkg-conff-takeover-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-one-run-ordered: + # test-one-run-ordered + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(DPKG_INSTALL) pkg-conff-original-1.deb pkg-conff-takeover-0.deb + $(DPKG_INSTALL) pkg-conff-takeover-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-two-run-reverse: + # test-two-run-reverse + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(DPKG_INSTALL) pkg-conff-takeover-0.deb + $(DPKG_INSTALL) pkg-conff-original-1.deb + $(DPKG_INSTALL) pkg-conff-takeover-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-one-run-reverse: + # test-one-run-reverse + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(DPKG_INSTALL) pkg-conff-takeover-0.deb pkg-conff-original-1.deb + $(DPKG_INSTALL) pkg-conff-takeover-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-clean: + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/DEBIAN/conffiles b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/DEBIAN/control b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/DEBIAN/control new file mode 100644 index 0000000..523e417 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/test-conffile b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/test-conffile new file mode 100644 index 0000000..995e78d --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/test-conffile @@ -0,0 +1 @@ +test original 0 diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/test-original b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-0/test-original diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/DEBIAN/conffiles b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/DEBIAN/control b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/DEBIAN/control new file mode 100644 index 0000000..aebf74d --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/test-conffile b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/test-conffile new file mode 100644 index 0000000..326ec44 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/test-conffile @@ -0,0 +1 @@ +test original 1 diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/test-original b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-original-1/test-original diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/DEBIAN/conffiles b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/DEBIAN/control b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/DEBIAN/control new file mode 100644 index 0000000..1f1e038 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff-original +Description: test package - conffile replaces takeover + diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/test-conffile b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/test-conffile new file mode 100644 index 0000000..01c117f --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/test-conffile @@ -0,0 +1 @@ +test takeover 0 diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/test-takeover b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-0/test-takeover diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/DEBIAN/conffiles b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/DEBIAN/control b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/DEBIAN/control new file mode 100644 index 0000000..f323304 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-takeover +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff-original +Description: test package - conffile replaces takeover + diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/test-conffile b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/test-conffile new file mode 100644 index 0000000..1bc4643 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/test-conffile @@ -0,0 +1 @@ +test takeover 1 diff --git a/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/test-takeover b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/pkg-conff-takeover-1/test-takeover diff --git a/tests/t-conffile-replaces-existing-and-upgrade/ref-conffile b/tests/t-conffile-replaces-existing-and-upgrade/ref-conffile new file mode 100644 index 0000000..1bc4643 --- /dev/null +++ b/tests/t-conffile-replaces-existing-and-upgrade/ref-conffile @@ -0,0 +1 @@ +test takeover 1 diff --git a/tests/t-conffile-replaces-existing/Makefile b/tests/t-conffile-replaces-existing/Makefile new file mode 100644 index 0000000..6c3d617 --- /dev/null +++ b/tests/t-conffile-replaces-existing/Makefile @@ -0,0 +1,48 @@ +TESTS_DEB := pkg-conff-original-0 pkg-conff-original-1 pkg-conff-takeover + +include ../Test.mk + +TEST_CASES += test-two-run-ordered +TEST_CASES += test-one-run-ordered +TEST_CASES += test-two-run-reverse +TEST_CASES += test-one-run-reverse + +test-case: $(TEST_CASES) + +define VERIFY +$(call pkg_is_installed,pkg-conff-original) +$(call pkg_is_installed,pkg-conff-takeover) +test "`$(DPKG_QUERY) -S /test-conffile`" = "pkg-conff-takeover: /test-conffile" +cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" +endef + +test-two-run-ordered: + # test-two-run-ordered + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(DPKG_INSTALL) pkg-conff-original-1.deb + $(DPKG_INSTALL) pkg-conff-takeover.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-one-run-ordered: + # test-one-run-ordered + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(DPKG_INSTALL) pkg-conff-original-1.deb pkg-conff-takeover.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-two-run-reverse: + # test-two-run-reverse + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(DPKG_INSTALL) pkg-conff-takeover.deb + $(DPKG_INSTALL) pkg-conff-original-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-one-run-reverse: + # test-one-run-reverse + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(DPKG_INSTALL) pkg-conff-takeover.deb pkg-conff-original-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + diff --git a/tests/t-conffile-replaces-existing/pkg-conff-original-0/DEBIAN/conffiles b/tests/t-conffile-replaces-existing/pkg-conff-original-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-original-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-existing/pkg-conff-original-0/DEBIAN/control b/tests/t-conffile-replaces-existing/pkg-conff-original-0/DEBIAN/control new file mode 100644 index 0000000..523e417 --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-original-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-replaces-existing/pkg-conff-original-0/test-conffile b/tests/t-conffile-replaces-existing/pkg-conff-original-0/test-conffile new file mode 100644 index 0000000..995e78d --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-original-0/test-conffile @@ -0,0 +1 @@ +test original 0 diff --git a/tests/t-conffile-replaces-existing/pkg-conff-original-0/test-original b/tests/t-conffile-replaces-existing/pkg-conff-original-0/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-original-0/test-original diff --git a/tests/t-conffile-replaces-existing/pkg-conff-original-1/DEBIAN/conffiles b/tests/t-conffile-replaces-existing/pkg-conff-original-1/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-original-1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-existing/pkg-conff-original-1/DEBIAN/control b/tests/t-conffile-replaces-existing/pkg-conff-original-1/DEBIAN/control new file mode 100644 index 0000000..aebf74d --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-original-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-replaces-existing/pkg-conff-original-1/test-conffile b/tests/t-conffile-replaces-existing/pkg-conff-original-1/test-conffile new file mode 100644 index 0000000..326ec44 --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-original-1/test-conffile @@ -0,0 +1 @@ +test original 1 diff --git a/tests/t-conffile-replaces-existing/pkg-conff-original-1/test-original b/tests/t-conffile-replaces-existing/pkg-conff-original-1/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-original-1/test-original diff --git a/tests/t-conffile-replaces-existing/pkg-conff-takeover/DEBIAN/conffiles b/tests/t-conffile-replaces-existing/pkg-conff-takeover/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-takeover/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces-existing/pkg-conff-takeover/DEBIAN/control b/tests/t-conffile-replaces-existing/pkg-conff-takeover/DEBIAN/control new file mode 100644 index 0000000..1f1e038 --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-takeover/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff-original +Description: test package - conffile replaces takeover + diff --git a/tests/t-conffile-replaces-existing/pkg-conff-takeover/test-conffile b/tests/t-conffile-replaces-existing/pkg-conff-takeover/test-conffile new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-takeover/test-conffile @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-conffile-replaces-existing/pkg-conff-takeover/test-takeover b/tests/t-conffile-replaces-existing/pkg-conff-takeover/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-existing/pkg-conff-takeover/test-takeover diff --git a/tests/t-conffile-replaces-existing/ref-conffile b/tests/t-conffile-replaces-existing/ref-conffile new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-conffile-replaces-existing/ref-conffile @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-conffile-replaces-upgrade/Makefile b/tests/t-conffile-replaces-upgrade/Makefile new file mode 100644 index 0000000..88298b3 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/Makefile @@ -0,0 +1,58 @@ +TESTS_DEB := pkg-conff-original pkg-conff-takeover-0 pkg-conff-takeover-1 + +include ../Test.mk + +TEST_CASES += test-two-run-ordered +TEST_CASES += test-one-run-ordered +TEST_CASES += test-two-run-reverse +TEST_CASES += test-one-run-reverse + +test-case: $(TEST_CASES) + +define CONFFILES +$(DPKG_QUERY) -f '$${Package} @ $${Conffiles}\n' +endef + +define VERIFY +$(call pkg_is_installed,pkg-conff-original) +$(call pkg_is_installed,pkg-conff-takeover) +test "`$(DPKG_QUERY) -S /test-conffile`" = "pkg-conff-takeover: /test-conffile" +test "`$(DPKG_QUERY) -S /test-confpath`" = "pkg-conff-takeover: /test-confpath" +test "`$(CONFFILES) -W pkg-conff-original | grep obsolete | wc -l`" = "2" +test "`$(CONFFILES) -W pkg-conff-takeover | grep -v obsolete | wc -l`" = "2" +cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" +cmp ref-conffile "$(DPKG_INSTDIR)/test-confpath" +endef + +test-two-run-ordered: + # test-two-run-ordered + $(DPKG_INSTALL) pkg-conff-original.deb + $(DPKG_INSTALL) pkg-conff-takeover-0.deb + $(DPKG_INSTALL) pkg-conff-takeover-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-one-run-ordered: + # test-one-run-ordered + $(DPKG_INSTALL) pkg-conff-original.deb pkg-conff-takeover-0.deb + $(DPKG_INSTALL) pkg-conff-takeover-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-two-run-reverse: + # test-two-run-reverse + $(DPKG_INSTALL) pkg-conff-takeover-0.deb + $(DPKG_INSTALL) pkg-conff-original.deb + $(DPKG_INSTALL) pkg-conff-takeover-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-one-run-reverse: + # test-one-run-reverse + $(DPKG_INSTALL) pkg-conff-takeover-0.deb pkg-conff-original.deb + $(DPKG_INSTALL) pkg-conff-takeover-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-clean: + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-original/DEBIAN/conffiles b/tests/t-conffile-replaces-upgrade/pkg-conff-original/DEBIAN/conffiles new file mode 100644 index 0000000..da14206 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-original/DEBIAN/conffiles @@ -0,0 +1,2 @@ +/test-conffile +/test-confpath diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-original/DEBIAN/control b/tests/t-conffile-replaces-upgrade/pkg-conff-original/DEBIAN/control new file mode 100644 index 0000000..523e417 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-original/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-original/test-conffile b/tests/t-conffile-replaces-upgrade/pkg-conff-original/test-conffile new file mode 100644 index 0000000..995e78d --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-original/test-conffile @@ -0,0 +1 @@ +test original 0 diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-original/test-confpath b/tests/t-conffile-replaces-upgrade/pkg-conff-original/test-confpath new file mode 100644 index 0000000..995e78d --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-original/test-confpath @@ -0,0 +1 @@ +test original 0 diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-original/test-original b/tests/t-conffile-replaces-upgrade/pkg-conff-original/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-original/test-original diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/DEBIAN/conffiles b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/DEBIAN/conffiles new file mode 100644 index 0000000..da14206 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/DEBIAN/conffiles @@ -0,0 +1,2 @@ +/test-conffile +/test-confpath diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/DEBIAN/control b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/DEBIAN/control new file mode 100644 index 0000000..1f1e038 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff-original +Description: test package - conffile replaces takeover + diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/test-conffile b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/test-conffile new file mode 100644 index 0000000..01c117f --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/test-conffile @@ -0,0 +1 @@ +test takeover 0 diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/test-confpath b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/test-confpath new file mode 100644 index 0000000..01c117f --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/test-confpath @@ -0,0 +1 @@ +test takeover 0 diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/test-takeover b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-0/test-takeover diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/DEBIAN/conffiles b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/DEBIAN/conffiles new file mode 100644 index 0000000..da14206 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/DEBIAN/conffiles @@ -0,0 +1,2 @@ +/test-conffile +/test-confpath diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/DEBIAN/control b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/DEBIAN/control new file mode 100644 index 0000000..f323304 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-takeover +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff-original +Description: test package - conffile replaces takeover + diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/test-conffile b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/test-conffile new file mode 100644 index 0000000..1bc4643 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/test-conffile @@ -0,0 +1 @@ +test takeover 1 diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/test-confpath b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/test-confpath new file mode 100644 index 0000000..1bc4643 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/test-confpath @@ -0,0 +1 @@ +test takeover 1 diff --git a/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/test-takeover b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/pkg-conff-takeover-1/test-takeover diff --git a/tests/t-conffile-replaces-upgrade/ref-conffile b/tests/t-conffile-replaces-upgrade/ref-conffile new file mode 100644 index 0000000..1bc4643 --- /dev/null +++ b/tests/t-conffile-replaces-upgrade/ref-conffile @@ -0,0 +1 @@ +test takeover 1 diff --git a/tests/t-conffile-replaces/Makefile b/tests/t-conffile-replaces/Makefile new file mode 100644 index 0000000..27d934f --- /dev/null +++ b/tests/t-conffile-replaces/Makefile @@ -0,0 +1,44 @@ +TESTS_DEB := pkg-conff-original pkg-conff-takeover + +include ../Test.mk + +TEST_CASES += test-two-run-ordered +TEST_CASES += test-one-run-ordered +TEST_CASES += test-two-run-reverse +TEST_CASES += test-one-run-reverse + +test-case: $(TEST_CASES) + +define VERIFY +$(call pkg_is_installed,pkg-conff-original) +$(call pkg_is_installed,pkg-conff-takeover) +test "`$(DPKG_QUERY) -S /test-conffile`" = "pkg-conff-takeover: /test-conffile" +cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" +endef + +test-two-run-ordered: + # test-two-run-ordered + $(DPKG_INSTALL) pkg-conff-original.deb + $(DPKG_INSTALL) pkg-conff-takeover.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-one-run-ordered: + # test-one-run-ordered + $(DPKG_INSTALL) pkg-conff-original.deb pkg-conff-takeover.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-two-run-reverse: + # test-two-run-reverse + $(DPKG_INSTALL) pkg-conff-takeover.deb + $(DPKG_INSTALL) pkg-conff-original.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + +test-one-run-reverse: + # test-one-run-reverse + $(DPKG_INSTALL) pkg-conff-takeover.deb pkg-conff-original.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + diff --git a/tests/t-conffile-replaces/pkg-conff-original/DEBIAN/conffiles b/tests/t-conffile-replaces/pkg-conff-original/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces/pkg-conff-original/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces/pkg-conff-original/DEBIAN/control b/tests/t-conffile-replaces/pkg-conff-original/DEBIAN/control new file mode 100644 index 0000000..523e417 --- /dev/null +++ b/tests/t-conffile-replaces/pkg-conff-original/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-replaces/pkg-conff-original/test-conffile b/tests/t-conffile-replaces/pkg-conff-original/test-conffile new file mode 100644 index 0000000..7e3c47b --- /dev/null +++ b/tests/t-conffile-replaces/pkg-conff-original/test-conffile @@ -0,0 +1 @@ +test original diff --git a/tests/t-conffile-replaces/pkg-conff-original/test-original b/tests/t-conffile-replaces/pkg-conff-original/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces/pkg-conff-original/test-original diff --git a/tests/t-conffile-replaces/pkg-conff-takeover/DEBIAN/conffiles b/tests/t-conffile-replaces/pkg-conff-takeover/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-replaces/pkg-conff-takeover/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-replaces/pkg-conff-takeover/DEBIAN/control b/tests/t-conffile-replaces/pkg-conff-takeover/DEBIAN/control new file mode 100644 index 0000000..1f1e038 --- /dev/null +++ b/tests/t-conffile-replaces/pkg-conff-takeover/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff-original +Description: test package - conffile replaces takeover + diff --git a/tests/t-conffile-replaces/pkg-conff-takeover/test-conffile b/tests/t-conffile-replaces/pkg-conff-takeover/test-conffile new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-conffile-replaces/pkg-conff-takeover/test-conffile @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-conffile-replaces/pkg-conff-takeover/test-takeover b/tests/t-conffile-replaces/pkg-conff-takeover/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-replaces/pkg-conff-takeover/test-takeover diff --git a/tests/t-conffile-replaces/ref-conffile b/tests/t-conffile-replaces/ref-conffile new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-conffile-replaces/ref-conffile @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-conffile-root-option/Makefile b/tests/t-conffile-root-option/Makefile new file mode 100644 index 0000000..bd98cc7 --- /dev/null +++ b/tests/t-conffile-root-option/Makefile @@ -0,0 +1,39 @@ +TESTS_DEB := pkg-conff-a-1 pkg-conff-a-2 pkg-conff-b-1 pkg-conff-b-2 + +include ../Test.mk + +TEST_CASES += test-conffile-move-packages-no-rootdir +TEST_CASES += test-conffile-move-packages-rootdir + +test-case: $(TEST_CASES) + +test-conffile-move-packages-no-rootdir: + # Install base versions. + $(DPKG_INSTALL) pkg-conff-a-1.deb pkg-conff-b-1.deb + # Install update, conffile moves from a to b. + $(DPKG_INSTALL) pkg-conff-a-2.deb pkg-conff-b-2.deb + # Cleanup. + -$(DPKG_PURGE) pkg-conff-b + -$(DPKG_PURGE) pkg-conff-a + +TEST_ROOT := $(CURDIR)/target + +test-conffile-move-packages-rootdir: override DPKG_ADMINDIR = $(TEST_ROOT)/var/lib/dpkg +test-conffile-move-packages-rootdir: override DPKG_INSTDIR = $(TEST_ROOT) +test-conffile-move-packages-rootdir: + # Create template root dir. + mkdir -p $(DPKG_ADMINDIR)/info + mkdir -p $(DPKG_ADMINDIR)/updates + mkdir -p $(DPKG_ADMINDIR)/triggers + touch $(DPKG_ADMINDIR)/status + # Install base versions. + $(DPKG_INSTALL) pkg-conff-a-1.deb pkg-conff-b-1.deb + # Install update, conffile moves from a to b. + $(DPKG_INSTALL) pkg-conff-a-2.deb pkg-conff-b-2.deb + # Cleanup. + -$(DPKG_PURGE) pkg-conff-b + -$(DPKG_PURGE) pkg-conff-a + +test-clean: + -$(DPKG_PURGE) pkg-conff-a pkg-conff-b + -$(BEROOT) rm -rf $(TEST_ROOT) diff --git a/tests/t-conffile-root-option/pkg-conff-a-1/DEBIAN/conffiles b/tests/t-conffile-root-option/pkg-conff-a-1/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-root-option/pkg-conff-a-1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-root-option/pkg-conff-a-1/DEBIAN/control b/tests/t-conffile-root-option/pkg-conff-a-1/DEBIAN/control new file mode 100644 index 0000000..a2578e4 --- /dev/null +++ b/tests/t-conffile-root-option/pkg-conff-a-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conff-a +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conflicting conffile diff --git a/tests/t-conffile-root-option/pkg-conff-a-1/test-conffile b/tests/t-conffile-root-option/pkg-conff-a-1/test-conffile new file mode 100644 index 0000000..024da49 --- /dev/null +++ b/tests/t-conffile-root-option/pkg-conff-a-1/test-conffile @@ -0,0 +1 @@ +pkg-conff-a diff --git a/tests/t-conffile-root-option/pkg-conff-a-2/DEBIAN/control b/tests/t-conffile-root-option/pkg-conff-a-2/DEBIAN/control new file mode 100644 index 0000000..21eb309 --- /dev/null +++ b/tests/t-conffile-root-option/pkg-conff-a-2/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conff-a +Version: 2 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conflicting conffile diff --git a/tests/t-conffile-root-option/pkg-conff-b-1/DEBIAN/control b/tests/t-conffile-root-option/pkg-conff-b-1/DEBIAN/control new file mode 100644 index 0000000..0f87276 --- /dev/null +++ b/tests/t-conffile-root-option/pkg-conff-b-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conff-b +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conflicting conffile diff --git a/tests/t-conffile-root-option/pkg-conff-b-2/DEBIAN/conffiles b/tests/t-conffile-root-option/pkg-conff-b-2/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-root-option/pkg-conff-b-2/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-root-option/pkg-conff-b-2/DEBIAN/control b/tests/t-conffile-root-option/pkg-conff-b-2/DEBIAN/control new file mode 100644 index 0000000..57b18ee --- /dev/null +++ b/tests/t-conffile-root-option/pkg-conff-b-2/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conff-b +Version: 2 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conflicting conffile diff --git a/tests/t-conffile-root-option/pkg-conff-b-2/test-conffile b/tests/t-conffile-root-option/pkg-conff-b-2/test-conffile new file mode 100644 index 0000000..006fbc7 --- /dev/null +++ b/tests/t-conffile-root-option/pkg-conff-b-2/test-conffile @@ -0,0 +1 @@ +pkg-conff-b diff --git a/tests/t-conffile-versioned-replaces-downgrade/Makefile b/tests/t-conffile-versioned-replaces-downgrade/Makefile new file mode 100644 index 0000000..df08bd6 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/Makefile @@ -0,0 +1,20 @@ +TESTS_DEB := pkg-conff-original-0 pkg-conff-original-1 pkg-conff-takeover + +include ../Test.mk + +define VERIFY +$(call pkg_is_installed,pkg-conff-original) +$(call pkg_is_installed,pkg-conff-takeover) +test "`$(DPKG_QUERY) -S /test-conffile`" = "pkg-conff-takeover: /test-conffile" +cmp ref-conffile "$(DPKG_INSTDIR)/test-conffile" +endef + +test-case: + # Install packages + $(DPKG_INSTALL) pkg-conff-original-1.deb + $(DPKG_INSTALL) pkg-conff-takeover.deb + # Downgrade to test versioned Replaces + $(DPKG_INSTALL) pkg-conff-original-0.deb + $(VERIFY) + $(DPKG_PURGE) pkg-conff-original pkg-conff-takeover + diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/DEBIAN/conffiles b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/DEBIAN/control b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/DEBIAN/control new file mode 100644 index 0000000..523e417 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a conffile + diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/test-conffile b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/test-conffile new file mode 100644 index 0000000..995e78d --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/test-conffile @@ -0,0 +1 @@ +test original 0 diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/test-original b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-0/test-original diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-1/DEBIAN/control b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-1/DEBIAN/control new file mode 100644 index 0000000..6cb5a69 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conff-original +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - stop provinding a conffile + diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-1/test-original b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-1/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-original-1/test-original diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/DEBIAN/conffiles b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/DEBIAN/conffiles new file mode 100644 index 0000000..4fad7e9 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-conffile diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/DEBIAN/control b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/DEBIAN/control new file mode 100644 index 0000000..22ae20f --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-conff-takeover +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-conff-original (<= 0) +Description: test package - conffile replaces takeover + diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/test-conffile b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/test-conffile new file mode 100644 index 0000000..1bc4643 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/test-conffile @@ -0,0 +1 @@ +test takeover 1 diff --git a/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/test-takeover b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/pkg-conff-takeover/test-takeover diff --git a/tests/t-conffile-versioned-replaces-downgrade/ref-conffile b/tests/t-conffile-versioned-replaces-downgrade/ref-conffile new file mode 100644 index 0000000..1bc4643 --- /dev/null +++ b/tests/t-conffile-versioned-replaces-downgrade/ref-conffile @@ -0,0 +1 @@ +test takeover 1 diff --git a/tests/t-conflict-provide-replace-interface/Makefile b/tests/t-conflict-provide-replace-interface/Makefile new file mode 100644 index 0000000..6aefafb --- /dev/null +++ b/tests/t-conflict-provide-replace-interface/Makefile @@ -0,0 +1,18 @@ +TESTS_DEB := pkg-a pkg-b + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-a.deb + # The user was not explicit in the request, fail + ! $(DPKG_INSTALL) pkg-b.deb + # Even if requesting auto-deconfigure the request is not explicit + # enough, fail + ! $(DPKG_INSTALL) -B pkg-b.deb + # Set up the desired transaction + echo pkg-a deinstall | $(BEROOT) $(DPKG) --set-selections + $(DPKG_INSTALL) pkg-b.deb + +test-clean: + $(DPKG_PURGE) pkg-b + -$(DPKG_PURGE) pkg-a diff --git a/tests/t-conflict-provide-replace-interface/pkg-a/DEBIAN/control b/tests/t-conflict-provide-replace-interface/pkg-a/DEBIAN/control new file mode 100644 index 0000000..3e079f1 --- /dev/null +++ b/tests/t-conflict-provide-replace-interface/pkg-a/DEBIAN/control @@ -0,0 +1,10 @@ +Package: pkg-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-iface +Replaces: pkg-iface +Provides: pkg-iface +Description: test package - package providing an interface diff --git a/tests/t-conflict-provide-replace-interface/pkg-b/DEBIAN/control b/tests/t-conflict-provide-replace-interface/pkg-b/DEBIAN/control new file mode 100644 index 0000000..80b99d7 --- /dev/null +++ b/tests/t-conflict-provide-replace-interface/pkg-b/DEBIAN/control @@ -0,0 +1,11 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-iface +Replaces: pkg-iface +Provides: pkg-iface +Description: test package - package providing an interface + diff --git a/tests/t-conflict-provide-replace-real/Makefile b/tests/t-conflict-provide-replace-real/Makefile new file mode 100644 index 0000000..84334ce --- /dev/null +++ b/tests/t-conflict-provide-replace-real/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := pkg-a pkg-b + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-a.deb + # test if the replacing package takes over on install + $(DPKG_INSTALL) pkg-b.deb + +test-clean: + $(DPKG_PURGE) pkg-b + -$(DPKG_PURGE) pkg-a + diff --git a/tests/t-conflict-provide-replace-real/pkg-a/DEBIAN/control b/tests/t-conflict-provide-replace-real/pkg-a/DEBIAN/control new file mode 100644 index 0000000..0d7fa10 --- /dev/null +++ b/tests/t-conflict-provide-replace-real/pkg-a/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package to be replaced + diff --git a/tests/t-conflict-provide-replace-real/pkg-a/test-conflict b/tests/t-conflict-provide-replace-real/pkg-a/test-conflict new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conflict-provide-replace-real/pkg-a/test-conflict diff --git a/tests/t-conflict-provide-replace-real/pkg-b/DEBIAN/control b/tests/t-conflict-provide-replace-real/pkg-b/DEBIAN/control new file mode 100644 index 0000000..8b292a6 --- /dev/null +++ b/tests/t-conflict-provide-replace-real/pkg-b/DEBIAN/control @@ -0,0 +1,11 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-a +Provides: pkg-a +Replaces: pkg-a +Description: test package - replacing package + diff --git a/tests/t-conflict-provide-replace-real/pkg-b/test-conflict b/tests/t-conflict-provide-replace-real/pkg-b/test-conflict new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-conflict-provide-replace-real/pkg-b/test-conflict diff --git a/tests/t-conflict-provide-replace-virtual-multiarch/Makefile b/tests/t-conflict-provide-replace-virtual-multiarch/Makefile new file mode 100644 index 0000000..22176a3 --- /dev/null +++ b/tests/t-conflict-provide-replace-virtual-multiarch/Makefile @@ -0,0 +1,23 @@ +TESTS_DEB := pkg-virt-i386 pkg-virt-amd64 pkg-real-i386 pkg-real-amd64 + +include ../Test.mk + +test-case: + $(DPKG) --add-architecture amd64 + $(DPKG) --add-architecture i386 + $(DPKG_INSTALL) pkg-virt-i386.deb + # Configuring pkg-real:amd64 should not be allowed + ! $(DPKG_INSTALL) pkg-real-amd64.deb + $(DPKG_INSTALL) pkg-real-i386.deb + $(DPKG_INSTALL) pkg-virt-amd64.deb + $(DPKG_INSTALL) pkg-real-i386.deb + # Purging should not be allowed + ! $(DPKG_PURGE) pkg-virt:i386 + +test-clean: + $(DPKG_PURGE) pkg-real:i386 + $(DPKG_PURGE) pkg-real:amd64 + $(DPKG_PURGE) pkg-virt:i386 + $(DPKG_PURGE) pkg-virt:amd64 + $(DPKG) --remove-architecture amd64 + $(DPKG) --remove-architecture i386 diff --git a/tests/t-conflict-provide-replace-virtual-multiarch/pkg-real-amd64/DEBIAN/control b/tests/t-conflict-provide-replace-virtual-multiarch/pkg-real-amd64/DEBIAN/control new file mode 100644 index 0000000..b0d033c --- /dev/null +++ b/tests/t-conflict-provide-replace-virtual-multiarch/pkg-real-amd64/DEBIAN/control @@ -0,0 +1,10 @@ +Package: pkg-real +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Depends: pkg-v +Description: test package - depending on virtual + diff --git a/tests/t-conflict-provide-replace-virtual-multiarch/pkg-real-i386/DEBIAN/control b/tests/t-conflict-provide-replace-virtual-multiarch/pkg-real-i386/DEBIAN/control new file mode 100644 index 0000000..e248c73 --- /dev/null +++ b/tests/t-conflict-provide-replace-virtual-multiarch/pkg-real-i386/DEBIAN/control @@ -0,0 +1,10 @@ +Package: pkg-real +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Depends: pkg-v +Description: test package - depending on virtual + diff --git a/tests/t-conflict-provide-replace-virtual-multiarch/pkg-virt-amd64/DEBIAN/control b/tests/t-conflict-provide-replace-virtual-multiarch/pkg-virt-amd64/DEBIAN/control new file mode 100644 index 0000000..312fafd --- /dev/null +++ b/tests/t-conflict-provide-replace-virtual-multiarch/pkg-virt-amd64/DEBIAN/control @@ -0,0 +1,12 @@ +Package: pkg-virt +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Conflicts: pkg-v +Provides: pkg-v +Replaces: pkg-v +Description: test package - conflicting virtual + diff --git a/tests/t-conflict-provide-replace-virtual-multiarch/pkg-virt-i386/DEBIAN/control b/tests/t-conflict-provide-replace-virtual-multiarch/pkg-virt-i386/DEBIAN/control new file mode 100644 index 0000000..f1b171f --- /dev/null +++ b/tests/t-conflict-provide-replace-virtual-multiarch/pkg-virt-i386/DEBIAN/control @@ -0,0 +1,12 @@ +Package: pkg-virt +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Conflicts: pkg-v +Provides: pkg-v +Replaces: pkg-v +Description: test package - conflicting virtual + diff --git a/tests/t-conflict-provide-replace-virtual/Makefile b/tests/t-conflict-provide-replace-virtual/Makefile new file mode 100644 index 0000000..e0ed06e --- /dev/null +++ b/tests/t-conflict-provide-replace-virtual/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := pkg-a pkg-b + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-a.deb + # test if the conflicting package fails on install + ! $(DPKG_INSTALL) pkg-b.deb + +test-clean: + -$(DPKG_PURGE) pkg-b + $(DPKG_PURGE) pkg-a + diff --git a/tests/t-conflict-provide-replace-virtual/pkg-a/DEBIAN/control b/tests/t-conflict-provide-replace-virtual/pkg-a/DEBIAN/control new file mode 100644 index 0000000..1dba668 --- /dev/null +++ b/tests/t-conflict-provide-replace-virtual/pkg-a/DEBIAN/control @@ -0,0 +1,11 @@ +Package: pkg-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-v +Provides: pkg-v +Replaces: pkg-v +Description: test package - conflicting virtual + diff --git a/tests/t-conflict-provide-replace-virtual/pkg-b/DEBIAN/control b/tests/t-conflict-provide-replace-virtual/pkg-b/DEBIAN/control new file mode 100644 index 0000000..8bee1c4 --- /dev/null +++ b/tests/t-conflict-provide-replace-virtual/pkg-b/DEBIAN/control @@ -0,0 +1,11 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-v +Provides: pkg-v +Replaces: pkg-v +Description: test package - conflicting virtual + diff --git a/tests/t-conflicts/Makefile b/tests/t-conflicts/Makefile new file mode 100644 index 0000000..396d71d --- /dev/null +++ b/tests/t-conflicts/Makefile @@ -0,0 +1,15 @@ +TESTS_DEB := pkg-a pkg-b + +include ../Test.mk + +test-case: + # test if the conflicting packages fail on install + ! $(DPKG_INSTALL) pkg-b.deb pkg-a.deb + $(call pkg_is_not_installed,pkg-a) + -$(DPKG_PURGE) pkg-a pkg-b + ! $(DPKG_INSTALL) pkg-a.deb pkg-b.deb + $(call pkg_is_not_installed,pkg-b) + -$(DPKG_PURGE) pkg-a pkg-b + +test-clean: + -$(DPKG_PURGE) pkg-a pkg-b diff --git a/tests/t-conflicts/pkg-a/DEBIAN/control b/tests/t-conflicts/pkg-a/DEBIAN/control new file mode 100644 index 0000000..ca34e72 --- /dev/null +++ b/tests/t-conflicts/pkg-a/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-b +Description: test package - conflicting against pkg-b diff --git a/tests/t-conflicts/pkg-b/DEBIAN/control b/tests/t-conflicts/pkg-b/DEBIAN/control new file mode 100644 index 0000000..f723a59 --- /dev/null +++ b/tests/t-conflicts/pkg-b/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conflicting package diff --git a/tests/t-control-bogus/Makefile b/tests/t-control-bogus/Makefile new file mode 100644 index 0000000..ec042dd --- /dev/null +++ b/tests/t-control-bogus/Makefile @@ -0,0 +1,32 @@ +include ../Test.mk + +test-case: + # test building package with bogus control files + ! $(DPKG_BUILD_DEB) pkg-bogus-colon + ! $(DPKG_BUILD_DEB) pkg-bogus-blank + ! $(DPKG_BUILD_DEB) pkg-bogus-fieldname-empty + ! $(DPKG_BUILD_DEB) pkg-bogus-fieldname-partial + ! $(DPKG_BUILD_DEB) pkg-bogus-format-string + + # build bogus packages + $(DPKG_BUILD_DEB) --nocheck pkg-bogus-colon + $(DPKG_BUILD_DEB) --nocheck pkg-bogus-blank + $(DPKG_BUILD_DEB) --nocheck pkg-bogus-fieldname-empty + $(DPKG_BUILD_DEB) --nocheck pkg-bogus-fieldname-partial + $(DPKG_BUILD_DEB) --nocheck pkg-bogus-format-string + + # test installing packages with bogus control files + ! $(DPKG_INSTALL) pkg-bogus-colon.deb + $(call pkg_is_not_installed,pkg-bogus-colon) + ! $(DPKG_INSTALL) pkg-bogus-blank.deb + $(call pkg_is_not_installed,pkg-bogus-blank) + ! $(DPKG_INSTALL) pkg-bogus-fieldname-empty.deb + $(call pkg_is_not_installed,pkg-bogus-fieldname-empty) + ! $(DPKG_INSTALL) pkg-bogus-fieldname-partial.deb + $(call pkg_is_not_installed,pkg-bogus-fieldname-partial) + ! $(DPKG_INSTALL) pkg-bogus-format-string.deb + $(call pkg_is_not_installed,pkg-bogus-format-string) + +test-clean: + rm -f pkg-bogus-colon.deb + rm -f pkg-bogus-blank.deb diff --git a/tests/t-control-bogus/pkg-bogus-blank/DEBIAN/control b/tests/t-control-bogus/pkg-bogus-blank/DEBIAN/control new file mode 100644 index 0000000..7904382 --- /dev/null +++ b/tests/t-control-bogus/pkg-bogus-blank/DEBIAN/control @@ -0,0 +1,18 @@ +Package: pkg-bogus-blank +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - bogus control file w/ blank lines in fields + This is an invalid description, containing lines with one space: + + or two: + + or even more: + + Instead of the correct blank line using a dot as delimiter: + . + Or valid lines with multiple spaces with content: + line 1 + line 2 diff --git a/tests/t-control-bogus/pkg-bogus-colon/DEBIAN/control b/tests/t-control-bogus/pkg-bogus-colon/DEBIAN/control new file mode 100644 index 0000000..3b32476 --- /dev/null +++ b/tests/t-control-bogus/pkg-bogus-colon/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-bogus +BOGUS-LINE +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - bogus control file diff --git a/tests/t-control-bogus/pkg-bogus-fieldname-empty/DEBIAN/control b/tests/t-control-bogus/pkg-bogus-fieldname-empty/DEBIAN/control new file mode 100644 index 0000000..ad433ca --- /dev/null +++ b/tests/t-control-bogus/pkg-bogus-fieldname-empty/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-bogus-fieldname-empty +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +: value +Description: test package - bogus control file w/ empty field name diff --git a/tests/t-control-bogus/pkg-bogus-fieldname-partial/DEBIAN/control b/tests/t-control-bogus/pkg-bogus-fieldname-partial/DEBIAN/control new file mode 100644 index 0000000..dd28c0b --- /dev/null +++ b/tests/t-control-bogus/pkg-bogus-fieldname-partial/DEBIAN/control @@ -0,0 +1,7 @@ +Pack: pkg-bogus-fieldname-partial +Vers: 0.0-1 +Sect: test +Prio: extra +Main: Dpkg Developers <debian-dpkg@lists.debian.org> +Arch: all +Desc: test package - bogus control file w/ partial field names diff --git a/tests/t-control-bogus/pkg-bogus-format-string/DEBIAN/control b/tests/t-control-bogus/pkg-bogus-format-string/DEBIAN/control new file mode 100644 index 0000000..bbb181a --- /dev/null +++ b/tests/t-control-bogus/pkg-bogus-format-string/DEBIAN/control @@ -0,0 +1,7 @@ +Package: %s +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: %s +Description: test package - bogus control file w/ format string in values diff --git a/tests/t-control-no-arch/Makefile b/tests/t-control-no-arch/Makefile new file mode 100644 index 0000000..48b79fd --- /dev/null +++ b/tests/t-control-no-arch/Makefile @@ -0,0 +1,22 @@ +include ../Test.mk + +test-case: + # test building package with missing Architecture field. + ! $(DPKG_BUILD_DEB) pkg-no-arch + + # build bogus packages + $(DPKG_BUILD_DEB) --nocheck pkg-no-arch + + # test handling of package without the Architecture field + ! $(DPKG_INSTALL) pkg-no-arch.deb + $(call pkg_is_not_installed,pkg-no-arch) + # these ancient/bogus packages need to be forced now + $(DPKG_INSTALL) --force-architecture pkg-no-arch.deb + $(call pkg_is_installed,pkg-no-arch) + ! $(call stdout_has,$(DPKG_QUERY) --status pkg-no-arch,^Architecture:) + $(DPKG_PURGE) pkg-no-arch + # Clear the available file to avoid missing Architecture warnings + $(BEROOT) $(DPKG) --clear-avail + +test-clean: + rm -f pkg-no-arch.deb diff --git a/tests/t-control-no-arch/pkg-no-arch/DEBIAN/control b/tests/t-control-no-arch/pkg-no-arch/DEBIAN/control new file mode 100644 index 0000000..8871216 --- /dev/null +++ b/tests/t-control-no-arch/pkg-no-arch/DEBIAN/control @@ -0,0 +1,6 @@ +Package: pkg-no-arch +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Description: test package - without Architecture field diff --git a/tests/t-db/Makefile b/tests/t-db/Makefile new file mode 100644 index 0000000..2e5b621 --- /dev/null +++ b/tests/t-db/Makefile @@ -0,0 +1,60 @@ +# Copyright © 2012 Guillem Jover <guillem@debian.org> + +TESTS_DEB := + +include ../Test.mk + +PKG_TUPLE = LC_ALL=C $(DPKG_QUERY) -f '$${Package}:$${Architecture}:$${Version}' -W + +TEST_CASES += test-field-blank-lines +TEST_CASES += test-field-blank-lines-update +TEST_CASES += test-dupe-multi +TEST_CASES += test-cross-single-update +TEST_CASES += test-cross-multi-update +TEST_CASES += test-bogus-single +TEST_CASES += test-bogus-dupe-same-single +TEST_CASES += test-bogus-dupe-diff-single +TEST_CASES += test-bogus-multi +TEST_CASES += test-bogus-multi-update + +test-case: $(TEST_CASES) + +test-field-blank-lines: override DPKG_ADMINDIR = db-field-blank-lines +test-field-blank-lines: + $(call stderr_has,$(PKG_TUPLE),warning) + +test-field-blank-lines-update: override DPKG_ADMINDIR = db-field-blank-lines-update +test-field-blank-lines-update: + $(call stderr_has,$(PKG_TUPLE),warning) + +test-dupe-multi: override DPKG_ADMINDIR = db-dupe-multi +test-dupe-multi: + $(call stdout_is,$(PKG_TUPLE),pkg-multi:amd64:1.0) + +test-cross-single-update: override DPKG_ADMINDIR = db-cross-single-update +test-cross-single-update: + $(call stdout_is,$(PKG_TUPLE),pkg-single:armel:3.0) + +test-cross-multi-update: override DPKG_ADMINDIR = db-cross-multi-update +test-cross-multi-update: + $(call stdout_is,$(PKG_TUPLE),pkg-multi:armel:4.0) + +test-bogus-dupe-same-single: override DPKG_ADMINDIR = db-bogus-dupe-same-single +test-bogus-dupe-same-single: + $(call stderr_has,$(PKG_TUPLE),error) + +test-bogus-dupe-diff-single: override DPKG_ADMINDIR = db-bogus-dupe-diff-single +test-bogus-dupe-diff-single: + $(call stderr_has,$(PKG_TUPLE),error) + +test-bogus-single: override DPKG_ADMINDIR = db-bogus-single +test-bogus-single: + $(call stderr_has,$(PKG_TUPLE),error) + +test-bogus-multi: override DPKG_ADMINDIR = db-bogus-multi +test-bogus-multi: + $(call stderr_has,$(PKG_TUPLE),error) + +test-bogus-multi-update: override DPKG_ADMINDIR = db-bogus-multi-update +test-bogus-multi-update: + $(call stderr_has,$(PKG_TUPLE),error) diff --git a/tests/t-db/db-bogus-dupe-diff-single/status b/tests/t-db/db-bogus-dupe-diff-single/status new file mode 100644 index 0000000..0274528 --- /dev/null +++ b/tests/t-db/db-bogus-dupe-diff-single/status @@ -0,0 +1,18 @@ +Package: pkg-single +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Version: 1.0 +Description: test package + +Package: pkg-single +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Version: 2.0 +Description: test package + diff --git a/tests/t-db/db-bogus-dupe-diff-single/updates/.keep b/tests/t-db/db-bogus-dupe-diff-single/updates/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-db/db-bogus-dupe-diff-single/updates/.keep diff --git a/tests/t-db/db-bogus-dupe-same-single/status b/tests/t-db/db-bogus-dupe-same-single/status new file mode 100644 index 0000000..b336494 --- /dev/null +++ b/tests/t-db/db-bogus-dupe-same-single/status @@ -0,0 +1,18 @@ +Package: pkg-single +Status: install ok config-files +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Version: 1.0 +Description: test package + +Package: pkg-single +Status: install ok half-installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Version: 2.0 +Description: test package + diff --git a/tests/t-db/db-bogus-dupe-same-single/updates/.keep b/tests/t-db/db-bogus-dupe-same-single/updates/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-db/db-bogus-dupe-same-single/updates/.keep diff --git a/tests/t-db/db-bogus-multi-update/status b/tests/t-db/db-bogus-multi-update/status new file mode 100644 index 0000000..d605d4b --- /dev/null +++ b/tests/t-db/db-bogus-multi-update/status @@ -0,0 +1,16 @@ +Package: pkg-multi +Status: install ok config-files +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Version: 1.0 +Description: test package + +Package: pkg-multi +Status: install ok not-installed +Priority: extra +Section: test +Architecture: armel + diff --git a/tests/t-db/db-bogus-multi-update/updates/0001 b/tests/t-db/db-bogus-multi-update/updates/0001 new file mode 100644 index 0000000..4c00629 --- /dev/null +++ b/tests/t-db/db-bogus-multi-update/updates/0001 @@ -0,0 +1,10 @@ +Package: pkg-multi +Status: install ok half-installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Version: 1.0 +Description: test package + diff --git a/tests/t-db/db-bogus-multi-update/updates/0002 b/tests/t-db/db-bogus-multi-update/updates/0002 new file mode 100644 index 0000000..468518a --- /dev/null +++ b/tests/t-db/db-bogus-multi-update/updates/0002 @@ -0,0 +1,9 @@ +Package: pkg-multi +Status: install ok unpacked +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: armel +Version: 1.0 +Description: test package + diff --git a/tests/t-db/db-bogus-multi/status b/tests/t-db/db-bogus-multi/status new file mode 100644 index 0000000..c79b950 --- /dev/null +++ b/tests/t-db/db-bogus-multi/status @@ -0,0 +1,29 @@ +Package: pkg-multi +Status: install ok config-files +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Version: 1.0 +Description: test package + +Package: pkg-multi +Status: install ok half-installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: armel +Version: 1.0 +Description: test package + +Package: pkg-multi +Status: install ok unpacked +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Version: 1.0 +Description: test package + diff --git a/tests/t-db/db-bogus-multi/updates/.keep b/tests/t-db/db-bogus-multi/updates/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-db/db-bogus-multi/updates/.keep diff --git a/tests/t-db/db-bogus-single/status b/tests/t-db/db-bogus-single/status new file mode 100644 index 0000000..87eed5d --- /dev/null +++ b/tests/t-db/db-bogus-single/status @@ -0,0 +1,19 @@ +Package: pkg-single +Status: install ok config-files +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Version: 1.0 +Description: test package + +Package: pkg-single +Status: install ok half-configured +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Version: 1.0 +Description: test package + diff --git a/tests/t-db/db-bogus-single/updates/.keep b/tests/t-db/db-bogus-single/updates/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-db/db-bogus-single/updates/.keep diff --git a/tests/t-db/db-cross-multi-update/status b/tests/t-db/db-cross-multi-update/status new file mode 100644 index 0000000..cfa1c04 --- /dev/null +++ b/tests/t-db/db-cross-multi-update/status @@ -0,0 +1,10 @@ +Package: pkg-multi +Status: install ok config-files +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Version: 1.0 +Description: test package + diff --git a/tests/t-db/db-cross-multi-update/updates/0001 b/tests/t-db/db-cross-multi-update/updates/0001 new file mode 100644 index 0000000..a0fea54 --- /dev/null +++ b/tests/t-db/db-cross-multi-update/updates/0001 @@ -0,0 +1,10 @@ +Package: pkg-multi +Status: install ok half-installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Version: 2.0 +Description: test package + diff --git a/tests/t-db/db-cross-multi-update/updates/0002 b/tests/t-db/db-cross-multi-update/updates/0002 new file mode 100644 index 0000000..7850eef --- /dev/null +++ b/tests/t-db/db-cross-multi-update/updates/0002 @@ -0,0 +1,10 @@ +Package: pkg-multi +Status: install ok not-installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Version: 2.0 +Description: test package + diff --git a/tests/t-db/db-cross-multi-update/updates/0003 b/tests/t-db/db-cross-multi-update/updates/0003 new file mode 100644 index 0000000..3759577 --- /dev/null +++ b/tests/t-db/db-cross-multi-update/updates/0003 @@ -0,0 +1,9 @@ +Package: pkg-multi +Status: install ok unpacked +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: armel +Version: 4.0 +Description: test package + diff --git a/tests/t-db/db-cross-single-update/status b/tests/t-db/db-cross-single-update/status new file mode 100644 index 0000000..10c934b --- /dev/null +++ b/tests/t-db/db-cross-single-update/status @@ -0,0 +1,9 @@ +Package: pkg-single +Status: install ok config-files +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Version: 1.0 +Description: test package + diff --git a/tests/t-db/db-cross-single-update/updates/0001 b/tests/t-db/db-cross-single-update/updates/0001 new file mode 100644 index 0000000..ae9d517 --- /dev/null +++ b/tests/t-db/db-cross-single-update/updates/0001 @@ -0,0 +1,10 @@ +Package: pkg-single +Status: install ok half-installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: same +Version: 2.0 +Description: test package + diff --git a/tests/t-db/db-cross-single-update/updates/0002 b/tests/t-db/db-cross-single-update/updates/0002 new file mode 100644 index 0000000..11be9c5 --- /dev/null +++ b/tests/t-db/db-cross-single-update/updates/0002 @@ -0,0 +1,9 @@ +Package: pkg-single +Status: install ok unpacked +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: armel +Version: 3.0 +Description: test package + diff --git a/tests/t-db/db-dupe-multi/status b/tests/t-db/db-dupe-multi/status new file mode 100644 index 0000000..e2e1a7d --- /dev/null +++ b/tests/t-db/db-dupe-multi/status @@ -0,0 +1,20 @@ +Package: pkg-multi +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Version: 1.0 +Description: test package + +Package: pkg-multi +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Multi-Arch: same +Version: 1.0 +Description: test package + diff --git a/tests/t-db/db-dupe-multi/updates/.keep b/tests/t-db/db-dupe-multi/updates/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-db/db-dupe-multi/updates/.keep diff --git a/tests/t-db/db-field-blank-lines-update/status b/tests/t-db/db-field-blank-lines-update/status new file mode 100644 index 0000000..7b58a81 --- /dev/null +++ b/tests/t-db/db-field-blank-lines-update/status @@ -0,0 +1,13 @@ +Package: pkg-correct +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Version: 1.0 +Description: test package + This description splits + . + lines correctly + . + with dots. diff --git a/tests/t-db/db-field-blank-lines-update/updates/.keep b/tests/t-db/db-field-blank-lines-update/updates/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-db/db-field-blank-lines-update/updates/.keep diff --git a/tests/t-db/db-field-blank-lines-update/updates/0001 b/tests/t-db/db-field-blank-lines-update/updates/0001 new file mode 100644 index 0000000..6d9c599 --- /dev/null +++ b/tests/t-db/db-field-blank-lines-update/updates/0001 @@ -0,0 +1,13 @@ +Package: pkg-blank-lines +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Version: 1.0 +Description: test package + This description splits + + lines incorrectly + + with blank lines, but is still tolerated. diff --git a/tests/t-db/db-field-blank-lines/status b/tests/t-db/db-field-blank-lines/status new file mode 100644 index 0000000..a9759da --- /dev/null +++ b/tests/t-db/db-field-blank-lines/status @@ -0,0 +1,27 @@ +Package: pkg-blank-lines +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Version: 1.0 +Description: test package + This description splits + + lines incorrectly + + with blank lines, but is still tolerated. + +Package: pkg-correct +Status: install ok installed +Priority: extra +Section: test +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Version: 1.0 +Description: test package + This description splits + . + lines correctly + . + with dots. diff --git a/tests/t-db/db-field-blank-lines/updates/.keep b/tests/t-db/db-field-blank-lines/updates/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-db/db-field-blank-lines/updates/.keep diff --git a/tests/t-deb-lfs/Makefile b/tests/t-deb-lfs/Makefile new file mode 100644 index 0000000..4e45e1f --- /dev/null +++ b/tests/t-deb-lfs/Makefile @@ -0,0 +1,35 @@ +PKG_SFS := pkg-sfs +PKG_LFS := pkg-lfs + +TESTS_DEB := $(PKG_LFS) $(PKG_SFS) + +# This will test both the ar archive and the tar LFS support. +DPKG_DEB_OPTIONS = -Znone + +include ../Test.mk + +$(PKG_LFS)/large-file: + dd if=/dev/zero of=$@ bs=1K count=5M + +$(PKG_SFS)/small-file: + yes | dd of=$@ bs=1K count=4 + +build-hook: $(PKG_LFS)/large-file $(PKG_SFS)/small-file + +clean-hook: + $(RM) $(PKG_LFS)/large-file $(PKG_SFS)/small-file + +test-case: + # test Small File Support packages + $(DPKG_INSTALL) pkg-sfs.deb + $(call pkg_is_installed,pkg-sfs) + test "`stat -c%s '$(DPKG_INSTDIR)/small-file'`" = "4096" + + # test Large File Support packages + $(DPKG_INSTALL) pkg-lfs.deb + $(call pkg_is_installed,pkg-lfs) + test "`stat -c%s '$(DPKG_INSTDIR)/large-file'`" = "5368709120" + +test-clean: + $(DPKG_PURGE) pkg-sfs + $(DPKG_PURGE) pkg-lfs diff --git a/tests/t-deb-lfs/pkg-lfs/DEBIAN/control b/tests/t-deb-lfs/pkg-lfs/DEBIAN/control new file mode 100644 index 0000000..8982f07 --- /dev/null +++ b/tests/t-deb-lfs/pkg-lfs/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-lfs +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - large file support diff --git a/tests/t-deb-lfs/pkg-sfs/DEBIAN/control b/tests/t-deb-lfs/pkg-sfs/DEBIAN/control new file mode 100644 index 0000000..2ccee74 --- /dev/null +++ b/tests/t-deb-lfs/pkg-sfs/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-sfs +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - small file support diff --git a/tests/t-depends/Makefile b/tests/t-depends/Makefile new file mode 100644 index 0000000..73c10ea --- /dev/null +++ b/tests/t-depends/Makefile @@ -0,0 +1,83 @@ +TESTS_DEB := \ + pkg-real pkg-depends \ + pkg-version-1 pkg-version-2 pkg-version-3 pkg-depends-eq \ + pkg-depends-lt pkg-depends-le pkg-depends-ge pkg-depends-gt + +include ../Test.mk + +test-depends: + # The dependency is not present, fail + ! $(DPKG_INSTALL) pkg-depends.deb + # Install the real package + $(DPKG_INSTALL) pkg-real.deb + # The dependency is present, pass + $(DPKG_INSTALL) pkg-depends.deb + # The dependency is removed, fail + ! $(DPKG_PURGE) pkg-real + # The depending package is removed, pass + $(DPKG_PURGE) pkg-depends + # The dependency is removed, pass + $(DPKG_PURGE) pkg-real + # Now try with --force-depends + $(DPKG_INSTALL) --force-depends pkg-depends.deb + $(DPKG_PURGE) pkg-depends + +define PURGE_DEPENDS +$(DPKG_PURGE) pkg-depends-lt +$(DPKG_PURGE) pkg-depends-le +$(DPKG_PURGE) pkg-depends-eq +$(DPKG_PURGE) pkg-depends-ge +$(DPKG_PURGE) pkg-depends-gt +endef + +test-depends-versioned: + $(PURGE_DEPENDS) + + # The dependency is not present, fail + ! $(DPKG_INSTALL) pkg-depends-lt.deb + ! $(DPKG_INSTALL) pkg-depends-le.deb + ! $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-ge.deb + ! $(DPKG_INSTALL) pkg-depends-gt.deb + + # Install the package v1 + $(DPKG_INSTALL) pkg-version-1.deb + $(DPKG_INSTALL) pkg-depends-lt.deb + $(DPKG_INSTALL) pkg-depends-le.deb + ! $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-ge.deb + ! $(DPKG_INSTALL) pkg-depends-gt.deb + + $(PURGE_DEPENDS) + + # Install the package v2 + $(DPKG_INSTALL) pkg-version-2.deb + ! $(DPKG_INSTALL) pkg-depends-lt.deb + $(DPKG_INSTALL) pkg-depends-le.deb + $(DPKG_INSTALL) pkg-depends-eq.deb + $(DPKG_INSTALL) pkg-depends-ge.deb + ! $(DPKG_INSTALL) pkg-depends-gt.deb + + $(PURGE_DEPENDS) + + # Install the package v3 + $(DPKG_INSTALL) pkg-version-3.deb + ! $(DPKG_INSTALL) pkg-depends-lt.deb + ! $(DPKG_INSTALL) pkg-depends-le.deb + ! $(DPKG_INSTALL) pkg-depends-eq.deb + $(DPKG_INSTALL) pkg-depends-ge.deb + $(DPKG_INSTALL) pkg-depends-gt.deb + + $(PURGE_DEPENDS) + +test-case: test-depends test-depends-versioned + +test-clean: + -$(DPKG_PURGE) pkg-depends + -$(DPKG_PURGE) pkg-real + -$(DPKG_PURGE) pkg-depends-lt + -$(DPKG_PURGE) pkg-depends-le + -$(DPKG_PURGE) pkg-depends-eq + -$(DPKG_PURGE) pkg-depends-ge + -$(DPKG_PURGE) pkg-depends-gt + -$(DPKG_PURGE) pkg-version diff --git a/tests/t-depends/pkg-depends-eq/DEBIAN/control b/tests/t-depends/pkg-depends-eq/DEBIAN/control new file mode 100644 index 0000000..87e1603 --- /dev/null +++ b/tests/t-depends/pkg-depends-eq/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-eq +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-version (= 2) +Description: test package - package depending on an exact version diff --git a/tests/t-depends/pkg-depends-ge/DEBIAN/control b/tests/t-depends/pkg-depends-ge/DEBIAN/control new file mode 100644 index 0000000..7ba7567 --- /dev/null +++ b/tests/t-depends/pkg-depends-ge/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-ge +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-version (>= 2) +Description: test package - package depending on a greater or equal version diff --git a/tests/t-depends/pkg-depends-gt/DEBIAN/control b/tests/t-depends/pkg-depends-gt/DEBIAN/control new file mode 100644 index 0000000..41cb041 --- /dev/null +++ b/tests/t-depends/pkg-depends-gt/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-gt +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-version (>> 2) +Description: test package - package depending on a greater than version diff --git a/tests/t-depends/pkg-depends-le/DEBIAN/control b/tests/t-depends/pkg-depends-le/DEBIAN/control new file mode 100644 index 0000000..b620960 --- /dev/null +++ b/tests/t-depends/pkg-depends-le/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-le +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-version (<= 2) +Description: test package - package depending on an earlier or equal version diff --git a/tests/t-depends/pkg-depends-lt/DEBIAN/control b/tests/t-depends/pkg-depends-lt/DEBIAN/control new file mode 100644 index 0000000..ffbb9ba --- /dev/null +++ b/tests/t-depends/pkg-depends-lt/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-lt +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-version (<< 2) +Description: test package - package depending on an earlier than version diff --git a/tests/t-depends/pkg-depends/DEBIAN/control b/tests/t-depends/pkg-depends/DEBIAN/control new file mode 100644 index 0000000..eeefbe4 --- /dev/null +++ b/tests/t-depends/pkg-depends/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-real +Description: test package - package depending on a real package diff --git a/tests/t-depends/pkg-real/DEBIAN/control b/tests/t-depends/pkg-real/DEBIAN/control new file mode 100644 index 0000000..bbd53c2 --- /dev/null +++ b/tests/t-depends/pkg-real/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-real +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - real package to depend on diff --git a/tests/t-depends/pkg-version-1/DEBIAN/control b/tests/t-depends/pkg-version-1/DEBIAN/control new file mode 100644 index 0000000..3ec97d1 --- /dev/null +++ b/tests/t-depends/pkg-version-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-version +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - real package to depend on a specific version diff --git a/tests/t-depends/pkg-version-2/DEBIAN/control b/tests/t-depends/pkg-version-2/DEBIAN/control new file mode 100644 index 0000000..1aff119 --- /dev/null +++ b/tests/t-depends/pkg-version-2/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-version +Version: 2 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - real package to depend on a specific version diff --git a/tests/t-depends/pkg-version-3/DEBIAN/control b/tests/t-depends/pkg-version-3/DEBIAN/control new file mode 100644 index 0000000..322945a --- /dev/null +++ b/tests/t-depends/pkg-version-3/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-version +Version: 3 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - real package to depend on a specific version diff --git a/tests/t-dir-extension-check/Makefile b/tests/t-dir-extension-check/Makefile new file mode 100644 index 0000000..2cbc250 --- /dev/null +++ b/tests/t-dir-extension-check/Makefile @@ -0,0 +1,10 @@ +TESTS_DEB := pkg-dbg-dir + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) -D10 pkg-dbg-dir.deb + +test-clean: + $(DPKG_PURGE) pkg-dbg-dir + diff --git a/tests/t-dir-extension-check/pkg-dbg-dir/DEBIAN/control b/tests/t-dir-extension-check/pkg-dbg-dir/DEBIAN/control new file mode 100644 index 0000000..743b4c2 --- /dev/null +++ b/tests/t-dir-extension-check/pkg-dbg-dir/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-dbg-dir +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - weird dbg output with dir + bug 80416 + diff --git a/tests/t-dir-extension-check/pkg-dbg-dir/test-dir/.keep b/tests/t-dir-extension-check/pkg-dbg-dir/test-dir/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-dir-extension-check/pkg-dbg-dir/test-dir/.keep diff --git a/tests/t-dir-extension-check/pkg-dbg-dir/test-file b/tests/t-dir-extension-check/pkg-dbg-dir/test-file new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-dir-extension-check/pkg-dbg-dir/test-file diff --git a/tests/t-dir-leftover-conffile/Makefile b/tests/t-dir-leftover-conffile/Makefile new file mode 100644 index 0000000..28ac9e9 --- /dev/null +++ b/tests/t-dir-leftover-conffile/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := pkg-dir-leftover-conffile + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-dir-leftover-conffile.deb + $(DPKG_REMOVE) pkg-dir-leftover-conffile + $(DPKG_PURGE) pkg-dir-leftover-conffile + test ! -d '$(DPKG_INSTDIR)/test-dir' + +test-clean: + $(DPKG_PURGE) pkg-dir-leftover-conffile + $(BEROOT) rm -rf '$(DPKG_INSTDIR)/test-dir' diff --git a/tests/t-dir-leftover-conffile/pkg-dir-leftover-conffile/DEBIAN/conffiles b/tests/t-dir-leftover-conffile/pkg-dir-leftover-conffile/DEBIAN/conffiles new file mode 100644 index 0000000..6d57c35 --- /dev/null +++ b/tests/t-dir-leftover-conffile/pkg-dir-leftover-conffile/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-dir/test-conffile diff --git a/tests/t-dir-leftover-conffile/pkg-dir-leftover-conffile/DEBIAN/control b/tests/t-dir-leftover-conffile/pkg-dir-leftover-conffile/DEBIAN/control new file mode 100644 index 0000000..74e2a00 --- /dev/null +++ b/tests/t-dir-leftover-conffile/pkg-dir-leftover-conffile/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-leftover-conffile +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - shared directory with configuration file diff --git a/tests/t-dir-leftover-conffile/pkg-dir-leftover-conffile/test-dir/test-conffile b/tests/t-dir-leftover-conffile/pkg-dir-leftover-conffile/test-dir/test-conffile new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-dir-leftover-conffile/pkg-dir-leftover-conffile/test-dir/test-conffile diff --git a/tests/t-dir-leftover-deadlock/Makefile b/tests/t-dir-leftover-deadlock/Makefile new file mode 100644 index 0000000..e0f381f --- /dev/null +++ b/tests/t-dir-leftover-deadlock/Makefile @@ -0,0 +1,17 @@ +TESTS_DEB := pkg-dir-shared-0 pkg-dir-shared-1 + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-dir-shared-0.deb + $(DPKG_INSTALL) pkg-dir-shared-1.deb + $(DPKG_REMOVE) pkg-dir-shared-1 + $(DPKG_REMOVE) pkg-dir-shared-0 + $(DPKG_PURGE) pkg-dir-shared-0 + $(DPKG_PURGE) pkg-dir-shared-1 + test ! -d '$(DPKG_INSTDIR)/test-dir' + +test-clean: + $(DPKG_PURGE) pkg-dir-shared-0 + $(DPKG_PURGE) pkg-dir-shared-1 + $(BEROOT) rm -rf '$(DPKG_INSTDIR)/test-dir' diff --git a/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/DEBIAN/control b/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/DEBIAN/control new file mode 100644 index 0000000..90e43b9 --- /dev/null +++ b/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-shared-0 +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - shared directory with configuration file diff --git a/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/DEBIAN/postinst b/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/DEBIAN/postinst new file mode 100755 index 0000000..328e575 --- /dev/null +++ b/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/DEBIAN/postinst @@ -0,0 +1,7 @@ +#!/bin/sh + +case "$1" in +configure) + touch "$DPKG_ROOT/test-dir/test-config-0" + ;; +esac diff --git a/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/DEBIAN/postrm b/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/DEBIAN/postrm new file mode 100755 index 0000000..1a1e745 --- /dev/null +++ b/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/DEBIAN/postrm @@ -0,0 +1,7 @@ +#!/bin/sh + +case "$1" in +purge) + rm "$DPKG_ROOT/test-dir/test-config-0" + ;; +esac diff --git a/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/test-dir/.keep0 b/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/test-dir/.keep0 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-dir-leftover-deadlock/pkg-dir-shared-0/test-dir/.keep0 diff --git a/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/DEBIAN/control b/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/DEBIAN/control new file mode 100644 index 0000000..2d6750e --- /dev/null +++ b/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-dir-shared-1 +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-dir-shared-0 +Description: test package - shared directory with configuration file diff --git a/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/DEBIAN/postinst b/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/DEBIAN/postinst new file mode 100755 index 0000000..ba38c67 --- /dev/null +++ b/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/DEBIAN/postinst @@ -0,0 +1,7 @@ +#!/bin/sh + +case "$1" in +configure) + touch "$DPKG_ROOT/test-dir/test-config-1" + ;; +esac diff --git a/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/DEBIAN/postrm b/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/DEBIAN/postrm new file mode 100755 index 0000000..3358b37 --- /dev/null +++ b/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/DEBIAN/postrm @@ -0,0 +1,7 @@ +#!/bin/sh + +case "$1" in +purge) + rm "$DPKG_ROOT/test-dir/test-config-1" + ;; +esac diff --git a/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/test-dir/.keep1 b/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/test-dir/.keep1 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-dir-leftover-deadlock/pkg-dir-shared-1/test-dir/.keep1 diff --git a/tests/t-dir-leftover-parents/Makefile b/tests/t-dir-leftover-parents/Makefile new file mode 100644 index 0000000..35e2718 --- /dev/null +++ b/tests/t-dir-leftover-parents/Makefile @@ -0,0 +1,16 @@ +TESTS_DEB := pkg-dir-shared pkg-dir-shared-notempty + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-dir-shared.deb + $(DPKG_INSTALL) pkg-dir-shared-notempty.deb + $(DPKG_REMOVE) pkg-dir-shared-notempty + $(DPKG_PURGE) pkg-dir-shared + $(DPKG_PURGE) pkg-dir-shared-notempty + test ! -d "$(DPKG_INSTDIR)/test-dir" + +test-clean: + $(DPKG_PURGE) pkg-dir-shared + $(DPKG_PURGE) pkg-dir-shared-notempty + $(BEROOT) rm -rf "$(DPKG_INSTDIR)/test-dir" diff --git a/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/DEBIAN/control b/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/DEBIAN/control new file mode 100644 index 0000000..e904178 --- /dev/null +++ b/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-shared-notempty +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - shared directory with a config file diff --git a/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/DEBIAN/postinst b/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/DEBIAN/postinst new file mode 100755 index 0000000..d3cc9ef --- /dev/null +++ b/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/DEBIAN/postinst @@ -0,0 +1,7 @@ +#!/bin/sh + +case "$1" in +configure) + touch "$DPKG_ROOT/test-dir/subdir/subsubdir/file" + ;; +esac diff --git a/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/DEBIAN/postrm b/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/DEBIAN/postrm new file mode 100755 index 0000000..7906c69 --- /dev/null +++ b/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/DEBIAN/postrm @@ -0,0 +1,7 @@ +#!/bin/sh + +case "$1" in +purge) + rm "$DPKG_ROOT/test-dir/subdir/subsubdir/file" + ;; +esac diff --git a/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/test-dir/subdir/subsubdir/.keep b/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/test-dir/subdir/subsubdir/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-dir-leftover-parents/pkg-dir-shared-notempty/test-dir/subdir/subsubdir/.keep diff --git a/tests/t-dir-leftover-parents/pkg-dir-shared/DEBIAN/control b/tests/t-dir-leftover-parents/pkg-dir-shared/DEBIAN/control new file mode 100644 index 0000000..03b3029 --- /dev/null +++ b/tests/t-dir-leftover-parents/pkg-dir-shared/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-shared +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - shared directory diff --git a/tests/t-dir-leftover-parents/pkg-dir-shared/test-dir/subdir/.keep b/tests/t-dir-leftover-parents/pkg-dir-shared/test-dir/subdir/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-dir-leftover-parents/pkg-dir-shared/test-dir/subdir/.keep diff --git a/tests/t-dir-shared-replaces-lost/Makefile b/tests/t-dir-shared-replaces-lost/Makefile new file mode 100644 index 0000000..17b2b26 --- /dev/null +++ b/tests/t-dir-shared-replaces-lost/Makefile @@ -0,0 +1,35 @@ +TESTS_DEB := pkg-dir-original pkg-dir-takeover + +include ../Test.mk + +TEST_CASES += test-ordered +TEST_CASES += test-reverse + +test-case: $(TEST_CASES) + +define VERIFY +$(call pkg_is_installed,pkg-dir-original) +$(call pkg_is_installed,pkg-dir-takeover) +test -d '$(DPKG_INSTDIR)/test-dir' +test "`$(DPKG_QUERY) -S /test-dir/test-original`" = "pkg-dir-original: /test-dir/test-original" +test "`$(DPKG_QUERY) -S /test-dir/test-takeover`" = "pkg-dir-takeover: /test-dir/test-takeover" +endef + +test-ordered: + # test-ordered + $(DPKG_INSTALL) pkg-dir-original.deb + $(BEROOT) rm -rf '$(DPKG_INSTDIR)/test-dir' + $(DPKG_INSTALL) pkg-dir-takeover.deb + $(VERIFY) + $(DPKG_PURGE) pkg-dir-original pkg-dir-takeover + +test-reverse: + # test-reverse + $(DPKG_INSTALL) pkg-dir-takeover.deb + $(BEROOT) rm -rf '$(DPKG_INSTDIR)/test-dir' + $(DPKG_INSTALL) pkg-dir-original.deb + $(VERIFY) + $(DPKG_PURGE) pkg-dir-original pkg-dir-takeover + +test-clean: + -$(DPKG_PURGE) pkg-dir-original pkg-dir-takeover diff --git a/tests/t-dir-shared-replaces-lost/pkg-dir-original/DEBIAN/control b/tests/t-dir-shared-replaces-lost/pkg-dir-original/DEBIAN/control new file mode 100644 index 0000000..9bb5a2e --- /dev/null +++ b/tests/t-dir-shared-replaces-lost/pkg-dir-original/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a shared directory diff --git a/tests/t-dir-shared-replaces-lost/pkg-dir-original/test-dir/test-original b/tests/t-dir-shared-replaces-lost/pkg-dir-original/test-dir/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-dir-shared-replaces-lost/pkg-dir-original/test-dir/test-original diff --git a/tests/t-dir-shared-replaces-lost/pkg-dir-takeover/DEBIAN/control b/tests/t-dir-shared-replaces-lost/pkg-dir-takeover/DEBIAN/control new file mode 100644 index 0000000..a9a2a34 --- /dev/null +++ b/tests/t-dir-shared-replaces-lost/pkg-dir-takeover/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-dir-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-dir-original +Description: test package - dir replaces takeover diff --git a/tests/t-dir-shared-replaces-lost/pkg-dir-takeover/test-dir/test-takeover b/tests/t-dir-shared-replaces-lost/pkg-dir-takeover/test-dir/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-dir-shared-replaces-lost/pkg-dir-takeover/test-dir/test-takeover diff --git a/tests/t-disappear-depended/Makefile b/tests/t-disappear-depended/Makefile new file mode 100644 index 0000000..f7b8362 --- /dev/null +++ b/tests/t-disappear-depended/Makefile @@ -0,0 +1,21 @@ +TESTS_DEB := pkg-normal pkg-depend pkg-disappear + +include ../Test.mk + +test-case: + # test disappearing depended package + $(DPKG_INSTALL) pkg-disappear.deb + $(DPKG_INSTALL) pkg-depend.deb + $(DPKG_INSTALL) pkg-normal.deb + # should not disappear while it's being depended on + $(call pkg_is_installed,pkg-disappear) + $(DPKG_PURGE) pkg-depend + $(DPKG_INSTALL) pkg-normal.deb + # should have been disappered now + $(call pkg_is_not_installed,pkg-disappear) + +test-clean: + -$(DPKG_PURGE) pkg-depend + -$(DPKG_PURGE) pkg-disappear + $(DPKG_PURGE) pkg-normal + diff --git a/tests/t-disappear-depended/pkg-depend/DEBIAN/control b/tests/t-disappear-depended/pkg-depend/DEBIAN/control new file mode 100644 index 0000000..d39c783 --- /dev/null +++ b/tests/t-disappear-depended/pkg-depend/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-depend +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-disappear +Description: test package - depend on disappearing package + diff --git a/tests/t-disappear-depended/pkg-disappear/DEBIAN/control b/tests/t-disappear-depended/pkg-disappear/DEBIAN/control new file mode 100644 index 0000000..78c2a17 --- /dev/null +++ b/tests/t-disappear-depended/pkg-disappear/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-disappear +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - disappear + diff --git a/tests/t-disappear-depended/pkg-normal/DEBIAN/control b/tests/t-disappear-depended/pkg-normal/DEBIAN/control new file mode 100644 index 0000000..09e51b2 --- /dev/null +++ b/tests/t-disappear-depended/pkg-normal/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-normal +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - normal + diff --git a/tests/t-disappear-depended/pkg-normal/test-dir/test-normal b/tests/t-disappear-depended/pkg-normal/test-dir/test-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-disappear-depended/pkg-normal/test-dir/test-normal diff --git a/tests/t-disappear-empty/Makefile b/tests/t-disappear-empty/Makefile new file mode 100644 index 0000000..66d5c3f --- /dev/null +++ b/tests/t-disappear-empty/Makefile @@ -0,0 +1,16 @@ +TESTS_DEB := pkg-normal pkg-disappear-0 pkg-disappear-1 + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-disappear-0.deb + # test that an upgraded empty package does not get disappeared + $(DPKG_INSTALL) pkg-disappear-1.deb + $(call pkg_is_installed,pkg-disappear) + $(DPKG_INSTALL) pkg-normal.deb + $(call pkg_is_installed,pkg-normal) + +test-clean: + $(DPKG_PURGE) pkg-disappear + $(DPKG_PURGE) pkg-normal + diff --git a/tests/t-disappear-empty/pkg-disappear-0/DEBIAN/control b/tests/t-disappear-empty/pkg-disappear-0/DEBIAN/control new file mode 100644 index 0000000..78c2a17 --- /dev/null +++ b/tests/t-disappear-empty/pkg-disappear-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-disappear +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - disappear + diff --git a/tests/t-disappear-empty/pkg-disappear-0/test-dir/test-disappear b/tests/t-disappear-empty/pkg-disappear-0/test-dir/test-disappear new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-disappear-empty/pkg-disappear-0/test-dir/test-disappear diff --git a/tests/t-disappear-empty/pkg-disappear-1/DEBIAN/control b/tests/t-disappear-empty/pkg-disappear-1/DEBIAN/control new file mode 100644 index 0000000..7949c6e --- /dev/null +++ b/tests/t-disappear-empty/pkg-disappear-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-disappear +Version: 0.0-2 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - disappear + diff --git a/tests/t-disappear-empty/pkg-normal/DEBIAN/control b/tests/t-disappear-empty/pkg-normal/DEBIAN/control new file mode 100644 index 0000000..4e2f9a3 --- /dev/null +++ b/tests/t-disappear-empty/pkg-normal/DEBIAN/control @@ -0,0 +1,10 @@ +Package: pkg-normal +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-disappear +Provides: pkg-disappear +Description: test package - normal + diff --git a/tests/t-disappear-empty/pkg-normal/test-dir/test-normal b/tests/t-disappear-empty/pkg-normal/test-dir/test-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-disappear-empty/pkg-normal/test-dir/test-normal diff --git a/tests/t-disappear/Makefile b/tests/t-disappear/Makefile new file mode 100644 index 0000000..573c334 --- /dev/null +++ b/tests/t-disappear/Makefile @@ -0,0 +1,14 @@ +TESTS_DEB := pkg-normal pkg-disappear-0 pkg-disappear-1 + +include ../Test.mk + +test-case: + # test disappearing package + $(DPKG_INSTALL) pkg-disappear-0.deb + $(DPKG_INSTALL) pkg-disappear-1.deb + $(DPKG_INSTALL) pkg-normal.deb + +test-clean: + -$(DPKG_PURGE) pkg-disappear + $(DPKG_PURGE) pkg-normal + diff --git a/tests/t-disappear/pkg-disappear-0/DEBIAN/control b/tests/t-disappear/pkg-disappear-0/DEBIAN/control new file mode 100644 index 0000000..78c2a17 --- /dev/null +++ b/tests/t-disappear/pkg-disappear-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-disappear +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - disappear + diff --git a/tests/t-disappear/pkg-disappear-0/test-dir/test-disappear b/tests/t-disappear/pkg-disappear-0/test-dir/test-disappear new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-disappear/pkg-disappear-0/test-dir/test-disappear diff --git a/tests/t-disappear/pkg-disappear-1/DEBIAN/control b/tests/t-disappear/pkg-disappear-1/DEBIAN/control new file mode 100644 index 0000000..7949c6e --- /dev/null +++ b/tests/t-disappear/pkg-disappear-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-disappear +Version: 0.0-2 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - disappear + diff --git a/tests/t-disappear/pkg-normal/DEBIAN/control b/tests/t-disappear/pkg-normal/DEBIAN/control new file mode 100644 index 0000000..09e51b2 --- /dev/null +++ b/tests/t-disappear/pkg-normal/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-normal +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - normal + diff --git a/tests/t-disappear/pkg-normal/test-dir/test-normal b/tests/t-disappear/pkg-normal/test-dir/test-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-disappear/pkg-normal/test-dir/test-normal diff --git a/tests/t-failinst-failrm/Makefile b/tests/t-failinst-failrm/Makefile new file mode 100644 index 0000000..325c7ef --- /dev/null +++ b/tests/t-failinst-failrm/Makefile @@ -0,0 +1,12 @@ +TESTS_DEB := pkg-failinst-failrm-0 pkg-failinst-failrm-1 + +include ../Test.mk + +test-case: + -$(DPKG_INSTALL) pkg-failinst-failrm-0.deb + $(call pkg_status_is,pkg-failinst-failrm,install ok half-configured) + +test-clean: + # Upgrade to a working version to allow the purge. + -$(DPKG_INSTALL) pkg-failinst-failrm-1.deb + $(DPKG_PURGE) pkg-failinst-failrm diff --git a/tests/t-failinst-failrm/pkg-failinst-failrm-0/DEBIAN/control b/tests/t-failinst-failrm/pkg-failinst-failrm-0/DEBIAN/control new file mode 100644 index 0000000..1230320 --- /dev/null +++ b/tests/t-failinst-failrm/pkg-failinst-failrm-0/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-failinst-failrm +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - #432893 + postinst-fail + prerm-fail diff --git a/tests/t-failinst-failrm/pkg-failinst-failrm-0/DEBIAN/postinst b/tests/t-failinst-failrm/pkg-failinst-failrm-0/DEBIAN/postinst new file mode 100755 index 0000000..b35b197 --- /dev/null +++ b/tests/t-failinst-failrm/pkg-failinst-failrm-0/DEBIAN/postinst @@ -0,0 +1,15 @@ +#!/bin/sh + +case "$1" in + configure) + exit 1 + ;; + abort-upgrade|abort-deconfigure|abort-remove) + ;; + *) + echo "$0 called with unknown argument '$1'" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/tests/t-failinst-failrm/pkg-failinst-failrm-0/DEBIAN/prerm b/tests/t-failinst-failrm/pkg-failinst-failrm-0/DEBIAN/prerm new file mode 100755 index 0000000..0abf6fb --- /dev/null +++ b/tests/t-failinst-failrm/pkg-failinst-failrm-0/DEBIAN/prerm @@ -0,0 +1,15 @@ +#!/bin/sh + +case "$1" in + remove) + exit 1 + ;; + purge|upgrade|failed-upgrade|disappear|abort-install|abort-upgrade) + ;; + *) + echo "$0 called with unknown argument '$1'" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/tests/t-failinst-failrm/pkg-failinst-failrm-1/DEBIAN/control b/tests/t-failinst-failrm/pkg-failinst-failrm-1/DEBIAN/control new file mode 100644 index 0000000..1709965 --- /dev/null +++ b/tests/t-failinst-failrm/pkg-failinst-failrm-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-failinst-failrm +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - non-broken package to allow purge diff --git a/tests/t-field-priority/Makefile b/tests/t-field-priority/Makefile new file mode 100644 index 0000000..08239e7 --- /dev/null +++ b/tests/t-field-priority/Makefile @@ -0,0 +1,12 @@ +TESTS_DEB := pkg-priority + +include ../Test.mk + +test-case: + # test for unknown priority values + $(DPKG_INSTALL) pkg-priority.deb + $(call pkg_is_installed,pkg-priority) + $(call pkg_field_is,pkg-priority,Priority,value not known) + +test-clean: + $(DPKG_PURGE) pkg-priority diff --git a/tests/t-field-priority/pkg-priority/DEBIAN/control b/tests/t-field-priority/pkg-priority/DEBIAN/control new file mode 100644 index 0000000..f06c05c --- /dev/null +++ b/tests/t-field-priority/pkg-priority/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-priority +Version: 0.0-1 +Section: test +Priority: value not known +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - unknown priority value diff --git a/tests/t-file-conflicts/Makefile b/tests/t-file-conflicts/Makefile new file mode 100644 index 0000000..4eeb0f5 --- /dev/null +++ b/tests/t-file-conflicts/Makefile @@ -0,0 +1,15 @@ +TESTS_DEB := pkg-a pkg-b + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-a.deb + # test if the conflicting package fails on install + ! $(DPKG_INSTALL) pkg-b.deb + +test-clean: + # tell dpkg we do not want pkg-b, even if we asked for it and failed + echo pkg-b purge | $(BEROOT) $(DPKG) --set-selections + -$(DPKG_PURGE) pkg-b + $(DPKG_PURGE) pkg-a + diff --git a/tests/t-file-conflicts/pkg-a/DEBIAN/control b/tests/t-file-conflicts/pkg-a/DEBIAN/control new file mode 100644 index 0000000..7bf61bb --- /dev/null +++ b/tests/t-file-conflicts/pkg-a/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conflicting file + diff --git a/tests/t-file-conflicts/pkg-a/test-conflict b/tests/t-file-conflicts/pkg-a/test-conflict new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-file-conflicts/pkg-a/test-conflict diff --git a/tests/t-file-conflicts/pkg-b/DEBIAN/control b/tests/t-file-conflicts/pkg-b/DEBIAN/control new file mode 100644 index 0000000..135098a --- /dev/null +++ b/tests/t-file-conflicts/pkg-b/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - conflicting file + diff --git a/tests/t-file-conflicts/pkg-b/test-conflict b/tests/t-file-conflicts/pkg-b/test-conflict new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-file-conflicts/pkg-b/test-conflict diff --git a/tests/t-file-replaces-disappear/Makefile b/tests/t-file-replaces-disappear/Makefile new file mode 100644 index 0000000..719f02b --- /dev/null +++ b/tests/t-file-replaces-disappear/Makefile @@ -0,0 +1,65 @@ +TESTS_DEB := pkg-file-original pkg-file-takeover + +include ../Test.mk + +TEST_CASES += test-two-run-ordered +TEST_CASES += test-one-run-ordered +TEST_CASES += test-two-run-reverse +TEST_CASES += test-one-run-reverse + +test-case: $(TEST_CASES) + +define VERIFY +$(call pkg_is_installed,pkg-file-takeover) +test "`$(DPKG_QUERY) -S /test-file`" = "pkg-file-takeover: /test-file" +test "`$(DPKG_QUERY) -S /test-other`" = "pkg-file-takeover: /test-other" +cmp ref-file "$(DPKG_INSTDIR)/test-file" +cmp ref-file "$(DPKG_INSTDIR)/test-other" +endef + +test-two-run-ordered: + # test-two-run-ordered + $(DPKG_INSTALL) pkg-file-original.deb + $(DPKG_INSTALL) pkg-file-takeover.deb + $(call pkg_is_not_installed,pkg-file-original) + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + test ! -f "$(DPKG_INSTDIR)/test-file" + test ! -f "$(DPKG_INSTDIR)/test-other" + +test-one-run-ordered: + # test-one-run-ordered + $(DPKG_INSTALL) pkg-file-original.deb pkg-file-takeover.deb + $(call pkg_is_not_installed,pkg-file-original) + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + test ! -f "$(DPKG_INSTDIR)/test-file" + test ! -f "$(DPKG_INSTDIR)/test-other" + +test-two-run-reverse: + # test-two-run-reverse + $(DPKG_INSTALL) pkg-file-takeover.deb + $(DPKG_INSTALL) pkg-file-original.deb + $(call pkg_is_installed,pkg-file-original) + $(VERIFY) + $(DPKG_PURGE) pkg-file-original + test -f "$(DPKG_INSTDIR)/test-file" + test -f "$(DPKG_INSTDIR)/test-other" + $(DPKG_PURGE) pkg-file-takeover + test ! -f "$(DPKG_INSTDIR)/test-file" + test ! -f "$(DPKG_INSTDIR)/test-other" + +test-one-run-reverse: + # test-one-run-reverse + $(DPKG_INSTALL) pkg-file-takeover.deb pkg-file-original.deb + $(call pkg_is_installed,pkg-file-original) + $(VERIFY) + $(DPKG_PURGE) pkg-file-original + test -f "$(DPKG_INSTDIR)/test-file" + test -f "$(DPKG_INSTDIR)/test-other" + $(DPKG_PURGE) pkg-file-takeover + test ! -f "$(DPKG_INSTDIR)/test-file" + test ! -f "$(DPKG_INSTDIR)/test-other" + +test-clean: + $(DPKG_PURGE) pkg-file-original pkg-file-takeover diff --git a/tests/t-file-replaces-disappear/pkg-file-original/DEBIAN/control b/tests/t-file-replaces-disappear/pkg-file-original/DEBIAN/control new file mode 100644 index 0000000..4dae80f --- /dev/null +++ b/tests/t-file-replaces-disappear/pkg-file-original/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-file-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide some files + diff --git a/tests/t-file-replaces-disappear/pkg-file-original/test-file b/tests/t-file-replaces-disappear/pkg-file-original/test-file new file mode 100644 index 0000000..7e3c47b --- /dev/null +++ b/tests/t-file-replaces-disappear/pkg-file-original/test-file @@ -0,0 +1 @@ +test original diff --git a/tests/t-file-replaces-disappear/pkg-file-original/test-other b/tests/t-file-replaces-disappear/pkg-file-original/test-other new file mode 100644 index 0000000..7e3c47b --- /dev/null +++ b/tests/t-file-replaces-disappear/pkg-file-original/test-other @@ -0,0 +1 @@ +test original diff --git a/tests/t-file-replaces-disappear/pkg-file-takeover/DEBIAN/control b/tests/t-file-replaces-disappear/pkg-file-takeover/DEBIAN/control new file mode 100644 index 0000000..6af91c8 --- /dev/null +++ b/tests/t-file-replaces-disappear/pkg-file-takeover/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-file-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-file-original +Description: test package - file replaces takeover + diff --git a/tests/t-file-replaces-disappear/pkg-file-takeover/test-file b/tests/t-file-replaces-disappear/pkg-file-takeover/test-file new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-file-replaces-disappear/pkg-file-takeover/test-file @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-file-replaces-disappear/pkg-file-takeover/test-other b/tests/t-file-replaces-disappear/pkg-file-takeover/test-other new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-file-replaces-disappear/pkg-file-takeover/test-other @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-file-replaces-disappear/ref-file b/tests/t-file-replaces-disappear/ref-file new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-file-replaces-disappear/ref-file @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-file-replaces-versioned/Makefile b/tests/t-file-replaces-versioned/Makefile new file mode 100644 index 0000000..248ca18 --- /dev/null +++ b/tests/t-file-replaces-versioned/Makefile @@ -0,0 +1,52 @@ +TESTS_DEB := pkg-file-original-0 pkg-file-original-1 \ + pkg-file-takeover-0 pkg-file-takeover-1 + +include ../Test.mk + +TEST_CASES += test-two-run-ordered +TEST_CASES += test-one-run-ordered +TEST_CASES += test-two-run-reverse +TEST_CASES += test-one-run-reverse + +test-case: $(TEST_CASES) + +define VERIFY +$(call pkg_is_installed,pkg-file-original) +$(call pkg_is_installed,pkg-file-takeover) +test "`$(DPKG_QUERY) -S /test-file`" = "pkg-file-takeover: /test-file" +cmp ref-file "$(DPKG_INSTDIR)/test-file" +endef + +test-two-run-ordered: + # test-two-run-ordered + $(DPKG_INSTALL) pkg-file-original-0.deb pkg-file-takeover-0.deb + $(DPKG_INSTALL) pkg-file-original-1.deb + $(DPKG_INSTALL) pkg-file-takeover-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + +test-one-run-ordered: + # test-one-run-ordered + $(DPKG_INSTALL) pkg-file-original-0.deb pkg-file-takeover-0.deb + $(DPKG_INSTALL) pkg-file-original-1.deb pkg-file-takeover-1.deb + $(DPKG_CONFIGURE) -a + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + +test-two-run-reverse: + # test-two-run-reverse + $(DPKG_INSTALL) pkg-file-original-0.deb pkg-file-takeover-0.deb + $(DPKG_INSTALL) pkg-file-takeover-1.deb + $(DPKG_INSTALL) pkg-file-original-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + +test-one-run-reverse: + # test-one-run-reverse + $(DPKG_INSTALL) pkg-file-original-0.deb pkg-file-takeover-0.deb + $(DPKG_INSTALL) pkg-file-takeover-1.deb pkg-file-original-1.deb + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + +test-clean: + $(DPKG_PURGE) pkg-file-original pkg-file-takeover diff --git a/tests/t-file-replaces-versioned/pkg-file-original-0/DEBIAN/control b/tests/t-file-replaces-versioned/pkg-file-original-0/DEBIAN/control new file mode 100644 index 0000000..93bb772 --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-original-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-file-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a file diff --git a/tests/t-file-replaces-versioned/pkg-file-original-0/test-file b/tests/t-file-replaces-versioned/pkg-file-original-0/test-file new file mode 100644 index 0000000..7e3c47b --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-original-0/test-file @@ -0,0 +1 @@ +test original diff --git a/tests/t-file-replaces-versioned/pkg-file-original-0/test-original b/tests/t-file-replaces-versioned/pkg-file-original-0/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-original-0/test-original diff --git a/tests/t-file-replaces-versioned/pkg-file-original-1/DEBIAN/control b/tests/t-file-replaces-versioned/pkg-file-original-1/DEBIAN/control new file mode 100644 index 0000000..8c5a742 --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-original-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-file-original +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a file diff --git a/tests/t-file-replaces-versioned/pkg-file-original-1/test-original b/tests/t-file-replaces-versioned/pkg-file-original-1/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-original-1/test-original diff --git a/tests/t-file-replaces-versioned/pkg-file-takeover-0/DEBIAN/control b/tests/t-file-replaces-versioned/pkg-file-takeover-0/DEBIAN/control new file mode 100644 index 0000000..913a3a8 --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-takeover-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-file-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - future file replaces takeover diff --git a/tests/t-file-replaces-versioned/pkg-file-takeover-0/test-takeover b/tests/t-file-replaces-versioned/pkg-file-takeover-0/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-takeover-0/test-takeover diff --git a/tests/t-file-replaces-versioned/pkg-file-takeover-1/DEBIAN/control b/tests/t-file-replaces-versioned/pkg-file-takeover-1/DEBIAN/control new file mode 100644 index 0000000..4c130a9 --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-takeover-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-file-takeover +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-file-original (<< 1) +Description: test package - file replaces takeover diff --git a/tests/t-file-replaces-versioned/pkg-file-takeover-1/test-file b/tests/t-file-replaces-versioned/pkg-file-takeover-1/test-file new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-takeover-1/test-file @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-file-replaces-versioned/pkg-file-takeover-1/test-takeover b/tests/t-file-replaces-versioned/pkg-file-takeover-1/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-file-replaces-versioned/pkg-file-takeover-1/test-takeover diff --git a/tests/t-file-replaces-versioned/ref-file b/tests/t-file-replaces-versioned/ref-file new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-file-replaces-versioned/ref-file @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-file-replaces/Makefile b/tests/t-file-replaces/Makefile new file mode 100644 index 0000000..6c67d75 --- /dev/null +++ b/tests/t-file-replaces/Makefile @@ -0,0 +1,44 @@ +TESTS_DEB := pkg-file-original pkg-file-takeover + +include ../Test.mk + +TEST_CASES += test-two-run-ordered +TEST_CASES += test-one-run-ordered +TEST_CASES += test-two-run-reverse +TEST_CASES += test-one-run-reverse + +test-case: $(TEST_CASES) + +define VERIFY +$(call pkg_is_installed,pkg-file-original) +$(call pkg_is_installed,pkg-file-takeover) +test "`$(DPKG_QUERY) -S /test-file`" = "pkg-file-takeover: /test-file" +cmp ref-file "$(DPKG_INSTDIR)/test-file" +endef + +test-two-run-ordered: + # test-two-run-ordered + $(DPKG_INSTALL) pkg-file-original.deb + $(DPKG_INSTALL) pkg-file-takeover.deb + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + +test-one-run-ordered: + # test-one-run-ordered + $(DPKG_INSTALL) pkg-file-original.deb pkg-file-takeover.deb + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + +test-two-run-reverse: + # test-two-run-reverse + $(DPKG_INSTALL) pkg-file-takeover.deb + $(DPKG_INSTALL) pkg-file-original.deb + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + +test-one-run-reverse: + # test-one-run-reverse + $(DPKG_INSTALL) pkg-file-takeover.deb pkg-file-original.deb + $(VERIFY) + $(DPKG_PURGE) pkg-file-original pkg-file-takeover + diff --git a/tests/t-file-replaces/pkg-file-original/DEBIAN/control b/tests/t-file-replaces/pkg-file-original/DEBIAN/control new file mode 100644 index 0000000..305534f --- /dev/null +++ b/tests/t-file-replaces/pkg-file-original/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-file-original +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a file + diff --git a/tests/t-file-replaces/pkg-file-original/test-file b/tests/t-file-replaces/pkg-file-original/test-file new file mode 100644 index 0000000..7e3c47b --- /dev/null +++ b/tests/t-file-replaces/pkg-file-original/test-file @@ -0,0 +1 @@ +test original diff --git a/tests/t-file-replaces/pkg-file-original/test-original b/tests/t-file-replaces/pkg-file-original/test-original new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-file-replaces/pkg-file-original/test-original diff --git a/tests/t-file-replaces/pkg-file-takeover/DEBIAN/control b/tests/t-file-replaces/pkg-file-takeover/DEBIAN/control new file mode 100644 index 0000000..6af91c8 --- /dev/null +++ b/tests/t-file-replaces/pkg-file-takeover/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-file-takeover +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-file-original +Description: test package - file replaces takeover + diff --git a/tests/t-file-replaces/pkg-file-takeover/test-file b/tests/t-file-replaces/pkg-file-takeover/test-file new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-file-replaces/pkg-file-takeover/test-file @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-file-replaces/pkg-file-takeover/test-takeover b/tests/t-file-replaces/pkg-file-takeover/test-takeover new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-file-replaces/pkg-file-takeover/test-takeover diff --git a/tests/t-file-replaces/ref-file b/tests/t-file-replaces/ref-file new file mode 100644 index 0000000..82fe7fe --- /dev/null +++ b/tests/t-file-replaces/ref-file @@ -0,0 +1 @@ +test takeover diff --git a/tests/t-filtering/Makefile b/tests/t-filtering/Makefile new file mode 100644 index 0000000..63c6ad2 --- /dev/null +++ b/tests/t-filtering/Makefile @@ -0,0 +1,166 @@ +TESTS_DEB := pkg-somefiles + +include ../Test.mk + +DEB_FILES_COUNT = $(shell dpkg-deb -c pkg-somefiles.deb | wc -l ) + +TEST_CASES += test-no-filter +TEST_CASES += test-no-doc-sub +TEST_CASES += test-no-doc-all +TEST_CASES += test-no-doc-except-copyright +TEST_CASES += test-no-doc-except-copyright-subdir +TEST_CASES += test-no-doc-except-copyright-and-readme +TEST_CASES += test-include-only +TEST_CASES += test-reinclude-subdir +TEST_CASES += test-same-include-exclude +TEST_CASES += test-upgrade test-help + +test-case: $(TEST_CASES) + +test-clean: + $(DPKG_PURGE) pkg-somefiles + +test-no-filter: + # no filter, should have all files + $(DPKG_INSTALL) pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT) + $(DPKG_PURGE) pkg-somefiles + +test-no-doc-sub: + # filter out /test/share/doc/*/*; this keeps the actual + # /test/share/doc/pkg-somefiles dir around + $(DPKG_INSTALL) \ + --path-exclude '/test/share/doc/*/*' \ + pkg-somefiles.deb + test -d "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles" + test "`ls '$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles'`" = "" + test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run" + $(DPKG_PURGE) pkg-somefiles + +test-no-doc-all: + # filter out /test/share/doc/* + $(DPKG_INSTALL) \ + --path-exclude '/test/share/doc/*' \ + pkg-somefiles.deb + ! test -d "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles" + test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run" + $(DPKG_PURGE) pkg-somefiles + +test-no-doc-except-copyright: + # filter out /test/share/doc/*/* except copyright + $(DPKG_INSTALL) \ + --path-exclude '/test/share/doc/*/*' \ + --path-include '/test/share/doc/*/copyright' \ + pkg-somefiles.deb + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright" + ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html" + ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README" + test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run" + $(DPKG_PURGE) pkg-somefiles + +test-no-doc-except-copyright-subdir: + # prune the entire doc dir; this triggers the special case that + # /test/share/doc/pkg-somefiles is matched by the exclude, but still + # needs to be created due to the following include + $(DPKG_INSTALL) \ + --path-exclude '/test/share/doc/*' \ + --path-include '/test/share/doc/*/copyright' \ + pkg-somefiles.deb + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright" + ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html" + ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README" + test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run" + $(DPKG_PURGE) pkg-somefiles + +test-no-doc-except-copyright-and-readme: + # two includes which revert an exclude, second of which matches + # several subdirs with one * + $(DPKG_INSTALL) \ + --path-exclude '/test/share/doc/*' \ + --path-include '/test/share/doc/*/copyright' \ + --path-include '/test*/READ*' \ + pkg-somefiles.deb + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright" + ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html" + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README" + test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run" + $(DPKG_PURGE) pkg-somefiles + +test-include-only: + # only includes, should be a no-op and have all files + $(DPKG_INSTALL) \ + --path-include '/test/*' \ + --path-include '/test/share/doc' \ + --path-include '/test/lib/*/*' \ + pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT) + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright" + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html" + test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run" + $(DPKG_PURGE) pkg-somefiles + +test-reinclude-subdir: + # Exclude a directory tree and reinclude some of its subdirectories + $(DPKG_INSTALL) \ + --path-exclude '/test/share/locale/*' \ + --path-include '/test/share/locale/de/*' \ + pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT) + test -d "$(DPKG_INSTDIR)/test/share/locale/de" + test -f "$(DPKG_INSTDIR)/test/share/locale/de/foo.mo" + ! test -f "$(DPKG_INSTDIR)/test/share/locale/ca/foo.mo" + ! test -f "$(DPKG_INSTDIR)/test/share/locale/es/foo.mo" + $(DPKG_PURGE) pkg-somefiles + +test-same-include-exclude: + # include the same things than exclude, should be a no-op and have + # all files + $(DPKG_INSTALL) \ + --path-exclude '/test/share/*' \ + --path-include '/test/share/*' \ + pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT) + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html" + test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run" + $(DPKG_PURGE) pkg-somefiles + + # now doubly so + $(DPKG_INSTALL) \ + --path-exclude '/test/share/*' \ + --path-include '/test/share/*' \ + --path-exclude '/test/share/*' \ + --path-include '/test/share/*' \ + pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT) + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/html/index.html" + test -f "$(DPKG_INSTDIR)/test/lib/pkg-somefiles/run" + $(DPKG_PURGE) pkg-somefiles + +test-upgrade: + # files are removed/re-added on upgrades + $(DPKG_INSTALL) pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT) + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright" + + $(DPKG_INSTALL) \ + --path-exclude '/test/share/doc/*' \ + pkg-somefiles.deb + ! test -d "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles" + + $(DPKG_INSTALL) \ + --path-exclude '/test/share/doc/*' \ + --path-include '/test/share/doc/*/copyright' \ + pkg-somefiles.deb + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright" + ! test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README" + + $(DPKG_INSTALL) pkg-somefiles.deb + test "`$(DPKG_QUERY) -L pkg-somefiles | wc -l`" = $(DEB_FILES_COUNT) + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/copyright" + test -f "$(DPKG_INSTDIR)/test/share/doc/pkg-somefiles/README" + $(DPKG_PURGE) pkg-somefiles + +# --help output explains the options +test-help: + $(DPKG) --help | grep -q -- --path-include + $(DPKG) --help | grep -q -- --path-exclude diff --git a/tests/t-filtering/pkg-somefiles/DEBIAN/control b/tests/t-filtering/pkg-somefiles/DEBIAN/control new file mode 100644 index 0000000..f468c92 --- /dev/null +++ b/tests/t-filtering/pkg-somefiles/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-somefiles +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide some files + diff --git a/tests/t-filtering/pkg-somefiles/test/lib/pkg-somefiles/run b/tests/t-filtering/pkg-somefiles/test/lib/pkg-somefiles/run new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-filtering/pkg-somefiles/test/lib/pkg-somefiles/run diff --git a/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/README b/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/README new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/README diff --git a/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/copyright b/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/copyright new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/copyright diff --git a/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/html/index.html b/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/html/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/html/index.html diff --git a/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/html/topic1/1.html b/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/html/topic1/1.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-filtering/pkg-somefiles/test/share/doc/pkg-somefiles/html/topic1/1.html diff --git a/tests/t-filtering/pkg-somefiles/test/share/locale/ca/foo.mo b/tests/t-filtering/pkg-somefiles/test/share/locale/ca/foo.mo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-filtering/pkg-somefiles/test/share/locale/ca/foo.mo diff --git a/tests/t-filtering/pkg-somefiles/test/share/locale/de/foo.mo b/tests/t-filtering/pkg-somefiles/test/share/locale/de/foo.mo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-filtering/pkg-somefiles/test/share/locale/de/foo.mo diff --git a/tests/t-filtering/pkg-somefiles/test/share/locale/es/foo.mo b/tests/t-filtering/pkg-somefiles/test/share/locale/es/foo.mo new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-filtering/pkg-somefiles/test/share/locale/es/foo.mo diff --git a/tests/t-maintscript-leak/Makefile b/tests/t-maintscript-leak/Makefile new file mode 100644 index 0000000..c01646a --- /dev/null +++ b/tests/t-maintscript-leak/Makefile @@ -0,0 +1,14 @@ +TESTS_DEB := pkg-maintscript-leak + +include ../Test.mk + +test-case: + # Check for leaks on install + $(DPKG_INSTALL) pkg-maintscript-leak.deb + # Check for leaks on upgrade + $(DPKG_INSTALL) pkg-maintscript-leak.deb + # Check for leaks on removal + $(DPKG_PURGE) pkg-maintscript-leak + +test-clean: + $(DPKG_PURGE) pkg-maintscript-leak diff --git a/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/control b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/control new file mode 100644 index 0000000..5829d13 --- /dev/null +++ b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-maintscript-leak +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - maintscript leaks diff --git a/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/postinst b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/postinst new file mode 100755 index 0000000..580884d --- /dev/null +++ b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/postinst @@ -0,0 +1,16 @@ +#!/bin/sh + +# On kFreeBSD: /dev/fd/ +# On Linux and kFreeBSD w/ linprocfs: /proc/self/fd/ +for d in /dev/fd/ /proc/self/fd/; do + if [ -d $d ]; then + fddir=$d + break + fi +done + +if [ -n $fddir ]; then + ls -l $fddir + # We should have the 3 standard descriptors, plus 1 for the open directory. + [ `ls $fddir | wc -l` -eq 4 ] || echo WARN: maintscript leaks fd +fi diff --git a/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/postrm b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/postrm new file mode 100755 index 0000000..580884d --- /dev/null +++ b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/postrm @@ -0,0 +1,16 @@ +#!/bin/sh + +# On kFreeBSD: /dev/fd/ +# On Linux and kFreeBSD w/ linprocfs: /proc/self/fd/ +for d in /dev/fd/ /proc/self/fd/; do + if [ -d $d ]; then + fddir=$d + break + fi +done + +if [ -n $fddir ]; then + ls -l $fddir + # We should have the 3 standard descriptors, plus 1 for the open directory. + [ `ls $fddir | wc -l` -eq 4 ] || echo WARN: maintscript leaks fd +fi diff --git a/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/preinst b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/preinst new file mode 100755 index 0000000..580884d --- /dev/null +++ b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/preinst @@ -0,0 +1,16 @@ +#!/bin/sh + +# On kFreeBSD: /dev/fd/ +# On Linux and kFreeBSD w/ linprocfs: /proc/self/fd/ +for d in /dev/fd/ /proc/self/fd/; do + if [ -d $d ]; then + fddir=$d + break + fi +done + +if [ -n $fddir ]; then + ls -l $fddir + # We should have the 3 standard descriptors, plus 1 for the open directory. + [ `ls $fddir | wc -l` -eq 4 ] || echo WARN: maintscript leaks fd +fi diff --git a/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/prerm b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/prerm new file mode 100755 index 0000000..580884d --- /dev/null +++ b/tests/t-maintscript-leak/pkg-maintscript-leak/DEBIAN/prerm @@ -0,0 +1,16 @@ +#!/bin/sh + +# On kFreeBSD: /dev/fd/ +# On Linux and kFreeBSD w/ linprocfs: /proc/self/fd/ +for d in /dev/fd/ /proc/self/fd/; do + if [ -d $d ]; then + fddir=$d + break + fi +done + +if [ -n $fddir ]; then + ls -l $fddir + # We should have the 3 standard descriptors, plus 1 for the open directory. + [ `ls $fddir | wc -l` -eq 4 ] || echo WARN: maintscript leaks fd +fi diff --git a/tests/t-multiarch/Makefile b/tests/t-multiarch/Makefile new file mode 100644 index 0000000..97cbc62 --- /dev/null +++ b/tests/t-multiarch/Makefile @@ -0,0 +1,831 @@ +# Copyright © 2011 Linaro Limited +# Copyright © 2011 Raphaël Hertzog <hertzog@debian.org> +# Copyright © 2011-2012 Guillem Jover <guillem@debian.org> + +TESTS_DEB := + +include ../Test.mk + +NATIVE_ARCH := $(shell dpkg --print-architecture) +ifeq ($(NATIVE_ARCH),i386) + FOREIGN_ARCH := amd64 +else + FOREIGN_ARCH := i386 +endif + +ma-setup: + $(DPKG) --add-architecture $(FOREIGN_ARCH) + +## BUILDING THE TEST PACKAGES ## + +# Params are (dirname, pkgname, ver, arch, ma, dep) +# Dirname and pkgname are auto-prefixed with "pkg-ma" +define build_pkg +PKG_TO_BUILD += pkg-ma-$(1).deb + +pkg-ma-$(1):: pkg-template + [ -e pkg-ma-$(1) ] || cp -a pkg-template pkg-ma-$(1) + sed -i -e "s/Package: .*/Package: pkg-ma-$(2)/" \ + -e "s/Version: .*/Version: $(3)/" \ + -e "s/Architecture: .*/Architecture: $(4)/" \ + -e "s/Multi-Arch: .*/Multi-Arch: $(5)/" \ + -e "s/Depends:.*/Depends: $(6)/" \ + pkg-ma-$(1)/DEBIAN/control + mkdir -p pkg-ma-$(1)/m-a + echo "In file pkg-ma-$(1)" > pkg-ma-$(1)/m-a/foo-$(1) + touch pkg-ma-$(1) + +pkg-ma-$(1).deb: pkg-ma-$(1) + $(DPKG_BUILD_DEB) --nocheck pkg-ma-$(1) pkg-ma-$(1).deb + +clean-hook:: + rm -rf pkg-ma-$(1) + rm -f pkg-ma-$(1).deb +endef + +$(foreach arch,$(NATIVE_ARCH) $(FOREIGN_ARCH),\ + $(foreach ma,same foreign allowed no,\ + $(foreach version,1.0 2.0,\ + $(eval $(call build_pkg,$(ma)_$(version)_$(arch),$(ma),$(version),$(arch),$(ma),))))) + +# Arch: all done separately because M-A: same can't be Arch: all +$(foreach ma,foreign allowed no,\ + $(eval $(call build_pkg,$(ma)_1.0_all,$(ma),1.0,all,$(ma),))) + +$(eval $(call build_pkg,same_1.0_all,same,1.0,all,no,)) + +$(foreach arch,$(NATIVE_ARCH) $(FOREIGN_ARCH),\ + $(eval $(call build_pkg,self-conflict_1.0_$(arch),self-conflict,1.0,$(arch),same,))\ + $(foreach ma,same foreign foreign-any allowed allowed-any allowed-fake no,\ + $(eval $(call build_pkg,dep-on-$(ma)_1.0_$(arch),dep-on-$(ma),1.0,$(arch),foreign,pkg-ma-$(subst -,:,$(ma)) (>= 1.0))))) + +$(foreach ma,same foreign foreign-any allowed allowed-any allowed-fake no,\ + $(eval $(call build_pkg,dep-on-$(ma)_1.0_all,dep-on-$(ma),1.0,all,no,pkg-ma-$(subst -,:,$(ma)) (>= 1.0)))) + +shared_file_types := file symlink fifo +ifdef DPKG_AS_ROOT +shared_file_types += chardev blockdev +endif +$(foreach arch,$(NATIVE_ARCH) $(FOREIGN_ARCH),\ + $(foreach version,1.0 2.0,\ + $(eval $(call build_pkg,shared-conffiles_$(version)_orig_$(arch),shared-conffiles,$(version),$(arch),same,))\ + $(eval $(call build_pkg,shared-conffiles_$(version)_alt_$(arch),shared-conffiles,$(version),$(arch),same,))\ + $(foreach variant,orig alt,\ + $(foreach type,$(shared_file_types),\ + $(eval $(call build_pkg,shared-files_$(version)_$(variant)-$(type)_$(arch),shared-files,$(version),$(arch),same,)))))) + +$(foreach arch,$(NATIVE_ARCH) $(FOREIGN_ARCH),\ + $(eval $(call build_pkg,triggers_1.0_$(arch),triggers,1.0,$(arch),same,))\ + $(eval $(call build_pkg,shared-diversion_1.0_$(arch),shared-diversion,1.0,$(arch),same,))) + +$(eval $(call build_pkg,act-trig_1.0_all,act-trig,1.0,all,no,)) +$(eval $(call build_pkg,diversion_1.0_all,diversion,1.0,all,no,)) +$(eval $(call build_pkg,diverted_1.0_all,diverted,1.0,all,no,)) +$(eval $(call build_pkg,db-layout_1.0_$(NATIVE_ARCH),db-layout,1.0,$(NATIVE_ARCH),no,)) +$(eval $(call build_pkg,db-layout_2.0_$(NATIVE_ARCH),db-layout,2.0,$(NATIVE_ARCH),same,)) + +build-hook: $(PKG_TO_BUILD) + +## TEST CASES BELOW ## + +TEST_CASES += test-print-foreign-architecture +TEST_CASES += test-build-invalid +TEST_CASES += test-build-valid +TEST_CASES += test-install-native +TEST_CASES += test-install-foreign +TEST_CASES += test-coinstall-ma-same +TEST_CASES += test-crossgrade +TEST_CASES += test-deps +TEST_CASES += test-coinstall-shared-files +TEST_CASES += test-coinstall-shared-conffiles +TEST_CASES += test-coinstall-triggers +TEST_CASES += test-coinstall-diversions +TEST_CASES += test-dpkg-output +TEST_CASES += test-db-layout + +test-case: $(TEST_CASES) + +test-print-foreign-architecture: + echo $(FOREIGN_ARCH) >ref-arch + echo foobar >>ref-arch + $(DPKG) --remove-architecture $(FOREIGN_ARCH) + $(DPKG) --remove-architecture foobar + $(call stdout_is,$(DPKG) --print-foreign-architectures,) + $(DPKG) --add-architecture $(FOREIGN_ARCH) + $(call stdout_is,$(DPKG) --print-foreign-architectures,$(FOREIGN_ARCH)) + $(DPKG) --add-architecture foobar + $(DPKG) --print-foreign-architectures | cmp ref-arch - + # Ensure all/any can't be addded as foreign arch + ! $(DPKG) --add-architecture all + ! $(DPKG) --add-architecture any + # Ensure the native arch is never considered as + $(DPKG) --add-architecture $(NATIVE_ARCH) + $(DPKG) --print-foreign-architectures | cmp ref-arch - + $(DPKG) --remove-architecture foobar + rm -f ref-arch + +test-build-invalid: + # Test build of Architecture: all with Multi-Arch: same field + ! $(DPKG_BUILD_DEB) pkg-template foo.deb + rm -f foo.deb + +test-build-valid: + # Test build of package with valid dependency (ma-allowed:fake) + $(DPKG_BUILD_DEB) pkg-ma-dep-on-allowed-fake_1.0_$(NATIVE_ARCH) foo.deb + rm -f foo.deb + +test-install-native: + $(DPKG_INSTALL) pkg-ma-same_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-foreign_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-allowed_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-no_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-same:$(NATIVE_ARCH)) + $(call pkg_is_installed,pkg-ma-foreign) + $(call pkg_is_installed,pkg-ma-allowed) + $(call pkg_is_installed,pkg-ma-no) + $(DPKG_PURGE) pkg-ma-same:$(NATIVE_ARCH) pkg-ma-foreign pkg-ma-allowed pkg-ma-no + $(call pkg_is_not_installed,pkg-ma-same:$(NATIVE_ARCH)) + $(call pkg_is_not_installed,pkg-ma-foreign) + $(call pkg_is_not_installed,pkg-ma-allowed) + $(call pkg_is_not_installed,pkg-ma-no) + +test-install-foreign: + $(DPKG) --remove-architecture $(FOREIGN_ARCH) + # Installation of foreign arch packages must fail by default + ! $(DPKG_INSTALL) pkg-ma-same_1.0_$(FOREIGN_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-foreign_1.0_$(FOREIGN_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-allowed_1.0_$(FOREIGN_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-no_1.0_$(FOREIGN_ARCH).deb + # Once architecture has been added it should succeed + $(DPKG) --add-architecture $(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-same_1.0_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-foreign_1.0_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-allowed_1.0_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-no_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-same:$(FOREIGN_ARCH)) + $(call pkg_is_installed,pkg-ma-foreign:$(FOREIGN_ARCH)) + $(call pkg_is_installed,pkg-ma-allowed:$(FOREIGN_ARCH)) + $(call pkg_is_installed,pkg-ma-no:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-same:$(FOREIGN_ARCH) pkg-ma-foreign:$(FOREIGN_ARCH) pkg-ma-allowed:$(FOREIGN_ARCH) pkg-ma-no:$(FOREIGN_ARCH) + $(call pkg_is_not_installed,pkg-ma-same:$(FOREIGN_ARCH)) + $(call pkg_is_not_installed,pkg-ma-foreign:$(FOREIGN_ARCH)) + $(call pkg_is_not_installed,pkg-ma-allowed:$(FOREIGN_ARCH)) + $(call pkg_is_not_installed,pkg-ma-no:$(FOREIGN_ARCH)) + +test-coinstall-ma-same: ma-setup + # Coinstall 2 Multi-Arch: same packages + $(DPKG_INSTALL) pkg-ma-same_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-same_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-same:$(NATIVE_ARCH)) + $(call pkg_is_installed,pkg-ma-same:$(FOREIGN_ARCH)) + # Upgrade one, the other must be unconfigured + $(DPKG_UNPACK) pkg-ma-same_2.0_$(NATIVE_ARCH).deb + $(call pkg_status_is,pkg-ma-same:$(NATIVE_ARCH),install ok unpacked) + $(call pkg_status_is,pkg-ma-same:$(FOREIGN_ARCH),install ok half-configured) + # Configure one alone must fail + ! $(DPKG_CONFIGURE) pkg-ma-same:$(NATIVE_ARCH) + ! $(DPKG_CONFIGURE) pkg-ma-same:$(FOREIGN_ARCH) + # Upgrade the other and it's now possible to configure them + $(DPKG_UNPACK) pkg-ma-same_2.0_$(FOREIGN_ARCH).deb + $(DPKG_CONFIGURE) --pending + $(call pkg_is_installed,pkg-ma-same:$(NATIVE_ARCH)) + $(call pkg_is_installed,pkg-ma-same:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-same:$(NATIVE_ARCH) pkg-ma-same:$(FOREIGN_ARCH) + +TEST_CASES_CROSSGRADE := +TEST_CASES_CROSSGRADE += test-crossgrade-foreign-allowed + +test-crossgrade: $(TEST_CASES_CROSSGRADE) + +test-crossgrade-foreign-allowed: ma-setup + # Ensure we can cross-grade Multi-Arch: foreign/allowed + $(DPKG_INSTALL) pkg-ma-foreign_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-foreign_1.0_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-allowed_1.0_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-allowed_1.0_$(NATIVE_ARCH).deb + $(DPKG_PURGE) pkg-ma-foreign:$(NATIVE_ARCH) pkg-ma-allowed:$(FOREIGN_ARCH) + +TEST_CASES_CROSSGRADE := +TEST_CASES_CROSSGRADE += test-crossgrade-any-all-same +TEST_CASES_CROSSGRADE += test-crossgrade-any-all-foreign +TEST_CASES_CROSSGRADE += test-crossgrade-any-all-allowed +TEST_CASES_CROSSGRADE += test-crossgrade-all-any-same +TEST_CASES_CROSSGRADE += test-crossgrade-all-any-foreign +TEST_CASES_CROSSGRADE += test-crossgrade-all-any-allowed +TEST_CASES_CROSSGRADE += test-crossgrade-same-all +TEST_CASES_CROSSGRADE += test-crossgrade-no + +test-crossgrade: $(TEST_CASES_CROSSGRADE) + +test-crossgrade-any-all-%: ma-setup + # M-A: $* / Upgrade from arch: any-native -> all + $(DPKG_INSTALL) pkg-ma-$*_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-$*_1.0_all.deb + $(call pkg_is_installed,pkg-ma-$*:all) + $(call pkg_is_not_installed,pkg-ma-$*:$(NATIVE_ARCH)) + $(call pkg_field_is,pkg-ma-$*,Architecture,all) + $(DPKG_PURGE) pkg-ma-$* + $(call pkg_is_not_installed,pkg-ma-$*) + # M-A: $* / Upgrade from arch: any-foreign -> all + $(DPKG_INSTALL) pkg-ma-$*_1.0_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-$*_1.0_all.deb + $(call pkg_is_installed,pkg-ma-$*:all) + $(call pkg_is_not_installed,pkg-ma-$*:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-$* + +test-crossgrade-all-any-%: ma-setup + # M-A: $* / Upgrade from arch: all -> any-native + $(DPKG_INSTALL) pkg-ma-$*_1.0_all.deb + $(DPKG_INSTALL) pkg-ma-$*_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-$*:$(NATIVE_ARCH)) + $(call pkg_is_not_installed,pkg-ma-$*:all) + $(call pkg_field_is,pkg-ma-$*,Architecture,$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-$*:$(NATIVE_ARCH) + $(call pkg_is_not_installed,pkg-ma-$*:all) + $(call pkg_is_not_installed,pkg-ma-$*:$(NATIVE_ARCH)) + # M-A: $* / Upgrade from arch: all -> any-foreign + $(DPKG_INSTALL) pkg-ma-$*_1.0_all.deb + $(DPKG_INSTALL) pkg-ma-$*_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_not_installed,pkg-ma-$*:all) + $(call pkg_is_installed,pkg-ma-$*:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-$* + +test-crossgrade-same-all: ma-setup + # Several M-A: same installed, can't upgrade to single arch all + $(DPKG_INSTALL) pkg-ma-same_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-same_1.0_$(FOREIGN_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-same_1.0_all.deb + $(call pkg_is_installed,pkg-ma-same:$(NATIVE_ARCH)) + $(call pkg_is_installed,pkg-ma-same:$(FOREIGN_ARCH)) + $(call pkg_is_not_installed,pkg-ma-same:all) + $(DPKG_PURGE) pkg-ma-same:$(NATIVE_ARCH) pkg-ma-same:$(FOREIGN_ARCH) + +pkg-ma-no_1.0_$(NATIVE_ARCH) pkg-ma-no_1.0_$(FOREIGN_ARCH):: pkg-template + echo "A conffile" > $@/m-a/conffile-$@ + echo "/m-a/conffile-$@" > $@/DEBIAN/conffiles + +test-crossgrade-no: ma-setup + $(DPKG_INSTALL) pkg-ma-no_1.0_$(NATIVE_ARCH).deb + $(DPKG_REMOVE) pkg-ma-no:$(NATIVE_ARCH) + $(call pkg_status_is,pkg-ma-no:$(NATIVE_ARCH),deinstall ok config-files) + $(call pkg_is_not_installed,pkg-ma-no:$(FOREIGN_ARCH)) + $(call stdout_has,$(DPKG_QUERY) -L pkg-ma-no,/m-a/conffile-pkg-ma-no_1.0_$(NATIVE_ARCH)) + $(DPKG_INSTALL) pkg-ma-no_1.0_$(FOREIGN_ARCH).deb + # Verify the replaced package disappeared + $(call pkg_is_not_installed,pkg-ma-no:$(NATIVE_ARCH)) + $(call pkg_is_installed,pkg-ma-no:$(FOREIGN_ARCH)) + $(call stdout_has,$(DPKG_QUERY) -L pkg-ma-no:$(FOREIGN_ARCH),/m-a/conffile-pkg-ma-no_1.0_$(FOREIGN_ARCH)) + # Ensure the conffile of the disappeared package is still tracked + $(call stdout_has,$(DPKG_QUERY) -L pkg-ma-no:$(FOREIGN_ARCH),/m-a/conffile-pkg-ma-no_1.0_$(NATIVE_ARCH)) + $(call stdout_has,$(DPKG_QUERY) -f '$${Conffiles}' -W pkg-ma-no:$(FOREIGN_ARCH), /m-a/conffile-pkg-ma-no_1.0_$(NATIVE_ARCH) [a-f0-9]+ obsolete$$) + $(DPKG_PURGE) pkg-ma-no:$(FOREIGN_ARCH) + +TEST_CASES_DEPS := +TEST_CASES_DEPS += test-deps-same +TEST_CASES_DEPS += test-deps-foreign +TEST_CASES_DEPS += test-deps-allowed +TEST_CASES_DEPS += test-deps-no +TEST_CASES_DEPS += test-deps-self-conflict +TEST_CASES_DEPS += test-deps-force + +test-deps: $(TEST_CASES_DEPS) + +test-deps-same: ma-setup + # Native M-A: same is installed, no cross-arch dep allowed + $(DPKG_INSTALL) pkg-ma-same_1.0_$(NATIVE_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-dep-on-same_1.0_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-same:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-same_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-same) + $(DPKG_PURGE) pkg-ma-dep-on-same + $(DPKG_INSTALL) pkg-ma-dep-on-same_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-same:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-same:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-same:$(NATIVE_ARCH) + # Foreign M-A: same is installed + $(DPKG_INSTALL) pkg-ma-same_1.0_$(FOREIGN_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-dep-on-same_1.0_$(NATIVE_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-same:$(NATIVE_ARCH) + ! $(DPKG_INSTALL) pkg-ma-dep-on-same_1.0_all.deb + $(DPKG_PURGE) pkg-ma-dep-on-same + $(DPKG_INSTALL) pkg-ma-dep-on-same_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-same:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-same:$(FOREIGN_ARCH) + $(DPKG_PURGE) pkg-ma-same:$(FOREIGN_ARCH) + # Arch: all M-A: same can't exist + +test-deps-foreign: ma-setup + # Native M-A: foreign is installed + $(DPKG_INSTALL) pkg-ma-foreign_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-dep-on-foreign_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-foreign:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-foreign:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-foreign_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-foreign) + $(DPKG_PURGE) pkg-ma-dep-on-foreign + $(DPKG_INSTALL) pkg-ma-dep-on-foreign_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-foreign:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-foreign:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-foreign:$(NATIVE_ARCH) + # Foreign M-A: foreign is installed + $(DPKG_INSTALL) pkg-ma-foreign_1.0_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-dep-on-foreign_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-foreign:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-foreign:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-foreign_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-foreign) + $(DPKG_PURGE) pkg-ma-dep-on-foreign + $(DPKG_INSTALL) pkg-ma-dep-on-foreign_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-foreign:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-foreign:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-foreign:$(FOREIGN_ARCH) + # Arch: all M-A: foreign is installed + $(DPKG_INSTALL) pkg-ma-foreign_1.0_all.deb + $(DPKG_INSTALL) pkg-ma-dep-on-foreign_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-foreign:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-foreign:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-foreign_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-foreign) + $(DPKG_PURGE) pkg-ma-dep-on-foreign + $(DPKG_INSTALL) pkg-ma-dep-on-foreign_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-foreign:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-foreign:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-foreign + +test-deps-allowed: ma-setup + ## Native M-A: allowed is installed + $(DPKG_INSTALL) pkg-ma-allowed_1.0_$(NATIVE_ARCH).deb + # Non-annotated dependency on pkg-ma-allowed + ! $(DPKG_INSTALL) pkg-ma-dep-on-allowed_1.0_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-allowed:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-allowed:$(NATIVE_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed) + $(DPKG_PURGE) pkg-ma-dep-on-allowed + # Annotated dep: pkg-ma-allowed:any + $(DPKG_INSTALL) pkg-ma-dep-on-allowed-any_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed-any:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-allowed-any:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed-any_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed-any:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-allowed-any:$(NATIVE_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed-any_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed-any) + $(DPKG_PURGE) pkg-ma-dep-on-allowed-any + $(DPKG_PURGE) pkg-ma-allowed:$(NATIVE_ARCH) + ## Foreign M-A: allowed is installed + $(DPKG_INSTALL) pkg-ma-allowed_1.0_$(FOREIGN_ARCH).deb + # Non-annotated dependency on pkg-ma-allowed + $(DPKG_INSTALL) pkg-ma-dep-on-allowed_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-allowed:$(FOREIGN_ARCH) + ! $(DPKG_INSTALL) pkg-ma-dep-on-allowed_1.0_$(NATIVE_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-allowed:$(NATIVE_ARCH) + ! $(DPKG_INSTALL) pkg-ma-dep-on-allowed_1.0_all.deb + $(DPKG_PURGE) pkg-ma-dep-on-allowed + # Annotated dep: pkg-ma-allowed:any + $(DPKG_INSTALL) pkg-ma-dep-on-allowed-any_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed-any:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-allowed-any:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed-any_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed-any:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-allowed-any:$(NATIVE_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed-any_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed-any) + $(DPKG_PURGE) pkg-ma-dep-on-allowed-any + $(DPKG_PURGE) pkg-ma-allowed:$(FOREIGN_ARCH) + ## Arch: all M-A: allowed is installed + $(DPKG_INSTALL) pkg-ma-allowed_1.0_all.deb + # Non-annotated dependency on pkg-ma-allowed + ! $(DPKG_INSTALL) pkg-ma-dep-on-allowed_1.0_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-allowed:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-allowed:$(NATIVE_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed) + $(DPKG_PURGE) pkg-ma-dep-on-allowed + # Annotated dep: pkg-ma-allowed:any + $(DPKG_INSTALL) pkg-ma-dep-on-allowed-any_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed-any:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-allowed-any:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed-any_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed-any:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-allowed-any:$(NATIVE_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-allowed-any_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-allowed-any) + $(DPKG_PURGE) pkg-ma-dep-on-allowed-any + $(DPKG_PURGE) pkg-ma-allowed + +test-deps-no: ma-setup + # Native M-A: no is installed + $(DPKG_INSTALL) pkg-ma-no_1.0_$(NATIVE_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-dep-on-no_1.0_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-no:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-no_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-no) + $(DPKG_PURGE) pkg-ma-dep-on-no + $(DPKG_INSTALL) pkg-ma-dep-on-no_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-no:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-no:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-no:$(NATIVE_ARCH) + # Foreign M-A: no is installed (with --force-architecture) + $(DPKG_INSTALL) --force-architecture pkg-ma-no_1.0_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-dep-on-no_1.0_$(FOREIGN_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-no:$(FOREIGN_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-no:$(FOREIGN_ARCH) + ! $(DPKG_INSTALL) pkg-ma-dep-on-no_1.0_all.deb + $(DPKG_PURGE) pkg-ma-dep-on-no + ! $(DPKG_INSTALL) pkg-ma-dep-on-no_1.0_$(NATIVE_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-no:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-no:$(FOREIGN_ARCH) + # Arch: all M-A: no is installed + $(DPKG_INSTALL) pkg-ma-no_1.0_all.deb + ! $(DPKG_INSTALL) pkg-ma-dep-on-no_1.0_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-no:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-dep-on-no_1.0_all.deb + $(call pkg_is_installed,pkg-ma-dep-on-no) + $(DPKG_PURGE) pkg-ma-dep-on-no + $(DPKG_INSTALL) pkg-ma-dep-on-no_1.0_$(NATIVE_ARCH).deb + $(call pkg_is_installed,pkg-ma-dep-on-no:$(NATIVE_ARCH)) + $(DPKG_PURGE) pkg-ma-dep-on-no:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-no + +pkg-ma-self-conflict_1.0_$(NATIVE_ARCH) pkg-ma-self-conflict_1.0_$(FOREIGN_ARCH):: pkg-template + grep -q "Conflicts: " $@/DEBIAN/control || \ + (echo "Conflicts: virtual-foo" >> $@/DEBIAN/control; \ + echo "Provides: virtual-foo" >> $@/DEBIAN/control) + +test-deps-self-conflict: ma-setup + $(DPKG_INSTALL) pkg-ma-self-conflict_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-self-conflict_1.0_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-self-conflict:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-self-conflict:$(FOREIGN_ARCH) + +test-deps-force: ma-setup + # Try --force-depends when dependency is missing + $(DPKG_INSTALL) --force-depends pkg-ma-dep-on-no_1.0_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-no:$(FOREIGN_ARCH) + # Try --force-depends when dependency is of the wrong arch + $(DPKG_INSTALL) pkg-ma-no_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) --force-depends pkg-ma-dep-on-no_1.0_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-dep-on-no:$(FOREIGN_ARCH) + $(DPKG_PURGE) pkg-ma-no + +common_file = /m-a/common-file + +# Further customize test packages for test-coinstall-shared-files +define customize_shared_files +pkg-ma-shared-files_$(1)_$(2)-file_$(3):: pkg-template + echo "Variant: $(2) Version: $(1)" > pkg-ma-shared-files_$(1)_$(2)-file_$(3)$(common_file) + +pkg-ma-shared-files_$(1)_$(2)-symlink_$(3):: pkg-template + ln -sf "$(2)-$(1)" pkg-ma-shared-files_$(1)_$(2)-symlink_$(3)$(common_file) + +pkg-ma-shared-files_$(1)_$(2)-fifo_$(3):: pkg-template + test -e pkg-ma-shared-files_$(1)_$(2)-fifo_$(3)$(common_file) || \ + $(BEROOT) mkfifo pkg-ma-shared-files_$(1)_$(2)-fifo_$(3)$(common_file) + +pkg-ma-shared-files_$(1)_$(2)-chardev_$(3):: pkg-template + [ "$(2)" = "orig" ] && major=1 || major=2; \ + [ "$(1)" = "1.0" ] && minor=3 || minor=4; \ + test -e pkg-ma-shared-files_$(1)_$(2)-chardev_$(3)$(common_file) || \ + $(BEROOT) mknod pkg-ma-shared-files_$(1)_$(2)-chardev_$(3)$(common_file) c $$$$major $$$$minor + +pkg-ma-shared-files_$(1)_$(2)-blockdev_$(3):: pkg-template + [ "$(2)" = "orig" ] && major=1 || major=2; \ + [ "$(1)" = "1.0" ] && minor=3 || minor=4; \ + test -e pkg-ma-shared-files_$(1)_$(2)-blockdev_$(3)$(common_file) || \ + $(BEROOT) mknod pkg-ma-shared-files_$(1)_$(2)-blockdev_$(3)$(common_file) b $$$$major $$$$minor +endef + +$(foreach version,1.0 2.0,$(foreach variant,orig alt,\ + $(eval $(call customize_shared_files,$(version),$(variant),$(NATIVE_ARCH)))\ + $(eval $(call customize_shared_files,$(version),$(variant),$(FOREIGN_ARCH))))) + +test-coinstall-shared-files: ma-setup + # Ensure we can't install a shared file conflicting with a + # multi-arch sibling package of the same version + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-file_$(NATIVE_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-symlink_$(FOREIGN_ARCH).deb + test -f "$(DPKG_INSTDIR)$(common_file)" + ! $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-fifo_$(FOREIGN_ARCH).deb + test -f "$(DPKG_INSTDIR)$(common_file)" +ifdef DPKG_AS_ROOT + ! $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-chardev_$(FOREIGN_ARCH).deb + test -f "$(DPKG_INSTDIR)$(common_file)" + ! $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-blockdev_$(FOREIGN_ARCH).deb + test -f "$(DPKG_INSTDIR)$(common_file)" +endif + ! $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-file_$(FOREIGN_ARCH).deb + grep -q "Variant: orig Version: 1.0" "$(DPKG_INSTDIR)$(common_file)" + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-file_$(FOREIGN_ARCH).deb + $(call stdout_has,$(DPKG_QUERY) -L pkg-ma-shared-files:$(NATIVE_ARCH),$(common_file)) + $(call stdout_has,$(DPKG_QUERY) -L pkg-ma-shared-files:$(FOREIGN_ARCH),$(common_file)) + ! $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-file_$(FOREIGN_ARCH).deb + # But that we can install another version while upgrading + $(DPKG_UNPACK) pkg-ma-shared-files_2.0_orig-file_$(NATIVE_ARCH).deb + grep -q "Variant: orig Version: 2.0" "$(DPKG_INSTDIR)$(common_file)" + ! $(DPKG_UNPACK) pkg-ma-shared-files_2.0_alt-file_$(FOREIGN_ARCH).deb + $(DPKG_UNPACK) pkg-ma-shared-files_2.0_orig-file_$(FOREIGN_ARCH).deb + $(DPKG_CONFIGURE) --pending + $(DPKG_UNPACK) pkg-ma-shared-files_1.0_alt-file_$(NATIVE_ARCH).deb + grep -q "Variant: alt" "$(DPKG_INSTDIR)$(common_file)" + # Even during upgrade you can't come with a conflicting version + ! $(DPKG_UNPACK) pkg-ma-shared-files_1.0_orig-file_$(FOREIGN_ARCH).deb + $(DPKG_UNPACK) pkg-ma-shared-files_1.0_alt-file_$(FOREIGN_ARCH).deb + $(DPKG_CONFIGURE) --pending + $(DPKG_PURGE) pkg-ma-shared-files:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-shared-files:$(FOREIGN_ARCH) + # Ensure we can re-install a conflicting version of a package if + # no multi-arch siblings are installed + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-file_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-file_$(NATIVE_ARCH).deb + $(DPKG_PURGE) pkg-ma-shared-files:$(NATIVE_ARCH) + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-file_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-file_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-shared-files:$(FOREIGN_ARCH) + # Ensure files are kept during removal + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-file_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-file_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-shared-files:$(FOREIGN_ARCH) + grep -q "Variant: orig Version: 1.0" "$(DPKG_INSTDIR)$(common_file)" + $(call stdout_has,$(DPKG_QUERY) -L pkg-ma-shared-files:$(NATIVE_ARCH),$(common_file)) + $(DPKG_PURGE) pkg-ma-shared-files:$(NATIVE_ARCH) + # Ensure we detect differences with non-files too + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-symlink_$(NATIVE_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-symlink_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-symlink_$(FOREIGN_ARCH).deb + $(call stdout_is,readlink "$(DPKG_INSTDIR)$(common_file)",orig-1.0) + $(DPKG_PURGE) pkg-ma-shared-files:$(NATIVE_ARCH) pkg-ma-shared-files:$(FOREIGN_ARCH) +ifdef DPKG_AS_ROOT + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-chardev_$(NATIVE_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-chardev_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-chardev_$(FOREIGN_ARCH).deb + test -c "$(DPKG_INSTDIR)$(common_file)" + $(call stdout_is,stat -c "%t %T" "$(DPKG_INSTDIR)$(common_file)",1 3) + $(DPKG_PURGE) pkg-ma-shared-files:$(NATIVE_ARCH) pkg-ma-shared-files:$(FOREIGN_ARCH) + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-blockdev_$(NATIVE_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-shared-files_1.0_alt-blockdev_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-blockdev_$(FOREIGN_ARCH).deb + test -b "$(DPKG_INSTDIR)$(common_file)" + $(call stdout_is,stat -c "%t %T" "$(DPKG_INSTDIR)$(common_file)",1 3) + $(DPKG_PURGE) pkg-ma-shared-files:$(NATIVE_ARCH) pkg-ma-shared-files:$(FOREIGN_ARCH) +endif + +# Further customize test packages for test-coinstall-shared-conffiles +define customize_shared_conffiles +pkg-ma-shared-conffiles_$(1)_$(2)_$(3):: pkg-template + echo "Variant: $(2) Version: $(1)" > pkg-ma-shared-conffiles_$(1)_$(2)_$(3)/m-a/conffile + echo "/m-a/conffile" > pkg-ma-shared-conffiles_$(1)_$(2)_$(3)/DEBIAN/conffiles +endef + +$(foreach version,1.0 2.0,$(foreach variant,orig alt,\ + $(eval $(call customize_shared_conffiles,$(version),$(variant),$(NATIVE_ARCH)))\ + $(eval $(call customize_shared_conffiles,$(version),$(variant),$(FOREIGN_ARCH))))) + +test-coinstall-shared-conffiles: ma-setup + # Ensure we can't install a shared conffile conflicting with a + # multi-arch sibling package of the same version + $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_orig_$(NATIVE_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_alt_$(FOREIGN_ARCH).deb + grep -q "Variant: orig Version: 1.0" "$(DPKG_INSTDIR)/m-a/conffile" + $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_orig_$(FOREIGN_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_alt_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-shared-conffiles:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-shared-conffiles:$(FOREIGN_ARCH) + # Ensure this is still true even if the installed conffile is modified + $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_orig_$(NATIVE_ARCH).deb + $(BEROOT) sh -c "echo 'MODIFIED' >>'$(DPKG_INSTDIR)/m-a/conffile'" + ! $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_alt_$(FOREIGN_ARCH).deb + grep -q "Variant: orig Version: 1.0" "$(DPKG_INSTDIR)/m-a/conffile" + $(DPKG_INSTALL) --force-confold pkg-ma-shared-conffiles_1.0_orig_$(FOREIGN_ARCH).deb + ! $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_alt_$(FOREIGN_ARCH).deb + # Ensure we can install another version while upgrading even + # with a modified conffile + $(DPKG_UNPACK) pkg-ma-shared-conffiles_2.0_orig_$(NATIVE_ARCH).deb + grep -q "Variant: orig Version: 2.0" "$(DPKG_INSTDIR)/m-a/conffile.dpkg-new" + ! $(DPKG_UNPACK) pkg-ma-shared-conffiles_2.0_alt_$(FOREIGN_ARCH).deb + grep -q "Variant: orig Version: 2.0" "$(DPKG_INSTDIR)/m-a/conffile.dpkg-new" + $(DPKG_UNPACK) pkg-ma-shared-conffiles_2.0_orig_$(FOREIGN_ARCH).deb + $(DPKG_CONFIGURE) --force-confnew --pending + grep -q "Variant: orig Version: 2.0" "$(DPKG_INSTDIR)/m-a/conffile" + # Ensure the conffile hashes are correct, i.e. the new hashes have + # propagated to all instances + $(call stdout_is,$(DPKG_QUERY) -f '$${Conffiles}' -W pkg-ma-shared-conffiles:$(NATIVE_ARCH), /m-a/conffile 7404b80581282025ee3ec6689e111114) + $(call stdout_is,$(DPKG_QUERY) -f '$${Conffiles}' -W pkg-ma-shared-conffiles:$(FOREIGN_ARCH), /m-a/conffile 7404b80581282025ee3ec6689e111114) + # Ensure we can reinstall coinstallable packages with conffiles on + # the same run + $(DPKG_INSTALL) pkg-ma-shared-conffiles_2.0_orig_$(NATIVE_ARCH).deb \ + pkg-ma-shared-conffiles_2.0_orig_$(FOREIGN_ARCH).deb + grep -q "Variant: orig Version: 2.0" "$(DPKG_INSTDIR)/m-a/conffile" + # Ensure we can reinstall coinstallable packages with conffiles on + # different runs + $(DPKG_UNPACK) pkg-ma-shared-conffiles_2.0_orig_$(FOREIGN_ARCH).deb + $(DPKG_UNPACK) pkg-ma-shared-conffiles_2.0_orig_$(NATIVE_ARCH).deb + $(DPKG_CONFIGURE) pkg-ma-shared-conffiles:$(NATIVE_ARCH) + $(DPKG_CONFIGURE) pkg-ma-shared-conffiles:$(FOREIGN_ARCH) + grep -q "Variant: orig Version: 2.0" "$(DPKG_INSTDIR)/m-a/conffile" + # Another time with a downgrade and an unmodified conffile + $(DPKG_UNPACK) pkg-ma-shared-conffiles_1.0_alt_$(NATIVE_ARCH).deb + grep -q "Variant: alt" "$(DPKG_INSTDIR)/m-a/conffile.dpkg-new" + ! $(DPKG_UNPACK) pkg-ma-shared-conffiles_1.0_orig_$(FOREIGN_ARCH).deb + $(DPKG_UNPACK) pkg-ma-shared-conffiles_1.0_alt_$(FOREIGN_ARCH).deb + $(DPKG_CONFIGURE) --force-confnew --pending + # Verify shared conffiles are forgotten on remove, and really + # removed on purge of last package + $(DPKG_REMOVE) pkg-ma-shared-conffiles:$(NATIVE_ARCH) + ! $(call stdout_has,$(DPKG_QUERY) -L pkg-ma-shared-conffiles:$(NATIVE_ARCH),/m-a/conffile) + $(DPKG_PURGE) pkg-ma-shared-conffiles:$(NATIVE_ARCH) + test -e "$(DPKG_INSTDIR)/m-a/conffile" + $(DPKG_PURGE) pkg-ma-shared-conffiles:$(FOREIGN_ARCH) + ! test -e "$(DPKG_INSTDIR)/m-a/conffile" + # Ensure we can re-install a conflicting version of a package if + # no multi-arch siblings are installed + $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_orig_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_alt_$(NATIVE_ARCH).deb + $(DPKG_PURGE) pkg-ma-shared-conffiles:$(NATIVE_ARCH) + $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_orig_$(FOREIGN_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_alt_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-shared-conffiles:$(FOREIGN_ARCH) + # Same with modified conffile + $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_orig_$(NATIVE_ARCH).deb + $(BEROOT) sh -c "echo 'MODIFIED' >>'$(DPKG_INSTDIR)/m-a/conffile'" + $(DPKG_INSTALL) --force-confnew pkg-ma-shared-conffiles_1.0_alt_$(NATIVE_ARCH).deb + $(DPKG_PURGE) pkg-ma-shared-conffiles:$(NATIVE_ARCH) + $(DPKG_INSTALL) pkg-ma-shared-conffiles_1.0_orig_$(FOREIGN_ARCH).deb + $(BEROOT) sh -c "echo 'MODIFIED' >>'$(DPKG_INSTDIR)/m-a/conffile'" + $(DPKG_INSTALL) --force-confnew pkg-ma-shared-conffiles_1.0_alt_$(FOREIGN_ARCH).deb + $(DPKG_PURGE) pkg-ma-shared-conffiles:$(FOREIGN_ARCH) + +# Further customize test packages for test-coinstall-triggers +pkg-ma-triggers_1.0_$(NATIVE_ARCH) pkg-ma-triggers_1.0_$(FOREIGN_ARCH):: pkg-template + echo "#!/bin/sh" >$@/DEBIAN/postinst + echo '[ "$$1" = "triggered" ] || exit 0' >>$@/DEBIAN/postinst + echo 'case " $$2 " in' >>$@/DEBIAN/postinst + echo '*" /m-a/trigger-watch "*) ' >>$@/DEBIAN/postinst + echo ' echo "FILE $$DPKG_MAINTSCRIPT_ARCH" >>"$$DPKG_ROOT/m-a/triggers" ;;' >>$@/DEBIAN/postinst + echo 'esac' >>$@/DEBIAN/postinst + echo 'case " $$2 " in' >>$@/DEBIAN/postinst + echo '*" test-m-a-same "*)' >>$@/DEBIAN/postinst + echo ' echo "MANUAL $$DPKG_MAINTSCRIPT_ARCH" >>"$$DPKG_ROOT/m-a/triggers" ;;' >>$@/DEBIAN/postinst + echo 'esac' >>$@/DEBIAN/postinst + chmod 755 $@/DEBIAN/postinst + echo 'interest /m-a/trigger-watch' >$@/DEBIAN/triggers + echo 'interest test-m-a-same' >>$@/DEBIAN/triggers + +pkg-ma-act-trig_1.0_all:: pkg-template + echo "Activates a trigger" >$@/m-a/trigger-watch + echo "#!/bin/sh" >$@/DEBIAN/postinst + echo "dpkg-trigger test-m-a-same" >>$@/DEBIAN/postinst + chmod 755 $@/DEBIAN/postinst + +test-coinstall-triggers: ma-setup + -cat "$(DPKG_ADMINDIR)/triggers/File" + $(DPKG_INSTALL) pkg-ma-triggers_1.0_$(NATIVE_ARCH).deb + cat "$(DPKG_ADMINDIR)/triggers/File" + $(DPKG_INSTALL) pkg-ma-triggers_1.0_$(FOREIGN_ARCH).deb + cat "$(DPKG_ADMINDIR)/triggers/File" + # Test file trigger processing + $(BEROOT) sh -c ":>'$(DPKG_INSTDIR)/m-a/triggers'" + $(DPKG_UNPACK) --no-triggers pkg-ma-act-trig_1.0_all.deb + $(call pkg_status_is,pkg-ma-triggers:$(NATIVE_ARCH),install ok triggers-pending) + $(call pkg_status_is,pkg-ma-triggers:$(FOREIGN_ARCH),install ok triggers-pending) + $(DPKG_CONFIGURE) pkg-ma-triggers:$(NATIVE_ARCH) pkg-ma-triggers:$(FOREIGN_ARCH) + $(call pkg_is_installed,pkg-ma-triggers:$(NATIVE_ARCH)) + $(call pkg_is_installed,pkg-ma-triggers:$(FOREIGN_ARCH)) + $(call stdout_is,grep -c FILE "$(DPKG_INSTDIR)/m-a/triggers",2) + grep -q "FILE $(NATIVE_ARCH)" "$(DPKG_INSTDIR)/m-a/triggers" + grep -q "FILE $(FOREIGN_ARCH)" "$(DPKG_INSTDIR)/m-a/triggers" + # Test manual trigger processing + $(DPKG_CONFIGURE) pkg-ma-act-trig + $(call pkg_is_installed,pkg-ma-triggers:$(NATIVE_ARCH)) + $(call pkg_is_installed,pkg-ma-triggers:$(FOREIGN_ARCH)) + $(call stdout_is,grep -c MANUAL "$(DPKG_INSTDIR)/m-a/triggers",2) + grep -q "MANUAL $(NATIVE_ARCH)" "$(DPKG_INSTDIR)/m-a/triggers" + grep -q "MANUAL $(FOREIGN_ARCH)" "$(DPKG_INSTDIR)/m-a/triggers" + # Clean up + $(DPKG_PURGE) pkg-ma-act-trig + $(BEROOT) rm -f "$(DPKG_INSTDIR)/m-a/triggers" + $(DPKG_PURGE) pkg-ma-triggers:$(NATIVE_ARCH) + $(DPKG_PURGE) pkg-ma-triggers:$(FOREIGN_ARCH) + +# Further customize test packages for test-coinstall-diversions +pkg-ma-diversion_1.0_all:: pkg-template + echo "File provided by pkg-ma-diversion" >$@$(common_file) + echo "#!/bin/sh" >$@/DEBIAN/preinst + echo '[ "$$1" = "install" ] || exit 0' >>$@/DEBIAN/preinst + echo 'dpkg-divert --add --rename $(common_file)' >>$@/DEBIAN/preinst + echo "#!/bin/sh" >$@/DEBIAN/postrm + echo '[ "$$1" = "remove" ] || exit 0' >>$@/DEBIAN/postrm + echo 'dpkg-divert --remove --rename $(common_file)' >>$@/DEBIAN/postrm + chmod 755 $@/DEBIAN/preinst $@/DEBIAN/postrm + +pkg-ma-diverted_1.0_all:: pkg-template + echo "File provided by pkg-ma-diverted" >$@$(common_file) + +pkg-ma-shared-diversion_1.0_$(NATIVE_ARCH) pkg-ma-shared-diversion_1.0_$(FOREIGN_ARCH):: pkg-template + echo "File provided by pkg-ma-shared-diversion" >$@$(common_file) + echo "#!/bin/sh" >$@/DEBIAN/preinst + echo '[ "$$1" = "install" ] || exit 0' >>$@/DEBIAN/preinst + echo 'dpkg-divert --add --rename $(common_file)' >>$@/DEBIAN/preinst + echo "#!/bin/sh" >$@/DEBIAN/postrm + echo '[ "$$1" = "remove" ] || exit 0' >>$@/DEBIAN/postrm + echo 'dpkg-divert --remove --rename $(common_file)' >>$@/DEBIAN/postrm + chmod 755 $@/DEBIAN/preinst $@/DEBIAN/postrm + +test-coinstall-diversions: ma-setup + # Test shared files with a diversion + $(DPKG_DIVERT_ADD) --local --divert $(common_file).real $(common_file) + $(MAKE) test-coinstall-shared-files common_file=$(common_file).real + $(DPKG_DIVERT_DEL) --local --divert $(common_file).real $(common_file) + $(DPKG_INSTALL) pkg-ma-diversion_1.0_all.deb + $(MAKE) test-coinstall-shared-files common_file=$(common_file).distrib + $(DPKG_PURGE) pkg-ma-diversion + # Test with another package providing a conflicting file + # and the multiarch packages registering the diversion + $(DPKG_INSTALL) pkg-ma-diverted_1.0_all.deb + $(DPKG_INSTALL) pkg-ma-shared-diversion_1.0_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-diversion_1.0_$(FOREIGN_ARCH).deb + grep -q "pkg-ma-diverted" "$(DPKG_INSTDIR)$(common_file).distrib" + grep -q "pkg-ma-shared-diversion" "$(DPKG_INSTDIR)$(common_file)" + $(DPKG_PURGE) pkg-ma-shared-diversion:$(NATIVE_ARCH) + $(call stdout_has,$(DPKG_DIVERT) --list,$(common_file).distrib) + $(DPKG_PURGE) pkg-ma-shared-diversion:$(FOREIGN_ARCH) + ! $(call stdout_has,$(DPKG_DIVERT) --list,$(common_file).distrib) + $(DPKG_PURGE) pkg-ma-diverted + +test-dpkg-output: ma-setup + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-file_$(NATIVE_ARCH).deb + $(DPKG_INSTALL) pkg-ma-shared-files_1.0_orig-file_$(FOREIGN_ARCH).deb + $(call stdout_has,$(DPKG_QUERY) -W,^pkg-ma-shared-files:$(NATIVE_ARCH) 1.0$) + $(call stdout_has,$(DPKG_QUERY) -W,^pkg-ma-shared-files:$(FOREIGN_ARCH) 1.0$) + ! $(call stdout_is,$(DPKG_QUERY) -f'$${binary:Package}' -W pkg-ma-shared-files,pkg-ma-shared-files) + $(call stdout_is,$(DPKG_QUERY) -f'$${binary:Package}' -W pkg-ma-shared-files:$(NATIVE_ARCH),pkg-ma-shared-files:$(NATIVE_ARCH)) + $(call stdout_is,$(DPKG_QUERY) -f'$${binary:Package}' -W pkg-ma-shared-files:$(FOREIGN_ARCH),pkg-ma-shared-files:$(FOREIGN_ARCH)) + ! $(call stdout_is,$(DPKG_QUERY) -f'$${Package}' -W pkg-ma-shared-files,pkg-ma-shared-files) + $(call stdout_is,$(DPKG_QUERY) -f'$${Package}' -W pkg-ma-shared-files:$(NATIVE_ARCH),pkg-ma-shared-files) + $(call stdout_is,$(DPKG_QUERY) -f'$${Package}' -W pkg-ma-shared-files:$(FOREIGN_ARCH),pkg-ma-shared-files) + $(call stdout_has,$(DPKG_QUERY) -W,^pkg-ma-shared-files:$(FOREIGN_ARCH) 1.0$) + $(call stdout_has,$(DPKG_QUERY) --search $(common_file),(\, |^)pkg-ma-shared-files:$(NATIVE_ARCH)(\, |: )) + $(call stdout_has,$(DPKG_QUERY) --search $(common_file),(\, |^)pkg-ma-shared-files:$(FOREIGN_ARCH)(\, |: )) + $(call stdout_has,$(DPKG_QUERY) --list,^ii pkg-ma-shared-files:$(NATIVE_ARCH)) + $(call stdout_has,$(DPKG_QUERY) --list,^ii pkg-ma-shared-files:$(FOREIGN_ARCH) ) + $(call stdout_has,$(DPKG) --get-selections,^pkg-ma-shared-files:$(NATIVE_ARCH) +install$) + $(call stdout_has,$(DPKG) --get-selections,^pkg-ma-shared-files:$(FOREIGN_ARCH) +install$) + echo "pkg-ma-shared-files:$(NATIVE_ARCH) hold" | $(BEROOT) $(DPKG) --set-selections + $(call stdout_has,$(DPKG) --get-selections,^pkg-ma-shared-files:$(NATIVE_ARCH) +hold$) + $(call stdout_has,$(DPKG) --get-selections,^pkg-ma-shared-files:$(FOREIGN_ARCH) +install$) + echo "pkg-ma-shared-files:$(FOREIGN_ARCH) deinstall" | $(BEROOT) $(DPKG) --set-selections + $(call stdout_has,$(DPKG) --get-selections,^pkg-ma-shared-files:$(NATIVE_ARCH) +hold$) + $(call stdout_has,$(DPKG) --get-selections,^pkg-ma-shared-files:$(FOREIGN_ARCH) +deinstall$) + echo "pkg-ma-shared-files:$(NATIVE_ARCH) install" | $(BEROOT) $(DPKG) --set-selections + $(call stdout_has,$(DPKG) --get-selections,^pkg-ma-shared-files:$(NATIVE_ARCH) +install$) + $(call stdout_has,$(DPKG) --get-selections,^pkg-ma-shared-files:$(FOREIGN_ARCH) +deinstall$) + $(DPKG_PURGE) pkg-ma-shared-files:$(NATIVE_ARCH) pkg-ma-shared-files:$(FOREIGN_ARCH) + +pkg-ma-db-layout_1.0_$(NATIVE_ARCH):: pkg-template + touch pkg-ma-db-layout_1.0_$(NATIVE_ARCH)/DEBIAN/foo-1 + +pkg-ma-db-layout_2.0_$(NATIVE_ARCH):: pkg-template + touch pkg-ma-db-layout_2.0_$(NATIVE_ARCH)/DEBIAN/foo-2 + +test-db-layout: ma-setup + $(DPKG_INSTALL) pkg-ma-db-layout_1.0_$(NATIVE_ARCH).deb + test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.list" + test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.foo-1" + $(DPKG_INSTALL) pkg-ma-db-layout_2.0_$(NATIVE_ARCH).deb + ! test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.list" + ! test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.foo-1" + test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout:$(NATIVE_ARCH).list" + test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout:$(NATIVE_ARCH).foo-2" + $(DPKG_INSTALL) pkg-ma-db-layout_1.0_$(NATIVE_ARCH).deb + test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.list" + test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.foo-1" + ! test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout:$(NATIVE_ARCH).list" + ! test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout:$(NATIVE_ARCH).foo-2" + $(DPKG_PURGE) pkg-ma-db-layout + # Test the upgrade of the db layout + $(DPKG_INSTALL) pkg-ma-db-layout_2.0_$(NATIVE_ARCH).deb + rm -f "$(DPKG_ADMINDIR)/info/format" + mv "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout:$(NATIVE_ARCH).list" "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.list" + mv "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout:$(NATIVE_ARCH).foo-2" "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.foo-2" + $(call stdout_has,$(DPKG_QUERY) --control-path pkg-ma-db-layout foo-2,/pkg-ma-db-layout\.foo-2$$) + $(DPKG_CONFIGURE) -a + grep -q "^1$$" "$(DPKG_ADMINDIR)/info/format" + test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout:$(NATIVE_ARCH).list" + test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout:$(NATIVE_ARCH).foo-2" + ! test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.list" + ! test -e "$(DPKG_ADMINDIR)/info/pkg-ma-db-layout.foo-2" + $(call stdout_has,$(DPKG_QUERY) --control-path pkg-ma-db-layout foo-2,/pkg-ma-db-layout:$(NATIVE_ARCH)\.foo-2$$) + $(DPKG_PURGE) pkg-ma-db-layout + +test-clean: + $(BEROOT) rm -f "$(DPKG_INSTDIR)/m-a/triggers" + $(DPKG_QUERY) -W | grep ^pkg-ma- | (while read pkg ver; do \ + $(DPKG_PURGE) $$pkg; \ + done) + -$(DPKG_DIVERT_DEL) --local --divert $(common_file).real $(common_file) + rm -f "$(DPKG_ADMINDIR)/arch" diff --git a/tests/t-multiarch/pkg-template/DEBIAN/control b/tests/t-multiarch/pkg-template/DEBIAN/control new file mode 100644 index 0000000..c1daefe --- /dev/null +++ b/tests/t-multiarch/pkg-template/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-template +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Multi-Arch: same +Depends: +Description: test package diff --git a/tests/t-normal/Makefile b/tests/t-normal/Makefile new file mode 100644 index 0000000..70e1dd0 --- /dev/null +++ b/tests/t-normal/Makefile @@ -0,0 +1,12 @@ +TESTS_DEB := pkg-normal + +include ../Test.mk + +test-case: + # test normal working packages + $(DPKG_INSTALL) pkg-normal.deb + $(call pkg_is_installed,pkg-normal) + +test-clean: + $(DPKG_PURGE) pkg-normal + diff --git a/tests/t-normal/pkg-normal/DEBIAN/control b/tests/t-normal/pkg-normal/DEBIAN/control new file mode 100644 index 0000000..09e51b2 --- /dev/null +++ b/tests/t-normal/pkg-normal/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-normal +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - normal + diff --git a/tests/t-option-dry-run/Makefile b/tests/t-option-dry-run/Makefile new file mode 100644 index 0000000..b534a41 --- /dev/null +++ b/tests/t-option-dry-run/Makefile @@ -0,0 +1,32 @@ +TESTS_DEB := pkg-normal + +include ../Test.mk + +test-case: + # Make sure the package is not there + $(DPKG_PURGE) pkg-normal + + # Simulate unpacking a package + $(DPKG_UNPACK) --dry-run pkg-normal.deb + $(call pkg_is_not_installed,pkg-normal) + $(DPKG_INSTALL) --dry-run pkg-normal.deb + $(call pkg_is_not_installed,pkg-normal) + + $(DPKG_UNPACK) pkg-normal.deb + + # Simulate configuring a package + $(DPKG_CONFIGURE) --dry-run pkg-normal + $(call pkg_status_is,pkg-normal,install ok unpacked) + + $(DPKG_CONFIGURE) pkg-normal + + # Simulate removing and purging a package + $(DPKG_REMOVE) --dry-run pkg-normal + $(call pkg_is_installed,pkg-normal) + $(DPKG_PURGE) --dry-run pkg-normal + $(call pkg_is_installed,pkg-normal) + + # XXX: Complete + +test-clean: + $(DPKG_PURGE) pkg-normal diff --git a/tests/t-option-dry-run/pkg-normal/DEBIAN/control b/tests/t-option-dry-run/pkg-normal/DEBIAN/control new file mode 100644 index 0000000..09e51b2 --- /dev/null +++ b/tests/t-option-dry-run/pkg-normal/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-normal +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - normal + diff --git a/tests/t-option-recursive/Makefile b/tests/t-option-recursive/Makefile new file mode 100644 index 0000000..c0108ed --- /dev/null +++ b/tests/t-option-recursive/Makefile @@ -0,0 +1,25 @@ +TESTS_DEB := dir-a/pkg-a dir-b/dir-bb/pkg-b pkg-c + +include ../Test.mk + +test-case: + # Try recursive directory unpacking of packages + $(DPKG_INSTALL) -R . + $(call pkg_is_unpacked,pkg-a) + $(call pkg_is_unpacked,pkg-b) + $(call pkg_is_unpacked,pkg-c) + + $(DPKG_PURGE) pkg-a + $(DPKG_PURGE) pkg-b + $(DPKG_PURGE) pkg-c + + # Try recursive directory installation of packages + $(DPKG_INSTALL) -R . + $(call pkg_is_installed,pkg-a) + $(call pkg_is_installed,pkg-b) + $(call pkg_is_installed,pkg-c) + +test-clean: + $(DPKG_PURGE) pkg-a + $(DPKG_PURGE) pkg-b + $(DPKG_PURGE) pkg-c diff --git a/tests/t-option-recursive/dir-a/pkg-a/DEBIAN/control b/tests/t-option-recursive/dir-a/pkg-a/DEBIAN/control new file mode 100644 index 0000000..af9ae1a --- /dev/null +++ b/tests/t-option-recursive/dir-a/pkg-a/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-a +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - normal diff --git a/tests/t-option-recursive/dir-b/dir-bb/pkg-b/DEBIAN/control b/tests/t-option-recursive/dir-b/dir-bb/pkg-b/DEBIAN/control new file mode 100644 index 0000000..e70151f --- /dev/null +++ b/tests/t-option-recursive/dir-b/dir-bb/pkg-b/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-b +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - normal diff --git a/tests/t-option-recursive/pkg-c/DEBIAN/control b/tests/t-option-recursive/pkg-c/DEBIAN/control new file mode 100644 index 0000000..2ae6c72 --- /dev/null +++ b/tests/t-option-recursive/pkg-c/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-c +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - normal diff --git a/tests/t-predepends-no-triggers/Makefile b/tests/t-predepends-no-triggers/Makefile new file mode 100644 index 0000000..962cf93 --- /dev/null +++ b/tests/t-predepends-no-triggers/Makefile @@ -0,0 +1,28 @@ +TESTS_DEB := pkg-real pkg-predepends pkg-trigger + +include ../Test.mk + +test-case: + # Install the file trigger + $(DPKG_INSTALL) pkg-trigger.deb + # Install the pre-dependency with --no-triggers + $(DPKG_INSTALL) --no-triggers pkg-real.deb + $(call pkg_status_is,pkg-real,install ok triggers-awaited) + # Should pass even if not yet configured... + $(DPKG_UNPACK) --no-triggers pkg-predepends.deb + # ...by running the required triggers + $(call pkg_status_is,pkg-real,install ok installed) + # Retry again, this time the trigger processing is not required + # because pkg-real has already been configured once + $(DPKG_PURGE) pkg-predepends + $(DPKG_INSTALL) --no-triggers pkg-real.deb + $(call pkg_status_is,pkg-real,install ok triggers-awaited) + $(DPKG_UNPACK) --no-triggers pkg-predepends.deb + $(call pkg_status_is,pkg-real,install ok triggers-awaited) + # Cleanup + $(DPKG_PURGE) pkg-predepends + $(DPKG_PURGE) pkg-real + $(DPKG_PURGE) pkg-trigger + +test-clean: + -$(DPKG_PURGE) pkg-predepends pkg-real pkg-trigger diff --git a/tests/t-predepends-no-triggers/pkg-predepends/DEBIAN/control b/tests/t-predepends-no-triggers/pkg-predepends/DEBIAN/control new file mode 100644 index 0000000..33b5450 --- /dev/null +++ b/tests/t-predepends-no-triggers/pkg-predepends/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-predepends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Pre-Depends: pkg-real +Description: test package - package pre-depending on a real package diff --git a/tests/t-predepends-no-triggers/pkg-real/DEBIAN/control b/tests/t-predepends-no-triggers/pkg-real/DEBIAN/control new file mode 100644 index 0000000..9428516 --- /dev/null +++ b/tests/t-predepends-no-triggers/pkg-real/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-real +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - real package to pre-depend on + Contains a file that will activate a trigger. diff --git a/tests/t-predepends-no-triggers/pkg-real/trigger/a-file b/tests/t-predepends-no-triggers/pkg-real/trigger/a-file new file mode 100644 index 0000000..e7ee9ee --- /dev/null +++ b/tests/t-predepends-no-triggers/pkg-real/trigger/a-file @@ -0,0 +1 @@ +Just a file. diff --git a/tests/t-predepends-no-triggers/pkg-trigger/DEBIAN/control b/tests/t-predepends-no-triggers/pkg-trigger/DEBIAN/control new file mode 100644 index 0000000..19519d9 --- /dev/null +++ b/tests/t-predepends-no-triggers/pkg-trigger/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trigger +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - interested in a file trigger on /trigger + Contains a file that will activate a trigger. diff --git a/tests/t-predepends-no-triggers/pkg-trigger/DEBIAN/postinst b/tests/t-predepends-no-triggers/pkg-trigger/DEBIAN/postinst new file mode 100755 index 0000000..c52d3c2 --- /dev/null +++ b/tests/t-predepends-no-triggers/pkg-trigger/DEBIAN/postinst @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 0 diff --git a/tests/t-predepends-no-triggers/pkg-trigger/DEBIAN/triggers b/tests/t-predepends-no-triggers/pkg-trigger/DEBIAN/triggers new file mode 100644 index 0000000..91238aa --- /dev/null +++ b/tests/t-predepends-no-triggers/pkg-trigger/DEBIAN/triggers @@ -0,0 +1 @@ +interest /trigger diff --git a/tests/t-provides-arch-implicit/Makefile b/tests/t-provides-arch-implicit/Makefile new file mode 100644 index 0000000..4b1ffe3 --- /dev/null +++ b/tests/t-provides-arch-implicit/Makefile @@ -0,0 +1,24 @@ +TESTS_DEB := pkg-a pkg-b pkg-dep + +include ../Test.mk + +test-case: + $(DPKG) --add-architecture i386 + $(DPKG) --add-architecture amd64 + $(DPKG_INSTALL) pkg-a.deb + $(DPKG_INSTALL) pkg-b.deb + $(DPKG_INSTALL) pkg-dep.deb + ! $(DPKG_PURGE) pkg-b + $(DPKG_PURGE) pkg-a + $(DPKG_PURGE) pkg-dep + $(DPKG_PURGE) pkg-b + + $(DPKG_INSTALL) pkg-a.deb + ! $(DPKG_INSTALL) pkg-dep.deb + $(DPKG_PURGE) pkg-a + +test-clean: + $(DPKG_PURGE) pkg-dep + $(DPKG_PURGE) pkg-b pkg-b + $(DPKG) --remove-architecture i386 + $(DPKG) --remove-architecture amd64 diff --git a/tests/t-provides-arch-implicit/pkg-a/DEBIAN/control b/tests/t-provides-arch-implicit/pkg-a/DEBIAN/control new file mode 100644 index 0000000..c2cab2e --- /dev/null +++ b/tests/t-provides-arch-implicit/pkg-a/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Provides: pkg-v +Description: test package - provides a virtual package + diff --git a/tests/t-provides-arch-implicit/pkg-b/DEBIAN/control b/tests/t-provides-arch-implicit/pkg-b/DEBIAN/control new file mode 100644 index 0000000..b7446bc --- /dev/null +++ b/tests/t-provides-arch-implicit/pkg-b/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Provides: pkg-v +Description: test package - provides a virtual package + diff --git a/tests/t-provides-arch-implicit/pkg-dep/DEBIAN/control b/tests/t-provides-arch-implicit/pkg-dep/DEBIAN/control new file mode 100644 index 0000000..b0eec43 --- /dev/null +++ b/tests/t-provides-arch-implicit/pkg-dep/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-dep +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Depends: pkg-v +Description: test package - depends on a virtual package + diff --git a/tests/t-provides-arch-qualified/Makefile b/tests/t-provides-arch-qualified/Makefile new file mode 100644 index 0000000..0334b19 --- /dev/null +++ b/tests/t-provides-arch-qualified/Makefile @@ -0,0 +1,16 @@ +TESTS_DEB := pkg-a pkg-b + +include ../Test.mk + +test-case: + $(DPKG) --add-architecture i386 + $(DPKG) --add-architecture amd64 + $(DPKG_INSTALL) pkg-a.deb + # test if the conflicting package fails on install + ! $(DPKG_INSTALL) pkg-b.deb + +test-clean: + $(DPKG_PURGE) pkg-b + $(DPKG_PURGE) pkg-a + $(DPKG) --remove-architecture i386 + $(DPKG) --remove-architecture amd64 diff --git a/tests/t-provides-arch-qualified/pkg-a/DEBIAN/control b/tests/t-provides-arch-qualified/pkg-a/DEBIAN/control new file mode 100644 index 0000000..5b69929 --- /dev/null +++ b/tests/t-provides-arch-qualified/pkg-a/DEBIAN/control @@ -0,0 +1,10 @@ +Package: pkg-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: i386 +Multi-Arch: foreign +Provides: pkg-v:armel +Description: test package - provide an arch-qualified virtual package + diff --git a/tests/t-provides-arch-qualified/pkg-b/DEBIAN/control b/tests/t-provides-arch-qualified/pkg-b/DEBIAN/control new file mode 100644 index 0000000..1fe149d --- /dev/null +++ b/tests/t-provides-arch-qualified/pkg-b/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: amd64 +Depends: pkg-v:mips +Description: test package - unsatisfied virtual + diff --git a/tests/t-provides-self/Makefile b/tests/t-provides-self/Makefile new file mode 100644 index 0000000..caa6886 --- /dev/null +++ b/tests/t-provides-self/Makefile @@ -0,0 +1,281 @@ +TESTS_DEB := \ + pkg-provides pkg-provides-10 pkg-provides-20 pkg-provides-10-20 \ + pkg-depends pkg-depends-eq pkg-depends-le pkg-depends-ge \ + pkg-predepends pkg-predepends-eq pkg-predepends-le pkg-predepends-ge \ + pkg-breaks pkg-breaks-eq pkg-breaks-le pkg-breaks-ge \ + pkg-conflicts pkg-conflicts-eq pkg-conflicts-le pkg-conflicts-ge + +include ../Test.mk + +define PURGE_DEPENDS +$(DPKG_PURGE) pkg-depends +$(DPKG_PURGE) pkg-depends-le +$(DPKG_PURGE) pkg-depends-eq +$(DPKG_PURGE) pkg-depends-ge +endef + +test-depends: + # The provided dependency is not present, fail + ! $(DPKG_INSTALL) pkg-depends.deb + ! $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-le.deb + ! $(DPKG_INSTALL) pkg-depends-ge.deb + + # Install the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + $(DPKG_INSTALL) pkg-depends.deb + ! $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-le.deb + ! $(DPKG_INSTALL) pkg-depends-ge.deb + # Upgrade the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + ! $(DPKG_PURGE) pkg-provides + + $(PURGE_DEPENDS) + + # Install the providing package (pkg-provides 10) + $(DPKG_INSTALL) pkg-provides-10.deb + $(DPKG_INSTALL) pkg-depends.deb + $(DPKG_INSTALL) pkg-depends-le.deb + ! $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-ge.deb + # Upgrade the providing package (pkg-provides 10) + $(DPKG_INSTALL) pkg-provides-10.deb + + $(PURGE_DEPENDS) + + # Install the providing package (pkg-provides 20) + $(DPKG_INSTALL) pkg-provides-20.deb + $(DPKG_INSTALL) pkg-depends.deb + $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-le.deb + $(DPKG_INSTALL) pkg-depends-ge.deb + # Upgrade the providing package (pkg-provides 20) + $(DPKG_INSTALL) pkg-provides-20.deb + + $(PURGE_DEPENDS) + + # Install the providing package (pkg-provides 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + $(DPKG_INSTALL) pkg-depends.deb + $(DPKG_INSTALL) pkg-depends-eq.deb + $(DPKG_INSTALL) pkg-depends-le.deb + $(DPKG_INSTALL) pkg-depends-ge.deb + # Upgrade the providing package (pkg-provides 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + + $(PURGE_DEPENDS) + + # The provided dependency is removed, pass + $(DPKG_PURGE) pkg-provides + +define PURGE_PREDEPENDS +$(DPKG_PURGE) pkg-predepends +$(DPKG_PURGE) pkg-predepends-le +$(DPKG_PURGE) pkg-predepends-eq +$(DPKG_PURGE) pkg-predepends-ge +endef + +test-predepends: + # The provided predependency is not present, fail + ! $(DPKG_UNPACK) pkg-predepends.deb + ! $(DPKG_UNPACK) pkg-predepends-eq.deb + ! $(DPKG_UNPACK) pkg-predepends-le.deb + ! $(DPKG_UNPACK) pkg-predepends-ge.deb + + # Install the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + $(DPKG_UNPACK) pkg-predepends.deb + ! $(DPKG_UNPACK) pkg-predepends-eq.deb + ! $(DPKG_UNPACK) pkg-predepends-le.deb + ! $(DPKG_UNPACK) pkg-predepends-ge.deb + # Upgrade the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + ! $(DPKG_PURGE) pkg-provides + + $(PURGE_PREDEPENDS) + + # Install the providing package (pkg-provides 10) + $(DPKG_INSTALL) pkg-provides-10.deb + $(DPKG_UNPACK) pkg-predepends.deb + $(DPKG_UNPACK) pkg-predepends-le.deb + ! $(DPKG_UNPACK) pkg-predepends-eq.deb + ! $(DPKG_UNPACK) pkg-predepends-ge.deb + # Upgrade the providing package (pkg-provides 10) + $(DPKG_INSTALL) pkg-provides-10.deb + + $(PURGE_PREDEPENDS) + + # Install the providing package (pkg-provides 20) + $(DPKG_INSTALL) pkg-provides-20.deb + $(DPKG_UNPACK) pkg-predepends.deb + $(DPKG_UNPACK) pkg-predepends-eq.deb + ! $(DPKG_UNPACK) pkg-predepends-le.deb + $(DPKG_UNPACK) pkg-predepends-ge.deb + # Upgrade the providing package (pkg-provides 20) + $(DPKG_INSTALL) pkg-provides-20.deb + + $(PURGE_PREDEPENDS) + + # Install the providing package (pkg-provides 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + $(DPKG_UNPACK) pkg-predepends.deb + $(DPKG_UNPACK) pkg-predepends-eq.deb + $(DPKG_UNPACK) pkg-predepends-le.deb + $(DPKG_UNPACK) pkg-predepends-ge.deb + # Upgrade the providing package (pkg-provides 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + + $(PURGE_PREDEPENDS) + + # The provided predependency is removed, pass + $(DPKG_PURGE) pkg-provides + +define PURGE_BREAKS +$(DPKG_PURGE) pkg-breaks +$(DPKG_PURGE) pkg-breaks-le +$(DPKG_PURGE) pkg-breaks-eq +$(DPKG_PURGE) pkg-breaks-ge +endef + +test-breaks: + # The provided dependency is not present, pass + $(DPKG_INSTALL) pkg-breaks.deb + $(DPKG_INSTALL) pkg-breaks-eq.deb + $(DPKG_INSTALL) pkg-breaks-le.deb + $(DPKG_INSTALL) pkg-breaks-ge.deb + + $(PURGE_BREAKS) + + # Install the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + ! $(DPKG_INSTALL) pkg-breaks.deb + $(DPKG_INSTALL) pkg-breaks-eq.deb + $(DPKG_INSTALL) pkg-breaks-le.deb + $(DPKG_INSTALL) pkg-breaks-ge.deb + # Upgrade the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + $(DPKG_PURGE) pkg-provides + + $(PURGE_BREAKS) + + # Install the providing package (pkg-provides 10) + $(DPKG_INSTALL) pkg-provides-10.deb + ! $(DPKG_INSTALL) pkg-breaks.deb + ! $(DPKG_INSTALL) pkg-breaks-le.deb + $(DPKG_INSTALL) pkg-breaks-eq.deb + $(DPKG_INSTALL) pkg-breaks-ge.deb + # Upgrade the providing package (pkg-provides 10) + $(DPKG_INSTALL) pkg-provides-10.deb + + $(PURGE_BREAKS) + + # Install the providing package (pkg-provides 20) + $(DPKG_INSTALL) pkg-provides-20.deb + ! $(DPKG_INSTALL) pkg-breaks.deb + ! $(DPKG_INSTALL) pkg-breaks-eq.deb + $(DPKG_INSTALL) pkg-breaks-le.deb + ! $(DPKG_INSTALL) pkg-breaks-ge.deb + # Upgrade the providing package (pkg-provides 20) + $(DPKG_INSTALL) pkg-provides-20.deb + + $(PURGE_BREAKS) + + # Install the providing package (pkg-provides 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + ! $(DPKG_INSTALL) pkg-breaks.deb + ! $(DPKG_INSTALL) pkg-breaks-eq.deb + ! $(DPKG_INSTALL) pkg-breaks-le.deb + ! $(DPKG_INSTALL) pkg-breaks-ge.deb + # Upgrade the providing package (pkg-provides 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + + $(PURGE_BREAKS) + + # The provided dependency is removed, pass + $(DPKG_PURGE) pkg-provides + +define PURGE_CONFLICTS +$(DPKG_PURGE) pkg-conflicts +$(DPKG_PURGE) pkg-conflicts-le +$(DPKG_PURGE) pkg-conflicts-eq +$(DPKG_PURGE) pkg-conflicts-ge +endef + +test-conflicts: + # The provided predependency is not present, fail + $(DPKG_UNPACK) pkg-conflicts.deb + $(DPKG_UNPACK) pkg-conflicts-eq.deb + $(DPKG_UNPACK) pkg-conflicts-le.deb + $(DPKG_UNPACK) pkg-conflicts-ge.deb + + $(PURGE_CONFLICTS) + + # Install the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + ! $(DPKG_UNPACK) pkg-conflicts.deb + $(DPKG_UNPACK) pkg-conflicts-eq.deb + $(DPKG_UNPACK) pkg-conflicts-le.deb + $(DPKG_UNPACK) pkg-conflicts-ge.deb + # Upgrade the providing package (pkg-provides versionless) + $(DPKG_INSTALL) pkg-provides.deb + $(DPKG_PURGE) pkg-provides + + $(PURGE_CONFLICTS) + + # Install the providing package (pkg-provides 10) + $(DPKG_INSTALL) pkg-provides-10.deb + ! $(DPKG_UNPACK) pkg-conflicts.deb + ! $(DPKG_UNPACK) pkg-conflicts-le.deb + $(DPKG_UNPACK) pkg-conflicts-eq.deb + $(DPKG_UNPACK) pkg-conflicts-ge.deb + # Upgrade the providing package (pkg-provides 10) + $(DPKG_INSTALL) pkg-provides-10.deb + + $(PURGE_CONFLICTS) + + # Install the providing package (pkg-provides 20) + $(DPKG_INSTALL) pkg-provides-20.deb + ! $(DPKG_UNPACK) pkg-conflicts.deb + ! $(DPKG_UNPACK) pkg-conflicts-eq.deb + $(DPKG_UNPACK) pkg-conflicts-le.deb + ! $(DPKG_UNPACK) pkg-conflicts-ge.deb + # Upgrade the providing package (pkg-provides 20) + $(DPKG_INSTALL) pkg-provides-20.deb + + $(PURGE_CONFLICTS) + + # Install the providing package (pkg-provides 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + ! $(DPKG_UNPACK) pkg-conflicts.deb + ! $(DPKG_UNPACK) pkg-conflicts-eq.deb + ! $(DPKG_UNPACK) pkg-conflicts-le.deb + ! $(DPKG_UNPACK) pkg-conflicts-ge.deb + # Upgrade the providing package (pkg-provides 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + + $(PURGE_CONFLICTS) + + # The provided predependency is removed, pass + $(DPKG_PURGE) pkg-provides + +test-case: test-depends test-predepends test-breaks test-conflicts + +test-clean: + -$(DPKG_PURGE) pkg-depends + -$(DPKG_PURGE) pkg-depends-eq + -$(DPKG_PURGE) pkg-depends-ge + -$(DPKG_PURGE) pkg-depends-le + -$(DPKG_PURGE) pkg-predepends + -$(DPKG_PURGE) pkg-predepends-eq + -$(DPKG_PURGE) pkg-predepends-ge + -$(DPKG_PURGE) pkg-predepends-le + -$(DPKG_PURGE) pkg-breaks + -$(DPKG_PURGE) pkg-breaks-eq + -$(DPKG_PURGE) pkg-breaks-ge + -$(DPKG_PURGE) pkg-breaks-le + -$(DPKG_PURGE) pkg-conflicts + -$(DPKG_PURGE) pkg-conflicts-eq + -$(DPKG_PURGE) pkg-conflicts-ge + -$(DPKG_PURGE) pkg-conflicts-le + -$(DPKG_PURGE) pkg-provides diff --git a/tests/t-provides-self/pkg-breaks-eq/DEBIAN/control b/tests/t-provides-self/pkg-breaks-eq/DEBIAN/control new file mode 100644 index 0000000..b6a6edd --- /dev/null +++ b/tests/t-provides-self/pkg-breaks-eq/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-breaks-eq +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: pkg-provides (= 20) +Description: test package - package breaking on a virtual package diff --git a/tests/t-provides-self/pkg-breaks-ge/DEBIAN/control b/tests/t-provides-self/pkg-breaks-ge/DEBIAN/control new file mode 100644 index 0000000..223d00c --- /dev/null +++ b/tests/t-provides-self/pkg-breaks-ge/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-breaks-ge +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: pkg-provides (>= 20) +Description: test package - package breaking on a virtual package diff --git a/tests/t-provides-self/pkg-breaks-le/DEBIAN/control b/tests/t-provides-self/pkg-breaks-le/DEBIAN/control new file mode 100644 index 0000000..3326245 --- /dev/null +++ b/tests/t-provides-self/pkg-breaks-le/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-breaks-le +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: pkg-provides (<= 10) +Description: test package - package breaking on a virtual package diff --git a/tests/t-provides-self/pkg-breaks/DEBIAN/control b/tests/t-provides-self/pkg-breaks/DEBIAN/control new file mode 100644 index 0000000..188486f --- /dev/null +++ b/tests/t-provides-self/pkg-breaks/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-breaks +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: pkg-provides +Description: test package - package breaking on a virtual package diff --git a/tests/t-provides-self/pkg-conflicts-eq/DEBIAN/control b/tests/t-provides-self/pkg-conflicts-eq/DEBIAN/control new file mode 100644 index 0000000..0ad703c --- /dev/null +++ b/tests/t-provides-self/pkg-conflicts-eq/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conflicts-eq +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-provides (= 20) +Description: test package - package conflicting on a virtual package diff --git a/tests/t-provides-self/pkg-conflicts-ge/DEBIAN/control b/tests/t-provides-self/pkg-conflicts-ge/DEBIAN/control new file mode 100644 index 0000000..cccc1d0 --- /dev/null +++ b/tests/t-provides-self/pkg-conflicts-ge/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conflicts-ge +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-provides (>= 20) +Description: test package - package conflicting on a virtual package diff --git a/tests/t-provides-self/pkg-conflicts-le/DEBIAN/control b/tests/t-provides-self/pkg-conflicts-le/DEBIAN/control new file mode 100644 index 0000000..e34a5c0 --- /dev/null +++ b/tests/t-provides-self/pkg-conflicts-le/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conflicts-le +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-provides (<= 10) +Description: test package - package conflicting on a virtual package diff --git a/tests/t-provides-self/pkg-conflicts/DEBIAN/control b/tests/t-provides-self/pkg-conflicts/DEBIAN/control new file mode 100644 index 0000000..90efe2b --- /dev/null +++ b/tests/t-provides-self/pkg-conflicts/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conflicts +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-provides +Description: test package - package conflicting on a virtual package diff --git a/tests/t-provides-self/pkg-depends-eq/DEBIAN/control b/tests/t-provides-self/pkg-depends-eq/DEBIAN/control new file mode 100644 index 0000000..2266b03 --- /dev/null +++ b/tests/t-provides-self/pkg-depends-eq/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-eq +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-provides (= 20) +Description: test package - package depending on a virtual package diff --git a/tests/t-provides-self/pkg-depends-ge/DEBIAN/control b/tests/t-provides-self/pkg-depends-ge/DEBIAN/control new file mode 100644 index 0000000..60867d6 --- /dev/null +++ b/tests/t-provides-self/pkg-depends-ge/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-ge +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-provides (>= 20) +Description: test package - package depending on a virtual package diff --git a/tests/t-provides-self/pkg-depends-le/DEBIAN/control b/tests/t-provides-self/pkg-depends-le/DEBIAN/control new file mode 100644 index 0000000..45136eb --- /dev/null +++ b/tests/t-provides-self/pkg-depends-le/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-le +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-provides (<= 10) +Description: test package - package depending on a virtual package diff --git a/tests/t-provides-self/pkg-depends/DEBIAN/control b/tests/t-provides-self/pkg-depends/DEBIAN/control new file mode 100644 index 0000000..d07cc45 --- /dev/null +++ b/tests/t-provides-self/pkg-depends/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-provides +Description: test package - package depending on a virtual package diff --git a/tests/t-provides-self/pkg-predepends-eq/DEBIAN/control b/tests/t-provides-self/pkg-predepends-eq/DEBIAN/control new file mode 100644 index 0000000..11e7a0a --- /dev/null +++ b/tests/t-provides-self/pkg-predepends-eq/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-predepends-eq +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Pre-Depends: pkg-provides (= 20) +Description: test package - package pre-depending on a virtual package diff --git a/tests/t-provides-self/pkg-predepends-ge/DEBIAN/control b/tests/t-provides-self/pkg-predepends-ge/DEBIAN/control new file mode 100644 index 0000000..ff8d720 --- /dev/null +++ b/tests/t-provides-self/pkg-predepends-ge/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-predepends-ge +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Pre-Depends: pkg-provides (>= 20) +Description: test package - package pre-depending on a virtual package diff --git a/tests/t-provides-self/pkg-predepends-le/DEBIAN/control b/tests/t-provides-self/pkg-predepends-le/DEBIAN/control new file mode 100644 index 0000000..b7df6fb --- /dev/null +++ b/tests/t-provides-self/pkg-predepends-le/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-predepends-le +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Pre-Depends: pkg-provides (<= 10) +Description: test package - package pre-depending on a virtual package diff --git a/tests/t-provides-self/pkg-predepends/DEBIAN/control b/tests/t-provides-self/pkg-predepends/DEBIAN/control new file mode 100644 index 0000000..8423965 --- /dev/null +++ b/tests/t-provides-self/pkg-predepends/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-predepends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Pre-Depends: pkg-provides +Description: test package - package pre-depending on a virtual package diff --git a/tests/t-provides-self/pkg-provides-10-20/DEBIAN/control b/tests/t-provides-self/pkg-provides-10-20/DEBIAN/control new file mode 100644 index 0000000..37dbe97 --- /dev/null +++ b/tests/t-provides-self/pkg-provides-10-20/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-provides +Version: 10 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-provides (= 20) +Description: test package - package providing a versioned virtual package diff --git a/tests/t-provides-self/pkg-provides-10/DEBIAN/control b/tests/t-provides-self/pkg-provides-10/DEBIAN/control new file mode 100644 index 0000000..5fa91ae --- /dev/null +++ b/tests/t-provides-self/pkg-provides-10/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-provides +Version: 10 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-provides (= 10) +Description: test package - package providing a versioned virtual package diff --git a/tests/t-provides-self/pkg-provides-20/DEBIAN/control b/tests/t-provides-self/pkg-provides-20/DEBIAN/control new file mode 100644 index 0000000..3c94af2 --- /dev/null +++ b/tests/t-provides-self/pkg-provides-20/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-provides +Version: 20 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-provides (= 20) +Description: test package - package providing a versioned virtual package diff --git a/tests/t-provides-self/pkg-provides/DEBIAN/control b/tests/t-provides-self/pkg-provides/DEBIAN/control new file mode 100644 index 0000000..865b72a --- /dev/null +++ b/tests/t-provides-self/pkg-provides/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-provides +Version: 15 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-provides +Description: test package - package providing a virtual package diff --git a/tests/t-provides/Makefile b/tests/t-provides/Makefile new file mode 100644 index 0000000..6794c20 --- /dev/null +++ b/tests/t-provides/Makefile @@ -0,0 +1,307 @@ +TESTS_DEB := \ + pkg-provides pkg-provides-10 pkg-provides-20 pkg-provides-10-20 \ + pkg-depends pkg-depends-eq pkg-depends-le pkg-depends-ge \ + pkg-predepends pkg-predepends-eq pkg-predepends-le pkg-predepends-ge \ + pkg-breaks pkg-breaks-eq pkg-breaks-le pkg-breaks-ge \ + pkg-conflicts pkg-conflicts-eq pkg-conflicts-le pkg-conflicts-ge \ + pkg-a-depends-ge-lt pkg-b-provides-10 pkg-c-provides-20 + +include ../Test.mk + +define PURGE_DEPENDS +$(DPKG_PURGE) pkg-depends +$(DPKG_PURGE) pkg-depends-le +$(DPKG_PURGE) pkg-depends-eq +$(DPKG_PURGE) pkg-depends-ge +endef + +test-depends: + # The provided dependency is not present, fail + ! $(DPKG_INSTALL) pkg-depends.deb + ! $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-le.deb + ! $(DPKG_INSTALL) pkg-depends-ge.deb + + # Install the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + $(DPKG_INSTALL) pkg-depends.deb + ! $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-le.deb + ! $(DPKG_INSTALL) pkg-depends-ge.deb + # Upgrade the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + ! $(DPKG_PURGE) pkg-provides + + $(PURGE_DEPENDS) + + # Install the providing package (pkg-virtual 10) + $(DPKG_INSTALL) pkg-provides-10.deb + $(DPKG_INSTALL) pkg-depends.deb + $(DPKG_INSTALL) pkg-depends-le.deb + ! $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-ge.deb + # Upgrade the providing package (pkg-virtual 10) + $(DPKG_INSTALL) pkg-provides-10.deb + + $(PURGE_DEPENDS) + + # Install the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-provides-20.deb + $(DPKG_INSTALL) pkg-depends.deb + $(DPKG_INSTALL) pkg-depends-eq.deb + ! $(DPKG_INSTALL) pkg-depends-le.deb + $(DPKG_INSTALL) pkg-depends-ge.deb + # Upgrade the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-provides-20.deb + + $(PURGE_DEPENDS) + + # Install the providing package (pkg-virtual 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + $(DPKG_INSTALL) pkg-depends.deb + $(DPKG_INSTALL) pkg-depends-eq.deb + $(DPKG_INSTALL) pkg-depends-le.deb + $(DPKG_INSTALL) pkg-depends-ge.deb + # Upgrade the providing package (pkg-virtual 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + + $(PURGE_DEPENDS) + + $(DPKG_PURGE) pkg-provides + + # Install the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-c-provides-20.deb + ! $(DPKG_INSTALL) pkg-a-depends-ge-lt.deb + $(DPKG_PURGE) pkg-a-depends-ge-lt + $(DPKG_PURGE) pkg-c-provides + + # Install the providing package (pkg-virtual 10) + $(DPKG_INSTALL) pkg-b-provides-10.deb + $(DPKG_INSTALL) pkg-a-depends-ge-lt.deb + # Install the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-c-provides-20.deb + + # Cannot purge the only package satisfying the dependency + ! $(DPKG_PURGE) pkg-b-provides + # Can purge package not satisfying the dependency + $(DPKG_PURGE) pkg-c-provides + + $(DPKG_PURGE) pkg-a-depends-ge-lt + $(DPKG_PURGE) pkg-b-provides + + # The provided dependency is removed, pass + $(DPKG_PURGE) pkg-provides + +define PURGE_PREDEPENDS +$(DPKG_PURGE) pkg-predepends +$(DPKG_PURGE) pkg-predepends-le +$(DPKG_PURGE) pkg-predepends-eq +$(DPKG_PURGE) pkg-predepends-ge +endef + +test-predepends: + # The provided predependency is not present, fail + ! $(DPKG_UNPACK) pkg-predepends.deb + ! $(DPKG_UNPACK) pkg-predepends-eq.deb + ! $(DPKG_UNPACK) pkg-predepends-le.deb + ! $(DPKG_UNPACK) pkg-predepends-ge.deb + + # Install the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + $(DPKG_UNPACK) pkg-predepends.deb + ! $(DPKG_UNPACK) pkg-predepends-eq.deb + ! $(DPKG_UNPACK) pkg-predepends-le.deb + ! $(DPKG_UNPACK) pkg-predepends-ge.deb + # Upgrade the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + ! $(DPKG_PURGE) pkg-provides + + $(PURGE_PREDEPENDS) + + # Install the providing package (pkg-virtual 10) + $(DPKG_INSTALL) pkg-provides-10.deb + $(DPKG_UNPACK) pkg-predepends.deb + $(DPKG_UNPACK) pkg-predepends-le.deb + ! $(DPKG_UNPACK) pkg-predepends-eq.deb + ! $(DPKG_UNPACK) pkg-predepends-ge.deb + # Upgrade the providing package (pkg-virtual 10) + $(DPKG_INSTALL) pkg-provides-10.deb + + $(PURGE_PREDEPENDS) + + # Install the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-provides-20.deb + $(DPKG_UNPACK) pkg-predepends.deb + $(DPKG_UNPACK) pkg-predepends-eq.deb + ! $(DPKG_UNPACK) pkg-predepends-le.deb + $(DPKG_UNPACK) pkg-predepends-ge.deb + # Upgrade the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-provides-20.deb + + $(PURGE_PREDEPENDS) + + # Install the providing package (pkg-virtual 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + $(DPKG_UNPACK) pkg-predepends.deb + $(DPKG_UNPACK) pkg-predepends-eq.deb + $(DPKG_UNPACK) pkg-predepends-le.deb + $(DPKG_UNPACK) pkg-predepends-ge.deb + # Upgrade the providing package (pkg-virtual 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + + $(PURGE_PREDEPENDS) + + # The provided predependency is removed, pass + $(DPKG_PURGE) pkg-provides + +define PURGE_BREAKS +$(DPKG_PURGE) pkg-breaks +$(DPKG_PURGE) pkg-breaks-le +$(DPKG_PURGE) pkg-breaks-eq +$(DPKG_PURGE) pkg-breaks-ge +endef + +test-breaks: + # The provided dependency is not present, pass + $(DPKG_INSTALL) pkg-breaks.deb + $(DPKG_INSTALL) pkg-breaks-eq.deb + $(DPKG_INSTALL) pkg-breaks-le.deb + $(DPKG_INSTALL) pkg-breaks-ge.deb + + $(PURGE_BREAKS) + + # Install the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + ! $(DPKG_INSTALL) pkg-breaks.deb + $(DPKG_INSTALL) pkg-breaks-eq.deb + $(DPKG_INSTALL) pkg-breaks-le.deb + $(DPKG_INSTALL) pkg-breaks-ge.deb + # Upgrade the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + $(DPKG_PURGE) pkg-provides + + $(PURGE_BREAKS) + + # Install the providing package (pkg-virtual 10) + $(DPKG_INSTALL) pkg-provides-10.deb + ! $(DPKG_INSTALL) pkg-breaks.deb + ! $(DPKG_INSTALL) pkg-breaks-le.deb + $(DPKG_INSTALL) pkg-breaks-eq.deb + $(DPKG_INSTALL) pkg-breaks-ge.deb + # Upgrade the providing package (pkg-virtual 10) + $(DPKG_INSTALL) pkg-provides-10.deb + + $(PURGE_BREAKS) + + # Install the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-provides-20.deb + ! $(DPKG_INSTALL) pkg-breaks.deb + ! $(DPKG_INSTALL) pkg-breaks-eq.deb + $(DPKG_INSTALL) pkg-breaks-le.deb + ! $(DPKG_INSTALL) pkg-breaks-ge.deb + # Upgrade the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-provides-20.deb + + $(PURGE_BREAKS) + + # Install the providing package (pkg-virtual 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + ! $(DPKG_INSTALL) pkg-breaks.deb + ! $(DPKG_INSTALL) pkg-breaks-eq.deb + ! $(DPKG_INSTALL) pkg-breaks-le.deb + ! $(DPKG_INSTALL) pkg-breaks-ge.deb + # Upgrade the providing package (pkg-virtual 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + + $(PURGE_BREAKS) + + # The provided dependency is removed, pass + $(DPKG_PURGE) pkg-provides + +define PURGE_CONFLICTS +$(DPKG_PURGE) pkg-conflicts +$(DPKG_PURGE) pkg-conflicts-le +$(DPKG_PURGE) pkg-conflicts-eq +$(DPKG_PURGE) pkg-conflicts-ge +endef + +test-conflicts: + # The provided predependency is not present, fail + $(DPKG_UNPACK) pkg-conflicts.deb + $(DPKG_UNPACK) pkg-conflicts-eq.deb + $(DPKG_UNPACK) pkg-conflicts-le.deb + $(DPKG_UNPACK) pkg-conflicts-ge.deb + + $(PURGE_CONFLICTS) + + # Install the providing package (versionless) + $(DPKG_INSTALL) pkg-provides.deb + ! $(DPKG_UNPACK) pkg-conflicts.deb + $(DPKG_UNPACK) pkg-conflicts-eq.deb + $(DPKG_UNPACK) pkg-conflicts-le.deb + $(DPKG_UNPACK) pkg-conflicts-ge.deb + # Upgrade the providing package (pkg-virtual versionless) + $(DPKG_INSTALL) pkg-provides.deb + $(DPKG_PURGE) pkg-provides + + $(PURGE_CONFLICTS) + + # Install the providing package (pkg-virtual 10) + $(DPKG_INSTALL) pkg-provides-10.deb + ! $(DPKG_UNPACK) pkg-conflicts.deb + ! $(DPKG_UNPACK) pkg-conflicts-le.deb + $(DPKG_UNPACK) pkg-conflicts-eq.deb + $(DPKG_UNPACK) pkg-conflicts-ge.deb + # Upgrade the providing package (pkg-virtual 10) + $(DPKG_INSTALL) pkg-provides-10.deb + + $(PURGE_CONFLICTS) + + # Install the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-provides-20.deb + ! $(DPKG_UNPACK) pkg-conflicts.deb + ! $(DPKG_UNPACK) pkg-conflicts-eq.deb + $(DPKG_UNPACK) pkg-conflicts-le.deb + ! $(DPKG_UNPACK) pkg-conflicts-ge.deb + # Upgrade the providing package (pkg-virtual 20) + $(DPKG_INSTALL) pkg-provides-20.deb + + $(PURGE_CONFLICTS) + + # Install the providing package (pkg-virtual 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + ! $(DPKG_UNPACK) pkg-conflicts.deb + ! $(DPKG_UNPACK) pkg-conflicts-eq.deb + ! $(DPKG_UNPACK) pkg-conflicts-le.deb + ! $(DPKG_UNPACK) pkg-conflicts-ge.deb + # Upgrade the providing package (pkg-virtual 10 && 20) + $(DPKG_INSTALL) pkg-provides-10-20.deb + + $(PURGE_CONFLICTS) + + # The provided predependency is removed, pass + $(DPKG_PURGE) pkg-provides + +test-case: test-depends test-predepends test-breaks test-conflicts + +test-clean: + -$(DPKG_PURGE) pkg-depends + -$(DPKG_PURGE) pkg-depends-eq + -$(DPKG_PURGE) pkg-depends-ge + -$(DPKG_PURGE) pkg-depends-le + -$(DPKG_PURGE) pkg-predepends + -$(DPKG_PURGE) pkg-predepends-eq + -$(DPKG_PURGE) pkg-predepends-ge + -$(DPKG_PURGE) pkg-predepends-le + -$(DPKG_PURGE) pkg-breaks + -$(DPKG_PURGE) pkg-breaks-eq + -$(DPKG_PURGE) pkg-breaks-ge + -$(DPKG_PURGE) pkg-breaks-le + -$(DPKG_PURGE) pkg-conflicts + -$(DPKG_PURGE) pkg-conflicts-eq + -$(DPKG_PURGE) pkg-conflicts-ge + -$(DPKG_PURGE) pkg-conflicts-le + -$(DPKG_PURGE) pkg-provides + -$(DPKG_PURGE) pkg-a-depends-ge-lt + -$(DPKG_PURGE) pkg-b-provides + -$(DPKG_PURGE) pkg-c-provides diff --git a/tests/t-provides/pkg-a-depends-ge-lt/DEBIAN/control b/tests/t-provides/pkg-a-depends-ge-lt/DEBIAN/control new file mode 100644 index 0000000..77cc4b0 --- /dev/null +++ b/tests/t-provides/pkg-a-depends-ge-lt/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-a-depends-ge-lt +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-virtual (>= 10), pkg-virtual (<< 20) +Description: test package - package depending on a virtual package diff --git a/tests/t-provides/pkg-b-provides-10/DEBIAN/control b/tests/t-provides/pkg-b-provides-10/DEBIAN/control new file mode 100644 index 0000000..105d44c --- /dev/null +++ b/tests/t-provides/pkg-b-provides-10/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-b-provides +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-virtual (= 10) +Description: test package - package providing a versioned virtual package diff --git a/tests/t-provides/pkg-breaks-eq/DEBIAN/control b/tests/t-provides/pkg-breaks-eq/DEBIAN/control new file mode 100644 index 0000000..67d20b1 --- /dev/null +++ b/tests/t-provides/pkg-breaks-eq/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-breaks-eq +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: pkg-virtual (= 20) +Description: test package - package breaking on a virtual package diff --git a/tests/t-provides/pkg-breaks-ge/DEBIAN/control b/tests/t-provides/pkg-breaks-ge/DEBIAN/control new file mode 100644 index 0000000..33caed5 --- /dev/null +++ b/tests/t-provides/pkg-breaks-ge/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-breaks-ge +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: pkg-virtual (>= 20) +Description: test package - package breaking on a virtual package diff --git a/tests/t-provides/pkg-breaks-le/DEBIAN/control b/tests/t-provides/pkg-breaks-le/DEBIAN/control new file mode 100644 index 0000000..05152e2 --- /dev/null +++ b/tests/t-provides/pkg-breaks-le/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-breaks-le +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: pkg-virtual (<= 10) +Description: test package - package breaking on a virtual package diff --git a/tests/t-provides/pkg-breaks/DEBIAN/control b/tests/t-provides/pkg-breaks/DEBIAN/control new file mode 100644 index 0000000..6857392 --- /dev/null +++ b/tests/t-provides/pkg-breaks/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-breaks +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: pkg-virtual +Description: test package - package breaking on a virtual package diff --git a/tests/t-provides/pkg-c-provides-20/DEBIAN/control b/tests/t-provides/pkg-c-provides-20/DEBIAN/control new file mode 100644 index 0000000..a69d26a --- /dev/null +++ b/tests/t-provides/pkg-c-provides-20/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-c-provides +Version: 2 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-virtual (= 20) +Description: test package - package providing a versioned virtual package diff --git a/tests/t-provides/pkg-conflicts-eq/DEBIAN/control b/tests/t-provides/pkg-conflicts-eq/DEBIAN/control new file mode 100644 index 0000000..ca077d1 --- /dev/null +++ b/tests/t-provides/pkg-conflicts-eq/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conflicts-eq +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-virtual (= 20) +Description: test package - package conflicting on a virtual package diff --git a/tests/t-provides/pkg-conflicts-ge/DEBIAN/control b/tests/t-provides/pkg-conflicts-ge/DEBIAN/control new file mode 100644 index 0000000..d93415f --- /dev/null +++ b/tests/t-provides/pkg-conflicts-ge/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conflicts-ge +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-virtual (>= 20) +Description: test package - package conflicting on a virtual package diff --git a/tests/t-provides/pkg-conflicts-le/DEBIAN/control b/tests/t-provides/pkg-conflicts-le/DEBIAN/control new file mode 100644 index 0000000..4f62226 --- /dev/null +++ b/tests/t-provides/pkg-conflicts-le/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conflicts-le +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-virtual (<= 10) +Description: test package - package conflicting on a virtual package diff --git a/tests/t-provides/pkg-conflicts/DEBIAN/control b/tests/t-provides/pkg-conflicts/DEBIAN/control new file mode 100644 index 0000000..1b03248 --- /dev/null +++ b/tests/t-provides/pkg-conflicts/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-conflicts +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Conflicts: pkg-virtual +Description: test package - package conflicting on a virtual package diff --git a/tests/t-provides/pkg-depends-eq/DEBIAN/control b/tests/t-provides/pkg-depends-eq/DEBIAN/control new file mode 100644 index 0000000..b0c1bc5 --- /dev/null +++ b/tests/t-provides/pkg-depends-eq/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-eq +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-virtual (= 20) +Description: test package - package depending on a virtual package diff --git a/tests/t-provides/pkg-depends-ge/DEBIAN/control b/tests/t-provides/pkg-depends-ge/DEBIAN/control new file mode 100644 index 0000000..7c874a4 --- /dev/null +++ b/tests/t-provides/pkg-depends-ge/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-ge +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-virtual (>= 20) +Description: test package - package depending on a virtual package diff --git a/tests/t-provides/pkg-depends-le/DEBIAN/control b/tests/t-provides/pkg-depends-le/DEBIAN/control new file mode 100644 index 0000000..706c086 --- /dev/null +++ b/tests/t-provides/pkg-depends-le/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-le +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-virtual (<= 10) +Description: test package - package depending on a virtual package diff --git a/tests/t-provides/pkg-depends/DEBIAN/control b/tests/t-provides/pkg-depends/DEBIAN/control new file mode 100644 index 0000000..57572b8 --- /dev/null +++ b/tests/t-provides/pkg-depends/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-virtual +Description: test package - package depending on a virtual package diff --git a/tests/t-provides/pkg-predepends-eq/DEBIAN/control b/tests/t-provides/pkg-predepends-eq/DEBIAN/control new file mode 100644 index 0000000..25b1b46 --- /dev/null +++ b/tests/t-provides/pkg-predepends-eq/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-predepends-eq +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Pre-Depends: pkg-virtual (= 20) +Description: test package - package pre-depending on a virtual package diff --git a/tests/t-provides/pkg-predepends-ge/DEBIAN/control b/tests/t-provides/pkg-predepends-ge/DEBIAN/control new file mode 100644 index 0000000..65d155f --- /dev/null +++ b/tests/t-provides/pkg-predepends-ge/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-predepends-ge +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Pre-Depends: pkg-virtual (>= 20) +Description: test package - package pre-depending on a virtual package diff --git a/tests/t-provides/pkg-predepends-le/DEBIAN/control b/tests/t-provides/pkg-predepends-le/DEBIAN/control new file mode 100644 index 0000000..d95d89b --- /dev/null +++ b/tests/t-provides/pkg-predepends-le/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-predepends-le +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Pre-Depends: pkg-virtual (<= 10) +Description: test package - package pre-depending on a virtual package diff --git a/tests/t-provides/pkg-predepends/DEBIAN/control b/tests/t-provides/pkg-predepends/DEBIAN/control new file mode 100644 index 0000000..ca1df84 --- /dev/null +++ b/tests/t-provides/pkg-predepends/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-predepends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Pre-Depends: pkg-virtual +Description: test package - package pre-depending on a virtual package diff --git a/tests/t-provides/pkg-provides-10-20/DEBIAN/control b/tests/t-provides/pkg-provides-10-20/DEBIAN/control new file mode 100644 index 0000000..ac83a68 --- /dev/null +++ b/tests/t-provides/pkg-provides-10-20/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-provides +Version: 3 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-virtual (= 10), pkg-virtual (= 20) +Description: test package - package providing a versioned virtual package diff --git a/tests/t-provides/pkg-provides-10/DEBIAN/control b/tests/t-provides/pkg-provides-10/DEBIAN/control new file mode 100644 index 0000000..d4014e3 --- /dev/null +++ b/tests/t-provides/pkg-provides-10/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-provides +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-virtual (= 10) +Description: test package - package providing a versioned virtual package diff --git a/tests/t-provides/pkg-provides-20/DEBIAN/control b/tests/t-provides/pkg-provides-20/DEBIAN/control new file mode 100644 index 0000000..f923647 --- /dev/null +++ b/tests/t-provides/pkg-provides-20/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-provides +Version: 2 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-virtual (= 20) +Description: test package - package providing a versioned virtual package diff --git a/tests/t-provides/pkg-provides/DEBIAN/control b/tests/t-provides/pkg-provides/DEBIAN/control new file mode 100644 index 0000000..10f4932 --- /dev/null +++ b/tests/t-provides/pkg-provides/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-provides +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Provides: pkg-virtual +Description: test package - package providing a virtual package diff --git a/tests/t-queue-process-deconf-dupe/Makefile b/tests/t-queue-process-deconf-dupe/Makefile new file mode 100644 index 0000000..4524936 --- /dev/null +++ b/tests/t-queue-process-deconf-dupe/Makefile @@ -0,0 +1,12 @@ +TESTS_DEB := pkg-a-0 pkg-a-1 pkg-b + +include ../Test.mk + +DPKG_OPTIONS += --auto-deconfigure + +test-case: + $(DPKG_INSTALL) pkg-a-0.deb + $(DPKG_INSTALL) pkg-b.deb pkg-a-1.deb + +test-clean: + $(DPKG_PURGE) pkg-b pkg-a diff --git a/tests/t-queue-process-deconf-dupe/pkg-a-0/DEBIAN/control b/tests/t-queue-process-deconf-dupe/pkg-a-0/DEBIAN/control new file mode 100644 index 0000000..7559bbe --- /dev/null +++ b/tests/t-queue-process-deconf-dupe/pkg-a-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - broken package diff --git a/tests/t-queue-process-deconf-dupe/pkg-a-0/test-a b/tests/t-queue-process-deconf-dupe/pkg-a-0/test-a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-queue-process-deconf-dupe/pkg-a-0/test-a diff --git a/tests/t-queue-process-deconf-dupe/pkg-a-0/test-move b/tests/t-queue-process-deconf-dupe/pkg-a-0/test-move new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-queue-process-deconf-dupe/pkg-a-0/test-move diff --git a/tests/t-queue-process-deconf-dupe/pkg-a-1/DEBIAN/control b/tests/t-queue-process-deconf-dupe/pkg-a-1/DEBIAN/control new file mode 100644 index 0000000..f14ed79 --- /dev/null +++ b/tests/t-queue-process-deconf-dupe/pkg-a-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-a +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - broken package diff --git a/tests/t-queue-process-deconf-dupe/pkg-a-1/test-a b/tests/t-queue-process-deconf-dupe/pkg-a-1/test-a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-queue-process-deconf-dupe/pkg-a-1/test-a diff --git a/tests/t-queue-process-deconf-dupe/pkg-b/DEBIAN/control b/tests/t-queue-process-deconf-dupe/pkg-b/DEBIAN/control new file mode 100644 index 0000000..11fe204 --- /dev/null +++ b/tests/t-queue-process-deconf-dupe/pkg-b/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Breaks: pkg-a (<< 1) +Replaces: pkg-a (<< 1) +Description: test package - breaking package diff --git a/tests/t-queue-process-deconf-dupe/pkg-b/test-b b/tests/t-queue-process-deconf-dupe/pkg-b/test-b new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-queue-process-deconf-dupe/pkg-b/test-b diff --git a/tests/t-queue-process-deconf-dupe/pkg-b/test-move b/tests/t-queue-process-deconf-dupe/pkg-b/test-move new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-queue-process-deconf-dupe/pkg-b/test-move diff --git a/tests/t-switch-dir-to-symlink-abs/Makefile b/tests/t-switch-dir-to-symlink-abs/Makefile new file mode 100644 index 0000000..e285cfd --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/Makefile @@ -0,0 +1,146 @@ +TESTS_DEB := \ + pkg-dir-conffile-0 pkg-dir-conffile-1 \ + pkg-dir-file-other pkg-dir-symlink-int-0 pkg-dir-symlink-int-1 \ + pkg-dir-file-moved pkg-dir-symlink-ext-0 pkg-dir-symlink-ext-1 + +include ../Test.mk + +build-hook: + ln -sf test-dir pkg-dir-conffile-1/test-path + ln -sf test-dir pkg-dir-symlink-ext-1/test-path + ln -sf test-dir pkg-dir-symlink-int-1/test-path + +clean-hook: + $(RM) pkg-dir-conffile-1/test-path + $(RM) pkg-dir-symlink-ext-1/test-path + $(RM) pkg-dir-symlink-int-1/test-path + +test-case: + # Cannot switch a directory containing conffiles + $(DPKG_INSTALL) pkg-dir-conffile-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! $(DPKG_INSTALL) pkg-dir-conffile-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-conffile + + # Cannot switch a directory containing files owned by another package + $(DPKG_INSTALL) pkg-dir-file-other.deb + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + ! $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-symlink-int + $(DPKG_PURGE) pkg-dir-file-other + + # Cannot switch a directory containing local files + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + touch '$(DPKG_INSTDIR)/test-path/local file' + ! $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + rm '$(DPKG_INSTDIR)/test-path/local file' + $(DPKG_PURGE) pkg-dir-symlink-int + + # + # Otherwise allow the switch + # + + # Switch a directory to a symlink, contents moved within the package, + # with intermediate full installs. + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb + test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-symlink-int + ! test -e '$(DPKG_INSTDIR)/test-path' + + # Switch a directory to a symlink, contents moved within the package, + # with full install, upgrade with upack and configure. + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + ! test -h '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_UNPACK) pkg-dir-symlink-int-1.deb + ! test -h '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_CONFIGURE) pkg-dir-symlink-int + test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-symlink-int + ! test -e '$(DPKG_INSTDIR)/test-path' + + # Switch a directory to a symlink, contents moved within the package, + # with two unpacks and configure. + $(DPKG_UNPACK) pkg-dir-symlink-int-0.deb + ! test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_UNPACK) pkg-dir-symlink-int-1.deb + ! test -h '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_CONFIGURE) pkg-dir-symlink-int + test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-symlink-int + ! test -e '$(DPKG_INSTDIR)/test-path' + + # Switch a directory to a symlink, contents moved to another package, + # with intermediate full installs. + $(DPKG_INSTALL) pkg-dir-symlink-ext-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_INSTALL) pkg-dir-file-moved.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_INSTALL) pkg-dir-symlink-ext-1.deb + test -h '$(DPKG_INSTDIR)/test-path' + test "`readlink -f '$(DPKG_INSTDIR)/test-path'`" = "/test-dir" + ! test -h '$(DPKG_INSTDIR)/test-dir' + test -d '$(DPKG_INSTDIR)/test-dir' + test -f '$(DPKG_INSTDIR)/test-dir/file-normal' + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-moved + + # Switch a directory to a symlink, contents moved to another package, + # with full installs, upgrade with upack and configure. + $(DPKG_INSTALL) pkg-dir-symlink-ext-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_INSTALL) pkg-dir-file-moved.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_UNPACK) pkg-dir-symlink-ext-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_CONFIGURE) -a + test -h '$(DPKG_INSTDIR)/test-path' + test "`readlink -f '$(DPKG_INSTDIR)/test-path'`" = "/test-dir" + ! test -h '$(DPKG_INSTDIR)/test-dir' + test -d '$(DPKG_INSTDIR)/test-dir' + test -f '$(DPKG_INSTDIR)/test-dir/file-normal' + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-moved + + # Switch a directory to a symlink, contents moved to another package, + # with three unpacks and configure. + $(DPKG_UNPACK) pkg-dir-symlink-ext-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_UNPACK) pkg-dir-file-moved.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_UNPACK) pkg-dir-symlink-ext-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_CONFIGURE) -a + test -h '$(DPKG_INSTDIR)/test-path' + test "`readlink -f '$(DPKG_INSTDIR)/test-path'`" = "/test-dir" + ! test -h '$(DPKG_INSTDIR)/test-dir' + test -d '$(DPKG_INSTDIR)/test-dir' + test -f '$(DPKG_INSTDIR)/test-dir/file-normal' + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-moved + +test-clean: + $(DPKG_PURGE) pkg-dir-conffile + $(DPKG_PURGE) pkg-dir-symlink-int + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-other + $(DPKG_PURGE) pkg-dir-file-moved diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/conffiles b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/conffiles new file mode 100644 index 0000000..296ef19 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-path/file-conf diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/control new file mode 100644 index 0000000..57fdc53 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-conffile +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with dir to be switched to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/test-path/file-conf b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/test-path/file-conf new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/test-path/file-conf diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/control new file mode 100644 index 0000000..69f4d74 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-conffile +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package switching dir to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postrm new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postrm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/preinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/preinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/DEBIAN/control new file mode 100644 index 0000000..db492dd --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-file-moved +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with file moved from dir-to-symlink switch diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/test-dir/file-normal b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/test-dir/file-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/test-dir/file-normal diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/DEBIAN/control new file mode 100644 index 0000000..985c6db --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-file-other +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with real dir and contents diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/test-path/file-other b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/test-path/file-other new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/test-path/file-other diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/DEBIAN/control new file mode 100644 index 0000000..f9aca91 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink-ext +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with dir to be switched to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/test-path/file-normal b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/test-path/file-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/test-path/file-normal diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/control new file mode 100644 index 0000000..255195b --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-dir-symlink-ext +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-dir-file-moved (>= 1) +Description: test package - package switching dir to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postrm new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postrm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/preinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/preinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/DEBIAN/control new file mode 100644 index 0000000..3526664 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink-int +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with dir to be switched to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/test-path/file-normal b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/test-path/file-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/test-path/file-normal diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/control new file mode 100644 index 0000000..6852587 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink-int +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package switching dir to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postrm new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postrm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/preinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/preinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/test-dir/file-other b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/test-dir/file-other new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/test-dir/file-other diff --git a/tests/t-switch-dir-to-symlink-rel/Makefile b/tests/t-switch-dir-to-symlink-rel/Makefile new file mode 100644 index 0000000..ae4056b --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/Makefile @@ -0,0 +1,156 @@ +TESTS_DEB := \ + pkg-dir-conffile-0 pkg-dir-conffile-1 \ + pkg-dir-file-other pkg-dir-symlink-int-0 pkg-dir-symlink-int-1 \ + pkg-dir-file-moved pkg-dir-symlink-ext-0 pkg-dir-symlink-ext-1 + +include ../Test.mk + +build-hook: + mkdir -p pkg-dir-conffile-1/test-path + ln -sf ../test-dir pkg-dir-conffile-1/test-path/test-subpath + mkdir -p pkg-dir-symlink-ext-1/test-path + ln -sf ../test-dir pkg-dir-symlink-ext-1/test-path/test-subpath + mkdir -p pkg-dir-symlink-int-1/test-path + ln -sf ../test-dir pkg-dir-symlink-int-1/test-path/test-subpath + +clean-hook: + $(RM) pkg-dir-conffile-1/test-path/test-subpath + -rmdir pkg-dir-conffile-1/test-path + $(RM) pkg-dir-symlink-ext-1/test-path/test-subpath + -rmdir pkg-dir-symlink-ext-1/test-path + $(RM) pkg-dir-symlink-int-1/test-path/test-subpath + -rmdir pkg-dir-symlink-int-1/test-path + +test-case: + # Cannot switch a directory containing conffiles + $(DPKG_INSTALL) pkg-dir-conffile-0.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + ! $(DPKG_INSTALL) pkg-dir-conffile-1.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_PURGE) pkg-dir-conffile + + # Cannot switch a directory containing files owned by another package + $(DPKG_INSTALL) pkg-dir-file-other.deb + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + ! $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_PURGE) pkg-dir-symlink-int + $(DPKG_PURGE) pkg-dir-file-other + + # Cannot switch a directory containing local files + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + touch '$(DPKG_INSTDIR)/test-path/test-subpath/local file' + ! $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + rm '$(DPKG_INSTDIR)/test-path/test-subpath/local file' + $(DPKG_PURGE) pkg-dir-symlink-int + + # + # Otherwise allow the switch + # + + # Switch a directory to a symlink, contents moved within the package, + # with intermediate full installs. + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb + test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_PURGE) pkg-dir-symlink-int + ! test -e '$(DPKG_INSTDIR)/test-path/test-subpath' + + # Switch a directory to a symlink, contents moved within the package, + # with full install, upgrade with upack and configure. + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_UNPACK) pkg-dir-symlink-int-1.deb + ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_CONFIGURE) pkg-dir-symlink-int + test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_PURGE) pkg-dir-symlink-int + ! test -e '$(DPKG_INSTDIR)/test-path/test-subpath' + + # Switch a directory to a symlink, contents moved within the package, + # with two unpacks and configure. + $(DPKG_UNPACK) pkg-dir-symlink-int-0.deb + ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_UNPACK) pkg-dir-symlink-int-1.deb + ! test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_CONFIGURE) pkg-dir-symlink-int + test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_PURGE) pkg-dir-symlink-int + ! test -e '$(DPKG_INSTDIR)/test-path/test-subpath' + + # Switch a directory to a symlink, contents moved to another package, + # with intermediate full installs. + $(DPKG_INSTALL) pkg-dir-symlink-ext-0.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_INSTALL) pkg-dir-file-moved.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_INSTALL) pkg-dir-symlink-ext-1.deb + test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + test "`readlink '$(DPKG_INSTDIR)/test-path/test-subpath'`" = "../test-dir" + ! test -h '$(DPKG_INSTDIR)/test-dir' + test -d '$(DPKG_INSTDIR)/test-dir' + test -f '$(DPKG_INSTDIR)/test-dir/file-normal' + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-moved + + # Switch a directory to a symlink, contents moved to another package, + # with full installs, upgrade with upack and configure. + $(DPKG_INSTALL) pkg-dir-symlink-ext-0.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_INSTALL) pkg-dir-file-moved.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_UNPACK) pkg-dir-symlink-ext-1.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_CONFIGURE) -a + test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + test "`readlink '$(DPKG_INSTDIR)/test-path/test-subpath'`" = "../test-dir" + ! test -h '$(DPKG_INSTDIR)/test-dir' + test -d '$(DPKG_INSTDIR)/test-dir' + test -f '$(DPKG_INSTDIR)/test-dir/file-normal' + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-moved + + # Switch a directory to a symlink, contents moved to another package, + # with three unpacks and configure. + $(DPKG_UNPACK) pkg-dir-symlink-ext-0.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + $(DPKG_UNPACK) pkg-dir-file-moved.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_UNPACK) pkg-dir-symlink-ext-1.deb + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_CONFIGURE) -a + test -h '$(DPKG_INSTDIR)/test-path/test-subpath' + test -d '$(DPKG_INSTDIR)/test-path/test-subpath' + test "`readlink '$(DPKG_INSTDIR)/test-path/test-subpath'`" = "../test-dir" + ! test -h '$(DPKG_INSTDIR)/test-dir' + test -d '$(DPKG_INSTDIR)/test-dir' + test -f '$(DPKG_INSTDIR)/test-dir/file-normal' + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-moved + +test-clean: + $(DPKG_PURGE) pkg-dir-conffile + $(DPKG_PURGE) pkg-dir-symlink-int + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-other + $(DPKG_PURGE) pkg-dir-file-moved diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/conffiles b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/conffiles new file mode 100644 index 0000000..77b39da --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-path/test-subpath/file-conf diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/control new file mode 100644 index 0000000..57fdc53 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-conffile +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with dir to be switched to symlink diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/test-path/test-subpath/file-conf b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/test-path/test-subpath/file-conf new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-0/test-path/test-subpath/file-conf diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/control new file mode 100644 index 0000000..69f4d74 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-conffile +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package switching dir to symlink diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postinst new file mode 100755 index 0000000..572dfa2 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink \ + /test-path/test-subpath ../test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postrm new file mode 100755 index 0000000..572dfa2 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/postrm @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink \ + /test-path/test-subpath ../test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/preinst new file mode 100755 index 0000000..572dfa2 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-conffile-1/DEBIAN/preinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink \ + /test-path/test-subpath ../test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/DEBIAN/control new file mode 100644 index 0000000..db492dd --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-file-moved +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with file moved from dir-to-symlink switch diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/test-dir/file-normal b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/test-dir/file-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-moved/test-dir/file-normal diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/DEBIAN/control new file mode 100644 index 0000000..985c6db --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-file-other +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with real dir and contents diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/test-path/test-subpath/file-other b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/test-path/test-subpath/file-other new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-file-other/test-path/test-subpath/file-other diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/DEBIAN/control new file mode 100644 index 0000000..f9aca91 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink-ext +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with dir to be switched to symlink diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/test-path/test-subpath/file-normal b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/test-path/test-subpath/file-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-0/test-path/test-subpath/file-normal diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/control new file mode 100644 index 0000000..255195b --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-dir-symlink-ext +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-dir-file-moved (>= 1) +Description: test package - package switching dir to symlink diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postinst new file mode 100755 index 0000000..572dfa2 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink \ + /test-path/test-subpath ../test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postrm new file mode 100755 index 0000000..572dfa2 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/postrm @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink \ + /test-path/test-subpath ../test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/preinst new file mode 100755 index 0000000..572dfa2 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-ext-1/DEBIAN/preinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink \ + /test-path/test-subpath ../test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/DEBIAN/control new file mode 100644 index 0000000..3526664 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink-int +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with dir to be switched to symlink diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/test-path/test-subpath/file-normal b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/test-path/test-subpath/file-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-0/test-path/test-subpath/file-normal diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/control new file mode 100644 index 0000000..6852587 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink-int +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package switching dir to symlink diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postinst new file mode 100755 index 0000000..572dfa2 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink \ + /test-path/test-subpath ../test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postrm new file mode 100755 index 0000000..572dfa2 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/postrm @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink \ + /test-path/test-subpath ../test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/preinst new file mode 100755 index 0000000..572dfa2 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/DEBIAN/preinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink \ + /test-path/test-subpath ../test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/test-dir/file-other b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/test-dir/file-other new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-rel/pkg-dir-symlink-int-1/test-dir/file-other diff --git a/tests/t-switch-symlink-abs-to-dir/Makefile b/tests/t-switch-symlink-abs-to-dir/Makefile new file mode 100644 index 0000000..1d1b40d --- /dev/null +++ b/tests/t-switch-symlink-abs-to-dir/Makefile @@ -0,0 +1,28 @@ +TESTS_DEB := pkg-dir-real pkg-dir-symlink-0 pkg-dir-symlink-1 + +include ../Test.mk + +build-hook: + ln -sf test-dir pkg-dir-symlink-0/test-symlink + +clean-hook: + $(RM) pkg-dir-symlink-0/test-symlink + +test-case: + $(DPKG_INSTALL) pkg-dir-real.deb + + $(DPKG_INSTALL) pkg-dir-symlink-0.deb + test -h "$(DPKG_INSTDIR)/test-symlink" + + $(DPKG_INSTALL) pkg-dir-symlink-1.deb + ! test -h "$(DPKG_INSTDIR)/test-symlink" + test -d "$(DPKG_INSTDIR)/test-symlink" + + $(DPKG_PURGE) pkg-dir-symlink + ! test -e "$(DPKG_INSTDIR)/test-symlink" + + $(DPKG_PURGE) pkg-dir-real + +test-clean: + $(DPKG_PURGE) pkg-dir-symlink + $(DPKG_PURGE) pkg-dir-real diff --git a/tests/t-switch-symlink-abs-to-dir/pkg-dir-real/DEBIAN/control b/tests/t-switch-symlink-abs-to-dir/pkg-dir-real/DEBIAN/control new file mode 100644 index 0000000..1e94e7a --- /dev/null +++ b/tests/t-switch-symlink-abs-to-dir/pkg-dir-real/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-real +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with real dir diff --git a/tests/t-switch-symlink-abs-to-dir/pkg-dir-real/test-dir/file-dir b/tests/t-switch-symlink-abs-to-dir/pkg-dir-real/test-dir/file-dir new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-symlink-abs-to-dir/pkg-dir-real/test-dir/file-dir diff --git a/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-0/DEBIAN/control b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-0/DEBIAN/control new file mode 100644 index 0000000..730258b --- /dev/null +++ b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with symlink to dir diff --git a/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/control b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/control new file mode 100644 index 0000000..f68d6dc --- /dev/null +++ b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package switching symlink to dir diff --git a/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/postinst b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/postinst new file mode 100755 index 0000000..e87967a --- /dev/null +++ b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports symlink_to_dir; then + dpkg-maintscript-helper symlink_to_dir /test-symlink /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/postrm b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/postrm new file mode 100755 index 0000000..e87967a --- /dev/null +++ b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/postrm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports symlink_to_dir; then + dpkg-maintscript-helper symlink_to_dir /test-symlink /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/preinst b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/preinst new file mode 100755 index 0000000..e87967a --- /dev/null +++ b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/DEBIAN/preinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports symlink_to_dir; then + dpkg-maintscript-helper symlink_to_dir /test-symlink /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/test-symlink/file-owned b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/test-symlink/file-owned new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-symlink-abs-to-dir/pkg-dir-symlink-1/test-symlink/file-owned diff --git a/tests/t-switch-symlink-rel-to-dir/Makefile b/tests/t-switch-symlink-rel-to-dir/Makefile new file mode 100644 index 0000000..ee936a1 --- /dev/null +++ b/tests/t-switch-symlink-rel-to-dir/Makefile @@ -0,0 +1,30 @@ +TESTS_DEB := pkg-dir-real pkg-dir-symlink-0 pkg-dir-symlink-1 + +include ../Test.mk + +build-hook: + mkdir -p pkg-dir-symlink-0/test-path + ln -sf ../test-dir pkg-dir-symlink-0/test-path/test-symlink + +clean-hook: + $(RM) pkg-dir-symlink-0/test-path/test-symlink + -rmdir pkg-dir-symlink-0/test-path + +test-case: + $(DPKG_INSTALL) pkg-dir-real.deb + + $(DPKG_INSTALL) pkg-dir-symlink-0.deb + test -h '$(DPKG_INSTDIR)/test-path/test-symlink' + + $(DPKG_INSTALL) pkg-dir-symlink-1.deb + ! test -h '$(DPKG_INSTDIR)/test-path/test-symlink' + test -d '$(DPKG_INSTDIR)/test-path/test-symlink' + + $(DPKG_PURGE) pkg-dir-symlink + ! test -e '$(DPKG_INSTDIR)/test-path/test-symlink' + + $(DPKG_PURGE) pkg-dir-real + +test-clean: + $(DPKG_PURGE) pkg-dir-symlink + $(DPKG_PURGE) pkg-dir-real diff --git a/tests/t-switch-symlink-rel-to-dir/pkg-dir-real/DEBIAN/control b/tests/t-switch-symlink-rel-to-dir/pkg-dir-real/DEBIAN/control new file mode 100644 index 0000000..1e94e7a --- /dev/null +++ b/tests/t-switch-symlink-rel-to-dir/pkg-dir-real/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-real +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with real dir diff --git a/tests/t-switch-symlink-rel-to-dir/pkg-dir-real/test-dir/file-dir b/tests/t-switch-symlink-rel-to-dir/pkg-dir-real/test-dir/file-dir new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-symlink-rel-to-dir/pkg-dir-real/test-dir/file-dir diff --git a/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-0/DEBIAN/control b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-0/DEBIAN/control new file mode 100644 index 0000000..730258b --- /dev/null +++ b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with symlink to dir diff --git a/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/control b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/control new file mode 100644 index 0000000..f68d6dc --- /dev/null +++ b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package switching symlink to dir diff --git a/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/postinst b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/postinst new file mode 100755 index 0000000..89e4fcd --- /dev/null +++ b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/postinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports symlink_to_dir; then + dpkg-maintscript-helper symlink_to_dir \ + /test-path/test-symlink /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/postrm b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/postrm new file mode 100755 index 0000000..89e4fcd --- /dev/null +++ b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/postrm @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports symlink_to_dir; then + dpkg-maintscript-helper symlink_to_dir \ + /test-path/test-symlink /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/preinst b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/preinst new file mode 100755 index 0000000..89e4fcd --- /dev/null +++ b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/DEBIAN/preinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports symlink_to_dir; then + dpkg-maintscript-helper symlink_to_dir \ + /test-path/test-symlink /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/test-path/test-symlink/file-owned b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/test-path/test-symlink/file-owned new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-symlink-rel-to-dir/pkg-dir-symlink-1/test-path/test-symlink/file-owned diff --git a/tests/t-symlink-dir/Makefile b/tests/t-symlink-dir/Makefile new file mode 100644 index 0000000..6fa0a0b --- /dev/null +++ b/tests/t-symlink-dir/Makefile @@ -0,0 +1,29 @@ +TESTS_DEB := pkg-dir-real pkg-dir-symlink-0 pkg-dir-symlink-1 pkg-file + +include ../Test.mk + +build-hook: + ln -fs test-dir pkg-dir-symlink-0/test-symlink + ln -fs test-dir pkg-dir-symlink-1/test-symlink + +clean-hook: + $(RM) pkg-dir-symlink-0/test-symlink + $(RM) pkg-dir-symlink-1/test-symlink + +test-case: + $(DPKG_INSTALL) pkg-dir-real.deb + $(DPKG_INSTALL) pkg-dir-symlink-0.deb + $(DPKG_INSTALL) pkg-file.deb + $(DPKG_INSTALL) pkg-dir-symlink-1.deb + + $(DPKG_PURGE) pkg-dir-symlink + $(DPKG_PURGE) pkg-file + $(DPKG_PURGE) pkg-dir-real + + test ! -L '$(DPKG_INSTDIR)/test-symlink' + +test-clean: + $(DPKG_PURGE) pkg-dir-symlink + $(DPKG_PURGE) pkg-file + $(DPKG_PURGE) pkg-dir-real + $(BEROOT) $(RM) '$(DPKG_INSTDIR)/test-symlink' diff --git a/tests/t-symlink-dir/pkg-dir-real/DEBIAN/control b/tests/t-symlink-dir/pkg-dir-real/DEBIAN/control new file mode 100644 index 0000000..8d73fa6 --- /dev/null +++ b/tests/t-symlink-dir/pkg-dir-real/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-dir-real +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with real dir + diff --git a/tests/t-symlink-dir/pkg-dir-real/test-dir/file-dir b/tests/t-symlink-dir/pkg-dir-real/test-dir/file-dir new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-symlink-dir/pkg-dir-real/test-dir/file-dir diff --git a/tests/t-symlink-dir/pkg-dir-symlink-0/DEBIAN/control b/tests/t-symlink-dir/pkg-dir-symlink-0/DEBIAN/control new file mode 100644 index 0000000..a19a7e1 --- /dev/null +++ b/tests/t-symlink-dir/pkg-dir-symlink-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-dir-symlink +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with symlink to dir + diff --git a/tests/t-symlink-dir/pkg-dir-symlink-0/file-symlink b/tests/t-symlink-dir/pkg-dir-symlink-0/file-symlink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-symlink-dir/pkg-dir-symlink-0/file-symlink diff --git a/tests/t-symlink-dir/pkg-dir-symlink-1/DEBIAN/control b/tests/t-symlink-dir/pkg-dir-symlink-1/DEBIAN/control new file mode 100644 index 0000000..becfc01 --- /dev/null +++ b/tests/t-symlink-dir/pkg-dir-symlink-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-dir-symlink +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with symlink to dir + diff --git a/tests/t-symlink-dir/pkg-dir-symlink-1/file-symlink b/tests/t-symlink-dir/pkg-dir-symlink-1/file-symlink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-symlink-dir/pkg-dir-symlink-1/file-symlink diff --git a/tests/t-symlink-dir/pkg-file/DEBIAN/conffiles b/tests/t-symlink-dir/pkg-file/DEBIAN/conffiles new file mode 100644 index 0000000..551fc78 --- /dev/null +++ b/tests/t-symlink-dir/pkg-file/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-symlink/file-file diff --git a/tests/t-symlink-dir/pkg-file/DEBIAN/control b/tests/t-symlink-dir/pkg-file/DEBIAN/control new file mode 100644 index 0000000..b9a481c --- /dev/null +++ b/tests/t-symlink-dir/pkg-file/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-file +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with file inside dir + diff --git a/tests/t-symlink-dir/pkg-file/test-symlink/file-file b/tests/t-symlink-dir/pkg-file/test-symlink/file-file new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-symlink-dir/pkg-file/test-symlink/file-file diff --git a/tests/t-triggers-configure/Makefile b/tests/t-triggers-configure/Makefile new file mode 100644 index 0000000..96996b2 --- /dev/null +++ b/tests/t-triggers-configure/Makefile @@ -0,0 +1,22 @@ +TESTS_DEB := pkg-activate pkg-interest-0 pkg-interest-1 + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-interest-0.deb + + # Activate the trigger, and leave pkg-interest in triggers-pending. + $(DPKG_INSTALL) --no-triggers pkg-activate.deb + $(call pkg_status_is,pkg-interest,install ok triggers-pending) + + # Test that an upgrade from triggers-pending passes the previous + # configured version to "postinst configure". + $(DPKG_INSTALL) pkg-interest-1.deb + + # Cleanup. + $(DPKG_PURGE) pkg-interest + $(DPKG_PURGE) pkg-activate + +test-clean: + -$(DPKG_PURGE) pkg-interest + -$(DPKG_PURGE) pkg-activate diff --git a/tests/t-triggers-configure/pkg-activate/DEBIAN/control b/tests/t-triggers-configure/pkg-activate/DEBIAN/control new file mode 100644 index 0000000..b8a6cc9 --- /dev/null +++ b/tests/t-triggers-configure/pkg-activate/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-activate +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - activates triggers interested in /test/ diff --git a/tests/t-triggers-configure/pkg-activate/test/trigger/test-file b/tests/t-triggers-configure/pkg-activate/test/trigger/test-file new file mode 100644 index 0000000..fb67027 --- /dev/null +++ b/tests/t-triggers-configure/pkg-activate/test/trigger/test-file @@ -0,0 +1 @@ +sample file diff --git a/tests/t-triggers-configure/pkg-interest-0/DEBIAN/control b/tests/t-triggers-configure/pkg-interest-0/DEBIAN/control new file mode 100644 index 0000000..e5a1833 --- /dev/null +++ b/tests/t-triggers-configure/pkg-interest-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-interest +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - interested in files under /test/ diff --git a/tests/t-triggers-configure/pkg-interest-0/DEBIAN/triggers b/tests/t-triggers-configure/pkg-interest-0/DEBIAN/triggers new file mode 100644 index 0000000..97d27a2 --- /dev/null +++ b/tests/t-triggers-configure/pkg-interest-0/DEBIAN/triggers @@ -0,0 +1 @@ +interest-noawait /test diff --git a/tests/t-triggers-configure/pkg-interest-1/DEBIAN/control b/tests/t-triggers-configure/pkg-interest-1/DEBIAN/control new file mode 100644 index 0000000..59c323b --- /dev/null +++ b/tests/t-triggers-configure/pkg-interest-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-interest +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - interested in files under /test/ diff --git a/tests/t-triggers-configure/pkg-interest-1/DEBIAN/postinst b/tests/t-triggers-configure/pkg-interest-1/DEBIAN/postinst new file mode 100755 index 0000000..69ad9b5 --- /dev/null +++ b/tests/t-triggers-configure/pkg-interest-1/DEBIAN/postinst @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +case "$1" in + configure) + if [ -z "$2" ]; then + echo "FAIL: upgrading and no previous version passed to configure" 2>&1 + exit 1 + else + echo "PASS: upgrading from version '$2'" + fi + ;; +esac + +exit 0 diff --git a/tests/t-triggers-configure/pkg-interest-1/DEBIAN/triggers b/tests/t-triggers-configure/pkg-interest-1/DEBIAN/triggers new file mode 100644 index 0000000..97d27a2 --- /dev/null +++ b/tests/t-triggers-configure/pkg-interest-1/DEBIAN/triggers @@ -0,0 +1 @@ +interest-noawait /test diff --git a/tests/t-triggers-cycle/Makefile b/tests/t-triggers-cycle/Makefile new file mode 100644 index 0000000..b17f877 --- /dev/null +++ b/tests/t-triggers-cycle/Makefile @@ -0,0 +1,21 @@ +TESTS_DEB := pkg-depends pkg-trigger-a pkg-trigger-b + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-depends.deb + # Should fail due to a trigger cycle. + ! $(DPKG_INSTALL) pkg-trigger-a.deb pkg-trigger-b.deb + ! $(DPKG_CONFIGURE) --pending + + # Make sure everything is left in a correct state. + $(call pkg_is_installed,pkg-depends) + $(call pkg_is_installed,pkg-trigger-a) + $(call pkg_status_is,pkg-trigger-b,install ok half-configured) + + # Cleanup. + $(DPKG_PURGE) pkg-trigger-a pkg-trigger-b + $(DPKG_PURGE) pkg-depends + +test-clean: + -$(DPKG_PURGE) pkg-trigger-a pkg-trigger-b pkg-depends diff --git a/tests/t-triggers-cycle/pkg-depends/DEBIAN/control b/tests/t-triggers-cycle/pkg-depends/DEBIAN/control new file mode 100644 index 0000000..27c429f --- /dev/null +++ b/tests/t-triggers-cycle/pkg-depends/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-depends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package to be configured diff --git a/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/control b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/control new file mode 100644 index 0000000..093d8a6 --- /dev/null +++ b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trigger-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-depends +Description: test package - interested in files on /test/trigger-b/ diff --git a/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/postinst b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/postinst new file mode 100755 index 0000000..a874abf --- /dev/null +++ b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/postinst @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +case "$1" in + configure) + dpkg-trigger /test/trigger-b/test-file + ;; + triggered) + pkg_status=`dpkg-query -f '${Status}' -W pkg-depends` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-depends is installed" + else + echo "Fail: pkg-depends is not installed ($pkg_status)" + exit 1 + fi + dpkg-trigger /test/trigger-b/test-file + ;; +esac + +exit 0 diff --git a/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/triggers b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/triggers new file mode 100644 index 0000000..0f10564 --- /dev/null +++ b/tests/t-triggers-cycle/pkg-trigger-a/DEBIAN/triggers @@ -0,0 +1 @@ +interest /test/trigger-a diff --git a/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/control b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/control new file mode 100644 index 0000000..9cc2094 --- /dev/null +++ b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trigger-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-depends +Description: test package - interested in files on /test/trigger-a/ diff --git a/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/postinst b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/postinst new file mode 100755 index 0000000..8f1c02f --- /dev/null +++ b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/postinst @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +case "$1" in + configure) + dpkg-trigger /test/trigger-a/test-file + ;; + triggered) + pkg_status=`dpkg-query -f '${Status}' -W pkg-depends` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-depends is installed" + else + echo "Fail: pkg-depends is not installed ($pkg_status)" + exit 1 + fi + dpkg-trigger /test/trigger-a/test-file + ;; +esac + +exit 0 diff --git a/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/triggers b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/triggers new file mode 100644 index 0000000..86b4728 --- /dev/null +++ b/tests/t-triggers-cycle/pkg-trigger-b/DEBIAN/triggers @@ -0,0 +1 @@ +interest /test/trigger-b diff --git a/tests/t-triggers-depcycle/Makefile b/tests/t-triggers-depcycle/Makefile new file mode 100644 index 0000000..5b1f0fb --- /dev/null +++ b/tests/t-triggers-depcycle/Makefile @@ -0,0 +1,25 @@ +TESTS_DEB := \ + pkg-depends-0 pkg-depends-1 \ + pkg-files-0 pkg-files-1 \ + pkg-trigger + +include ../Test.mk + +test-case: + # Now provoke the trigger cycle + $(DPKG_INSTALL) pkg-depends-0.deb + $(DPKG_INSTALL) pkg-trigger.deb pkg-files-0.deb + $(DPKG_UNPACK) pkg-files-1.deb + ! $(DPKG_CONFIGURE) --pending + + # Make sure everything is left in the expected state. + $(call pkg_is_installed,pkg-files) + $(call pkg_is_installed,pkg-depends) + $(call pkg_status_is,pkg-trigger,install ok half-configured) + + # Cleanup. + $(DPKG_PURGE) pkg-trigger pkg-files + $(DPKG_PURGE) pkg-depends + +test-clean: + -$(DPKG_PURGE) --force-all pkg-trigger pkg-files pkg-depends diff --git a/tests/t-triggers-depcycle/pkg-depends-0/DEBIAN/control b/tests/t-triggers-depcycle/pkg-depends-0/DEBIAN/control new file mode 100644 index 0000000..27c429f --- /dev/null +++ b/tests/t-triggers-depcycle/pkg-depends-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-depends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package to be configured diff --git a/tests/t-triggers-depcycle/pkg-depends-1/DEBIAN/control b/tests/t-triggers-depcycle/pkg-depends-1/DEBIAN/control new file mode 100644 index 0000000..2b3a8f3 --- /dev/null +++ b/tests/t-triggers-depcycle/pkg-depends-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-files +Description: test package - package to be configured diff --git a/tests/t-triggers-depcycle/pkg-files-0/DEBIAN/control b/tests/t-triggers-depcycle/pkg-files-0/DEBIAN/control new file mode 100644 index 0000000..9668941 --- /dev/null +++ b/tests/t-triggers-depcycle/pkg-files-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-files +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-trigger +Description: test package - provides a file under /test/trigger/ diff --git a/tests/t-triggers-depcycle/pkg-files-0/test/trigger/test-file b/tests/t-triggers-depcycle/pkg-files-0/test/trigger/test-file new file mode 100644 index 0000000..fb67027 --- /dev/null +++ b/tests/t-triggers-depcycle/pkg-files-0/test/trigger/test-file @@ -0,0 +1 @@ +sample file diff --git a/tests/t-triggers-depcycle/pkg-files-1/DEBIAN/control b/tests/t-triggers-depcycle/pkg-files-1/DEBIAN/control new file mode 100644 index 0000000..f4312fa --- /dev/null +++ b/tests/t-triggers-depcycle/pkg-files-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-files +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-trigger +Description: test package - provides a file under /test/trigger/ diff --git a/tests/t-triggers-depcycle/pkg-files-1/test/trigger/test-file b/tests/t-triggers-depcycle/pkg-files-1/test/trigger/test-file new file mode 100644 index 0000000..fb67027 --- /dev/null +++ b/tests/t-triggers-depcycle/pkg-files-1/test/trigger/test-file @@ -0,0 +1 @@ +sample file diff --git a/tests/t-triggers-depcycle/pkg-trigger/DEBIAN/control b/tests/t-triggers-depcycle/pkg-trigger/DEBIAN/control new file mode 100644 index 0000000..72221a7 --- /dev/null +++ b/tests/t-triggers-depcycle/pkg-trigger/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trigger +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-depends, pkg-files +Description: test package - interested in files on /test/trigger/ diff --git a/tests/t-triggers-depcycle/pkg-trigger/DEBIAN/postinst b/tests/t-triggers-depcycle/pkg-trigger/DEBIAN/postinst new file mode 100755 index 0000000..716cdd5 --- /dev/null +++ b/tests/t-triggers-depcycle/pkg-trigger/DEBIAN/postinst @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +case "$1" in + triggered) + pkg_status=`dpkg-query -f '${Status}' -W pkg-depends` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-depends is installed" + else + echo "Fail: pkg-depends is not installed ($pkg_status)" + exit 1 + fi + pkg_status=`dpkg-query -f '${Status}' -W pkg-files` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-files is installed" + else + echo "Fail: pkg-files is not installed ($pkg_status)" + exit 1 + fi + ;; +esac + +exit 0 diff --git a/tests/t-triggers-depcycle/pkg-trigger/DEBIAN/triggers b/tests/t-triggers-depcycle/pkg-trigger/DEBIAN/triggers new file mode 100644 index 0000000..3b047af --- /dev/null +++ b/tests/t-triggers-depcycle/pkg-trigger/DEBIAN/triggers @@ -0,0 +1 @@ +interest /test/trigger diff --git a/tests/t-triggers-depends/Makefile b/tests/t-triggers-depends/Makefile new file mode 100644 index 0000000..cdce58d --- /dev/null +++ b/tests/t-triggers-depends/Makefile @@ -0,0 +1,25 @@ +TESTS_DEB := pkg-depended pkg-interest pkg-activate + +include ../Test.mk + +test-case: + # Should pass due to satisfied dependencies. + $(DPKG_INSTALL) pkg-depended.deb pkg-interest.deb + $(DPKG_INSTALL) pkg-activate.deb + $(DPKG_CONFIGURE) --pending + + # Should fail due to unsatisfied dependencies. + $(DPKG_UNPACK) --no-triggers pkg-depended.deb + $(DPKG_INSTALL) --no-triggers pkg-activate.deb + ! $(DPKG_CONFIGURE) pkg-interest + + # Should pass now due to satisfied dependencies. + $(DPKG_CONFIGURE) --no-triggers pkg-depended + $(DPKG_CONFIGURE) pkg-interest + + # Cleanup. + $(DPKG_PURGE) pkg-trigger-a pkg-trigger-b + $(DPKG_PURGE) pkg-depends + +test-clean: + -$(DPKG_PURGE) pkg-activate pkg-interest pkg-depended diff --git a/tests/t-triggers-depends/pkg-activate/DEBIAN/control b/tests/t-triggers-depends/pkg-activate/DEBIAN/control new file mode 100644 index 0000000..e6c4ab5 --- /dev/null +++ b/tests/t-triggers-depends/pkg-activate/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-activate +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - activate a trigger on /test/trigger/ diff --git a/tests/t-triggers-depends/pkg-activate/test/trigger/trigger-file b/tests/t-triggers-depends/pkg-activate/test/trigger/trigger-file new file mode 100644 index 0000000..647063d --- /dev/null +++ b/tests/t-triggers-depends/pkg-activate/test/trigger/trigger-file @@ -0,0 +1 @@ +activating file diff --git a/tests/t-triggers-depends/pkg-depended/DEBIAN/control b/tests/t-triggers-depends/pkg-depended/DEBIAN/control new file mode 100644 index 0000000..2b0e100 --- /dev/null +++ b/tests/t-triggers-depends/pkg-depended/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-depended +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package to be depended on diff --git a/tests/t-triggers-depends/pkg-interest/DEBIAN/control b/tests/t-triggers-depends/pkg-interest/DEBIAN/control new file mode 100644 index 0000000..dc4d98a --- /dev/null +++ b/tests/t-triggers-depends/pkg-interest/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-interest +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-depended +Description: test package - interested in files on /test/trigger/ diff --git a/tests/t-triggers-depends/pkg-interest/DEBIAN/postinst b/tests/t-triggers-depends/pkg-interest/DEBIAN/postinst new file mode 100755 index 0000000..9f76726 --- /dev/null +++ b/tests/t-triggers-depends/pkg-interest/DEBIAN/postinst @@ -0,0 +1,16 @@ +#!/bin/sh +set -e + +case "$1" in + triggered) + pkg_status=`dpkg-query -f '${Status}' -W pkg-depended` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-depended is installed" + else + echo "Fail: pkg-depended is not installed ($pkg_status)" + exit 1 + fi + ;; +esac + +exit 0 diff --git a/tests/t-triggers-depends/pkg-interest/DEBIAN/triggers b/tests/t-triggers-depends/pkg-interest/DEBIAN/triggers new file mode 100644 index 0000000..3b047af --- /dev/null +++ b/tests/t-triggers-depends/pkg-interest/DEBIAN/triggers @@ -0,0 +1 @@ +interest /test/trigger diff --git a/tests/t-triggers-depfarcycle/Makefile b/tests/t-triggers-depfarcycle/Makefile new file mode 100644 index 0000000..65a490c --- /dev/null +++ b/tests/t-triggers-depfarcycle/Makefile @@ -0,0 +1,36 @@ +TESTS_DEB := pkg-depends-a pkg-depends-b pkg-files pkg-trigger + +include ../Test.mk + +test-case: + # The trigger cycle does not affect us here. + $(DPKG_INSTALL) pkg-depends-a.deb pkg-files.deb \ + pkg-depends-b.deb pkg-trigger.deb + $(DPKG_UNPACK) pkg-files.deb + $(DPKG_CONFIGURE) --pending + + # Make sure everything is left in a correct state. + $(call pkg_is_installed,pkg-files) + $(call pkg_is_installed,pkg-depends-a) + $(call pkg_is_installed,pkg-depends-b) + $(call pkg_is_installed,pkg-trigger) + + # Provoke the trigger cycle. + $(DPKG_UNPACK) pkg-depends-a.deb + $(DPKG_UNPACK) pkg-depends-b.deb + $(DPKG_UNPACK) pkg-files.deb + ! $(DPKG_CONFIGURE) pkg-trigger + $(DPKG) -s pkg-depends-a pkg-depends-b pkg-files pkg-trigger + ! $(DPKG_CONFIGURE) --pending + + # Make sure everything is left in a correct state. + $(call pkg_is_installed,pkg-files) + $(call pkg_is_installed,pkg-depends-a) + $(call pkg_is_installed,pkg-depends-b) + $(call pkg_status_is,pkg-trigger,install ok half-configured) + + # Cleanup. + $(DPKG_PURGE) pkg-trigger pkg-files pkg-depends-a pkg-depends-b + +test-clean: + -$(DPKG_PURGE) pkg-trigger pkg-files pkg-depends-a pkg-depends-b diff --git a/tests/t-triggers-depfarcycle/pkg-depends-a/DEBIAN/control b/tests/t-triggers-depfarcycle/pkg-depends-a/DEBIAN/control new file mode 100644 index 0000000..e8a34db --- /dev/null +++ b/tests/t-triggers-depfarcycle/pkg-depends-a/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-files +Description: test package - package to be configured diff --git a/tests/t-triggers-depfarcycle/pkg-depends-b/DEBIAN/control b/tests/t-triggers-depfarcycle/pkg-depends-b/DEBIAN/control new file mode 100644 index 0000000..5498857 --- /dev/null +++ b/tests/t-triggers-depfarcycle/pkg-depends-b/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-trigger +Description: test package - package to be configured diff --git a/tests/t-triggers-depfarcycle/pkg-files/DEBIAN/control b/tests/t-triggers-depfarcycle/pkg-files/DEBIAN/control new file mode 100644 index 0000000..7ce4ebc --- /dev/null +++ b/tests/t-triggers-depfarcycle/pkg-files/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-files +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-depends-b +Description: test package - provides a file under /test/trigger/ diff --git a/tests/t-triggers-depfarcycle/pkg-files/test/trigger/test-file b/tests/t-triggers-depfarcycle/pkg-files/test/trigger/test-file new file mode 100644 index 0000000..fb67027 --- /dev/null +++ b/tests/t-triggers-depfarcycle/pkg-files/test/trigger/test-file @@ -0,0 +1 @@ +sample file diff --git a/tests/t-triggers-depfarcycle/pkg-trigger/DEBIAN/control b/tests/t-triggers-depfarcycle/pkg-trigger/DEBIAN/control new file mode 100644 index 0000000..8ed63e6 --- /dev/null +++ b/tests/t-triggers-depfarcycle/pkg-trigger/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trigger +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-depends-a +Description: test package - interested in files on /test/trigger/ diff --git a/tests/t-triggers-depfarcycle/pkg-trigger/DEBIAN/postinst b/tests/t-triggers-depfarcycle/pkg-trigger/DEBIAN/postinst new file mode 100755 index 0000000..ffbad78 --- /dev/null +++ b/tests/t-triggers-depfarcycle/pkg-trigger/DEBIAN/postinst @@ -0,0 +1,16 @@ +#!/bin/sh +set -e + +case "$1" in + triggered) + pkg_status=`dpkg-query -f '${Status}' -W pkg-depends-a` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-depends is installed" + else + echo "Fail: pkg-depends is not installed ($pkg_status)" + exit 1 + fi + ;; +esac + +exit 0 diff --git a/tests/t-triggers-depfarcycle/pkg-trigger/DEBIAN/triggers b/tests/t-triggers-depfarcycle/pkg-trigger/DEBIAN/triggers new file mode 100644 index 0000000..3b047af --- /dev/null +++ b/tests/t-triggers-depfarcycle/pkg-trigger/DEBIAN/triggers @@ -0,0 +1 @@ +interest /test/trigger diff --git a/tests/t-triggers-halt/Makefile b/tests/t-triggers-halt/Makefile new file mode 100644 index 0000000..0ce5c0f --- /dev/null +++ b/tests/t-triggers-halt/Makefile @@ -0,0 +1,26 @@ +TESTS_DEB := pkg-files pkg-depends pkg-remove pkg-trigger + +include ../Test.mk + +test-case: + # This is what apt is doing currently. :( + $(DPKG_INSTALL) pkg-files.deb + $(DPKG_INSTALL) pkg-depends.deb + $(DPKG_INSTALL) pkg-remove.deb + $(DPKG_INSTALL) pkg-trigger.deb + $(DPKG_REMOVE) --force-depends pkg-remove + $(DPKG_INSTALL) pkg-files.deb + $(DPKG_UNPACK) pkg-depends.deb + + $(DPKG) -s pkg-trigger pkg-files pkg-depends + + # Make sure everything is left in the expected state. + $(call pkg_status_is,pkg-depends,install ok unpacked) + $(call pkg_status_is,pkg-files,install ok triggers-awaited) + $(call pkg_status_is,pkg-trigger,install ok triggers-pending) + + # Should fail due to unsatisfied dependencies. + ! $(DPKG_CONFIGURE) pkg-trigger pkg-depends + +test-clean: + -$(DPKG_PURGE) pkg-trigger pkg-depends pkg-files diff --git a/tests/t-triggers-halt/pkg-depends/DEBIAN/control b/tests/t-triggers-halt/pkg-depends/DEBIAN/control new file mode 100644 index 0000000..aadf8be --- /dev/null +++ b/tests/t-triggers-halt/pkg-depends/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-files +Description: test package - package to be configured diff --git a/tests/t-triggers-halt/pkg-files/DEBIAN/control b/tests/t-triggers-halt/pkg-files/DEBIAN/control new file mode 100644 index 0000000..92fa468 --- /dev/null +++ b/tests/t-triggers-halt/pkg-files/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-files +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provides a file under /test/trigger/ diff --git a/tests/t-triggers-halt/pkg-files/test/trigger/test-file b/tests/t-triggers-halt/pkg-files/test/trigger/test-file new file mode 100644 index 0000000..fb67027 --- /dev/null +++ b/tests/t-triggers-halt/pkg-files/test/trigger/test-file @@ -0,0 +1 @@ +sample file diff --git a/tests/t-triggers-halt/pkg-remove/DEBIAN/control b/tests/t-triggers-halt/pkg-remove/DEBIAN/control new file mode 100644 index 0000000..59c8876 --- /dev/null +++ b/tests/t-triggers-halt/pkg-remove/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-remove +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package to be removed diff --git a/tests/t-triggers-halt/pkg-trigger/DEBIAN/control b/tests/t-triggers-halt/pkg-trigger/DEBIAN/control new file mode 100644 index 0000000..05a4d31 --- /dev/null +++ b/tests/t-triggers-halt/pkg-trigger/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trigger +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-remove, pkg-depends +Description: test package - interested in files on /test/trigger/ diff --git a/tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst b/tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst new file mode 100755 index 0000000..72b74a1 --- /dev/null +++ b/tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +case "$1" in + triggered) + pkg_status=`dpkg-query -f '${Status}' -W pkg-depends` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-depends is installed" + else + echo "Fail: pkg-depends is not installed ($pkg_status)" + exit 1 + fi + pkg_status=`dpkg-query -f '${Status}' -W pkg-nonexistent` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-nonexistent is installed" + else + echo "Fail: pkg-nonexistent is not installed ($pkg_status)" + exit 1 + fi + ;; +esac + +exit 0 diff --git a/tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers b/tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers new file mode 100644 index 0000000..3b047af --- /dev/null +++ b/tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers @@ -0,0 +1 @@ +interest /test/trigger diff --git a/tests/t-triggers-path/Makefile b/tests/t-triggers-path/Makefile new file mode 100644 index 0000000..c211204 --- /dev/null +++ b/tests/t-triggers-path/Makefile @@ -0,0 +1,26 @@ +TESTS_DEB := pkg-interest pkg-trigger-conffile pkg-trigger-cmd + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-interest.deb + + # Test that the trigger gets activated on conffile installation + $(DPKG_UNPACK) pkg-trigger-conffile.deb + test -e "$(DPKG_INSTDIR)/test-triggered-cmd" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/test-triggered-cmd" + $(DPKG_CONFIGURE) pkg-trigger-conffile + test -e "$(DPKG_INSTDIR)/test-triggered-file" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/test-triggered-file" + $(DPKG_PURGE) pkg-trigger-conffile + + # Test that the trigger gets activated on explicit file request + $(DPKG_INSTALL) pkg-trigger-cmd.deb + test -e "$(DPKG_INSTDIR)/test-triggered-cmd" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/test-triggered-cmd" + $(DPKG_PURGE) pkg-trigger-cmd + + # Cleanup. + $(DPKG_PURGE) pkg-interest + +test-clean: + $(BEROOT) rm -f "$(DPKG_INSTDIR)/test-triggered-cmd" "$(DPKG_INSTDIR)/test-triggered-file" + -$(DPKG_PURGE) pkg-interest + -$(DPKG_PURGE) pkg-trigger-conffile pkg-trigger-cmd diff --git a/tests/t-triggers-path/pkg-interest/DEBIAN/control b/tests/t-triggers-path/pkg-interest/DEBIAN/control new file mode 100644 index 0000000..e5a1833 --- /dev/null +++ b/tests/t-triggers-path/pkg-interest/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-interest +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - interested in files under /test/ diff --git a/tests/t-triggers-path/pkg-interest/DEBIAN/postinst b/tests/t-triggers-path/pkg-interest/DEBIAN/postinst new file mode 100755 index 0000000..3968b80 --- /dev/null +++ b/tests/t-triggers-path/pkg-interest/DEBIAN/postinst @@ -0,0 +1,14 @@ +#!/bin/sh +set -e + +case "$1" in + triggered) + if [ -e "$DPKG_ROOT/test/trigger/test-file" ]; then + touch "$DPKG_ROOT/test-triggered-file" + else + touch "$DPKG_ROOT/test-triggered-cmd" + fi + ;; +esac + +exit 0 diff --git a/tests/t-triggers-path/pkg-interest/DEBIAN/triggers b/tests/t-triggers-path/pkg-interest/DEBIAN/triggers new file mode 100644 index 0000000..b88b9d1 --- /dev/null +++ b/tests/t-triggers-path/pkg-interest/DEBIAN/triggers @@ -0,0 +1 @@ +interest /test diff --git a/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/control b/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/control new file mode 100644 index 0000000..de4f335 --- /dev/null +++ b/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-trigger-cmd +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package to be configured diff --git a/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/postinst b/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/postinst new file mode 100755 index 0000000..8ee3e60 --- /dev/null +++ b/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +dpkg-trigger /test/trigger/trig-cmd diff --git a/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/conffiles b/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/conffiles new file mode 100644 index 0000000..2b0ad40 --- /dev/null +++ b/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/conffiles @@ -0,0 +1 @@ +/test/trigger/test-file diff --git a/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/control b/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/control new file mode 100644 index 0000000..23b2840 --- /dev/null +++ b/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-trigger-conffile +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provides a conffile under /test/trigger/ diff --git a/tests/t-triggers-path/pkg-trigger-conffile/test/trigger/test-file b/tests/t-triggers-path/pkg-trigger-conffile/test/trigger/test-file new file mode 100644 index 0000000..fb67027 --- /dev/null +++ b/tests/t-triggers-path/pkg-trigger-conffile/test/trigger/test-file @@ -0,0 +1 @@ +sample file diff --git a/tests/t-triggers-selfcycle/Makefile b/tests/t-triggers-selfcycle/Makefile new file mode 100644 index 0000000..cd916f8 --- /dev/null +++ b/tests/t-triggers-selfcycle/Makefile @@ -0,0 +1,25 @@ +TESTS_DEB := pkg-trigger-unpack pkg-trigger-activate + +include ../Test.mk + +test-case: + # Self trigger cycles cannot happen with unpacked files. + $(DPKG_INSTALL) pkg-trigger-unpack.deb + $(DPKG_UNPACK) pkg-trigger-unpack.deb + $(DPKG_CONFIGURE) pkg-trigger-unpack + $(DPKG_CONFIGURE) --pending + $(DPKG_PURGE) pkg-trigger-unpack + + # Self trigger cycles cannot happen with activate directives. + $(DPKG_INSTALL) pkg-trigger-activate.deb + $(DPKG_UNPACK) pkg-trigger-activate.deb + $(DPKG_CONFIGURE) pkg-trigger-activate + $(DPKG_CONFIGURE) --pending + $(DPKG_PURGE) pkg-trigger-activate + + # Cleanup. + $(DPKG_PURGE) pkg-trigger-unpack + $(DPKG_PURGE) pkg-trigger-activate + +test-clean: + -$(DPKG_PURGE) pkg-trigger-unpack pkg-trigger-activate diff --git a/tests/t-triggers-selfcycle/pkg-trigger-activate/DEBIAN/control b/tests/t-triggers-selfcycle/pkg-trigger-activate/DEBIAN/control new file mode 100644 index 0000000..30a26fa --- /dev/null +++ b/tests/t-triggers-selfcycle/pkg-trigger-activate/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-trigger-activate +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - interested in files on /test/trigger/ diff --git a/tests/t-triggers-selfcycle/pkg-trigger-activate/DEBIAN/postinst b/tests/t-triggers-selfcycle/pkg-trigger-activate/DEBIAN/postinst new file mode 100755 index 0000000..4039f5b --- /dev/null +++ b/tests/t-triggers-selfcycle/pkg-trigger-activate/DEBIAN/postinst @@ -0,0 +1,10 @@ +#!/bin/sh +set -e + +case "$1" in + triggered) + echo "Pass: triggers processed" + ;; +esac + +exit 0 diff --git a/tests/t-triggers-selfcycle/pkg-trigger-activate/DEBIAN/triggers b/tests/t-triggers-selfcycle/pkg-trigger-activate/DEBIAN/triggers new file mode 100644 index 0000000..9ca0c8c --- /dev/null +++ b/tests/t-triggers-selfcycle/pkg-trigger-activate/DEBIAN/triggers @@ -0,0 +1,2 @@ +interest /test/trigger +activate /test/trigger diff --git a/tests/t-triggers-selfcycle/pkg-trigger-unpack/DEBIAN/control b/tests/t-triggers-selfcycle/pkg-trigger-unpack/DEBIAN/control new file mode 100644 index 0000000..45b7d2a --- /dev/null +++ b/tests/t-triggers-selfcycle/pkg-trigger-unpack/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-trigger-unpack +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - interested in files on /test/trigger/ diff --git a/tests/t-triggers-selfcycle/pkg-trigger-unpack/DEBIAN/postinst b/tests/t-triggers-selfcycle/pkg-trigger-unpack/DEBIAN/postinst new file mode 100755 index 0000000..4039f5b --- /dev/null +++ b/tests/t-triggers-selfcycle/pkg-trigger-unpack/DEBIAN/postinst @@ -0,0 +1,10 @@ +#!/bin/sh +set -e + +case "$1" in + triggered) + echo "Pass: triggers processed" + ;; +esac + +exit 0 diff --git a/tests/t-triggers-selfcycle/pkg-trigger-unpack/DEBIAN/triggers b/tests/t-triggers-selfcycle/pkg-trigger-unpack/DEBIAN/triggers new file mode 100644 index 0000000..3b047af --- /dev/null +++ b/tests/t-triggers-selfcycle/pkg-trigger-unpack/DEBIAN/triggers @@ -0,0 +1 @@ +interest /test/trigger diff --git a/tests/t-triggers-selfcycle/pkg-trigger-unpack/test/trigger/test-file b/tests/t-triggers-selfcycle/pkg-trigger-unpack/test/trigger/test-file new file mode 100644 index 0000000..647063d --- /dev/null +++ b/tests/t-triggers-selfcycle/pkg-trigger-unpack/test/trigger/test-file @@ -0,0 +1 @@ +activating file diff --git a/tests/t-triggers/Makefile b/tests/t-triggers/Makefile new file mode 100644 index 0000000..48cd8b6 --- /dev/null +++ b/tests/t-triggers/Makefile @@ -0,0 +1,365 @@ +TESTS_DEB := pkg-triggers pkg-triggers-await pkg-triggers-noawait \ + pkg-trig-file pkg-trig-explicit pkg-trig-cmd + +include ../Test.mk + +TEST_CASES += test-trigger-file +TEST_CASES += test-trigger-explicit +TEST_CASES += test-trigger-cmd +TEST_CASES += test-trigger-await-file +TEST_CASES += test-trigger-await-cmd +TEST_CASES += test-trigger-noawait-file +TEST_CASES += test-trigger-noawait-explicit +TEST_CASES += test-trigger-noawait-cmd +TEST_CASES += test-internal-db + +test-case: $(TEST_CASES) + +test-trigger-file test-trigger-await-file: + if [ "$@" = "test-trigger-file" ]; then \ + $(DPKG_UNPACK) pkg-triggers.deb; \ + else \ + $(DPKG_UNPACK) pkg-triggers-await.deb; \ + fi + $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" "$(DPKG_INSTDIR)/triggers/ok" + # When unpacked, triggers are not active + $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb + $(call pkg_is_installed,pkg-trig-file) + $(call pkg_status_is,pkg-triggers,install ok unpacked) + $(call pkg_field_is,pkg-triggers,Triggers-Pending,) + ! test -f "$(DPKG_INSTDIR)/triggers/ok" + $(DPKG_CONFIGURE) --no-triggers pkg-triggers + $(call pkg_is_installed,pkg-triggers) + ! test -f "$(DPKG_INSTDIR)/triggers/ok" + # When installed, triggers can be activated + $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_field_is,pkg-triggers,Triggers-Pending, /triggers) + $(call pkg_status_is,pkg-trig-file,install ok triggers-awaited) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + $(call pkg_is_installed,pkg-trig-file) + test -f "$(DPKG_INSTDIR)/triggers/ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/triggers/ok" + # Try other ways to run the triggers + $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-file,install ok triggers-awaited) + $(BEROOT) $(DPKG) --triggers-only --pending + $(call pkg_is_installed,pkg-trig-file) + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/triggers/ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/triggers/ok" + # Again + $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-file,install ok triggers-awaited) + $(DPKG_CONFIGURE) --pending + $(call pkg_is_installed,pkg-trig-file) + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/triggers/ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/triggers/ok" + # Again, but we're unpacking instead of installing + $(DPKG_UNPACK) --no-triggers pkg-trig-file.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-file,install ok unpacked) + $(DPKG_CONFIGURE) pkg-trig-file + # FIXME: Remove ifdef during dpkg 1.18.x cycle, after the apt + # workaround has been reverted. +ifdef DPKG_HAS_CONFIGURE_WITH_IMPLICIT_TRIGGER_PENDING + $(call pkg_status_is,pkg-trig-file,install ok triggers-awaited) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers +endif + $(call pkg_is_installed,pkg-trig-file) + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/triggers/ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/triggers/ok" + # Cleanup + $(DPKG_PURGE) pkg-triggers + $(DPKG_PURGE) pkg-trig-file + +test-trigger-noawait-file: + $(DPKG_UNPACK) pkg-triggers-noawait.deb + $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" "$(DPKG_INSTDIR)/triggers/ok" + # When unpacked, triggers are not active + $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb + $(call pkg_is_installed,pkg-trig-file) + $(call pkg_status_is,pkg-triggers,install ok unpacked) + $(call pkg_field_is,pkg-triggers,Triggers-Pending,) + ! test -f "$(DPKG_INSTDIR)/triggers/ok" + $(DPKG_CONFIGURE) --no-triggers pkg-triggers + $(call pkg_is_installed,pkg-triggers) + ! test -f "$(DPKG_INSTDIR)/triggers/ok" + # When installed, triggers can be activated + $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_field_is,pkg-triggers,Triggers-Pending, /triggers) + $(call pkg_is_installed,pkg-trig-file) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/triggers/ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/triggers/ok" + # Try other ways to run the triggers + $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_is_installed,pkg-trig-file) + $(BEROOT) $(DPKG) --triggers-only --pending + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/triggers/ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/triggers/ok" + # Again + $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_is_installed,pkg-trig-file) + $(DPKG_CONFIGURE) --pending + $(call pkg_is_installed,pkg-trig-file) + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/triggers/ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/triggers/ok" + # Again, but we're unpacking instead of installing + $(DPKG_UNPACK) --no-triggers pkg-trig-file.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-file,install ok unpacked) + $(DPKG_CONFIGURE) --no-triggers pkg-trig-file + $(call pkg_is_installed,pkg-trig-file) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/triggers/ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/triggers/ok" + # Cleanup + $(DPKG_PURGE) pkg-triggers + $(DPKG_PURGE) pkg-trig-file + +test-trigger-explicit: + $(DPKG_UNPACK) pkg-triggers.deb + $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" "$(DPKG_INSTDIR)/triggers/ok" + # When unpacked, triggers are not active + $(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb + $(call pkg_is_installed,pkg-trig-explicit) + $(call pkg_status_is,pkg-triggers,install ok unpacked) + $(call pkg_field_is,pkg-triggers,Triggers-Pending,) + ! test -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(DPKG_CONFIGURE) --no-triggers pkg-triggers + $(call pkg_is_installed,pkg-triggers) + ! test -f "$(DPKG_INSTDIR)/a-trigger-ok" + # When installed, triggers can be activated + $(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_field_is,pkg-triggers,Triggers-Pending, a-trigger) + $(call pkg_status_is,pkg-trig-explicit,install ok triggers-awaited) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + $(call pkg_is_installed,pkg-trig-explicit) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + # Try other ways to run the triggers + $(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-explicit,install ok triggers-awaited) + $(BEROOT) $(DPKG) --triggers-only --pending + $(call pkg_is_installed,pkg-trig-explicit) + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + # Again + $(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-explicit,install ok triggers-awaited) + $(DPKG_CONFIGURE) --pending + $(call pkg_is_installed,pkg-trig-explicit) + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + # Again, but we're unpacking instead of installing + $(DPKG_UNPACK) --no-triggers pkg-trig-explicit.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-explicit,install ok unpacked) + $(DPKG_CONFIGURE) pkg-trig-explicit + $(call pkg_is_installed,pkg-trig-explicit) + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + # Verify the trigger is activated on each status change + $(DPKG_UNPACK) --no-triggers pkg-trig-explicit.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-explicit,install ok unpacked) + $(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited, pkg-triggers) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + $(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited,) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(DPKG_CONFIGURE) --no-triggers pkg-trig-explicit + $(call pkg_status_is,pkg-trig-explicit,install ok triggers-awaited) + $(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited, pkg-triggers) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-trig-explicit) + $(call pkg_is_installed,pkg-triggers) + # Cleanup + $(DPKG_PURGE) pkg-triggers + $(DPKG_PURGE) pkg-trig-explicit + +test-trigger-noawait-explicit: + $(DPKG_INSTALL) pkg-triggers-noawait.deb + $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" "$(DPKG_INSTDIR)/triggers/ok" + # When installed, triggers can be activated + $(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_field_is,pkg-triggers,Triggers-Pending, a-trigger) + $(call pkg_is_installed,pkg-trig-explicit) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + # Again, but we're unpacking instead of installing + $(DPKG_UNPACK) --no-triggers pkg-trig-explicit.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-explicit,install ok unpacked) + $(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited,) + $(DPKG_CONFIGURE) --no-triggers pkg-trig-explicit + $(call pkg_is_installed,pkg-trig-explicit) + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(DPKG_CONFIGURE) --pending + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + # Verify the trigger is activated on each status change + $(DPKG_UNPACK) --no-triggers pkg-trig-explicit.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-explicit,install ok unpacked) + $(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited,) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(DPKG_CONFIGURE) --no-triggers pkg-trig-explicit + $(call pkg_is_installed,pkg-trig-explicit) + $(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited,) + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + # Cleanup + $(DPKG_PURGE) pkg-triggers + $(DPKG_PURGE) pkg-trig-explicit + +test-trigger-cmd test-trigger-await-cmd: + if [ "$@" = "test-trigger-await-cmd" ]; then \ + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-await"; \ + fi + $(DPKG_UNPACK) pkg-triggers.deb + $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" "$(DPKG_INSTDIR)/triggers/ok" + # When unpacked, triggers are not active + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-postinst" "$(DPKG_INSTDIR)/trigger-preinst" "$(DPKG_INSTDIR)/trigger-postrm" "$(DPKG_INSTDIR)/trigger-prerm" + $(DPKG_INSTALL) --no-triggers pkg-trig-cmd.deb + $(call pkg_is_installed,pkg-trig-cmd) + $(call pkg_status_is,pkg-triggers,install ok unpacked) + $(call pkg_field_is,pkg-triggers,Triggers-Pending,) + ! test -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(DPKG_CONFIGURE) --no-triggers pkg-triggers + $(call pkg_is_installed,pkg-triggers) + ! test -f "$(DPKG_INSTDIR)/a-trigger-ok" + # When installed, triggers can be activated + $(DPKG_INSTALL) --no-triggers pkg-trig-cmd.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_field_is,pkg-triggers,Triggers-Pending, a-trigger) + $(call pkg_status_is,pkg-trig-cmd,install ok triggers-awaited) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + $(call pkg_is_installed,pkg-trig-cmd) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-postinst" "$(DPKG_INSTDIR)/trigger-preinst" "$(DPKG_INSTDIR)/trigger-postrm" "$(DPKG_INSTDIR)/trigger-prerm" + # Call dpkg-trigger in the preinst + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-preinst" + $(DPKG_UNPACK) --no-triggers pkg-trig-cmd.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-cmd,install ok unpacked) + $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited, pkg-triggers) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-preinst" + # Call dpkg-trigger in the postinst + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-postinst" + $(DPKG_CONFIGURE) --no-triggers pkg-trig-cmd + $(call pkg_status_is,pkg-trig-cmd,install ok triggers-awaited) + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + $(call pkg_is_installed,pkg-trig-cmd) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-postinst" + # Call dpkg-trigger in the prerm + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-prerm" + $(DPKG_UNPACK) --no-triggers pkg-trig-cmd.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-cmd,install ok unpacked) + $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited, pkg-triggers) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-prerm" + # Call dpkg-trigger in the postrm + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-postrm" + $(DPKG_UNPACK) --no-triggers pkg-trig-cmd.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-cmd,install ok unpacked) + $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited, pkg-triggers) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-postrm" + # Cleanup + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-await" + $(DPKG_PURGE) pkg-triggers + $(DPKG_PURGE) pkg-trig-cmd + +test-trigger-noawait-cmd: + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-noawait" + $(DPKG_UNPACK) pkg-triggers.deb + $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" "$(DPKG_INSTDIR)/triggers/ok" + # When unpacked, triggers are not active + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-postinst" "$(DPKG_INSTDIR)/trigger-preinst" "$(DPKG_INSTDIR)/trigger-postrm" "$(DPKG_INSTDIR)/trigger-prerm" + $(DPKG_INSTALL) --no-triggers pkg-trig-cmd.deb + $(call pkg_is_installed,pkg-trig-cmd) + $(call pkg_status_is,pkg-triggers,install ok unpacked) + $(call pkg_field_is,pkg-triggers,Triggers-Pending,) + ! test -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(DPKG_CONFIGURE) --no-triggers pkg-triggers + $(call pkg_is_installed,pkg-triggers) + ! test -f "$(DPKG_INSTDIR)/a-trigger-ok" + # When installed, triggers can be activated + $(DPKG_INSTALL) --no-triggers pkg-trig-cmd.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_field_is,pkg-triggers,Triggers-Pending, a-trigger) + $(call pkg_is_installed,pkg-trig-cmd) + $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-postinst" "$(DPKG_INSTDIR)/trigger-preinst" "$(DPKG_INSTDIR)/trigger-postrm" "$(DPKG_INSTDIR)/trigger-prerm" + # Call dpkg-trigger in the preinst + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-preinst" + $(DPKG_UNPACK) --no-triggers pkg-trig-cmd.deb + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(call pkg_status_is,pkg-trig-cmd,install ok unpacked) + $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-preinst" + # Call dpkg-trigger in the postinst + $(BEROOT) touch "$(DPKG_INSTDIR)/trigger-postinst" + $(DPKG_CONFIGURE) --no-triggers pkg-trig-cmd + $(call pkg_is_installed,pkg-trig-cmd) + $(call pkg_status_is,pkg-triggers,install ok triggers-pending) + $(BEROOT) $(DPKG) --triggers-only pkg-triggers + $(call pkg_is_installed,pkg-triggers) + test -f "$(DPKG_INSTDIR)/a-trigger-ok" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-postinst" + # Cleanup + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-noawait" + $(DPKG_PURGE) pkg-triggers + $(DPKG_PURGE) pkg-trig-cmd + +test-internal-db: + # test that installing triggers creates the corresponding files + $(DPKG_INSTALL) pkg-triggers.deb + $(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers) + grep -q "^/triggers pkg-triggers$$" "$(DPKG_ADMINDIR)/triggers/File" + $(DPKG_INSTALL) pkg-triggers-noawait.deb + $(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers/noawait) + grep -q "^/triggers pkg-triggers/noawait$$" "$(DPKG_ADMINDIR)/triggers/File" + # Test that removal cleans up the triggers files + $(DPKG_PURGE) pkg-triggers + ! test -e "$(DPKG_ADMINDIR)/triggers/a-trigger" + ! test -e "$(DPKG_ADMINDIR)/triggers/File" + +test-clean: + $(DPKG_PURGE) pkg-triggers pkg-trig-file pkg-trig-explicit pkg-trig-cmd + $(BEROOT) rm -f "$(DPKG_INSTDIR)/a-trigger-ok" "$(DPKG_INSTDIR)/triggers/ok" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-postinst" "$(DPKG_INSTDIR)/trigger-preinst" "$(DPKG_INSTDIR)/trigger-postrm" "$(DPKG_INSTDIR)/trigger-prerm" + $(BEROOT) rm -f "$(DPKG_INSTDIR)/trigger-noawait" + diff --git a/tests/t-triggers/pkg-trig-cmd/DEBIAN/control b/tests/t-triggers/pkg-trig-cmd/DEBIAN/control new file mode 100644 index 0000000..196c8a8 --- /dev/null +++ b/tests/t-triggers/pkg-trig-cmd/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trig-cmd +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - running dpkg-trigger in maintainer scripts + diff --git a/tests/t-triggers/pkg-trig-cmd/DEBIAN/postinst b/tests/t-triggers/pkg-trig-cmd/DEBIAN/postinst new file mode 100755 index 0000000..3975be0 --- /dev/null +++ b/tests/t-triggers/pkg-trig-cmd/DEBIAN/postinst @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ -e "$DPKG_ROOT/trigger-$DPKG_MAINTSCRIPT_NAME" ]; then + if [ -e "$DPKG_ROOT/trigger-noawait" ]; then + echo "Executing 'dpkg-trigger --no-await a-trigger' from '$0 $1'" + dpkg-trigger --no-await a-trigger + elif [ -e "$DPKG_ROOT/trigger-await" ]; then + echo "Executing 'dpkg-trigger --await a-trigger' from '$0 $1'" + dpkg-trigger --await a-trigger + else + echo "Executing 'dpkg-trigger a-trigger' from '$0 $1'" + dpkg-trigger a-trigger + fi +fi + diff --git a/tests/t-triggers/pkg-trig-cmd/DEBIAN/postrm b/tests/t-triggers/pkg-trig-cmd/DEBIAN/postrm new file mode 100755 index 0000000..3975be0 --- /dev/null +++ b/tests/t-triggers/pkg-trig-cmd/DEBIAN/postrm @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ -e "$DPKG_ROOT/trigger-$DPKG_MAINTSCRIPT_NAME" ]; then + if [ -e "$DPKG_ROOT/trigger-noawait" ]; then + echo "Executing 'dpkg-trigger --no-await a-trigger' from '$0 $1'" + dpkg-trigger --no-await a-trigger + elif [ -e "$DPKG_ROOT/trigger-await" ]; then + echo "Executing 'dpkg-trigger --await a-trigger' from '$0 $1'" + dpkg-trigger --await a-trigger + else + echo "Executing 'dpkg-trigger a-trigger' from '$0 $1'" + dpkg-trigger a-trigger + fi +fi + diff --git a/tests/t-triggers/pkg-trig-cmd/DEBIAN/preinst b/tests/t-triggers/pkg-trig-cmd/DEBIAN/preinst new file mode 100755 index 0000000..3975be0 --- /dev/null +++ b/tests/t-triggers/pkg-trig-cmd/DEBIAN/preinst @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ -e "$DPKG_ROOT/trigger-$DPKG_MAINTSCRIPT_NAME" ]; then + if [ -e "$DPKG_ROOT/trigger-noawait" ]; then + echo "Executing 'dpkg-trigger --no-await a-trigger' from '$0 $1'" + dpkg-trigger --no-await a-trigger + elif [ -e "$DPKG_ROOT/trigger-await" ]; then + echo "Executing 'dpkg-trigger --await a-trigger' from '$0 $1'" + dpkg-trigger --await a-trigger + else + echo "Executing 'dpkg-trigger a-trigger' from '$0 $1'" + dpkg-trigger a-trigger + fi +fi + diff --git a/tests/t-triggers/pkg-trig-cmd/DEBIAN/prerm b/tests/t-triggers/pkg-trig-cmd/DEBIAN/prerm new file mode 100755 index 0000000..3975be0 --- /dev/null +++ b/tests/t-triggers/pkg-trig-cmd/DEBIAN/prerm @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ -e "$DPKG_ROOT/trigger-$DPKG_MAINTSCRIPT_NAME" ]; then + if [ -e "$DPKG_ROOT/trigger-noawait" ]; then + echo "Executing 'dpkg-trigger --no-await a-trigger' from '$0 $1'" + dpkg-trigger --no-await a-trigger + elif [ -e "$DPKG_ROOT/trigger-await" ]; then + echo "Executing 'dpkg-trigger --await a-trigger' from '$0 $1'" + dpkg-trigger --await a-trigger + else + echo "Executing 'dpkg-trigger a-trigger' from '$0 $1'" + dpkg-trigger a-trigger + fi +fi + diff --git a/tests/t-triggers/pkg-trig-explicit/DEBIAN/control b/tests/t-triggers/pkg-trig-explicit/DEBIAN/control new file mode 100644 index 0000000..8fdfeca --- /dev/null +++ b/tests/t-triggers/pkg-trig-explicit/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trig-explicit +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - activate trigger "a-trigger" + diff --git a/tests/t-triggers/pkg-trig-explicit/DEBIAN/triggers b/tests/t-triggers/pkg-trig-explicit/DEBIAN/triggers new file mode 100644 index 0000000..cc71459 --- /dev/null +++ b/tests/t-triggers/pkg-trig-explicit/DEBIAN/triggers @@ -0,0 +1 @@ +activate a-trigger diff --git a/tests/t-triggers/pkg-trig-file/DEBIAN/control b/tests/t-triggers/pkg-trig-file/DEBIAN/control new file mode 100644 index 0000000..ef3663a --- /dev/null +++ b/tests/t-triggers/pkg-trig-file/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trig-file +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - install a file in /triggers + diff --git a/tests/t-triggers/pkg-trig-file/triggers/a-file b/tests/t-triggers/pkg-trig-file/triggers/a-file new file mode 100644 index 0000000..4dd1ef7 --- /dev/null +++ b/tests/t-triggers/pkg-trig-file/triggers/a-file @@ -0,0 +1 @@ +This is a file. diff --git a/tests/t-triggers/pkg-triggers-await/DEBIAN/control b/tests/t-triggers/pkg-triggers-await/DEBIAN/control new file mode 100644 index 0000000..dc27453 --- /dev/null +++ b/tests/t-triggers/pkg-triggers-await/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-triggers +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - providing triggers diff --git a/tests/t-triggers/pkg-triggers-await/DEBIAN/postinst b/tests/t-triggers/pkg-triggers-await/DEBIAN/postinst new file mode 100755 index 0000000..5269ac4 --- /dev/null +++ b/tests/t-triggers/pkg-triggers-await/DEBIAN/postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ "$1" = "triggered" ]; then + case " $2 " in + *" a-trigger "*) + touch "$DPKG_ROOT/a-trigger-ok" + ;; + *" /triggers "*) + touch "$DPKG_ROOT/triggers/ok" + ;; + esac +fi + diff --git a/tests/t-triggers/pkg-triggers-await/DEBIAN/triggers b/tests/t-triggers/pkg-triggers-await/DEBIAN/triggers new file mode 100644 index 0000000..9ce7f67 --- /dev/null +++ b/tests/t-triggers/pkg-triggers-await/DEBIAN/triggers @@ -0,0 +1,2 @@ +interest-await a-trigger +interest-await /triggers diff --git a/tests/t-triggers/pkg-triggers-noawait/DEBIAN/control b/tests/t-triggers/pkg-triggers-noawait/DEBIAN/control new file mode 100644 index 0000000..ff9d5d5 --- /dev/null +++ b/tests/t-triggers/pkg-triggers-noawait/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-triggers +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - providing triggers + diff --git a/tests/t-triggers/pkg-triggers-noawait/DEBIAN/postinst b/tests/t-triggers/pkg-triggers-noawait/DEBIAN/postinst new file mode 100755 index 0000000..5269ac4 --- /dev/null +++ b/tests/t-triggers/pkg-triggers-noawait/DEBIAN/postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ "$1" = "triggered" ]; then + case " $2 " in + *" a-trigger "*) + touch "$DPKG_ROOT/a-trigger-ok" + ;; + *" /triggers "*) + touch "$DPKG_ROOT/triggers/ok" + ;; + esac +fi + diff --git a/tests/t-triggers/pkg-triggers-noawait/DEBIAN/triggers b/tests/t-triggers/pkg-triggers-noawait/DEBIAN/triggers new file mode 100644 index 0000000..13d2512 --- /dev/null +++ b/tests/t-triggers/pkg-triggers-noawait/DEBIAN/triggers @@ -0,0 +1,2 @@ +interest-noawait a-trigger +interest-noawait /triggers diff --git a/tests/t-triggers/pkg-triggers/DEBIAN/control b/tests/t-triggers/pkg-triggers/DEBIAN/control new file mode 100644 index 0000000..ff9d5d5 --- /dev/null +++ b/tests/t-triggers/pkg-triggers/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-triggers +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - providing triggers + diff --git a/tests/t-triggers/pkg-triggers/DEBIAN/postinst b/tests/t-triggers/pkg-triggers/DEBIAN/postinst new file mode 100755 index 0000000..5269ac4 --- /dev/null +++ b/tests/t-triggers/pkg-triggers/DEBIAN/postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ "$1" = "triggered" ]; then + case " $2 " in + *" a-trigger "*) + touch "$DPKG_ROOT/a-trigger-ok" + ;; + *" /triggers "*) + touch "$DPKG_ROOT/triggers/ok" + ;; + esac +fi + diff --git a/tests/t-triggers/pkg-triggers/DEBIAN/triggers b/tests/t-triggers/pkg-triggers/DEBIAN/triggers new file mode 100644 index 0000000..daa582c --- /dev/null +++ b/tests/t-triggers/pkg-triggers/DEBIAN/triggers @@ -0,0 +1,2 @@ +interest a-trigger +interest /triggers diff --git a/tests/t-unpack-device/Makefile b/tests/t-unpack-device/Makefile new file mode 100644 index 0000000..0dcb3ca --- /dev/null +++ b/tests/t-unpack-device/Makefile @@ -0,0 +1,26 @@ +PKG := pkg-device + +TESTS_DEB := $(PKG) + +include ../Test.mk + +$(PKG)/test-null: + $(BEROOT) mknod $@ c 1 3 + +$(PKG)/test-ram0: + $(BEROOT) mknod $@ b 1 0 + +build-hook: $(PKG)/test-null $(PKG)/test-ram0 + +clean-hook: + rm -f $(PKG)/test-null + rm -f $(PKG)/test-ram0 + +test-case: + # test unpacking device files + $(DPKG_INSTALL) pkg-device.deb + $(call pkg_is_installed,pkg-device) + +test-clean: + $(DPKG_PURGE) pkg-device + diff --git a/tests/t-unpack-device/pkg-device/DEBIAN/control b/tests/t-unpack-device/pkg-device/DEBIAN/control new file mode 100644 index 0000000..e5d5399 --- /dev/null +++ b/tests/t-unpack-device/pkg-device/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-device +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - devices unpack + diff --git a/tests/t-unpack-divert-hardlink/Makefile b/tests/t-unpack-divert-hardlink/Makefile new file mode 100644 index 0000000..75287f7 --- /dev/null +++ b/tests/t-unpack-divert-hardlink/Makefile @@ -0,0 +1,31 @@ +PKG := pkg-hardlink + +TESTS_DEB := $(PKG) + +include ../Test.mk + +$(PKG)/test-hardlink: + link $(PKG)/test-file $@ + +build-hook: $(PKG)/test-hardlink + +clean-hook: + rm -f $(PKG)/test-hardlink + +test-case: + $(DPKG_DIVERT_ADD) /test-file + $(DPKG_DIVERT_ADD) /test-hardlink + # test if unpack can divert a hardlink + $(DPKG_INSTALL) pkg-hardlink.deb + $(call pkg_is_installed,pkg-hardlink) + test -f '$(DPKG_INSTDIR)/test-file.distrib' + test -f '$(DPKG_INSTDIR)/test-hardlink.distrib' + cmp '$(DPKG_INSTDIR)/test-file.distrib' \ + '$(DPKG_INSTDIR)/test-hardlink.distrib' + test "`stat -c '%i' '$(DPKG_INSTDIR)/test-file.distrib'`" = \ + "`stat -c '%i' '$(DPKG_INSTDIR)/test-hardlink.distrib'`" + +test-clean: + $(DPKG_PURGE) pkg-hardlink + $(DPKG_DIVERT_DEL) /test-file + $(DPKG_DIVERT_DEL) /test-hardlink diff --git a/tests/t-unpack-divert-hardlink/pkg-hardlink/DEBIAN/control b/tests/t-unpack-divert-hardlink/pkg-hardlink/DEBIAN/control new file mode 100644 index 0000000..da36e99 --- /dev/null +++ b/tests/t-unpack-divert-hardlink/pkg-hardlink/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-hardlink +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide two hard linked files diff --git a/tests/t-unpack-divert-hardlink/pkg-hardlink/test-file b/tests/t-unpack-divert-hardlink/pkg-hardlink/test-file new file mode 100644 index 0000000..94e47d3 --- /dev/null +++ b/tests/t-unpack-divert-hardlink/pkg-hardlink/test-file @@ -0,0 +1 @@ +test diverted diff --git a/tests/t-unpack-divert-nowarn/Makefile b/tests/t-unpack-divert-nowarn/Makefile new file mode 100644 index 0000000..aa56877 --- /dev/null +++ b/tests/t-unpack-divert-nowarn/Makefile @@ -0,0 +1,10 @@ +TESTS_DEB := pkg-files pkg-divert-unpacking + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-files.deb + $(DPKG_UNPACK) pkg-divert-unpacking.deb + +test-clean: + $(DPKG_PURGE) pkg-files pkg-divert-unpacking diff --git a/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/DEBIAN/control b/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/DEBIAN/control new file mode 100644 index 0000000..d677e02 --- /dev/null +++ b/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-divert-unpacking +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - divert a file w/o having ever unpacked + This should not result in any warning. diff --git a/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/DEBIAN/postrm b/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/DEBIAN/postrm new file mode 100755 index 0000000..8d834a5 --- /dev/null +++ b/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/DEBIAN/postrm @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +if [ "$1" = "purge" ]; then + dpkg-divert --quiet --remove --rename /test-file +fi diff --git a/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/DEBIAN/preinst b/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/DEBIAN/preinst new file mode 100755 index 0000000..a61ad11 --- /dev/null +++ b/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/DEBIAN/preinst @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then + dpkg-divert --quiet --package pkg-divert-unpacking --rename \ + --divert /test-file.diverted --add /test-file 2>&1 | \ + grep "warning: " && echo "Fail: warning in output" && exit 1 || + echo Pass +fi diff --git a/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/test-file b/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/test-file new file mode 100644 index 0000000..94e47d3 --- /dev/null +++ b/tests/t-unpack-divert-nowarn/pkg-divert-unpacking/test-file @@ -0,0 +1 @@ +test diverted diff --git a/tests/t-unpack-divert-nowarn/pkg-files/DEBIAN/control b/tests/t-unpack-divert-nowarn/pkg-files/DEBIAN/control new file mode 100644 index 0000000..b616257 --- /dev/null +++ b/tests/t-unpack-divert-nowarn/pkg-files/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-files +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - provide a file diff --git a/tests/t-unpack-divert-nowarn/pkg-files/test-file b/tests/t-unpack-divert-nowarn/pkg-files/test-file new file mode 100644 index 0000000..6fbc8b5 --- /dev/null +++ b/tests/t-unpack-divert-nowarn/pkg-files/test-file @@ -0,0 +1 @@ +test init diff --git a/tests/t-unpack-fifo/Makefile b/tests/t-unpack-fifo/Makefile new file mode 100644 index 0000000..eaa848a --- /dev/null +++ b/tests/t-unpack-fifo/Makefile @@ -0,0 +1,22 @@ +PKG := pkg-fifo + +TESTS_DEB := pkg-fifo + +include ../Test.mk + +$(PKG)/test-fifo: + mkfifo $@ + +build-hook: $(PKG)/test-fifo + +clean-hook: + rm -f $(PKG)/test-fifo + +test-case: + # test unpacking a fifo + $(DPKG_INSTALL) pkg-fifo.deb + $(call pkg_is_installed,pkg-fifo) + +test-clean: + $(DPKG_PURGE) pkg-fifo + diff --git a/tests/t-unpack-fifo/pkg-fifo/DEBIAN/control b/tests/t-unpack-fifo/pkg-fifo/DEBIAN/control new file mode 100644 index 0000000..8087b89 --- /dev/null +++ b/tests/t-unpack-fifo/pkg-fifo/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-fifo +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - unpacking fifo + diff --git a/tests/t-unpack-hardlink/Makefile b/tests/t-unpack-hardlink/Makefile new file mode 100644 index 0000000..3412ca5 --- /dev/null +++ b/tests/t-unpack-hardlink/Makefile @@ -0,0 +1,56 @@ +PKG := pkg-hardlink + +TESTS_DEB := $(PKG) + +include ../Test.mk + +$(PKG)/test-conffile-link0: + echo "test hard linked conffile" >$@ + link $@ $(PKG)/test-conffile-link1 + +$(PKG)/test-file-link0: + echo "test hard linked file" >$@ + link $@ $(PKG)/test-file-link1 + +$(PKG)/test-fifo-link0: + mkfifo $@ + link $@ $(PKG)/test-fifo-link1 + +$(PKG)/test-null-link0: + $(BEROOT) mknod $@ c 1 3 + $(BEROOT) link $@ $(PKG)/test-null-link1 + +$(PKG)/test-ram0-link0: + $(BEROOT) mknod $@ b 1 0 + $(BEROOT) link $@ $(PKG)/test-ram0-link1 + +TEST_LINKS := \ + $(PKG)/test-conffile-link0 \ + $(PKG)/test-file-link0 \ + $(PKG)/test-fifo-link0 \ + # EOL + +ifdef DPKG_AS_ROOT +TEST_LINKS += \ + $(PKG)/test-null-link0 \ + $(PKG)/test-ram0-link0 \ + # EOL +endif + +build-hook: $(TEST_LINKS) + +clean-hook: + rm -f $(PKG)/test-conffile-link0 $(PKG)/test-conffile-link1 + rm -f $(PKG)/test-file-link0 $(PKG)/test-file-link1 + rm -f $(PKG)/test-fifo-link0 $(PKG)/test-fifo-link1 + rm -f $(PKG)/test-null-link0 $(PKG)/test-null-link1 + rm -f $(PKG)/test-ram0-link0 $(PKG)/test-ram0-link1 + +test-case: + # test unpacking hardlinks + $(DPKG_INSTALL) pkg-hardlink.deb + $(call pkg_is_installed,pkg-hardlink) + +test-clean: + $(DPKG_PURGE) pkg-hardlink + diff --git a/tests/t-unpack-hardlink/pkg-hardlink/DEBIAN/conffiles b/tests/t-unpack-hardlink/pkg-hardlink/DEBIAN/conffiles new file mode 100644 index 0000000..4634045 --- /dev/null +++ b/tests/t-unpack-hardlink/pkg-hardlink/DEBIAN/conffiles @@ -0,0 +1,2 @@ +/test-conffile-link0 +/test-conffile-link1 diff --git a/tests/t-unpack-hardlink/pkg-hardlink/DEBIAN/control b/tests/t-unpack-hardlink/pkg-hardlink/DEBIAN/control new file mode 100644 index 0000000..c513f9c --- /dev/null +++ b/tests/t-unpack-hardlink/pkg-hardlink/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-hardlink +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - unpack hardlinks + diff --git a/tests/t-unpack-symlink/Makefile b/tests/t-unpack-symlink/Makefile new file mode 100644 index 0000000..09287f4 --- /dev/null +++ b/tests/t-unpack-symlink/Makefile @@ -0,0 +1,12 @@ +TESTS_DEB := pkg-symlink + +include ../Test.mk + +test-case: + # test unpacking symlinks + $(DPKG_INSTALL) pkg-symlink.deb + $(call pkg_is_installed,pkg-symlink) + +test-clean: + $(DPKG_PURGE) pkg-symlink + diff --git a/tests/t-unpack-symlink/pkg-symlink/DEBIAN/control b/tests/t-unpack-symlink/pkg-symlink/DEBIAN/control new file mode 100644 index 0000000..f57852f --- /dev/null +++ b/tests/t-unpack-symlink/pkg-symlink/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-symlink +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - unpack symlink + diff --git a/tests/t-unpack-symlink/pkg-symlink/test-file b/tests/t-unpack-symlink/pkg-symlink/test-file new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-unpack-symlink/pkg-symlink/test-file diff --git a/tests/t-unpack-symlink/pkg-symlink/test-symlink b/tests/t-unpack-symlink/pkg-symlink/test-symlink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-unpack-symlink/pkg-symlink/test-symlink diff --git a/tests/t-verify/Makefile b/tests/t-verify/Makefile new file mode 100644 index 0000000..2763e84 --- /dev/null +++ b/tests/t-verify/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := pkg-verify + +include ../Test.mk + +test-case: + $(DPKG_INSTALL) pkg-verify.deb + $(call pkg_is_installed,pkg-verify) + $(call stdout_is,$(DPKG_VERIFY) pkg-verify,) + $(BEROOT) sh -c "echo 'MODIFIED' >>'$(DPKG_INSTDIR)/test-dir/test-data'" + $(call stdout_has,$(DPKG_VERIFY) pkg-verify,^\?\?5\?\?\?\?\?\? /test-dir/test-data$) + +test-clean: + $(DPKG_PURGE) pkg-verify diff --git a/tests/t-verify/pkg-verify/DEBIAN/control b/tests/t-verify/pkg-verify/DEBIAN/control new file mode 100644 index 0000000..5d383a2 --- /dev/null +++ b/tests/t-verify/pkg-verify/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-verify +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - verify diff --git a/tests/t-verify/pkg-verify/test-dir/test-data b/tests/t-verify/pkg-verify/test-dir/test-data new file mode 100644 index 0000000..f2f6d87 --- /dev/null +++ b/tests/t-verify/pkg-verify/test-dir/test-data @@ -0,0 +1 @@ +some other data diff --git a/tests/t-verify/pkg-verify/test-dir/test-digits b/tests/t-verify/pkg-verify/test-dir/test-digits new file mode 100644 index 0000000..0ff3bbb --- /dev/null +++ b/tests/t-verify/pkg-verify/test-dir/test-digits @@ -0,0 +1,20 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 diff --git a/tests/t-verify/pkg-verify/test-file b/tests/t-verify/pkg-verify/test-file new file mode 100644 index 0000000..7a1c613 --- /dev/null +++ b/tests/t-verify/pkg-verify/test-file @@ -0,0 +1 @@ +some file |