mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
Avoid possible error when 'tr' gets fed random bytes in an UTF-8 locale.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Makefile for gperf/tests
|
||||
|
||||
# Copyright (C) 1989, 1992-1993, 1995, 1998, 2000, 2002-2004, 2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1989, 1992-1993, 1995, 1998, 2000, 2002-2004, 2007-2008 Free Software Foundation, Inc.
|
||||
# Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
# and Bruno Haible <bruno@clisp.org>.
|
||||
#
|
||||
@@ -74,7 +74,7 @@ check-link-c++: force
|
||||
|
||||
check-c:
|
||||
@echo "testing ANSI C reserved words, all items should be found in the set"
|
||||
./cout -v < $(srcdir)/c.gperf | tr -d '\r' > c.out
|
||||
./cout -v < $(srcdir)/c.gperf | LC_ALL=C tr -d '\r' > c.out
|
||||
diff $(srcdir)/c.exp c.out
|
||||
|
||||
check-ada:
|
||||
@@ -82,26 +82,26 @@ check-ada:
|
||||
# double '$$' is only there since make gets confused; program wants only 1 '$'
|
||||
$(CC) $(CFLAGS) -o aout adainset.c test.o
|
||||
@echo "testing Ada reserved words, all items should be found in the set"
|
||||
./aout -v < $(srcdir)/ada.gperf | tr -d '\r' > ada-res.out
|
||||
./aout -v < $(srcdir)/ada.gperf | LC_ALL=C tr -d '\r' > ada-res.out
|
||||
diff $(srcdir)/ada-res.exp ada-res.out
|
||||
$(GPERF) -D -k1,'$$' -s 2 -I -o $(srcdir)/adadefs.gperf > preinset.c
|
||||
$(CC) $(CFLAGS) -o preout preinset.c test.o
|
||||
@echo "testing Ada predefined words, all items should be found in the set"
|
||||
./preout -v < $(srcdir)/adadefs.gperf | tr -d '\r' > ada-pred.out
|
||||
./preout -v < $(srcdir)/adadefs.gperf | LC_ALL=C tr -d '\r' > ada-pred.out
|
||||
diff $(srcdir)/ada-pred.exp ada-pred.out
|
||||
|
||||
check-modula3:
|
||||
$(GPERF) -k1,2,'$$' -I -o $(srcdir)/modula3.gperf > m3inset.c
|
||||
$(CC) $(CFLAGS) -o m3out m3inset.c test.o
|
||||
@echo "testing Modula3 reserved words, all items should be found in the set"
|
||||
./m3out -v < $(srcdir)/modula3.gperf | tr -d '\r' > modula.out
|
||||
./m3out -v < $(srcdir)/modula3.gperf | LC_ALL=C tr -d '\r' > modula.out
|
||||
diff $(srcdir)/modula.exp modula.out
|
||||
|
||||
check-pascal:
|
||||
$(GPERF) -o -S2 -I < $(srcdir)/pascal.gperf > pinset.c
|
||||
$(CC) $(CFLAGS) -o pout pinset.c test.o
|
||||
@echo "testing Pascal reserved words, all items should be found in the set"
|
||||
./pout -v < $(srcdir)/pascal.gperf | tr -d '\r' > pascal.out
|
||||
./pout -v < $(srcdir)/pascal.gperf | LC_ALL=C tr -d '\r' > pascal.out
|
||||
diff $(srcdir)/pascal.exp pascal.out
|
||||
|
||||
# check for 8-bit cleanliness
|
||||
@@ -109,7 +109,7 @@ check-lang-utf8:
|
||||
$(GPERF) -k1 -t -I -K foreign_name < $(srcdir)/lang-utf8.gperf > lu8inset.c
|
||||
$(CC) $(CFLAGS) -o lu8out lu8inset.c test.o
|
||||
@echo "testing UTF-8 encoded languages, all items should be found in the set"
|
||||
sed -e '1,6d' -e 's/,.*//' < $(srcdir)/lang-utf8.gperf | ./lu8out -v | tr -d '\r' > lang-utf8.out
|
||||
sed -e '1,6d' -e 's/,.*//' < $(srcdir)/lang-utf8.gperf | ./lu8out -v | LC_ALL=C tr -d '\r' > lang-utf8.out
|
||||
diff $(srcdir)/lang-utf8.exp lang-utf8.out
|
||||
|
||||
# check for binary keywords with NUL bytes
|
||||
@@ -118,7 +118,7 @@ check-lang-ucs2:
|
||||
$(GPERF) -k4 -t -l -I -K foreign_name < $(srcdir)/lang-ucs2.gperf > lu2inset.c
|
||||
$(CC) $(CFLAGS) -o lu2out lu2inset.c test2.o
|
||||
@echo "testing UCS-2 encoded languages, all items should be found in the set"
|
||||
./lu2out -v < $(srcdir)/lang-ucs2.in | tr -d '\r' > lang-ucs2.out
|
||||
./lu2out -v < $(srcdir)/lang-ucs2.in | LC_ALL=C tr -d '\r' > lang-ucs2.out
|
||||
diff $(srcdir)/lang-ucs2.exp lang-ucs2.out
|
||||
|
||||
# check case-insensitive lookup
|
||||
@@ -135,7 +135,7 @@ check-smtp:
|
||||
./smtp
|
||||
|
||||
# these next 5 are demos that show off the generated code
|
||||
POSTPROCESS_FOR_MINGW = tr -d '\r' | sed -e 's|[^ ]*[/\\][\\]*src[/\\][\\]*gperf[^ ]*|../src/gperf|'
|
||||
POSTPROCESS_FOR_MINGW = LC_ALL=C tr -d '\r' | sed -e 's|[^ ]*[/\\][\\]*src[/\\][\\]*gperf[^ ]*|../src/gperf|'
|
||||
check-test:
|
||||
$(GPERF) -L C -F ', 0, 0' -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,'$$' < $(srcdir)/c-parse.gperf | $(POSTPROCESS_FOR_MINGW) > c-parse.out
|
||||
diff $(srcdir)/c-parse.exp c-parse.out
|
||||
|
||||
Reference in New Issue
Block a user