]> sjero.net Git - wget/commitdiff
Automated merge.
authorMicah Cowan <micah@cowan.name>
Sun, 6 Sep 2009 21:08:56 +0000 (14:08 -0700)
committerMicah Cowan <micah@cowan.name>
Sun, 6 Sep 2009 21:08:56 +0000 (14:08 -0700)
31 files changed:
ChangeLog
configure.ac
msdos/ChangeLog
msdos/Makefile.DJ
msdos/Makefile.WC
msdos/config.h
src/ChangeLog
src/connect.c
src/init.c
src/main.c
src/openssl.c
src/options.h
src/retr.h
tests/ChangeLog
tests/Makefile.am
tests/Test-ftp-iri-disabled.px
tests/Test-ftp-iri-fallback.px
tests/Test-ftp-iri-recursive.px
tests/Test-ftp-iri.px
tests/Test-idn-cmd.px
tests/Test-idn-headers.px
tests/Test-idn-meta.px
tests/Test-idn-robots.px
tests/Test-iri-forced-remote.px
tests/Test-iri-list.px
tests/Test-iri-percent.px
tests/Test-iri.px
tests/Test-proxied-https-auth.px
tests/WgetFeature.cfg [new file with mode: 0644]
tests/WgetFeature.pm [new file with mode: 0644]
tests/run-px

index eded1a8d170619762bd2896cff8203d8d2ce1ef4..0ee1e0bba41182982785c7b86baf25756ff5ee5e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-05  Micah Cowan  <micah@cowan.name>
+
+       * configure.ac: If we can't find idna.h, check to see if it's
+       because we need to add /usr/include/idn to the inclusion
+       path (for OpenSolaris).
+
 2009-09-04  Steven Schubiger  <stsc@member.fsf.org>
 
        * configure.ac: Place gl_EARLY and md5_EARLY before the gettext
index 58bb8ebc758604a2a70cd248fec92f0f1253598f..fd8f8397459a594bb76a59101cc115ced0e1c7db 100644 (file)
@@ -520,10 +520,21 @@ if test "X$iri" != "Xno"; then
     LDFLAGS="${LDFLAGS} -L$libidn/lib"
     CPPFLAGS="${CPPFLAGS} -I$libidn/include"
   fi
-  AC_CHECK_HEADER(idna.h,
+
+  # If idna.h can't be found, check to see if it was installed under
+  # /usr/include/idn (OpenSolaris, at least, places it there).
+  # Check for idn-int.h in that case, because idna.h won't find
+  # idn-int.h until we've decided to add -I/usr/include/idn.
+  AC_CHECK_HEADER(idna.h, ,
+    [AC_CHECK_HEADER(idn/idn-int.h,
+                    [CPPFLAGS="${CPPFLAGS} -I/usr/include/idn"],
+                    [iri=no])]
+  )
+
+  if test "X$iri" != "Xno"; then
     AC_CHECK_LIB(idn, stringprep_check_version,
-      [iri=yes LIBS="${LIBS} -lidn"], iri=no),
-    iri=no)
+      [iri=yes LIBS="${LIBS} -lidn"], iri=no)
+  fi
 
   if test "X$iri" != "Xno" ; then
     AC_DEFINE(ENABLE_IRI, 1, [Define if IRI support is enabled.])
index 77715cbfd1c1d3ac3cddfa281c77adca138326fe..b07b359b8fb8b52cfd0760828f4f1201617fb75f 100644 (file)
@@ -1,3 +1,15 @@
+2009-09-05  Gisle Vanem  <gvanem@broadpark.no>
+
+       * config.h: Added 'HAVE_ALLOCA_H' for Watcom 1.5+.  Added
+       'USE_WATT32' since all DOS-targets use the Watt-32 tcp/ip stack.
+       Added meaningless dummy LOCALEDIR.
+
+       * Makefile.wc: A much needed update. Added rules for many files
+       in ./lib, css.c and version.c.
+
+       * Makefile.dj: A much needed update. Added rules for css.c and
+       version.c.
+
 2008-01-25  Micah Cowan  <micah@cowan.name>
 
        * config.h: Updated copyright year.
