+2005-10-27 Mauro Tortonesi <mauro@ferrara.linux.it>
+
+ * Makefile.in: Added basic support for unit testing.
+
2005-08-26 Stepan Kasal <kasal@ucw.cz>
* configure.in: Abort configure if --with-ssl given but SSL
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
infodir='$(infodir)' mandir='$(mandir)' manext='$(manext)'
+TESTDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS) -DTESTING' DEFS='$(DEFS)' \
+CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \
+prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
+infodir='$(infodir)' mandir='$(mandir)' manext='$(manext)'
+
# subdirectories in the distribution
SUBDIRS = src doc po util windows
# default target
all: src/config.h Makefile $(SUBDIRS)
+test: src/config.h Makefile
+ cd src && $(MAKE) $(TESTDEFS) clean && $(MAKE) $(TESTDEFS) test$(exeext)
+
check: all
$(SUBDIRS): FORCE
+2005-10-27 Mauro Tortonesi <mauro@ferrara.linux.it>
+
+ * Makefile.in: Added basic support for unit testing.
+
+ * test.c: Ditto.
+
+ * test.h: Ditto.
+
2005-10-13 Daniel Stenberg <daniel@haxx.se>
* http-ntlm.c (ntlm_output): Fixed buffer overflow vulnerability.
progress.h ptimer.h recur.h res.h retr.h safe-ctype.h ssl.h \
sysdep.h url.h utils.h wget.h xmalloc.h
+#
+# Dependencies for test binary
+#
+
+TESTOBJ = $(ALLOCA) cmpt.o connect.o convert.o cookies.o \
+ ftp.o ftp-basic.o ftp-ls.o $(OPIE_OBJ) $(GETOPT_OBJ) hash.o \
+ host.o html-parse.o html-url.o http.o $(NTLM_OBJ) init.o \
+ log.o main.o $(MD5_OBJ) netrc.o progress.o ptimer.o recur.o \
+ res.o retr.o safe-ctype.o snprintf.o $(SSL_OBJ) test.o \
+ url.o utils.o version.o xmalloc.o
+
+$(TESTOBJ): config-post.h config.h connect.h convert.h cookies.h ftp.h \
+ gen-md5.h getopt.h gnu-md5.h hash.h host.h html-parse.h \
+ http-ntlm.h init.h log.h mswindows.h netrc.h options.h \
+ progress.h ptimer.h recur.h res.h retr.h safe-ctype.h ssl.h \
+ sysdep.h test.h url.h utils.h wget.h xmalloc.h
+
+test$(exeext): $(TESTOBJ)
+ $(LINK) $(TESTOBJ) $(LIBS)
+
#
# Dependencies for installing
#
exit (0);
}
\f
+#ifndef TESTING
int
main (int argc, char *const *argv)
{
else
return 1;
}
+#endif /* TESTING */
\f
#if defined(SIGHUP) || defined(SIGUSR1)
--- /dev/null
+/* Unit testing.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Wget.
+
+GNU Wget is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GNU Wget is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Wget; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+In addition, as a special exception, the Free Software Foundation
+gives permission to link the code of its release of Wget with the
+OpenSSL project's "OpenSSL" library (or with modified versions of it
+that use the same license as the "OpenSSL" library), and distribute
+the linked executables. You must obey the GNU General Public License
+in all respects for all of the code used other than "OpenSSL". If you
+modify this file, you may extend this exception to your version of the
+file, but you are not obligated to do so. If you do not wish to do
+so, delete this exception statement from your version. */
+
+#include <stdio.h>
+
+#include "test.h"
+
+#ifndef TESTING
+#error "TESTING not set!!!"
+#endif
+
+int tests_run;
+
+// char *test_ccache();
+
+static char *
+all_tests()
+{
+ // mu_run_test (test_ccache);
+
+ return NULL;
+}
+
+
+int
+main (void)
+{
+ char *result = all_tests();
+
+ if (result != NULL)
+ {
+ puts (result);
+ }
+ else
+ {
+ printf ("ALL TESTS PASSED\n");
+ }
+
+ printf ("Tests run: %d\n", tests_run);
+
+ return result != 0;
+}
+
+/*
+ * vim: et ts=2 sw=2
+ */
+
--- /dev/null
+/* Unit testing declarations.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Wget.
+
+GNU Wget is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GNU Wget is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Wget; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+In addition, as a special exception, the Free Software Foundation
+gives permission to link the code of its release of Wget with the
+OpenSSL project's "OpenSSL" library (or with modified versions of it
+that use the same license as the "OpenSSL" library), and distribute
+the linked executables. You must obey the GNU General Public License
+in all respects for all of the code used other than "OpenSSL". If you
+modify this file, you may extend this exception to your version of the
+file, but you are not obligated to do so. If you do not wish to do
+so, delete this exception statement from your version. */
+
+#ifndef TEST_H
+#define TEST_H
+
+/* from MinUnit */
+#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
+#define mu_run_test(test) do { char *message = test(); tests_run++; \
+ if (message) return message; } while (0)
+
+extern int tests_run;
+
+#endif /* TEST_H */
+
+/*
+ * vim: et ts=2 sw=2
+ */
+