~uhh-ssd/+junk/Probe_Control

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/plplot_test/test_diff.sh

  • Committer: Joachim Erfle
  • Date: 2012-06-15 16:09:06 UTC
  • Revision ID: joachim.erfle@desy.de-20120615160906-popdt8a9d8ob1oyw
added stripmeasurements

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
# Test suite to compare C examples with other language bindings
 
3
#
 
4
# Copyright (C) 2008 Andrew Ross
 
5
#
 
6
# This file is part of PLplot.
 
7
#
 
8
# PLplot is free software; you can redistribute it and/or modify
 
9
# it under the terms of the GNU Library General Public License as published
 
10
# by the Free Software Foundation; either version 2 of the License, or
 
11
# (at your option) any later version.
 
12
#
 
13
# PLplot is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
# GNU Library General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU Library General Public License
 
19
# along with PLplot; if not, write to the Free Software
 
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
21
#
 
22
 
 
23
ret=0
 
24
# Comparison C results have no xsuffix.
 
25
xsuffix_c=
 
26
 
 
27
# Compare C results with c++, f77, f95, java, octave, python, tcl, perl, 
 
28
# ada, ocaml, lua and d results
 
29
for lang in c++ f77 f95 java octave python tcl perl ada adathick ocaml lua d; do
 
30
 
 
31
  # Check which suffix is used for this binding
 
32
    case $lang in 
 
33
        c++)
 
34
            xsuffix=
 
35
            suffix=cxx
 
36
            ;;
 
37
        f77)
 
38
            xsuffix=
 
39
            suffix=f
 
40
            ;;
 
41
        f95)
 
42
            xsuffix=
 
43
            suffix=f95
 
44
            ;;
 
45
        java)
 
46
            xsuffix=
 
47
            suffix=j
 
48
            ;;
 
49
        octave)
 
50
            xsuffix=
 
51
            suffix=o
 
52
            ;;
 
53
        python)
 
54
            xsuffix=
 
55
            suffix=p
 
56
            ;;
 
57
        tcl)
 
58
            xsuffix=
 
59
            suffix=t
 
60
            ;;
 
61
        perl)
 
62
            xsuffix=
 
63
            suffix=pdl
 
64
            ;;
 
65
        ada)
 
66
            xsuffix=
 
67
            suffix=a
 
68
            ;;
 
69
        adathick)
 
70
            xsuffix=thick
 
71
            suffix=a
 
72
            ;;
 
73
        ocaml)
 
74
            xsuffix=
 
75
            suffix=ocaml
 
76
            ;;
 
77
        lua)
 
78
            xsuffix=
 
79
            suffix=lua
 
80
            ;;
 
81
        d)
 
82
            xsuffix=
 
83
            suffix=d
 
84
            ;;
 
85
    esac
 
86
 
 
87
    missing=""
 
88
    different=""
 
89
    diffstdout=""
 
90
    missingstdout=""
 
91
 
 
92
    # List of standard examples
 
93
    INDEX_LIST="01 02 03 04 05 06 07 08 09 10 11 12 13 14 14a 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33"
 
94
    # Check if any examples exist for this language.
 
95
    EXAMPLES_EXIST="no"
 
96
    for index in ${INDEX_LIST} ; do
 
97
        if [ -f x${xsuffix}${index}${suffix}.psc ] ; then
 
98
            EXAMPLES_EXIST="yes"
 
99
            break
 
100
        fi
 
101
    done
 
102
    if [ "$EXAMPLES_EXIST" = "yes" ] ; then
 
103
        for index in ${INDEX_LIST} ; do
 
104
            if [ ! -f x${xsuffix_c}${index}c.psc ] ; then
 
105
                echo "C example ${index} is missing"
 
106
            else
 
107
                if [ ! -f x${xsuffix}${index}${suffix}.psc ] ; then
 
108
                    missing="${missing} ${index}"
 
109
                else
 
110
                    if [ "ON" = "ON" ] ; then
 
111
                    # Skip first 190 bytes of comparison to ignore date stamp.
 
112
                        /usr/bin/cmp -s -i 190 x${xsuffix_c}${index}c.psc x${xsuffix}${index}${suffix}.psc
 
113
                        if [ $? != 0 ] ; then
 
114
                            different="${different} ${index}"
 
115
                        fi
 
116
                    else
 
117
                    # Drop first 8 lines from comparison to ignore date stamp.
 
118
                        /usr/bin/tail -n +9 x${xsuffix_c}${index}c.psc > test1.psc
 
119
                        /usr/bin/tail -n +9 x${xsuffix}${index}${suffix}.psc > test2.psc
 
120
                        /usr/bin/diff -q test1.psc test2.psc 2>&1 > /dev/null
 
121
                        if [ $? != 0 ] ; then
 
122
                            different="${different} ${index}"
 
123
                        fi
 
124
                    fi
 
125
                    if [ "$index" != "14a" ] ; then
 
126
                        if [ -f x${xsuffix}${index}${suffix}_psc.txt ] ; then
 
127
                            /usr/bin/diff -q x${xsuffix_c}${index}c_psc.txt x${xsuffix}${index}${suffix}_psc.txt 2>&1 > /dev/null
 
128
                            if [ $? != 0 ] ; then
 
129
                                diffstdout="${diffstdout} ${index}"
 
130
                            fi
 
131
                        else
 
132
                            missingstdout="${missingstdout} ${index}"
 
133
                        fi
 
134
                    fi
 
135
                fi
 
136
            fi
 
137
        done
 
138
        echo "${lang}"
 
139
        echo "  Missing examples            : ${missing}"
 
140
        echo "  Differing postscript output : ${different}"
 
141
        echo "  Missing stdout              : ${missingstdout}"
 
142
        echo "  Differing stdout            : ${diffstdout}"
 
143
        if [ "${different}" != "" -o "${diffstdout}" != "" ] ; then
 
144
            ret=1
 
145
        fi
 
146
    fi 
 
147
done
 
148
 
 
149
if [ "${ret}" != "0" ] ; then
 
150
    echo "WARNING: Some PostScript or stdout results were different"
 
151
fi