summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/seetexk/ChangeLog7
-rw-r--r--Build/source/texk/seetexk/dvibook.c13
-rw-r--r--Build/source/texk/seetexk/dviconcat.c13
-rwxr-xr-xBuild/source/texk/seetexk/seetexk.test183
4 files changed, 149 insertions, 67 deletions
diff --git a/Build/source/texk/seetexk/ChangeLog b/Build/source/texk/seetexk/ChangeLog
index 839cc1b19f0..8d057a87e22 100644
--- a/Build/source/texk/seetexk/ChangeLog
+++ b/Build/source/texk/seetexk/ChangeLog
@@ -1,3 +1,10 @@
+2023-08-11 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * dvibook.c, dviconcat.c:
+ Better handling of STDIN/STDOUT on Windows.
+ * seetexk.test:
+ Make easier to test on Windows.
+
2023-07-05 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
* dvibook.c, dviconcat.c, dviselect.c, dvitodvi.c:
diff --git a/Build/source/texk/seetexk/dvibook.c b/Build/source/texk/seetexk/dvibook.c
index cee048731f7..9f2e0033183 100644
--- a/Build/source/texk/seetexk/dvibook.c
+++ b/Build/source/texk/seetexk/dvibook.c
@@ -45,6 +45,9 @@
extern char *optarg;
extern int optind;
#endif
+#if defined(WIN32)
+#include <sys/stat.h>
+#endif
#include "types.h"
#include "dviclass.h"
@@ -491,6 +494,16 @@ Usage: %s [-s signature] [-q] [-i infile] [-o outfile] [infile [outfile]]\n",
else
goto usage;
}
+#if defined(WIN32)
+ if (DVIFileName == NULL && outname == NULL) {
+ struct stat sti, sto;
+ int fdi = fileno(stdin), fdo = fileno(stdout);
+ if (isatty(fdi) == 0 && fstat(fdi, &sti) == 0 && S_ISFIFO(sti.st_mode)
+ && isatty(fdo) == 0 && fstat(fdo, &sto) == 0 && S_ISFIFO(sto.st_mode)) {
+ goto usage;
+ }
+ }
+#endif
if (DVIFileName == NULL) {
DVIFileName = "`stdin'";
inf = stdin;
diff --git a/Build/source/texk/seetexk/dviconcat.c b/Build/source/texk/seetexk/dviconcat.c
index 18e3c14c890..f3a035b931b 100644
--- a/Build/source/texk/seetexk/dviconcat.c
+++ b/Build/source/texk/seetexk/dviconcat.c
@@ -42,6 +42,9 @@
extern char *optarg;
extern int optind;
#endif
+#if defined(WIN32)
+#include <sys/stat.h>
+#endif
#include "types.h"
#include "dviclass.h"
@@ -467,6 +470,16 @@ usage:
* We write a preamble based on the first input file.
*/
if (optind >= argc) {
+#if defined(WIN32)
+ if (outf == stdout) {
+ struct stat sti, sto;
+ int fdi = fileno(stdin), fdo = fileno(stdout);
+ if (isatty(fdi) == 0 && fstat(fdi, &sti) == 0 && S_ISFIFO(sti.st_mode)
+ && isatty(fdo) == 0 && fstat(fdo, &sto) == 0 && S_ISFIFO(sto.st_mode)) {
+ goto usage;
+ }
+ }
+#endif
if (!isatty(fileno(stdin)))
SET_BINARY(fileno(stdin));
else
diff --git a/Build/source/texk/seetexk/seetexk.test b/Build/source/texk/seetexk/seetexk.test
index b26b300b916..278acc94add 100755
--- a/Build/source/texk/seetexk/seetexk.test
+++ b/Build/source/texk/seetexk/seetexk.test
@@ -4,148 +4,197 @@
# Copyright 2011-2013 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.
+BinDir=${BinDir:-.}
+ExeExt=${ExeExt:-}
+_dviselect=$BinDir/dviselect$ExeExt
+_dvibook=$BinDir/dvibook$ExeExt
+_dviconcat=$BinDir/dviconcat$ExeExt
+_dvitodvi=$BinDir/dvitodvi$ExeExt
+
+# pre-generated test results in the repository are stored in LF
+# but the output might be written in CRLF on some platform.
+# if 'diff --strip-trailing-cr' is available, exploit it.
+# (useful for tests on win32 binaries run on MSYS shell)
+DIFF="diff"
+$DIFF --strip-trailing-cr $0 $0 \
+ && DIFF="diff --strip-trailing-cr" || echo
+
+# check whether the binaries are Windows exe or not
+run_stdio_test=1
+if [ $ExeExt = ".exe" ]; then
+ echo "*** We assume EXE on Windows."
+ run_stdio_test=0
+fi
+
+# for check version
+echo "*** Start seetex tests with::"
+$_dviselect
+if [ $run_stdio_test -gt 0 ]; then
+$_dvibook
+$_dviconcat
+fi
+$_dvitodvi
+
+TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF
+
+
rm -rf play*
-./dviselect =25 $srcdir/tests/play.dvi playsel.dvi \
+$_dviselect =25 $srcdir/tests/play.dvi playsel.dvi \
2>playsel.2 \
&& exit 1
test -r playsel.dvi \
- && exit 1
- diff playsel.2 $srcdir/tests/playnot.2 \
- || exit 1
+ && exit 2
+ $DIFF playsel.2 $srcdir/tests/playnot.2 \
+ || exit 3
rm -rf play*
-./dviselect 15:25 $srcdir/tests/play.dvi playsel.dvi \
+$_dviselect 15:25 $srcdir/tests/play.dvi playsel.dvi \
2>playsel.2 \
- && diff playsel.2 $srcdir/tests/playsel.2 \
- || exit 1
+ && $DIFF playsel.2 $srcdir/tests/playsel.2 \
+ || exit 4
rm -rf play*
-./dviselect =5:15 $srcdir/tests/play.dvi playsel.dvi \
+$_dviselect =5:15 $srcdir/tests/play.dvi playsel.dvi \
2>playsel.2 \
- && diff playsel.2 $srcdir/tests/playsel.2 \
- || exit 1
+ && $DIFF playsel.2 $srcdir/tests/playsel.2 \
+ || exit 5
echo dviselect tests OK
rm -rf play*
-cat $srcdir/tests/play.dvi | ./dviselect =25 >playsel.dvi \
+cat $srcdir/tests/play.dvi | $_dviselect =25 >playsel.dvi \
2>playsel.2 \
- && exit 1
+ && exit 6
touch playnot.dvi \
- && diff playsel.dvi playnot.dvi \
- && diff playsel.2 $srcdir/tests/playnot.2 \
- || exit 1
+ && $DIFF playsel.dvi playnot.dvi \
+ && $DIFF playsel.2 $srcdir/tests/playnot.2 \
+ || exit 7
rm -rf play*
-cat $srcdir/tests/play.dvi | ./dviselect =5:15 >playsel.dvi \
+cat $srcdir/tests/play.dvi | $_dviselect =5:15 >playsel.dvi \
2>playsel.2 \
- && diff playsel.2 $srcdir/tests/playsel.2 \
- || exit 1
+ && $DIFF playsel.2 $srcdir/tests/playsel.2 \
+ || exit 8
rm -rf play*
-./dviselect =25 <$srcdir/tests/play.dvi >playsel.dvi \
+$_dviselect =25 <$srcdir/tests/play.dvi >playsel.dvi \
2>playsel.2 \
- && exit 1
+ && exit 9
touch playnot.dvi \
- && diff playsel.dvi playnot.dvi \
- && diff playsel.2 $srcdir/tests/playnot.2 \
- || exit 1
+ && $DIFF playsel.dvi playnot.dvi \
+ && $DIFF playsel.2 $srcdir/tests/playnot.2 \
+ || exit 10
rm -rf play*
-./dviselect =5:15 <$srcdir/tests/play.dvi >playsel.dvi \
+$_dviselect =5:15 <$srcdir/tests/play.dvi >playsel.dvi \
2>playsel.2 \
- && diff playsel.2 $srcdir/tests/playsel.2 \
- || exit 1
+ && $DIFF playsel.2 $srcdir/tests/playsel.2 \
+ || exit 11
echo dviselect with stdin and stdout tests OK
-./dviselect =5:15 $srcdir/tests/playtate.dvi playselt.dvi \
+$_dviselect =5:15 $srcdir/tests/playtate.dvi playselt.dvi \
2>playsel.3 \
- && diff playsel.3 $srcdir/tests/playsel.3 \
- || exit 1
+ && $DIFF playsel.3 $srcdir/tests/playsel.3 \
+ || exit 12
echo dviselect pTeX tests OK
-./dvibook -s4 playsel.dvi playbook.dvi \
+$_dvibook -s4 playsel.dvi playbook.dvi \
2>playbook.2 \
- && diff playbook.2 $srcdir/tests/playbook.2 \
- || exit 1
+ && $DIFF playbook.2 $srcdir/tests/playbook.2 \
+ || exit 13
echo dvibook tests OK
+if [ $run_stdio_test -gt 0 ]; then
+
rm -f playbook.2
-cat playsel.dvi | ./dvibook -s4 >playbook.dvi \
+cat playsel.dvi | $_dvibook -s4 >playbook.dvi \
2>playbook.2 \
- && diff playbook.2 $srcdir/tests/playbook.2 \
- || exit 1
+ && $DIFF playbook.2 $srcdir/tests/playbook.2 \
+ || exit 14
rm -f playbook.2
-./dvibook -s4 <playsel.dvi >playbook.dvi \
+$_dvibook -s4 <playsel.dvi >playbook.dvi \
2>playbook.2 \
- && diff playbook.2 $srcdir/tests/playbook.2 \
- || exit 1
+ && $DIFF playbook.2 $srcdir/tests/playbook.2 \
+ || exit 15
echo dvibook with stdin and stdout tests OK
-./dvibook -s4 playselt.dvi playbook.dvi \
+else
+
+echo dvibook with stdin and stdout tests **SKIPPED**
+
+fi
+
+$_dvibook -s4 playselt.dvi playbook.dvi \
2>playbook.3 \
- && diff playbook.3 $srcdir/tests/playbook.3 \
- || exit 1
+ && $DIFF playbook.3 $srcdir/tests/playbook.3 \
+ || exit 16
-./dvibook -r -s4 playselt.dvi playbook.dvi \
+$_dvibook -r -s4 playselt.dvi playbook.dvi \
2>playbook.4 \
- && diff playbook.4 $srcdir/tests/playbook.4 \
- || exit 1
+ && $DIFF playbook.4 $srcdir/tests/playbook.4 \
+ || exit 17
echo dvibook pTeX tests OK
-./dviselect =5:7 $srcdir/tests/play.dvi playsel1.dvi \
+$_dviselect =5:7 $srcdir/tests/play.dvi playsel1.dvi \
2>playconc.2 \
- && ./dviselect 23:25 $srcdir/tests/play.dvi playsel2.dvi \
+ && $_dviselect 23:25 $srcdir/tests/play.dvi playsel2.dvi \
2>>playconc.2 \
- && ./dviconcat -o playconc.dvi playsel2.dvi playsel1.dvi \
+ && $_dviconcat -o playconc.dvi playsel2.dvi playsel1.dvi \
2>>playconc.2 \
- && diff playconc.2 $srcdir/tests/playconc.2 \
- || exit 1
+ && $DIFF playconc.2 $srcdir/tests/playconc.2 \
+ || exit 18
echo dviconcat tests OK
-./dviselect =5:7 $srcdir/tests/playtate.dvi playsel1.dvi \
+$_dviselect =5:7 $srcdir/tests/playtate.dvi playsel1.dvi \
2>playconc.3 \
- && ./dviselect 23:25 $srcdir/tests/playtate.dvi playsel2.dvi \
+ && $_dviselect 23:25 $srcdir/tests/playtate.dvi playsel2.dvi \
2>>playconc.3 \
- && ./dviconcat -o playconc.dvi playsel2.dvi playsel1.dvi \
+ && $_dviconcat -o playconc.dvi playsel2.dvi playsel1.dvi \
2>>playconc.3 \
- && diff playconc.3 $srcdir/tests/playconc.3 \
- || exit 1
+ && $DIFF playconc.3 $srcdir/tests/playconc.3 \
+ || exit 19
echo dviconcat pTeX tests OK
-./dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' playsel.dvi playdvi.dvi \
+$_dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' playsel.dvi playdvi.dvi \
2>playdvi.2 \
- && diff playdvi.2 $srcdir/tests/playdvi.2 \
- || exit 1
+ && $DIFF playdvi.2 $srcdir/tests/playdvi.2 \
+ || exit 20
echo dvitodvi tests OK
+if [ $run_stdio_test -gt 0 ]; then
+
rm -f playdvi.2
-cat playsel.dvi | ./dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' -o playdvi.dvi \
+cat playsel.dvi | $_dvitodvi -o playdvi.dvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' \
2>playdvi.2 \
- && diff playdvi.2 $srcdir/tests/playdvi.2 \
- || exit 1
+ && $DIFF playdvi.2 $srcdir/tests/playdvi.2 \
+ || exit 21
rm -f playdvi.2
-./dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' -o playdvi.dvi <playsel.dvi \
+$_dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' >playdvi.dvi <playsel.dvi \
2>playdvi.2 \
- && diff playdvi.2 $srcdir/tests/playdvi.2 \
- || exit 1
+ && $DIFF playdvi.2 $srcdir/tests/playdvi.2 \
+ || exit 22
echo dvitodvi reading stdin tests OK
-./dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' playselt.dvi playdvi.dvi \
+else
+
+echo dvitodvi reading stdin tests **SKIPPED**
+
+fi
+
+$_dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' playselt.dvi playdvi.dvi \
2>playdvi.3 \
- && diff playdvi.3 $srcdir/tests/playdvi.3 \
- || exit 1
+ && $DIFF playdvi.3 $srcdir/tests/playdvi.3 \
+ || exit 23
echo dvitodvi pTeX tests OK
-