From bd7e00096e4ae941164026cb571c70939e13ced2 Mon Sep 17 00:00:00 2001 From: Björn Persson Date: Sun, 23 Feb 2014 16:16:12 +0100 Subject: Test installation and phoniness. --- testsuite/inputs/configure-build-install | 24 ++++++++++++ testsuite/inputs/configure_and_build | 21 ----------- testsuite/inputs/default_install | 21 +++++++++++ testsuite/library | 15 +++++--- testsuite/sources/steps/Comfignat_default_goal | 1 + testsuite/sources/steps/Makefile | 52 ++++++++++++++++++++++++++ testsuite/sources/steps/base | 1 + testsuite/sources/steps/build | 1 + testsuite/sources/steps/build_testcase.gpr | 20 ++++++++++ testsuite/sources/steps/clean | 1 + testsuite/sources/steps/configure | 1 + testsuite/sources/steps/distclean | 1 + testsuite/sources/steps/generated_files | 9 +++++ testsuite/sources/steps/install | 1 + testsuite/sources/steps/install_files | 1 + testsuite/sources/steps/install_stage | 1 + testsuite/sources/steps/postinstall | 1 + testsuite/sources/steps/preinstall | 1 + testsuite/sources/steps/preprocess | 1 + testsuite/sources/steps/testcase.adb | 20 ++++++++++ testsuite/sources/steps/unconfigure | 1 + 21 files changed, 168 insertions(+), 27 deletions(-) create mode 100644 testsuite/inputs/configure-build-install delete mode 100644 testsuite/inputs/configure_and_build create mode 100644 testsuite/inputs/default_install create mode 100644 testsuite/sources/steps/Comfignat_default_goal create mode 100644 testsuite/sources/steps/Makefile create mode 100644 testsuite/sources/steps/base create mode 100644 testsuite/sources/steps/build create mode 100644 testsuite/sources/steps/build_testcase.gpr create mode 100644 testsuite/sources/steps/clean create mode 100644 testsuite/sources/steps/configure create mode 100644 testsuite/sources/steps/distclean create mode 100644 testsuite/sources/steps/generated_files create mode 100644 testsuite/sources/steps/install create mode 100644 testsuite/sources/steps/install_files create mode 100644 testsuite/sources/steps/install_stage create mode 100644 testsuite/sources/steps/postinstall create mode 100644 testsuite/sources/steps/preinstall create mode 100644 testsuite/sources/steps/preprocess create mode 100644 testsuite/sources/steps/testcase.adb create mode 100644 testsuite/sources/steps/unconfigure diff --git a/testsuite/inputs/configure-build-install b/testsuite/inputs/configure-build-install new file mode 100644 index 0000000..33bcbe0 --- /dev/null +++ b/testsuite/inputs/configure-build-install @@ -0,0 +1,24 @@ +# part of Comfignat's testsuite +# Copyright 2014 B. Persson, Bjorn@Rombobeorn.se +# +# This material is provided as is, with absolutely no warranty expressed +# or implied. Any use is at your own risk. +# +# Permission is hereby granted to use or copy this testsuite +# for any purpose, provided the above notices are retained on all copies. +# Permission to modify the code and to distribute modified code is granted, +# provided the above notices are retained, and a notice that the code was +# modified is included with the above copyright notice. + + +prefix=/usr +libdir=/usr/lib64 +frobnicate=true +installation=files +expect_configuration always +expect_generated_files +expect_generated_files destdir +common_setup +make configure prefix="${prefix}" libdir="${libdir}" frobnicate=true +make +DESTDIR=destdir make install diff --git a/testsuite/inputs/configure_and_build b/testsuite/inputs/configure_and_build deleted file mode 100644 index 1a96953..0000000 --- a/testsuite/inputs/configure_and_build +++ /dev/null @@ -1,21 +0,0 @@ -# part of Comfignat's testsuite -# Copyright 2014 B. Persson, Bjorn@Rombobeorn.se -# -# This material is provided as is, with absolutely no warranty expressed -# or implied. Any use is at your own risk. -# -# Permission is hereby granted to use or copy this testsuite -# for any purpose, provided the above notices are retained on all copies. -# Permission to modify the code and to distribute modified code is granted, -# provided the above notices are retained, and a notice that the code was -# modified is included with the above copyright notice. - - -prefix=/usr -libdir=/usr/lib64 -frobnicate=true -expect_configuration always -expect_generated_files -common_setup -make configure prefix="${prefix}" libdir="${libdir}" frobnicate=true -make diff --git a/testsuite/inputs/default_install b/testsuite/inputs/default_install new file mode 100644 index 0000000..457a577 --- /dev/null +++ b/testsuite/inputs/default_install @@ -0,0 +1,21 @@ +# part of Comfignat's testsuite +# Copyright 2014 B. Persson, Bjorn@Rombobeorn.se +# +# This material is provided as is, with absolutely no warranty expressed +# or implied. Any use is at your own risk. +# +# Permission is hereby granted to use or copy this testsuite +# for any purpose, provided the above notices are retained on all copies. +# Permission to modify the code and to distribute modified code is granted, +# provided the above notices are retained, and a notice that the code was +# modified is included with the above copyright notice. + + +installation=full +expect_configuration +expect_generated_files +expect_generated_files destdir +common_setup +# Use DESTDIR to keep the testcase contained, but override do_preinstall and +# do_postinstall to simulate installation to the filesystem root. +make install DESTDIR=destdir do_preinstall=true do_postinstall=true diff --git a/testsuite/library b/testsuite/library index 4482215..9e4cbbd 100644 --- a/testsuite/library +++ b/testsuite/library @@ -23,8 +23,11 @@ expect_configuration () { expect_generated_files () { # The testcase is expected to generate files which are listed in the file - # generated_files. The list is whitespace-separated and may contain shell - # variable references. + # generated_files, one per line. The lines may contain shell variable + # references. A line that expands into an empty string is ignored. + # A directory name may be passed as a parameter. The generated files will + # then be expected under that directory instead of the default staging + # directory. # These directory variables mustn't be conveyed from Comfignat, because then # the testsuite would rely on the same thing that it's supposed to test. @@ -37,7 +40,7 @@ expect_generated_files () { libdir=${libdir:-${exec_prefix}/lib} alidir=${alidir:-${libdir}} gprdir=${gprdir:-${datarootdir}/gpr} - stagedir=stage + stagedir=${1:-stage} stage_bindir=${stagedir}${bindir} stage_libexecdir=${stagedir}${libexecdir} stage_includedir=${stagedir}${includedir} @@ -45,13 +48,13 @@ expect_generated_files () { stage_alidir=${stagedir}${alidir} stage_gprdir=${stagedir}${gprdir} - for file in $(cat "${srcdir}"/generated_files) ; do + cat "${srcdir}"/generated_files | while read line ; do # Expand variables in the string to get the pathname. - eval file="${file}" + eval file="${line}" # Write the pathname and its parent directories to the file list. # Chop off pathname components until only "." remains, but also avoid # looping forever if the final residue turns out to be "/" or "//". - while [ "${file}" != . -a "${file}" != / -a "${file}" != // ] ; do + while [ -n "${file}" -a "${file}" != . -a "${file}" != / -a "${file}" != // ] ; do echo "${builddir}/${file}" >>"${file_list}" file=$(dirname "${file}") done diff --git a/testsuite/sources/steps/Comfignat_default_goal b/testsuite/sources/steps/Comfignat_default_goal new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/Comfignat_default_goal @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/Makefile b/testsuite/sources/steps/Makefile new file mode 100644 index 0000000..9b78bbc --- /dev/null +++ b/testsuite/sources/steps/Makefile @@ -0,0 +1,52 @@ +# part of Comfignat's testsuite +# Copyright 2014 B. Persson, Bjorn@Rombobeorn.se +# +# This material is provided as is, with absolutely no warranty expressed +# or implied. Any use is at your own risk. +# +# Permission is hereby granted to use or copy this testsuite +# for any purpose, provided the above notices are retained on all copies. +# Permission to modify the code and to distribute modified code is granted, +# provided the above notices are retained, and a notice that the code was +# modified is included with the above copyright notice. + + +include comfignat.mk + +build_GPRs = build_testcase.gpr + +preprocess: + echo done >> preprocess_done + +base: + echo done >> base_done + +build: + echo done >> build_done + +preinstall: + echo done >> preinstall_done + +install_files: + echo done >> install_files_done + +postinstall: + echo done >> postinstall_done + +install: + echo done >> install_done + errors=0; \ + for file in *_done; do \ + if ! echo done | diff "$${file}" - >/dev/null; then \ + echo "The content of $${file} is wrong:" >&2; \ + cat "$${file}" >&2; \ + errors=`expr $${errors} + 1`; \ + fi; \ + done; \ + exit $${errors} +# Each *_done file shall contain one line with "done". If there are two, then a +# step has been performed twice. For example "make install" may have triggered +# a build even though a build had already been done. + +clean:: + rm -f *_done diff --git a/testsuite/sources/steps/base b/testsuite/sources/steps/base new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/base @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/build b/testsuite/sources/steps/build new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/build @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/build_testcase.gpr b/testsuite/sources/steps/build_testcase.gpr new file mode 100644 index 0000000..912115b --- /dev/null +++ b/testsuite/sources/steps/build_testcase.gpr @@ -0,0 +1,20 @@ +-- part of Comfignat's testsuite +-- Copyright 2014 B. Persson, Bjorn@Rombobeorn.se +-- +-- This material is provided as is, with absolutely no warranty expressed +-- or implied. Any use is at your own risk. +-- +-- Permission is hereby granted to use or copy this testsuite +-- for any purpose, provided the above notices are retained on all copies. +-- Permission to modify the code and to distribute modified code is granted, +-- provided the above notices are retained, and a notice that the code was +-- modified is included with the above copyright notice. + + +with "comfignat.gpr"; + +standard project Build_Testcase is + for Main use ("testcase"); + for Object_Dir use Comfignat.Objdir; + for Exec_Dir use Comfignat.Stage_Bindir; +end Build_Testcase; diff --git a/testsuite/sources/steps/clean b/testsuite/sources/steps/clean new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/clean @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/configure b/testsuite/sources/steps/configure new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/configure @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/distclean b/testsuite/sources/steps/distclean new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/distclean @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/generated_files b/testsuite/sources/steps/generated_files new file mode 100644 index 0000000..0788db6 --- /dev/null +++ b/testsuite/sources/steps/generated_files @@ -0,0 +1,9 @@ +comfignat.gpr +${stage_bindir}/testcase +preprocess_done +base_done +build_done +$(if [ "${installation}" = full ] ; then echo preinstall_done ; fi) +$(if [ "${installation}" = files -o "${installation}" = full ] ; then echo install_files_done ; fi) +$(if [ "${installation}" = full ] ; then echo postinstall_done ; fi) +$(if [ "${installation}" = files -o "${installation}" = full ] ; then echo install_done ; fi) diff --git a/testsuite/sources/steps/install b/testsuite/sources/steps/install new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/install @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/install_files b/testsuite/sources/steps/install_files new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/install_files @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/install_stage b/testsuite/sources/steps/install_stage new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/install_stage @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/postinstall b/testsuite/sources/steps/postinstall new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/postinstall @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/preinstall b/testsuite/sources/steps/preinstall new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/preinstall @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/preprocess b/testsuite/sources/steps/preprocess new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/preprocess @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. diff --git a/testsuite/sources/steps/testcase.adb b/testsuite/sources/steps/testcase.adb new file mode 100644 index 0000000..4121845 --- /dev/null +++ b/testsuite/sources/steps/testcase.adb @@ -0,0 +1,20 @@ +-- part of Comfignat's testsuite +-- Copyright 2014 B. Persson, Bjorn@Rombobeorn.se +-- +-- This material is provided as is, with absolutely no warranty expressed +-- or implied. Any use is at your own risk. +-- +-- Permission is hereby granted to use or copy this testsuite +-- for any purpose, provided the above notices are retained on all copies. +-- Permission to modify the code and to distribute modified code is granted, +-- provided the above notices are retained, and a notice that the code was +-- modified is included with the above copyright notice. + + +with Ada.Calendar; use Ada.Calendar; +with Ada.Text_IO; use Ada.Text_IO; + +procedure Testcase is +begin + Put_Line(Year(Clock)'Img); +end Testcase; diff --git a/testsuite/sources/steps/unconfigure b/testsuite/sources/steps/unconfigure new file mode 100644 index 0000000..ab91d7c --- /dev/null +++ b/testsuite/sources/steps/unconfigure @@ -0,0 +1 @@ +The presence of this file must not inhibit the like-named Make target. -- cgit v1.2.3