This file is indexed.

/usr/bin/tablix2_test is in tablix2 0.3.5-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#!/bin/bash

set -e

VERSION="0.3.5"

TABLIX="tablix"
TABLIX_OUTPUT="tablix_output"

TABLIX2="tablix2"
TABLIX2_OUTPUT="tablix2_output"

IDID='$Id: tablix2_test,v 1.11 2007-07-03 11:22:25 avian Exp $'

CMD=`basename $0`

# Counters for test cases
CNT_PASSED="0"
CNT_SKIPPED="0"
CNT_FAILED="0"

cat >&2 <<END
TABLIX testing framework $VERSION, Copyright (C) 2002-2006 Tomaz Solc
$IDID

END

function tablix_wrapper {
	INPUT=`echo $@ | sed 's/.* //'`
	if grep '<school>' $INPUT > /dev/null; then
		if [ `which $TABLIX` ]; then
			$TABLIX $@
		else
			return 100
		fi
	else
		if [ `which $TABLIX2` ]; then
			$TABLIX2 $@
		else
			return 100
		fi
	fi
}

# tablix_output_wrapper -s script=$TESTFILE ttf $RESULTFILE &> $RESULT
function tablix_output_wrapper {
	if grep '<school>' $1 > /dev/null; then
		$TABLIX_OUTPUT -s $1 ttf $2
	else
		$TABLIX2_OUTPUT -s script=$1 ttf $2
	fi
}

function syntax {
	cat <<END
Following tests are supported:

$CMD --file "OPTIONS" FILE

	Execute a single Tablix run using OPTIONS and verify the output.

$CMD --dir "OPTIONS" DIRECTORY

	Execute a single Tablix run using OPTIONS for each file in the 
	specified directory and verify the output.

$CMD --multi-file N "OPTIONS" FILE

	Execute N Tablix runs using OPTIONS and verify the output.

$CMD --multi-dir N "OPTIONS" DIRECTORY

	Execute N Tablix runs using OPTIONS for each file in the 
	specified directory and verify the output.
END
}

function test_pvm {
	if ! ps aux | grep -v grep | grep pvmd > /dev/null; then
		echo "PVM not running" >&2
		exit 1
	fi
}

function show_config {
	echo "using binary : `which $TABLIX`" >&2
	echo "using binary : `which $TABLIX2`" >&2
	echo "using binary : `which $TABLIX_OUTPUT`" >&2
	echo "using binary : `which $TABLIX2_OUTPUT`" >&2
	echo "repeats      : $RUNS" >&2
	echo "parameters   : $PARAMETERS" >&2

	if echo $PARAMETERS | grep -- -o; then
		echo "Do not add your own \"-o\" parameter in OPTIONS"
		exit 1
	fi
}

function test_run {
	ERRORMSG=`mktemp _ttf__XXXXXX`

	tablix_wrapper -o _ttf__ $PARAMETERS "$TESTFILE" &> "$ERRORMSG"
	RETVAL="$?"

	if [ "$RETVAL" -eq 100 ]; then
		rm "$ERRORMSG"
		return 100
	elif [ "$RETVAL" -ne 0 ]; then
		echo 
		cat "$ERRORMSG"
		echo
		rm "$ERRORMSG"
		return 1
	fi

	rm "$ERRORMSG"

	RESULT=`mktemp _ttf__XXXXXX`
		
	for RESULTFILE in _ttf__result*.xml; do
		tablix_output_wrapper "$TESTFILE" "$RESULTFILE" &> "$RESULT"
		if [ $? != "0" ]; then
			cat "$RESULT" | grep -v '^TABLIX' | grep -v '^Copyright'
			rm -f _ttf__result*.xml
			rm -f _ttf__conv*.txt
			rm -f _ttf__save*.txt
			rm "$RESULT"
			return 2
		fi
		if cat "$RESULT" | grep 'test number .* failed'; then
			cat "$RESULT" | grep 'debug'
#			rm -f _ttf__result*.xml
#			rm -f _ttf__conv*.txt
#			rm -f _ttf__save*.txt
			rm "$RESULT"
			return 3
		fi
	done

	rm -f _ttf__result*.xml
	rm -f _ttf__conv*.txt
	rm -f _ttf__save*.txt
	rm "$RESULT"
	return 0
}

function multi_test_run {
	BASEFILE=`basename $TESTFILE .xml`

	printf "%24s : " $BASEFILE

	N=1
	while [ $N -le $RUNS ]; do
		set +e
		test_run

		case $? in
			0)
				;;
			1)
				echo "*** FAILED (Tablix returned an error) ***"
				CNT_FAILED=$(($CNT_FAILED+1))
				return 1;
				;;
			2)
				echo "*** FAILED (most likely scheme syntax error) ***"
				CNT_FAILED=$(($CNT_FAILED+1))
				return 2;
				;;
			3)
				echo "*** FAILED (ttf test failed) ***"
				CNT_FAILED=$(($CNT_FAILED+1))
				return 3;
				;;
			100)
				echo "skipped (required Tablix version not found)"
				CNT_SKIPPED=$(($CNT_SKIPPED+1))
				return 100;
				;;
			*)
				echo "*** FAILED (unknown error) ***"
				CNT_FAILED=$(($CNT_FAILED+1))
				return 0;
		esac

		set -e
		N=$(($N+1))
	done

	if grep '<school>' $INPUT > /dev/null; then
		echo "passed (Tablix 0.1.x)"
	else
		echo "passed"
	fi
	CNT_PASSED=$(($CNT_PASSED+1))
	return 0
}

if [ $# -lt 1 ]; then 
	syntax
	exit 1
fi

test_pvm

case "$1" in
	--file)
		RUNS="1"
		PARAMETERS="$2"
		TESTFILE="$3"
		show_config

		if [ ! -f $TESTFILE ]; then
			echo "file $TESTFILE not found"
			exit 1;
		fi

		echo "test file    : $TESTFILE" >&2
		echo

		multi_test_run
		;;
	--multi-file)
		RUNS="$2"
		PARAMETERS="$3"
		TESTFILE="$4"
		show_config

		if [ ! -f $TESTFILE ]; then
			echo "file $TESTFILE not found"
			exit 1;
		fi

		echo "test file    : $TESTFILE" >&2
		echo

		multi_test_run
		;;
	--dir)
		RUNS="1"
		PARAMETERS="$2"
		TESTDIR="$3"
		show_config

		if [ ! -d $TESTDIR ]; then
			echo "directory $TESTDIR not found"
			exit 1;
		fi

		echo "test dir     : $TESTDIR" >&2
		echo

		for TESTFILE in $TESTDIR/*.xml; do
			multi_test_run
		done
		;;
	--multi-dir)
		RUNS="$2"
		PARAMETERS="$3"
		TESTDIR="$4"
		show_config

		if [ ! -d $TESTDIR ]; then
			echo "directory $TESTDIR not found"
			exit 1;
		fi

		echo "test dir     : $TESTDIR" >&2
		echo

		for TESTFILE in $TESTDIR/*.xml; do
			multi_test_run
		done
		;;
	*)
		syntax
		exit 1
esac

cat <<END

passed  : $CNT_PASSED
skipped : $CNT_SKIPPED
failed  : $CNT_FAILED
END

exit 0