diff options
author | Björn Persson <Bjorn@Rombobjörn.se> | 2014-01-31 08:32:17 +0100 |
---|---|---|
committer | Björn Persson <Bjorn@Rombobjörn.se> | 2014-01-31 08:32:17 +0100 |
commit | 5d900ea8ccb660d4d3bb9aaa08464fb9aae081f9 (patch) | |
tree | 67f8d3df5ed5b6549834cf59fc90aa87ab68ca9e /testsuite/library | |
parent | dfc4c5cdce886fa7261258a1b40d463ce5c39de1 (diff) |
Check that the right generated files exist.
Diffstat (limited to 'testsuite/library')
-rw-r--r-- | testsuite/library | 60 |
1 files changed, 49 insertions, 11 deletions
diff --git a/testsuite/library b/testsuite/library index 2d16973..c665c71 100644 --- a/testsuite/library +++ b/testsuite/library @@ -1,5 +1,5 @@ # function library for Comfignat's testcases -# Copyright 2013 B. Persson, Bjorn@Rombobeorn.se +# Copyright 2013 - 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. @@ -11,6 +11,54 @@ # modified is included with the above copyright notice. +# 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. +prefix=/usr/local +exec_prefix=${prefix} +datarootdir=${prefix}/share +bindir=${exec_prefix}/bin +libexecdir=${exec_prefix}/libexec +includedir=${prefix}/include +libdir=${exec_prefix}/lib +alidir=${libdir} +gprdir=${datarootdir}/gpr +stagedir=stage +stage_bindir=${stagedir}${bindir} +stage_libexecdir=${stagedir}${libexecdir} +stage_includedir=${stagedir}${includedir} +stage_libdir=${stagedir}${libdir} +stage_alidir=${stagedir}${alidir} +stage_gprdir=${stagedir}${gprdir} + + +expect_configuration () { + # If "always" is passed, the testcase is always expected to leave a + # configuration file. If this is called without "always", a configuration + # file is expected only in a separate build directory. + if [ "$1" = always -o "${relative_builddir}" != . ] ; then + echo "${builddir}"/comfignat_configuration.mk >>"${file_list}" + fi +} + + +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. + for file in $(cat "${srcdir}"/generated_files) ; do + # Expand variables in the string to get the pathname. + eval file="${file}" + # 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 + echo "${builddir}/${file}" >>"${file_list}" + file=$(dirname "${file}") + done + done +} + + common_setup () { # When the locations file specifies a separate build directory, initialize # the build directory and go there. When the source directory is also the @@ -22,13 +70,3 @@ common_setup () { cd "${relative_builddir}" fi } - - -expect_configuration () { - # If "always" is passed, the testcase is always expected to leave a - # configuration file. If this is called without "always", a configuration - # file is expected only in a separate build directory. - if [ "$1" = always -o "${relative_builddir}" != . ] ; then - echo "${builddir}"/comfignat_configuration.mk >>"${file_list}" - fi -} |