From 9e0ad7c0b14fbd017dc6be61e792bf69dd54e8fa Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Wed, 22 Jun 2011 12:03:05 +0100 Subject: Add tests for the external_command library, and fix a bug (which was actually a fairly late regression, showing the benefits of formal tests vs informal testing). I believe this bug was the cause of the recent Xapian indexing errors. --- spec/lib/external_command_scripts/output.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 spec/lib/external_command_scripts/output.sh (limited to 'spec/lib/external_command_scripts') diff --git a/spec/lib/external_command_scripts/output.sh b/spec/lib/external_command_scripts/output.sh new file mode 100755 index 000000000..0472c89a3 --- /dev/null +++ b/spec/lib/external_command_scripts/output.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +out_msg=${1:-out} +err_msg=${2:-} +repeats=${3:-10} +exit_status=${4:-0} + +n=0 +while [ "$n" -lt "$repeats" ] +do + if [ -n "$out_msg" ] + then + echo "$out_msg $n" + fi + if [ -n "$err_msg" ] + then + echo >&2 "$err_msg $n" + fi + n=$[$n + 1] +done + +exit "$exit_status" -- cgit v1.2.3