index 9b25ae529fd08d2a99b0ae5b656a6a884683527f..ef42f45f788c69ad57475b0eb81f08d09500cfa2 100644 (file)
@@ -1,13 +1,17 @@
 #
 # GNU Makefile for wget / djgpp / MSDOS.
-# By Gisle Vanem <giva@bgnett.no> 2007.
+# By Gisle Vanem <gvanem@broadpark.no> 2009.
 #
 # `cd' to `./src' and issue the command:
-#   make -f ../msdos/Makefile.dj
+#    make -f ../msdos/Makefile.dj depend
+#  followed by:
+#    make -f ../msdos/Makefile.dj
 #
+VERSION = 1.12 (djgpp/DOS)
+
 .SUFFIXES: .exe
 
-VPATH = ../lib
+VPATH = ../lib ../md5
 
 USE_OPENSSL = 0
 USE_IPV6    = 1
@@ -20,8 +24,9 @@ ZLIB_ROOT    = e:/djgpp/contrib/zlib
 
 OBJ_DIR = djgpp.obj
 CC      = gcc
-CFLAGS  = -O2 -g -Wall -Wcast-align -I. -I../msdos -I../lib -I/dev/env/WATT_ROOT/inc \
-          -DHAVE_CONFIG_H -DENABLE_DEBUG
+CFLAGS  = -O2 -g -Wall -Wcast-align -I. -I../msdos -I../lib -I../md5 \
+          -I/dev/env/WATT_ROOT/inc -DHAVE_CONFIG_H -DENABLE_DEBUG \
+          -DUSE_WATT32
 
 # LDFLAGS = -s
 
@@ -38,11 +43,13 @@ endif
 
 EX_LIBS += /dev/env/WATT_ROOT/lib/libwatt.a
 
-SOURCES += cmpt.c connect.c cookies.c ftp.c ftp-basic.c ftp-ls.c \
+SOURCES += cmpt.c connect.c cookies.c exits.c ftp.c ftp-basic.c ftp-ls.c \
            ftp-opie.c hash.c host.c html-parse.c html-url.c http.c \
            init.c log.c main.c gen-md5.c netrc.c progress.c recur.c \
-           res.c retr.c snprintf.c url.c utils.c version.c convert.c xmalloc.c \
-           ptimer.c spider.c ../lib/getopt.c ../lib/getopt1.c ../lib/md5.c
+           res.c retr.c snprintf.c url.c utils.c version.c convert.c \
+           ptimer.c spider.c css.c css-url.c build_info.c ../md5/md5.c \
+           $(addprefix ../lib/, error.c exitfail.c quote.c \
+             quotearg.c getopt.c getopt1.c xalloc-die.c xmalloc.c)
 
 OBJECTS = $(addprefix $(OBJ_DIR)/, $(notdir $(SOURCES:.c=.o)))
 
@@ -55,18 +62,26 @@ $(OBJ_DIR):
 wget.exe: $(OBJECTS)
        $(CC) $(LDFLAGS) -o $@ $^ $(EX_LIBS)
 
