From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- .../meta-oe/recipes-support/onig/onig/run-ptest | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 external/meta-openembedded/meta-oe/recipes-support/onig/onig/run-ptest (limited to 'external/meta-openembedded/meta-oe/recipes-support/onig/onig/run-ptest') diff --git a/external/meta-openembedded/meta-oe/recipes-support/onig/onig/run-ptest b/external/meta-openembedded/meta-oe/recipes-support/onig/onig/run-ptest new file mode 100755 index 00000000..2574d7ef --- /dev/null +++ b/external/meta-openembedded/meta-oe/recipes-support/onig/onig/run-ptest @@ -0,0 +1,47 @@ +#!/bin/sh -eu + +my_cleanup() { + [ -n "${workdir:-}" ] && rm -rf "${workdir}" +} + +trap "my_cleanup" EXIT +for sig in INT TERM ; do + # We want sig to expand right here and now, as it's + # a loop variable, not when signalled. For $$ it + # doesn't matter. + # shellcheck disable=SC2064 + trap "my_cleanup ; trap - EXIT ; trap - ${sig} ; kill -s ${sig} $$" ${sig} +done + +workdir=$(mktemp -d -t onig.ptest.XXXXXX) +status="${workdir}/failed" +touch "${status}" + +find tests/ -perm -111 -type f -exec sh -c ' + workdir="${1}" + status="${2}" + t="${3}" + t_log="${workdir}/$(basename ${t}).log" + + res=0 + ./${t} > "${t_log}" 2>&1 \ + || res=$? + if [ $res -eq 0 ] ; then + echo "PASS: ${t}" + else + echo "FAIL: ${t}" + echo "$(basename ${t}): ${t_log}" >> "${status}" + fi + ' _ "${workdir}" "${status}" {} \; + +if [ $(stat -c '%s' "${status}") -ne 0 ] ; then + exec >&2 + while IFS=': ' read -r t t_log ; do + printf "\n=========================\n" + printf "ERROR: %s:\n" "${t}" + printf -- "-------------------------\n" + cat "${t_log}" + done < "${status}" +fi + +[ $(stat -c '%s' "${status}") -eq 0 ] -- cgit 1.2.3-korg