summaryrefslogtreecommitdiff
path: root/Build/source/texk/tetex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-09-09 01:54:35 +0000
committerKarl Berry <karl@freefriends.org>2011-09-09 01:54:35 +0000
commit77df47391389b30f27b92ed13e805ac2cb588903 (patch)
tree56d876d3e16a9500528053affc8c3c3c7590fbc0 /Build/source/texk/tetex
parentb0d615a39fa08cf53df7081d22c15d93a6305b7b (diff)
beginning of updmap tests, option handling update
git-svn-id: svn://tug.org/texlive/trunk@23879 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/tetex')
-rw-r--r--Build/source/texk/tetex/ChangeLog11
-rw-r--r--Build/source/texk/tetex/Makefile.am3
-rw-r--r--Build/source/texk/tetex/Makefile.in130
-rwxr-xr-xBuild/source/texk/tetex/tests/updmap-cmdline-test.pl20
-rwxr-xr-xBuild/source/texk/tetex/updmap.pl45
5 files changed, 171 insertions, 38 deletions
diff --git a/Build/source/texk/tetex/ChangeLog b/Build/source/texk/tetex/ChangeLog
index 18a9005f35b..abfec76b320 100644
--- a/Build/source/texk/tetex/ChangeLog
+++ b/Build/source/texk/tetex/ChangeLog
@@ -1,3 +1,14 @@
+2011-09-09 Karl Berry <karl@tug.org>
+
+ * tests: new subdir, with first updmap test, that doesn't really
+ work yet but passes anyway.
+ * Makefile.am (TESTS): add tests/updmap-cmdline-test.pl.
+ * updmap.pl (read_option_vals): don't call getopt twice (from Norbert).
+ Don't complain about non-option args, that is how --enable/--disable
+ are currently (mis)handled.
+ (writeLines, copyFile, setupOutputDir, SetupCfgFile): do nothing
+ if $dry_run.
+
2011-09-05 Karl Berry <karl@tug.org>
* texconfig-dialog (runDialog): only clear screen if we actually
diff --git a/Build/source/texk/tetex/Makefile.am b/Build/source/texk/tetex/Makefile.am
index 73e01aa6f4f..32174b886cf 100644
--- a/Build/source/texk/tetex/Makefile.am
+++ b/Build/source/texk/tetex/Makefile.am
@@ -107,6 +107,9 @@ EXTRA_DIST += \
old-updmap
##
+TESTS = tests/updmap-cmdline-test.pl
+
+##
## This target is invoked by the top-level make,
## to create the per-format engine symlinks in $(bindir),
## after everything else is installed. We explicitly specify the
diff --git a/Build/source/texk/tetex/Makefile.in b/Build/source/texk/tetex/Makefile.in
index c879acab4e2..66a5fbe0d87 100644
--- a/Build/source/texk/tetex/Makefile.in
+++ b/Build/source/texk/tetex/Makefile.in
@@ -95,6 +95,8 @@ man5dir = $(mandir)/man5
NROFF = nroff
MANS = $(dist_man1_MANS) $(dist_man5_MANS)
DATA = $(dist_texconfig_DATA) $(dist_web2c_DATA)
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -268,6 +270,7 @@ man1_links = $(bin_links) \
updmap:updmap-sys
EXTRA_DIST = README.texdoctk old-fontinst.bat old-updmap
+TESTS = tests/updmap-cmdline-test.pl
run_texlinks = $(DESTDIR)$(bindir)/texlinks -v \
-f $(DESTDIR)$(web2cdir)/fmtutil.cnf \
-e "$(EXEEXT)" $(DESTDIR)$(bindir)
@@ -560,6 +563,98 @@ ctags: CTAGS
CTAGS:
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ echo "$$grn$$dashes"; \
+ else \
+ echo "$$red$$dashes"; \
+ fi; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes$$std"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
@@ -721,6 +816,7 @@ distcleancheck: distclean
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile $(SCRIPTS) $(MANS) $(DATA)
installdirs:
@@ -832,23 +928,23 @@ uninstall-am: uninstall-dist_binSCRIPTS uninstall-dist_texconfigDATA \
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
uninstall-man: uninstall-man1 uninstall-man5
-.MAKE: install-am install-data-am install-exec-am install-strip \
- uninstall-am
-
-.PHONY: all all-am am--refresh check check-am clean clean-generic dist \
- dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \
- dist-xz dist-zip distcheck distclean distclean-generic \
- distcleancheck distdir distuninstallcheck dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-data-hook install-dist_binSCRIPTS \
- install-dist_texconfigDATA install-dist_texconfigSCRIPTS \
- install-dist_texmfSCRIPTS install-dist_web2cDATA install-dvi \
- install-dvi-am install-exec install-exec-am install-exec-hook \
- install-html install-html-am install-info install-info-am \
- install-man install-man1 install-man5 \
- install-nodist_binSCRIPTS install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
+.MAKE: check-am install-am install-data-am install-exec-am \
+ install-strip uninstall-am
+
+.PHONY: all all-am am--refresh check check-TESTS check-am clean \
+ clean-generic dist dist-all dist-bzip2 dist-gzip dist-lzma \
+ dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \
+ distclean-generic distcleancheck distdir distuninstallcheck \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-data-hook \
+ install-dist_binSCRIPTS install-dist_texconfigDATA \
+ install-dist_texconfigSCRIPTS install-dist_texmfSCRIPTS \
+ install-dist_web2cDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-exec-hook install-html install-html-am \
+ install-info install-info-am install-man install-man1 \
+ install-man5 install-nodist_binSCRIPTS install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am uninstall uninstall-am \
uninstall-dist_binSCRIPTS uninstall-dist_texconfigDATA \
diff --git a/Build/source/texk/tetex/tests/updmap-cmdline-test.pl b/Build/source/texk/tetex/tests/updmap-cmdline-test.pl
new file mode 100755
index 00000000000..1fd6f4d21fe
--- /dev/null
+++ b/Build/source/texk/tetex/tests/updmap-cmdline-test.pl
@@ -0,0 +1,20 @@
+#!/usr/bin/env perl
+# $Id: bibtex-openout-test.pl 17384 2010-03-08 18:49:47Z karl $
+# Public domain. Originally written 2011, Karl Berry.
+# Check that updmap can parse various cmdline invocations.
+
+# srcdir = tetex (in the source tree)
+BEGIN { chomp ($srcdir = $ENV{"srcdir"} || `cd \`dirname $0\`/.. && pwd`); }
+require "$srcdir/../tests/common-test.pl";
+
+exit (&main ());
+
+sub main {
+ my $ret = &test_run ("$srcdir/updmap.pl", "-n", "--quiet",
+ #"--enable", "Map=foo"
+ );
+
+ # The test fails if the program succeeded. Could also check the output.
+ my $bad = ($ret == 0);
+ return $bad;
+}
diff --git a/Build/source/texk/tetex/updmap.pl b/Build/source/texk/tetex/updmap.pl
index 63e9fc52eb9..91627760df4 100755
--- a/Build/source/texk/tetex/updmap.pl
+++ b/Build/source/texk/tetex/updmap.pl
@@ -197,17 +197,15 @@ EOF
# process cmd line options
#
sub processOptions {
- #
- # We parse the command line twice. The first time is to handle
- # --setoption, which might take either one or two following values.
- # the second to handle everything else. The Getopt::Long feature to
- # handle this is only supported in 5.8.8 (released in 2006) or later,
- # and a few people run older perls.
+
+ # This deals with --setoption, which might take either one or two
+ # following values. The Getopt::Long feature to handle this (s{1,2})
+ # is only supported in 5.8.8 (released in 2006) or later, and a few
+ # people still run older perls. (--enable and --disable should get
+ # the same treatment.)
#
- my $oldconfig = Getopt::Long::Configure(qw(pass_through));
- #
- sub read_for_set_options {
- my ($setopt, $val) = @_;
+ sub read_option_vals {
+ my ($optname,$val) = @_;
# check if = occurs in $val, if not, get the next argument
if ($val =~ m/=/) {
push (@setoptions, $val);
@@ -218,11 +216,7 @@ sub processOptions {
push (@setoptions, "$val=$vv");
}
}
- GetOptions("setoption=s@" => \&read_for_set_options)
- || die "$0: could not read for --setoption; try --help.\n";
- # restore old getopt config and read everything else.
- Getopt::Long::Configure($oldconfig);
unless (&GetOptions (
"cnffile=s" => \$cnfFile,
"copy" => \$copy,
@@ -240,8 +234,7 @@ sub processOptions {
"outputdir=s" => \$outputdir,
"pdftexoutputdir=s" => \$pdftexoutputdir,
"q|quiet|silent" => \$quiet,
- "setoption" =>
- sub {die "$0: --setoption needs an option and value; try --help.\n"},
+ "setoption=s@" => \&read_option_vals,
"showoptions=s" => \@showoptions,
"syncwithtrees" => \$syncwithtrees,
"version" => sub { print &version(); exit(0); },
@@ -249,9 +242,10 @@ sub processOptions {
die "Try \"$0 --help\" for more information.\n";
}
- if (@ARGV) {
- warn "$0: Ignoring unexpected non-option argument(s): @ARGV.\n";
- }
+ # not until we parse --enable and --disable like --setoption.
+ #if (@ARGV) {
+ # warn "$0: Ignoring unexpected non-option argument(s): @ARGV.\n";
+ #}
if ($outputdir) {
$dvipsoutputdir = $outputdir if (! $dvipsoutputdir);
@@ -373,9 +367,11 @@ sub getLines {
###############################################################################
# writeLines()
-# write the lines in $filename
+# write the lines in $filename, unless $dry_run.
#
sub writeLines {
+ return if $dry_run;
+
my ($fname, @lines) = @_;
map { ($_ !~ m/\n$/ ? s/$/\n/ : $_ ) } @lines;
open FILE, ">$fname" or die "$0: can't write lines to $fname: $!";
@@ -389,6 +385,11 @@ sub writeLines {
#
sub copyFile {
my ($src, $dst) = @_;
+
+ if ($dry_run) {
+ print "$0: would copy $src to $dst\n";
+ return;
+ }
my $dir;
($dir=$dst)=~s/(.*)\/.*/$1/;
mkdirhier $dir;
@@ -698,6 +699,7 @@ sub disableMap {
sub setupOutputDir {
my($od, $driver) = @_;
+ return if $dry_run;
if (!$od) {
my $rel = "fonts/map/$driver/updmap";
my $tf;
@@ -727,6 +729,7 @@ sub setupDestDir {
# find config file if none specified on cmd line.
#
sub setupCfgFile {
+ return if $dry_run;
if (! $cnfFile) {
my $tf = `kpsewhich --var-value=TEXMFCONFIG`;
chomp($tf);
@@ -970,7 +973,7 @@ sub mkMaps {
print STDERR join(' ', @missing);
print STDERR "\n\n\tDid you run mktexlsr?\n\n" .
"\tYou can delete non-existent map entries using the option\n".
- "\t --syncwithtrees.\n\n";
+ "\t --syncwithtrees.\n";
exit (1);
}
exit(0) if $dry_run;