+css.c: css.l
+       flex -8 -o$@ $^
+
 clean:
        rm -f $(OBJ_DIR)/*.o $(MAPFILE)
 
 vclean realclean: clean
-       rm -f wget.exe depend.dj
+       rm -f wget.exe depend.dj version.c
        - rmdir $(OBJ_DIR)
 
 $(OBJ_DIR)/%.o: %.c
        $(CC) $(CFLAGS) -o $@ -c $<
        @echo
 
-depend:
+version.c: ../msdos/Makefile.DJ
+       @echo 'char *version_string     = "$(VERSION)";' > $@
+       @echo 'char *compilation_string = "$(CC) $(CFLAGS)";' >> $@
+       @echo 'char *link_string        = "$(CC) $(LDFLAGS) -o wget.exe $$(OBJECTS) $(EX_LIBS)";' >> $@
+
+depend: version.c
        $(CC) -MM $(CFLAGS) $(SOURCES) | \
         sed -e 's/^\([a-zA-Z0-9_-]*\.o:\)/$$(OBJ_DIR)\/\1/' > depend.dj
 
index d20988ce9584d2eb431c4cd715fff149b72a741f..5341511a33eba88187e4cd60ebbeb826b91a7b6c 100644 (file)
@@ -1,33 +1,40 @@
 #
 # Makefile for Wget / DOS32A / OpenWatcom
-# by G. Vanem <gvanem@broadpark.no> 2007
+# by G. Vanem <gvanem@broadpark.no> 2009
 #
 
-COMPILE = *wcc386 -mf -3r -w6 -d2 -zq -zm -of -I. -I$(%watt_root)\inc &
-            -I..\msdos -I..\lib -fr=nul -bt=dos -s -dHAVE_CONFIG_H &
-            -dENABLE_DEBUG -dSIZEOF_INT=4
+VERSION = 1.12 (Watcom/DOS)
+
+COMPILE = *wcc386 -mf -3r -w3 -d2 -zq -zm -of -I. -I$(%watt_root)\inc &
+            -I..\msdos -I..\lib -I..\md5 -fr=nul -bt=dos -s -dHAVE_CONFIG_H &
+            -dENABLE_DEBUG -dSIZEOF_INT=4 -dUSE_WATT32
 
 LINK = *wlink option quiet, map, verbose, eliminate, caseexact, stack=100k &
         debug all system dos32a
 
-OBJ_DIR = Watcom.obj
-
-OBJECTS = $(OBJ_DIR)\cmpt.obj      $(OBJ_DIR)\connect.obj    &
-          $(OBJ_DIR)\convert.obj   $(OBJ_DIR)\cookies.obj    &
-          $(OBJ_DIR)\c-ctype.obj    $(OBJ_DIR)\ftp-basic.obj &
-          $(OBJ_DIR)\ftp-ls.obj     $(OBJ_DIR)\ftp-opie.obj  &
-          $(OBJ_DIR)\ftp.obj        $(OBJ_DIR)\gen-md5.obj   &
-          $(OBJ_DIR)\getopt.obj     $(OBJ_DIR)\getopt1.obj   &
-          $(OBJ_DIR)\hash.obj       $(OBJ_DIR)\host.obj      &
-          $(OBJ_DIR)\html-parse.obj $(OBJ_DIR)\html-url.obj  &
-          $(OBJ_DIR)\http.obj       $(OBJ_DIR)\init.obj      &
-          $(OBJ_DIR)\log.obj        $(OBJ_DIR)\main.obj      &
-          $(OBJ_DIR)\md5.obj        $(OBJ_DIR)\netrc.obj     &
-          $(OBJ_DIR)\progress.obj  $(OBJ_DIR)\ptimer.obj     &
-          $(OBJ_DIR)\recur.obj     $(OBJ_DIR)\res.obj        &
-          $(OBJ_DIR)\retr.obj       $(OBJ_DIR)\spider.obj    &
-          $(OBJ_DIR)\url.obj        $(OBJ_DIR)\utils.obj     &
-          $(OBJ_DIR)\version.obj    $(OBJ_DIR)\xmalloc.obj
+OBJ_DIR = WC_DOS.obj
+
+OBJECTS = $(OBJ_DIR)\cmpt.obj       $(OBJ_DIR)\build_info.obj &
+          $(OBJ_DIR)\c-ctype.obj    $(OBJ_DIR)\cookies.obj    &
+          $(OBJ_DIR)\connect.obj    $(OBJ_DIR)\convert.obj    &
+          $(OBJ_DIR)\css.obj        $(OBJ_DIR)\css-url.obj    &
+          $(OBJ_DIR)\error.obj      $(OBJ_DIR)\exits.obj      &
+          $(OBJ_DIR)\exitfail.obj   $(OBJ_DIR)\ftp-basic.obj  &
+          $(OBJ_DIR)\ftp-ls.obj     $(OBJ_DIR)\ftp-opie.obj   &
+          $(OBJ_DIR)\ftp.obj        $(OBJ_DIR)\gen-md5.obj    &
+          $(OBJ_DIR)\getopt.obj     $(OBJ_DIR)\getopt1.obj    &
+          $(OBJ_DIR)\getpass.obj    $(OBJ_DIR)\hash.obj       &
+          $(OBJ_DIR)\host.obj       $(OBJ_DIR)\html-parse.obj &
+          $(OBJ_DIR)\html-url.obj   $(OBJ_DIR)\http.obj       &
+          $(OBJ_DIR)\init.obj       $(OBJ_DIR)\log.obj        &
+          $(OBJ_DIR)\main.obj       $(OBJ_DIR)\md5.obj        &
+          $(OBJ_DIR)\netrc.obj      $(OBJ_DIR)\progress.obj   &
+          $(OBJ_DIR)\ptimer.obj     $(OBJ_DIR)\recur.obj      &
+          $(OBJ_DIR)\res.obj        $(OBJ_DIR)\retr.obj       &
+          $(OBJ_DIR)\spider.obj     $(OBJ_DIR)\url.obj        &
+          $(OBJ_DIR)\utils.obj      $(OBJ_DIR)\version.obj    &
+          $(OBJ_DIR)\xalloc-die.obj $(OBJ_DIR)\xmalloc.obj    &
+          $(OBJ_DIR)\quote.obj      $(OBJ_DIR)\quotearg.obj
 
 all: $(OBJ_DIR) wget.exe .SYMBOLIC
        @echo 'Welcome to Wget / Watcom'
@@ -44,7 +51,11 @@ $(OBJ_DIR)\c-ctype.obj: ..\lib\c-ctype.c
        *$(COMPILE) -fo=$@ $[@
 
 .ERASE
-$(OBJ_DIR)\md5.obj: ..\lib\md5.c
+$(OBJ_DIR)\exitfail.obj: ..\lib\exitfail.c
+       *$(COMPILE) -fo=$@ $[@
+
+.ERASE
+$(OBJ_DIR)\error.obj: ..\lib\error.c
        *$(COMPILE) -fo=$@ $[@
 
 .ERASE
@@ -55,11 +66,42 @@ $(OBJ_DIR)\getopt.obj: ..\lib\getopt.c
 $(OBJ_DIR)\getopt1.obj: ..\lib\getopt1.c
        *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@
 
+.ERASE
+$(OBJ_DIR)\getpass.obj: ..\lib\getpass.c
+       *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@
+
+.ERASE
+$(OBJ_DIR)\md5.obj: ..\md5\md5.c
+       *$(COMPILE) -fo=$@ $[@
+
+.ERASE
+$(OBJ_DIR)\xmalloc.obj: ..\lib\xmalloc.c
+       *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@
+
+.ERASE
+$(OBJ_DIR)\xalloc-die.obj: ..\lib\xalloc-die.c
+       *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@
+
+.ERASE
+$(OBJ_DIR)\quote.obj: ..\lib\quote.c
+       *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@
+
+.ERASE
+$(OBJ_DIR)\quotearg.obj: ..\lib\quotearg.c
+       *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@
+
+css.c: css.l
+       flex -8 -o$@ $[@
+
 wget.exe: $(OBJECTS)
-      $(LINK) name $@ file { $(OBJECTS) } library $(%watt_root)\lib\wattcpwf.lib
+       $(LINK) name $@ file { $(OBJECTS) } library $(%watt_root)\lib\wattcpwf.lib
 
+version.c: ..\msdos\Makefile.WC
+       @echo char *version_string = "$(VERSION)"; > $@
+       @echo char *compilation_string = "$(COMPILE)"; >> $@
+       @echo char *link_string = "$(LINK) name wget.exe file { $$(OBJECTS) }"; >> $@
 
 clean: .SYMBOLIC
-       - rm $(OBJ_DIR)\*.obj wget.exe wget.map
+       - rm $(OBJ_DIR)\*.obj wget.exe wget.map version.c css.c
        - rmdir $(OBJ_DIR)
 
index 4567f81a0aaf2c5925638a6d445fd8d9c3105b21..a463b1201868940021bce951f1ca1ed603ece6f3 100644 (file)
@@ -91,6 +91,7 @@
 #endif
 
 #ifdef OPENWATCOM_15
+  #define HAVE_ALLOCA_H    1
   #define HAVE_INT64_T     1
   #define HAVE_SNPRINTF    1
   #define HAVE_STRCASECMP  1
   #define MSDOS
 #endif
 
+#if !defined(USE_WATT32)
+  #define USE_WATT32
+#endif
+
+#define LOCALEDIR ""
 #define OS_TYPE "DOS"
 
 #endif  /* CONFIG_DOS_H */
