xref: /freebsd/contrib/dialog/samples/run_test.sh (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1#!/bin/sh
2# $Id: run_test.sh,v 1.5 2019/12/10 23:54:52 tom Exp $
3# vile:ts=4 sw=4
4THIS=`basename "$0"`
5
6if [ -z "$DIALOG" ]
7then
8	have=
9	want=dialog
10	for p in . .. ../bin
11	do
12		prog=$p/$want
13		[ -f $prog ] || continue
14		if [ -x $prog ]
15		then
16			have=$prog
17			break
18		fi
19	done
20
21	if [ -z "$have" ]
22	then
23		echo "? did not find $want" >&2
24		exit
25	fi
26
27	DIALOG=$have
28	export DIALOG
29fi
30
31want=`basename $DIALOG`
32
33DIALOGOPTS="$DIALOGOPTS --trace $want.log"
34export DIALOGOPTS
35
36mylog=run_test.log
37cat >$mylog <<EOF
38** `date`
39EOF
40
41for name in "$@"
42do
43	[ -f "$name" ] || continue
44	[ -x "$name" ] || continue
45	# skip this script and known utility-scripts
46	case `basename "$name"` in
47	$THIS|dft-*|killall|listing|rotated-data|shortlist|with-*)
48		echo "** skipping $name" >>$mylog
49		continue
50		;;
51	esac
52	rm -f trace "$want.log" "$name.log"
53	echo "** running $name" >>$mylog
54	$name
55	[ -f "$want.log" ] && cp "$want.log" "$name.log"
56done
57