diff options
Diffstat (limited to 'test/Gentests')
-rwxr-xr-x | test/Gentests | 176 |
1 files changed, 165 insertions, 11 deletions
diff --git a/test/Gentests b/test/Gentests index 5a7aaa09..d7feaef5 100755 --- a/test/Gentests +++ b/test/Gentests @@ -3,8 +3,6 @@ # This program should generate Maketests BEGIN { - if (VMSTESTS) vmsargvfixup() - # read the list of files for (i = 2; i < ARGC; i++) files[ARGV[i]] @@ -13,6 +11,13 @@ BEGIN { ARGC = 2 ntests = 0 + + Locale["C"] = "C" + Locale["EN"] = "en_US.UTF-8" + Locale["FR"] = "fr_FR.UTF-8" + Locale["GR"] = "el_GR.iso88597" + Locale["JA"] = "ja_JP.UTF-8" + Locale["RU"] = "ru_RU.UTF-8" } # process the file Makefile.am: @@ -24,6 +29,13 @@ BEGIN { next } +/^NEED_DEBUG *=/,/[^\\]$/ { + gsub(/(^NEED_DEBUG *=|\\$)/,"") + for (i = 1; i <= NF; i++) + debug[$i] + next +} + /^NEED_LINT *=/,/[^\\]$/ { gsub(/(^NEED_LINT *=|\\$)/,"") for (i = 1; i <= NF; i++) @@ -38,6 +50,50 @@ BEGIN { next } +/^NEED_MPFR *=/,/[^\\]$/ { + gsub(/(^NEED_MPFR *=|\\$)/,"") + for (i = 1; i <= NF; i++) { + simple_mpfr[$i] + tests[++ntests] = $i + } + next +} + +/^NEED_NONDEC *=/,/[^\\]$/ { + gsub(/(^NEED_NONDEC *=|\\$)/,"") + for (i = 1; i <= NF; i++) + nondec[$i] + next +} + +/^NEED_PRETTY *=/,/[^\\]$/ { + gsub(/(^NEED_PRETTY *=|\\$)/,"") + for (i = 1; i <= NF; i++) + pretty[$i] + next +} + +/^NEED_POSIX *=/,/[^\\]$/ { + gsub(/(^NEED_POSIX *=|\\$)/,"") + for (i = 1; i <= NF; i++) + posix[$i] + next +} + +/^NEED_RE_INTERVAL *=/,/[^\\]$/ { + gsub(/(^NEED_RE_INTERVAL *=|\\$)/,"") + for (i = 1; i <= NF; i++) + re_interval[$i] + next +} + +/^NEED_TRADITIONAL *=/,/[^\\]$/ { + gsub(/(^NEED_TRADITIONAL *=|\\$)/,"") + for (i = 1; i <= NF; i++) + traditional[$i] + next +} + /^GENTESTS_UNUSED *=/,/[^\\]$/ { gsub(/(^GENTESTS_UNUSED *=|\\$)/,"") for (i = 1; i <= NF; i++) @@ -54,6 +110,18 @@ BEGIN { next } +# Tests needing a particular locale +/^NEED_LOCALE_.* *=/,/[^\\]$/ { + if (/^NEED/) + cur_locale = gensub(/^NEED_LOCALE_([[:alnum:]]+).*/, "\\1", 1, $1) + + gsub(/^NEED_LOCALE_.* *=|\\$/, "") + for (i = 1; i <= NF; i++) { + locale_tests[cur_locale][$i] + all_locale_tests[$i] + } +} + /^[[:alpha:]_][[:alnum:]_]*:/ { # remember all targets from Makefile.am sub(/:.*/,"") @@ -75,15 +143,34 @@ END { print "# end of file Maketests" } -function generate(x, s) +function generate_shell(x, s) { + delete files[x".sh"] + + s = "" + if (x".in" in files) { + s = "\"$(srcdir)\"/$@.in" + delete files[x".in"] + } + + print x ":" + printf "\t@echo $@\n" + + printf "\t@-$(LOCALES) AWK=\"$(AWKPROG)\" \"$(srcdir)\"/$@.sh %s > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@\n", s + printf "\t@-$(CMP) \"$(srcdir)\"/$@.ok _$@ && rm -f _$@\n\n" + +} + +function generate(x, s, i, locale_string) +{ + if (x".sh" in files) + return generate_shell(x) + if (!(x".awk" in files)) printf "WARNING: file `%s.awk' not found.\n", x > "/dev/stderr" else delete files[x".awk"] - if (VMSTESTS) return vmsgenerate(x) - print x ":" s = "" @@ -95,6 +182,34 @@ function generate(x, s) s = s " --lint-old" delete lint_old[x] } + if (x in simple_mpfr) { + s = s " -M" + delete simple_mpfr[x] + } + if (x in posix) { + s = s " --posix" + delete posix[x] + } + if (x in traditional) { + s = s " --traditional" + delete traditional[x] + } + if (x in pretty) { + s = s " --pretty-print=_$@" + delete pretty[x] + } + if (x in debug) { + s = s " --debug" + delete debug[x] + } + if (x in nondec) { + s = s " --non-decimal-data" + delete nondec[x] + } + if (x in re_interval) { + s = s " --re-interval" + delete re_interval[x] + } if (x".in" in files) { s = s " < \"$(srcdir)\"/$@.in" delete files[x".in"] @@ -102,14 +217,29 @@ function generate(x, s) printf "\t@echo $@\n" + # default is the leading tab and @ + locale_string = "\t@" + if (x in all_locale_tests) { + delete all_locale_tests[x] + for (i in locale_tests) { + if (x in locale_tests[i]) { + locale_string = sprintf("\t@[ -z \"$$GAWKLOCALE\" ] && GAWKLOCALE=%s; export GAWKLOCALE; \\\n\t", Locale[i]) + delete locale_tests[i][x] + break + } + } + } + if (x in mpfr) { delete mpfr[x] - printf "\t@AWKPATH=\"$(srcdir)\" $(AWK) $(AWKFLAGS) -f $@.awk %s >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@\n", s + printf "%s", locale_string + printf "AWKPATH=\"$(srcdir)\" $(AWK) $(AWKFLAGS) -f $@.awk %s >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@\n", s printf "\t@-if test -z \"$$AWKFLAGS\" ; then $(CMP) \"$(srcdir)\"/$@.ok _$@ && rm -f _$@ ; else \\\n" printf "\t$(CMP) \"$(srcdir)\"/$@-mpfr.ok _$@ && rm -f _$@ ; \\\n" printf "\tfi\n\n" } else { - printf "\t@AWKPATH=\"$(srcdir)\" $(AWK) -f $@.awk %s >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@\n", s + printf "%s", locale_string + printf "AWKPATH=\"$(srcdir)\" $(AWK) -f $@.awk %s >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@\n", s printf "\t@-$(CMP) \"$(srcdir)\"/$@.ok _$@ && rm -f _$@\n\n" } } @@ -121,11 +251,35 @@ END { for (x in lint_old) if (!(x in targets)) printf "WARNING: --lint-old target `%s' is missing.\n", x > "/dev/stderr" + for (x in simple_mpfr) + if (!(x in targets)) + printf "WARNING: -M target `%s' is missing.\n", x > "/dev/stderr" + for (x in posix) + if (!(x in targets)) + printf "WARNING: --posix target `%s' is missing.\n", x > "/dev/stderr" + for (x in traditional) + if (!(x in targets)) + printf "WARNING: --traditional target `%s' is missing.\n", x > "/dev/stderr" + for (x in pretty) + if (!(x in targets)) + printf "WARNING: --pretty-print target `%s' is missing.\n", x > "/dev/stderr" + for (x in debug) + if (!(x in targets)) + printf "WARNING: --debug target `%s' is missing.\n", x > "/dev/stderr" + for (x in nondec) + if (!(x in targets)) + printf "WARNING: --non-decimal-data target `%s' is missing.\n", x > "/dev/stderr" + + for (x in re_interval) + if (!(x in targets)) + printf "WARNING: --re-interval target `%s' is missing.\n", x > "/dev/stderr" + for (x in locale_tests) + for (y in locale_tests[x]) + if (!(y in targets)) + printf("WARNING: Locale `%s' target `%s' is missing.\n", x, y) > "/dev/stderr" + for (x in files) if (!(x in unused) && \ - !(gensub(/\.(awk|in)$/,"",1,x) in targets)) + !(gensub(/\.(awk|in|sh)$/,"",1,x) in targets)) printf "WARNING: unused file `%s'.\n", x > "/dev/stderr" } - -# VMSTESTS: generate test template in vms format -# gawk -v "VMSTESTS=1" -f Gentests -f Gentests.vms Makefile.am *.awk *.in >Maketests.vms |