index fabc8b8f7e9d8cc66266a1e102dca458b9dc6045..0c60ebfb1869e29ebe6b886e2f2eea47c88be5c1 100644 (file)
@@ -5,6 +5,16 @@
        separate parameters, one input (passed_expected_bytes) and one
        output (qtyread). Fixes bug #26870.
 
+2009-09-05  Steven Schubiger  <stsc@member.fsf.org>
+
+       * retr.h: Declare set_local_file() to avoid build warnings.
+
+2009-09-05  Gisle Vanem  <gvanem@broadpark.no>
+
+       * connect.c, init.c, main.c, openssl.c, options.h:  Replace
+       "ifdef MSDOS" with "ifdef USE_WATT32" since DOS-targets in fact
+       use the Watt-32 tcp/ip stack.
+
 2009-09-04  Micah Cowan  <micah@cowan.name>
 
        * Makefile.am: Move build_info.c to wget_SOURCES from
index aad6db18aebc8850d9c2dad0db6855af701ee9a3..854eebbc9f947a6cbe897d1588829384ec51b065 100644 (file)
@@ -701,7 +701,7 @@ test_socket_open (int sock)
 \f
 /* Basic socket operations, mostly EINTR wrappers.  */
 
-#if defined(WINDOWS) || defined(MSDOS)
+#if defined(WINDOWS) || defined(USE_WATT32)
 # define read(fd, buf, cnt) recv (fd, buf, cnt, 0)
 # define write(fd, buf, cnt) send (fd, buf, cnt, 0)
 # define close(fd) closesocket (fd)
