From 940fef353e6551f721651db79cb135219191ad9e Mon Sep 17 00:00:00 2001 From: Björn Persson Date: Mon, 16 Dec 2013 17:27:40 +0100 Subject: the beginning of a testsuite --- testsuite/inputs/distclean | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 testsuite/inputs/distclean (limited to 'testsuite/inputs/distclean') diff --git a/testsuite/inputs/distclean b/testsuite/inputs/distclean new file mode 100644 index 0000000..6e1119b --- /dev/null +++ b/testsuite/inputs/distclean @@ -0,0 +1,7 @@ +cd "${srcdir}" +if [ "${relative_builddir}" != . ] ; then + make configure builddir="${relative_builddir}" + cd "${relative_builddir}" +fi +make +make distclean -- cgit v1.2.3 From 098259b44d7895e3bb9537edbbd633fd3e0205d5 Mon Sep 17 00:00:00 2001 From: Björn Persson Date: Tue, 17 Dec 2013 14:29:11 +0100 Subject: function library for the testcases --- testsuite/inputs/clean | 7 ++----- testsuite/inputs/default_build | 7 ++----- testsuite/inputs/distclean | 7 ++----- testsuite/library | 25 +++++++++++++++++++++++++ testsuite/run_tests | 9 +++++++-- 5 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 testsuite/library (limited to 'testsuite/inputs/distclean') diff --git a/testsuite/inputs/clean b/testsuite/inputs/clean index ab322cc..6defe0e 100644 --- a/testsuite/inputs/clean +++ b/testsuite/inputs/clean @@ -1,7 +1,4 @@ -cd "${srcdir}" -if [ "${relative_builddir}" != . ] ; then - make configure builddir="${relative_builddir}" - cd "${relative_builddir}" -fi +. "${library}" +common_setup make make clean diff --git a/testsuite/inputs/default_build b/testsuite/inputs/default_build index 7ff31f7..1706516 100644 --- a/testsuite/inputs/default_build +++ b/testsuite/inputs/default_build @@ -1,6 +1,3 @@ -cd "${srcdir}" -if [ "${relative_builddir}" != . ] ; then - make configure builddir="${relative_builddir}" - cd "${relative_builddir}" -fi +. "${library}" +common_setup make diff --git a/testsuite/inputs/distclean b/testsuite/inputs/distclean index 6e1119b..76524c3 100644 --- a/testsuite/inputs/distclean +++ b/testsuite/inputs/distclean @@ -1,7 +1,4 @@ -cd "${srcdir}" -if [ "${relative_builddir}" != . ] ; then - make configure builddir="${relative_builddir}" - cd "${relative_builddir}" -fi +. "${library}" +common_setup make make distclean diff --git a/testsuite/library b/testsuite/library new file mode 100644 index 0000000..1302625 --- /dev/null +++ b/testsuite/library @@ -0,0 +1,25 @@ +# function library for Comfignat's testcases +# Copyright 2013 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. + + +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 + # build directory, just go to that directory. + cd "${srcdir}" + if [ "${relative_builddir}" != . ] ; then + make configure builddir="${relative_builddir}" + cd "${relative_builddir}" + fi +} + + diff --git a/testsuite/run_tests b/testsuite/run_tests index dfdfe75..c559814 100755 --- a/testsuite/run_tests +++ b/testsuite/run_tests @@ -6,7 +6,7 @@ # 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 program +# 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 @@ -27,6 +27,12 @@ Comfignat_overriding_absolute_builddir= Comfignat_overriding_absolute_objdir= Comfignat_overriding_absolute_stagedir= +# variables that the testcases need: +export library srcdir builddir relative_builddir + +# function library for the testcases: +library="${outer_srcdir}"/testsuite/library + rm -Rf "${outer_builddir}"/testruns for source_directory in "${outer_srcdir}"/testsuite/sources/* ; do @@ -40,7 +46,6 @@ for source_directory in "${outer_srcdir}"/testsuite/sources/* ; do mkdir -p "${srcdir}" "${builddir}" cp -RHp "${source_directory}"/* "${srcdir}" cp -p "${outer_srcdir}"/comfignat.* "${srcdir}" - export srcdir builddir relative_builddir if sh -e "${input_script}" >output 2>&1 ; then verdict=PASSED passed=$((passed + 1)) -- cgit v1.2.3 From cfde013bbd87fb30ced9c2c9fc4f0d1122c9c569 Mon Sep 17 00:00:00 2001 From: Björn Persson Date: Thu, 19 Dec 2013 09:29:52 +0100 Subject: Made run_test load the function library for the testcases. --- testsuite/inputs/clean | 1 - testsuite/inputs/default_build | 1 - testsuite/inputs/distclean | 1 - testsuite/run_tests | 12 +++++------- 4 files changed, 5 insertions(+), 10 deletions(-) (limited to 'testsuite/inputs/distclean') diff --git a/testsuite/inputs/clean b/testsuite/inputs/clean index 8f443d5..a0d18f9 100644 --- a/testsuite/inputs/clean +++ b/testsuite/inputs/clean @@ -1,4 +1,3 @@ -. "${library}" common_setup expect_configuration make diff --git a/testsuite/inputs/default_build b/testsuite/inputs/default_build index cd85823..af01356 100644 --- a/testsuite/inputs/default_build +++ b/testsuite/inputs/default_build @@ -1,4 +1,3 @@ -. "${library}" common_setup expect_configuration make diff --git a/testsuite/inputs/distclean b/testsuite/inputs/distclean index 76524c3..6e5e472 100644 --- a/testsuite/inputs/distclean +++ b/testsuite/inputs/distclean @@ -1,4 +1,3 @@ -. "${library}" common_setup make make distclean diff --git a/testsuite/run_tests b/testsuite/run_tests index 57364b3..38d6562 100755 --- a/testsuite/run_tests +++ b/testsuite/run_tests @@ -32,15 +32,11 @@ Comfignat_overriding_absolute_objdir= Comfignat_overriding_absolute_stagedir= # variables that the testcases need: -export library # absolute pathname of function library export file_list # absolute pathname of list of expected files export srcdir # testcase's source directory relative to testrundir export builddir # testcase's build directory relative to testrundir export relative_builddir # testcase's build directory relative to srcdir -# function library for the testcases: -library="${outer_srcdir}"/testsuite/library - # Clean out any old test results. rm -Rf "${outer_builddir}"/testruns @@ -48,7 +44,7 @@ for source_directory in "${outer_srcdir}"/testsuite/sources/* ; do for location_file in "${outer_srcdir}"/testsuite/locations/* ; do for input_script in "${outer_srcdir}"/testsuite/inputs/* ; do - # Compose the name of the combined test case. + # Compose the name of the combined testcase. test_name=$(basename "${source_directory}")+$(basename "${location_file}")+$(basename "${input_script}") testrundir="${outer_builddir}"/testruns/"${test_name}" file_list="${testrundir}"/files.expected @@ -67,8 +63,10 @@ for source_directory in "${outer_srcdir}"/testsuite/sources/* ; do cp -p "${outer_srcdir}"/comfignat.* "${srcdir}" find "${srcdir}" >>files.expected - # Run the test. - if sh -e "${input_script}" >output 2>&1 ; then + # Run the testcase in a child process. + # The child process first loads the function library and then runs the + # input script. + if sh -e -c ". ${outer_srcdir}/testsuite/library; . ${input_script}" >output 2>&1 ; then # Check that the expected files and no others are present. LC_COLLATE=C sort -o files.expected files.expected -- cgit v1.2.3