Rombobjörn

summaryrefslogtreecommitdiff
path: root/testsuite/run_tests
blob: dfdfe75ecbae8a9540f1cf36dda6687a9fd82028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh

# Comfignat's testsuite
# 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 program
# 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.


# It is hoped that this program will work in any Posix-compliant shell.

set -e

outer_srcdir="$1"
outer_builddir="$2"

passed=0
failed=0

Comfignat_overriding_absolute_builddir=
Comfignat_overriding_absolute_objdir=
Comfignat_overriding_absolute_stagedir=

rm -Rf "${outer_builddir}"/testruns

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
         test_name=$(basename "${source_directory}")+$(basename "${location_file}")+$(basename "${input_script}")
         testrundir="${outer_builddir}"/testruns/"${test_name}"
         mkdir -p "${testrundir}"
         cd "${testrundir}"
         . "${location_file}"
         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))
         else
            verdict=FAILED
            failed=$((failed + 1))
         fi
         echo "${test_name}: ${verdict}"
      done
   done
done

echo
echo "passed: ${passed}, failed: ${failed}"
exit ${failed}