index 4e16d1fee3d79b0e42da3bae08e074ca067af983..7708e275461d752b72f28d9449f7a82a200df092 100644 (file)
@@ -249,7 +249,7 @@ static const struct {
   { "verbose",          NULL,                   cmd_spec_verbose },
   { "wait",             &opt.wait,              cmd_time },
   { "waitretry",        &opt.waitretry,         cmd_time },
-#ifdef MSDOS
+#ifdef USE_WATT32
   { "wdebug",           &opt.wdebug,            cmd_boolean },
 #endif
 };
index 0f059f76233950488dbe5460a65ef657346eee9f..d45465e72b3ac73582dd411c8e39730368354734 100644 (file)
@@ -273,7 +273,7 @@ static struct cmdline_option option_data[] =
     { "version", 'V', OPT_FUNCALL, (void *) print_version, no_argument },
     { "wait", 'w', OPT_VALUE, "wait", -1 },
     { "waitretry", 0, OPT_VALUE, "waitretry", -1 },
-#ifdef MSDOS
+#ifdef USE_WATT32
     { "wdebug", 0, OPT_BOOLEAN, "wdebug", -1 },
 #endif
   };
@@ -419,7 +419,7 @@ Logging and input file:\n"),
     N_("\
   -d,  --debug               print lots of debugging information.\n"),
 #endif
