Home | History | Annotate | Line # | Download | only in test
      1 # /****************************************************************
      2 # Copyright (C) 1998, 2000 by Lucent Technologies
      3 # All Rights Reserved
      4 #
      5 # Permission to use, copy, modify, and distribute this software and
      6 # its documentation for any purpose and without fee is hereby
      7 # granted, provided that the above copyright notice appear in all
      8 # copies and that both that the copyright notice and this
      9 # permission notice and warranty disclaimer appear in supporting
     10 # documentation, and that the name of Lucent or any of its entities
     11 # not be used in advertising or publicity pertaining to
     12 # distribution of the software without specific, written prior
     13 # permission.
     14 #
     15 # LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
     16 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
     17 # IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
     18 # SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     19 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
     20 # IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
     21 # ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
     22 # THIS SOFTWARE.
     23 #
     24 # ****************************************************************/
     25 
     26 CC = cc
     27 CFLAGS = -g -I..
     28 CFLAGS+=-I${.CURDIR}/../../arch/${MACHINE_ARCH}/gdtoa
     29 L = -lm
     30 L1 = -lm
     31 #use "L1=-lm" when compiled with -DHonor_FLTP_ROUNDS or -DUSE_LOCALE
     32 INFFIX = | sed 's/[Ii][Nn][Ff][intyINTY]*/Infinity/g'
     33 
     34 .PATH: /usr/src/lib/libc/gdtoa
     35 
     36 all: dt dItest ddtest dtest ftest Qtest xLtest xtest ddtestsi dItestsi tests
     37 
     38 dt = dt.o $A
     39 dt: $(dt)
     40 	$(CC) -o dt $(dt) $L
     41 
     42 dItest = dItest.o getround.o g_dfmt.o strtoId.o strtodI.o \
     43 	g__fmt.o strtoIg.o
     44 dItest: $(dItest)
     45 	$(CC) -o dItest $(dItest) $(L1)
     46 
     47 ddtest = ddtest.o getround.o g_dfmt.o strtordd.o strtopdd.o g_ddfmt.o \
     48 	strtoIdd.o g__fmt.o strtoIg.o
     49 ddtest: $(ddtest)
     50 	$(CC) -o ddtest $(ddtest) $L
     51 
     52 dtest = dtest.o getround.o g_dfmt.o strtopd.o strtoId.o \
     53 	g__fmt.o strtoIg.o
     54 dtest: $(dtest)
     55 	$(CC) -o dtest $(dtest) $L
     56 
     57 ftest = ftest.o getround.o strtorf.o strtopf.o g_ffmt.o strtoIf.o \
     58 	g__fmt.o strtoIg.o
     59 ftest: $(ftest)
     60 	$(CC) -o ftest $(ftest) $(L1)
     61 
     62 Qtest = Qtest.o getround.o strtorQ.o g_Qfmt.o strtoIQ.o strtopQ.o \
     63 	g__fmt.o strtoIg.o
     64 Qtest: $(Qtest)
     65 	$(CC) -o Qtest $(Qtest) $(L1)
     66 
     67 xtest = xtest.o getround.o strtorx.o g_xfmt.o strtoIx.o \
     68 	g__fmt.o strtoIg.o
     69 xtest: $(xtest)
     70 	$(CC) -o xtest $(xtest) $(L1)
     71 
     72 xLtest = xLtest.o getround.o strtorxL.o strtopxL.o g_xLfmt.o strtoIxL.o \
     73 	g__fmt.o strtoIg.o
     74 xLtest: $(xLtest)
     75 	$(CC) -o xLtest $(xLtest) $(L1)
     76 
     77 ddtestsi = ddtest.o strtopddSI.o strtorddSI.o strtoIddSI.o getround.o \
     78 	g_dfmt.o g_ddfmt.o g__fmt.o strtoIg.o
     79 ddtestsi: $(ddtestsi)
     80 	$(CC) -o ddtestsi $(ddtestsi) $L
     81 
     82 dItestsi = dItest.o strtodISI.o strtoIdSI.o getround.o \
     83 	g_dfmt.o g__fmt.o strtoIg.o
     84 dItestsi: $(dItestsi)
     85 	$(CC) -o dItestsi $(dItestsi) $(L1)
     86 
     87 strtodt = strtodt.o $A
     88 strtodt: $(strtodt)
     89 	$(CC) -o strtodt $(strtodt) $L
     90 
     91 pftest = pftest.o $A
     92 pftest: $(pftest)
     93 	$(CC) -o pftest $(pftest) $L
     94 
     95 ## On Intel (and Intel-like) systems using extended-precision registers
     96 ## for double-precision (C type double) computations that sometimes suffer
     97 ## double rounding errors, the test below involving strtodt generally shows
     98 ## five lines of unexpected results.  Variant strtodtnrp uses ../strtodrnp.c
     99 ## (which does all computations in integer arithmetic) and should show no
    100 ## unexpected results.
    101 
    102 strtodtnrp = strtodt.o strtodnrp.o
    103 strtodtnrp: $(strtodtnrp)
    104 	$(CC) -o strtodtnrp $(strtodtnrp)
    105 
    106 # xQtest generates cp commands that depend on sizeof(long double).
    107 # See the source for details.  If you know better, create Q.out,
    108 # x.out and xL.out by copying the relevant *.ou0 or *.ou1 files
    109 # to the corresponding .out files.  In short, the *.ou0 files are
    110 # for long double == double; x.ou1 and xL.ou1 are for
    111 # long double == extended (a la 80x87 and MC680x0), and Q.ou1 is
    112 # for long double == quad.
    113 
    114 Q.out x.out xL.out:
    115 	$(CC) -o xQtest xQtest.c
    116 	./xQtest | sh
    117 	rm -f xQtest xQtest.o
    118 
    119 ## The rmdir below will fail if any test results differ.
    120 
    121 tests: Q.out x.out xL.out dt dItest ddtest dtest ftest Qtest xLtest xtest ddtestsi dItestsi strtodt strtodtnrp
    122 	mkdir bad
    123 	cat testnos testnos1 | ./dt $(INFFIX) >zap 2>&1
    124 	cmp dtst.out zap || mv zap bad/dtst.out
    125 	./dItest <testnos $(INFFIX) >zap 2>&1
    126 	cmp dI.out zap || mv zap bad/dI.out
    127 	./dItestsi <testnos $(INFFIX) >zap 2>&1
    128 	cmp dIsi.out zap || mv zap bad/dIsi.out
    129 	./ddtestsi <testnos $(INFFIX) >zap 2>&1
    130 	cmp ddsi.out zap || mv zap bad/ddsi.out
    131 	for i in dd d f x xL Q; do cat testnos rtestnos | \
    132 	 ./"$$i"test $(INFFIX) >zap 2>&1;\
    133 	cmp $$i.out zap || mv zap bad/$$i.out; done
    134 	./strtodt testnos3 >bad/strtodt.out && rm bad/strtodt.out || \
    135 		cat bad/strtodt.out
    136 	./strtodtnrp testnos3 >bad/strtodtnrp.out && rm bad/strtodtnrp.out || \
    137 		cat bad/strtodtnrp.out
    138 	rmdir bad 2>/dev/null || \
    139 	(cd bad; for i in *; do cmp -s $$i ../obad/$$i && rm $$i;done; cd ..; rmdir bad)
    140 	touch tests
    141 
    142 # To test Printf in ../gdtoa.a, "make pf_test" and perhaps "make pf_testLq"
    143 # (if both long double and quad are desired and available).
    144 
    145 pf_test: pftest
    146 	./pftest <pftestnos >zap
    147 	cmp pftest.out zap && rm zap
    148 
    149 pf_testLq: pftest
    150 	./pftest <pfLqtestnos >zap
    151 	cmp pftestLq.out zap && rm zap
    152 
    153 xs0 = README Q.ou0 Q.ou1 Qtest.c d.out dI.out dIsi.out dItest.c dd.out\
    154 	 ddsi.out ddtest.c dt.c dtest.c dtst.out f.out ftest.c\
    155 	 getround.c makefile pfLqtestnos pftest.c pftestQ.out\
    156 	 pftestx.out pftestLq.out pftestnos rtestnos strtoIdSI.c\
    157 	 strtoIddSI.c strtodISI.c strtodt.c strtopddSI.c strtorddSI.c\
    158 	 testnos testnos1 testnos3 x.ou0 x.ou1 xL.ou0 xL.ou1 xLtest.c\
    159 	 xQtest.c xtest.c
    160 
    161 # invoke "make -r xsum.out"
    162 xsum.out: xsum0.out $(xs0)
    163 	xsum $(xs0) >xsum1.out
    164 	cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out
    165 
    166 clean:
    167 	rm -f *.[ao] dt *test *testsi pftest.out strtodt strtodtnrp xsum.out\
    168 	 xsum1.out tests zap x.out xL.out Q.out
    169 	rm -rf bad
    170