summaryrefslogtreecommitdiff
path: root/macros/texinfo/texinfo/tp/maintain/all_tests.sh
blob: 748df424e73733723cc7fb0d851e8249905be1de (plain)
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
#! /bin/sh
# Helper script for tests.
#
# Copyright 2011-2019 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Originally written by Patrice Dumas.

command=$1
if [ $# -gt 0 ]; then 
 shift
 test_name=$1
fi

cmds_list="clean|generate|output|diff|texis"

if [ z"$command" = 'z' ]; then
  echo "$0: need an arg, one of: $cmds_list" >&2
  exit 1
fi

if [ "$command" = 'clean' ]; then
  rm -f t/results/*/*.pl.new
  rm -rf t/results/*/*/out_*/
elif [ "$command" = 'diff' ]; then
  if [ z"$test_name" = 'z' ]; then
    for result in t/results/*/*.pl; do
      diff -a -U 3 $result $result.new
    done
    for result in t/results/*/*/res*/; do
      out=`echo $result | sed 's;res\([^/]*/\)$;out\1;'`
      diff -a -u --exclude=CVS --exclude=.svn -r $result $out
    done
  else
    for result in t/results/$test_name/*.pl; do
      diff -a -u $result $result.new
    done
    for result in t/results/$test_name/*/res*/; do
      out=`echo $result | sed 's;res\([^/]*/\)$;out\1;'`
      diff -a -u --exclude=CVS --exclude=.svn -r $result $out
    done
  fi 
else
  # commands that require PERL
  . ./defs || exit 1

  if [ "$command" = 'generate' ]; then
    for file in $srcdir/t/*.t; do
      set -e
      $PERL -w $file -g
    done
  elif [ "$command" = 'output' ]; then
    for file in t/*.t; do
      $PERL -w $file -o
    done
  elif [ "$command" = 'texis' ]; then
    for file in t/*.t; do
      $PERL -w $file -c
    done
  else
    echo "$0: Unknown command ($cmds_list)" >&2
    exit 1
  fi
fi