-#ifdef MSDOS
+#ifdef USE_WATT32
     N_("\
        --wdebug              print Watt-32 debug output.\n"),
 #endif
@@ -1127,7 +1127,7 @@ for details.\n\n"));
         exit (1);
     }
 
-#ifdef MSDOS
+#ifdef USE_WATT32
   if (opt.wdebug)
      dbug_init();
   sock_init();
index b6240f6febc3fbcab739e154bf22c908fdfd42d4..6f591f3f5804fdd38033647e0bf2c34d7870dc63 100644 (file)
@@ -364,7 +364,7 @@ openssl_close (int fd, void *arg)
   xfree_null (ctx->last_error);
   xfree (ctx);
 
-#if defined(WINDOWS) || defined(MSDOS)
+#if defined(WINDOWS) || defined(USE_WATT32)
   closesocket (fd);
 #else
   close (fd);
index bf039dd69a2383abc936fb0db01cbd9892cb1690..caa7a9cb2959afae7ddefdc278e0c5fe86ede5ee 100644 (file)
@@ -132,7 +132,7 @@ struct options
   bool debug;                  /* Debugging on/off */
 #endif
 
-#ifdef MSDOS
+#ifdef USE_WATT32
   bool wdebug;                  /* Watt-32 tcp/ip debugging on/off */
 #endif
 
index 856e7bc8a044e3fabe46ef0e65a2a23f35128eb9..f50c99802fe2c110540a5c09c44683e066a47e3e 100644 (file)
@@ -67,4 +67,6 @@ void rotate_backups (const char *);
 
 bool url_uses_proxy (struct url *);
 
+void set_local_file (const char **, const char *);
+
 #endif /* RETR_H */
index dcc98e044c9a38cd00f7ec307b29120310e2bee3..a0f5185ae5086ae6b157e6e2e4633ddea4cb91f1 100644 (file)
 
        * WgetTest.pm.in (run): Error-checking improvements.
 
+2009-09-05  Steven Schubiger  <stsc@member.fsf.org>
+
+       * run-px: Introduce two new diagnostics: Skip and Unknown.
+
+       * WgetFeature.pm (import): Parse the version output of Wget
+       and assert the availability of a feature.
+
+       * WgetFeature.cfg: Messages to be printed in absence of a
+       required feature.
+
+       * Test-ftp-iri-disabled.px, Test-ftp-iri-fallback.px,
+       Test-ftp-iri-recursive.px, Test-ftp-iri.px, Test-idn-cmd.px,
+       Test-idn-headers.px, Test-idn-meta.px, Test-idn-robots.px,
+       Test-iri-forced-remote.px, Test-iri-list.px,
+       Test-iri-percent.px, Test-iri.px: Use WgetFeature.pm to
+       check for the presence of the IDN/IRI feature.
+
+       * Test-proxied-https-auth.px: Replace grepping for a feature
+       with loading WgetFeature.pm at compile-time.
+
+       * Makefile.am: Add WgetFeature.pm and WgetFeature.cfg
+       to EXTRA_DIST.
+
 2009-09-02  Micah Cowan  <micah@cowan.name>
 
        * Makefile.am (unit-tests): explicit dependency is
index efbb5b4ad1f749114ebe8f374f1f91c7f3f324e6..768bd084aeea42ae38fd700322ebfbaac9945544 100644 (file)
@@ -60,6 +60,7 @@ run-px-tests: WgetTest.pm ../src/wget$(EXEEXT)
        $(srcdir)/run-px $(top_srcdir)
 
 EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \
