xref: /Universal-ctags/Tmain/common-prelude.d/run.sh (revision ede39f0c5d52e932290a242f5cd67339df7d1abd)
1#!/bin/sh
2
3# Copyright: 2021 Masatake YAMATO
4# License: GPL-2
5
6CTAGS=$1
7BUILDDIR=$2
8OPTSCRIPT=$4
9
10. ../utils.sh
11
12if ! [ -x "${OPTSCRIPT}" ]; then
13	skip "no optscript"
14fi
15
16rm -f ${BUILDDIR}/*.tmp
17
18for t in $(ls *.ps); do
19	i=${BUILDDIR}/${t}.in.tmp
20	o=${BUILDDIR}/${t}.out.tmp
21	e=$(basename $t .ps).expected
22
23    printf "%s" "${t}..."
24
25	{
26		${CTAGS} --_dump-prelude
27		echo
28		cat $t
29	} > $i
30
31	${OPTSCRIPT} $i > $o 2>&1
32	s=$?
33	echo "$s"
34
35	if [ $s != 0 ]; then
36		continue
37	fi
38	if diff -ruN --strip-trailing-cr $e $o; then
39		rm $i
40		rm $o
41	fi
42done
43