Tests: Move preamble out of t/run
parent
3df2d5f715
commit
85ad712764
|
@ -0,0 +1,18 @@
|
||||||
|
#! /bin/bash
|
||||||
|
#
|
||||||
|
# preamble
|
||||||
|
# Copyright (C) 2016 Adrian Perez <aperez@igalia.com>
|
||||||
|
#
|
||||||
|
# Distributed under terms of the MIT license.
|
||||||
|
#
|
||||||
|
|
||||||
|
function fail () {
|
||||||
|
printf "(FF) "
|
||||||
|
printf "$@"
|
||||||
|
exit 1
|
||||||
|
} 1>&2
|
||||||
|
|
||||||
|
function warn () {
|
||||||
|
printf "(WW)"
|
||||||
|
printf "$@"
|
||||||
|
} 1>&2
|
14
t/run
14
t/run
|
@ -17,18 +17,6 @@ if [[ $# -gt 1 && $2 -eq 1 ]] ; then
|
||||||
fi
|
fi
|
||||||
readonly dynamic
|
readonly dynamic
|
||||||
|
|
||||||
readonly preamble='
|
|
||||||
function fail () {
|
|
||||||
printf "(FF) "
|
|
||||||
printf "$@"
|
|
||||||
exit 1
|
|
||||||
} 1>&2
|
|
||||||
function warn () {
|
|
||||||
printf "(WW)"
|
|
||||||
printf "$@"
|
|
||||||
} 1>&2
|
|
||||||
'
|
|
||||||
|
|
||||||
declare -a t_pass=( )
|
declare -a t_pass=( )
|
||||||
declare -a t_fail=( )
|
declare -a t_fail=( )
|
||||||
|
|
||||||
|
@ -40,9 +28,9 @@ for t in "$T"/*.test ; do
|
||||||
outfile="${name}.out"
|
outfile="${name}.out"
|
||||||
shfile="${name}.sh"
|
shfile="${name}.sh"
|
||||||
cat > "${shfile}" <<-EOF
|
cat > "${shfile}" <<-EOF
|
||||||
${preamble}
|
|
||||||
readonly PREFIX='${prefix}'
|
readonly PREFIX='${prefix}'
|
||||||
readonly DYNAMIC=${dynamic}
|
readonly DYNAMIC=${dynamic}
|
||||||
|
$(< "$T/preamble")
|
||||||
$(< "$t")
|
$(< "$t")
|
||||||
EOF
|
EOF
|
||||||
if bash -e "${shfile}" > "${outfile}" 2> "${errfile}" ; then
|
if bash -e "${shfile}" > "${outfile}" 2> "${errfile}" ; then
|
||||||
|
|
Loading…
Reference in New Issue