+             WgetFeature.pm WgetFeature.cfg \
              Test-auth-basic.px \
              Test-auth-no-challenge.px \
              Test-auth-no-challenge-url.px \
index 17bb85c888bed27b13027c262b3f6acc3a17edef..4ded28ffd182316d1f365d9c350451707a393b5a 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use FTPTest;
 
 
index f485721324d16067c77823a8e50e4a6ca7a990a8..c3f97385bab1e29d4a6a36261662b862934c08fd 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use FTPTest;
 
 
index 5bbc8808067599e71102ba8139839771a5ac6137..1a664e950b8ca775bbef2e807238833b27f7ae6b 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use FTPTest;
 
 
index 7bedb891c3ec29240d1bc2db1425a5aea6e48983..7594a80ca8448c1ef7810867bf1e2d4ec9366582 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use FTPTest;
 
 
index 822803ae6325a8f11de330663a621bfaef7179e9..4f92ea0ca6b1dfb2cbeb1e4dfa0698428a83a2a1 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use HTTPTest;
 
 # " Kon'nichiwa <dot> Japan
index b94c1cde1d780ba8681f6a938132b43afd705f98..f58581373df13dad5ed96ec7eba2613bfeee63a6 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use HTTPTest;
 
 # " Kon'nichiwa <dot> Japan
index 2734e1eaf537ffc1d586c944979e5a4a61f556cc..199eabe2b48394c3d6e58c6ceeb49e012ea82f78 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use HTTPTest;
 
 # " Kon'nichiwa <dot> Japan
index ff5033f06b3e8baa1982a239486d14468a796b34..3f0f8ddea94e9daafdf362801a85c65b8295e59b 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use HTTPTest;
 
 # " Kon'nichiwa <dot> Japan
index 8341d516931d6d9a9071f08e91b89abb87133640..9c3d5b6be898fbafc49de62b28faad4d63c20662 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use HTTPTest;
 
 # cf. http://en.wikipedia.org/wiki/Latin1
index 87cc33c8e11c96a30d5702ef38f79ddacc80e13a..8110358a7c0404473cc4f666fcceb8d2fc0c9eaa 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use HTTPTest;
 
 # cf. http://en.wikipedia.org/wiki/Latin1
index 158392df0fa08af6dd932e609ca8c8d33cbf1eb0..2184b4d847987302795c02d98a942267741470f7 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use HTTPTest;
 
 # Just a sanity check to verify that %-encoded values are always left
index 01e1c50a8b74a8bfd7301f14624cc979911873cb..f81ef38f8734cdb4ef4c92373e399adc69a3e0c1 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(iri);
 use HTTPTest;
 
 # cf. http://en.wikipedia.org/wiki/Latin1
index 2b37f32b2feff30bac3be449244e765635bdcc11..71d43b16d3ba6cee2619951a2ffb0680aad52bf6 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use WgetFeature qw(https);
 use WgetTest;  # For $WGETPATH.
 
 my $cert_path;
@@ -14,15 +15,6 @@ if (@ARGV) {
     $cert_path = "$top_srcdir/tests/certs/server-cert.pem";
 }
 
-# Have we even built an HTTPS-supporting Wget?
-{
-    my @version_lines = `${WgetTest::WGETPATH} --version`;
-    unless (grep /\+(openssl|gnutls)/, @version_lines) {
-        print "Not running test: Wget under test doesn't support HTTPS.\n";
-        exit 0;
-    }
-}
-
 use HTTP::Daemon;
 use HTTP::Request;
 use IO::Socket::SSL;
