From 76885ce7f12b98f0700a3a0535e06425bc1a9aa5 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 21 Apr 2019 23:37:27 -0400 Subject: tests/common.sh: Remove newly unused file --- (limited to 'tests') diff --git a/tests/common.sh b/tests/common.sh deleted file mode 100644 index 293dc7d..0000000 --- a/tests/common.sh +++ /dev/null @@ -1,110 +0,0 @@ -# Common testsuite functions -# -# Copyright (C) 2013, 2014 Patrick "P. J." McDermott -# -# This file is part of the ProteanOS Development Kit. -# -# The ProteanOS Development Kit is free software: you can redistribute -# it and/or modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# The ProteanOS Development Kit is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with the ProteanOS Development Kit. If not, see -# . - -tests_es=0 -atexit() -{ - local es=${?} - - if [ ${es} -ne 0 ]; then - exit ${es} - else - exit ${tests_es} - fi -} -trap atexit EXIT - -in_place=true -builddir='.' - -assert() -{ - if ! eval "${@}"; then - warn 'Assertion failed: %s\n' "${*}" - tests_es=1 - fi -} - -if [ "x${COLOR_TEST_LOGS:-no}" = 'xno' ]; then - red= grn= lgn= blu= mgn= std= -else - red='' # Red. - grn='' # Green. - lgn='' # Light green. - blu='' # Blue. - mgn='' # Magenta. - std='' # No color. -fi - -test_diff() -{ - local good_results="${1}" - local test_results="${2}" - local line_no= - local errors= - local good_line= - local test_line= - local line= - - printf 'Diff:\n' - exec 3<<-EOF - ${good_results} - EOF - exec 4<<-EOF - ${test_results} - EOF - line_no=0 - while :; do - line_no=$(($line_no + 1)) - errors=0 - read -r good_line <&3 || errors=$(($errors + 1)) - read -r test_line <&4 || errors=$(($errors + 1)) - [ ${errors} -eq 2 ] && break - if [ "x${good_line}" = "x${test_line}" ]; then - printf '%3d %s\n' ${line_no} "${good_line}" - else - printf '%3d %s-%s%s\n' ${line_no} "${red}" \ - "${good_line}" "${std}" - printf '%3d %s+%s%s\n' ${line_no} "${grn}" \ - "${test_line}" "${std}" - tests_es=1 - fi - done - exec 3<&- - exec 4<&- - - printf '\nExpected results:\n' - line_no=0 - while read -r line; do - line_no=$(($line_no + 1)) - printf '%3d %s\n' ${line_no} "${line}" - done <<-EOF - ${good_results} - EOF - printf '\nTest results:\n' - line_no=0 - while read -r line; do - line_no=$(($line_no + 1)) - printf '%3d %s\n' ${line_no} "${line}" - done <<-EOF - ${test_results} - EOF - printf '\n' -} -- cgit v0.9.1