diff --git a/tests/WgetFeature.cfg b/tests/WgetFeature.cfg
new file mode 100644 (file)
index 0000000..a1176e0
--- /dev/null
@@ -0,0 +1,6 @@
+%skip_messages = (
+    https => "Not running test: Wget under test doesn't support HTTPS.",
+    iri   => "Not running test: Wget under test doesn't support IDN/IRI.",
+);
+
+1;
diff --git a/tests/WgetFeature.pm b/tests/WgetFeature.pm
new file mode 100644 (file)
index 0000000..f58b998
--- /dev/null
@@ -0,0 +1,29 @@
+package WgetFeature;
+
+use strict;
+use warnings;
+
+use WgetTest;
+
+our %skip_messages;
+require 'WgetFeature.cfg';
+
+sub import
+{
+    my ($class, $feature) = @_;
+
+    my $output = `$WgetTest::WGETPATH --version`;
+    my ($list) = $output =~ /^([\+\-]\S+(?:\s+[\+\-]\S+)+)/m;
+    my %have_features = map {
+        my $feature = $_;
+           $feature =~ s/^.//;
+          ($feature, /^\+/ ? 1 : 0);
+    } split /\s+/, $list;
+
+    unless ($have_features{$feature}) {
+        print $skip_messages{$feature}, "\n";
+        exit 2; # skip
+    }
+}
+
+1;
index 102c75dc41cbbe26e3307dd94b863e773ce84f53..52101fc6720bc2f7eddbb63f1914f70840e3159f 100755 (executable)
@@ -4,8 +4,7 @@ use 5.006;
 use strict;
 use warnings;
 
-use Term::ANSIColor ':constants';
-$Term::ANSIColor::AUTORESET = 1;
+use Term::ANSIColor;
 
 die "Please specify the top source directory.\n" if (!@ARGV);
 my $top_srcdir = shift @ARGV;
@@ -84,26 +83,42 @@ my @tested;
 foreach my $test (@tests) {
     print "Running $test\n\n";
     system("$^X -I$top_srcdir/tests $top_srcdir/tests/$test $top_srcdir");
-    push @tested, { name => $test, result => $? };
+    push @tested, { name => $test, result => $? >> 8 };
 }
 
 foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
     delete $ENV{$var};
 }
 
+my %exit = (
+    pass    => 0,
+    fail    => 1,
+    skip    => 2,
+    unknown => 3, # or greater
+);
+
+my %colors = (
+    $exit{pass}    => colored('pass:',    'green'  ),
+    $exit{fail}    => colored('FAIL:',    'red'    ),
+    $exit{skip}    => colored('Skip:',    'yellow' ),
+    $exit{unknown} => colored('Unknown:', 'magenta'),
+);
+
 print "\n";
 foreach my $test (@tested) {
-    ($test->{result} == 0)
-      ? print GREEN 'pass: '
-      : print RED 'FAIL: ';
-   print $test->{name}, "\n";
+    my $colored = exists $colors{$test->{result}}
+      ? $colors{$test->{result}}
+      : $colors{$exit{unknown}};
+    print "$colored $test->{name}\n";
 }
 
 my $count = sub
 {
     return {
-      pass => sub { scalar grep $_->{result} == 0, @tested },
-      fail => sub { scalar grep $_->{result} != 0, @tested },
+      pass    => sub { scalar grep $_->{result} == $exit{pass},    @tested },
+      fail    => sub { scalar grep $_->{result} == $exit{fail},    @tested },
+      skip    => sub { scalar grep $_->{result} == $exit{skip},    @tested },
+      unknown => sub { scalar grep $_->{result} >= $exit{unknown}, @tested },
     }->{$_[0]}->();
 };
 
@@ -112,6 +127,7 @@ my $summary = sub
     my @lines = (
         "${\scalar @tested} tests were run",
         "${\$count->('pass')} PASS, ${\$count->('fail')} FAIL",
+        "${\$count->('skip')} SKIP, ${\$count->('unknown')} UNKNOWN",
     );
     my $len_longest = sub
     {
@@ -131,8 +147,8 @@ my $summary = sub
 
 print "\n";
 print $count->('fail')
-  ? RED $summary
-  : GREEN $summary;
+  ? colored($summary, 'red')
+  : colored($summary, 'green');
 print "\n";
 
 exit $count->('fail');