diff options
author | Kibum Kim <kb0929.kim@samsung.com> | 2012-01-07 01:10:56 +0900 |
---|---|---|
committer | Kibum Kim <kb0929.kim@samsung.com> | 2012-01-07 01:10:56 +0900 |
commit | 149930124f8c4cd9e17d046fc98c833b047ae90a (patch) | |
tree | 9889f95b35dfb13fa1ce7d444c533a621283305c /tests/libtest | |
parent | 09ba2f53439ad3f6043a6bc6ce0cf2d909bb2de7 (diff) | |
download | curl-149930124f8c4cd9e17d046fc98c833b047ae90a.tar.gz curl-149930124f8c4cd9e17d046fc98c833b047ae90a.tar.bz2 curl-149930124f8c4cd9e17d046fc98c833b047ae90a.zip |
Git init
Diffstat (limited to 'tests/libtest')
77 files changed, 11662 insertions, 0 deletions
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am new file mode 100644 index 0000000..9c0d595 --- /dev/null +++ b/tests/libtest/Makefile.am @@ -0,0 +1,83 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +AUTOMAKE_OPTIONS = foreign nostdinc + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h included from lib/setup.h +# $(top_srcdir)/include is for libcurl's external include files +# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file +# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "borrowed" files +# $(top_builddir)/ares is for in-tree c-ares's generated ares_build.h file +# $(top_srcdir)/ares is for in-tree c-ares's external include files + +if USE_EMBEDDED_ARES +INCLUDES = -I$(top_builddir)/include/curl \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_builddir)/ares \ + -I$(top_srcdir)/ares +else +INCLUDES = -I$(top_builddir)/include/curl \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib +endif + +EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl test1013.pl \ +test1022.pl Makefile.inc + +# Dependencies (may need to be overriden) +LDADD = $(top_builddir)/lib/libcurl.la @CURL_LIBS@ +DEPENDENCIES = $(top_builddir)/lib/libcurl.la + +# Makefile.inc provides the source defines (TESTUTIL, SUPPORTFILES, +# noinst_PROGRAMS, lib*_SOURCES, and lib*_CFLAGS) +include Makefile.inc + +# Preloading of libhostname allows host name overriding, +# this is used to make some tests machine independent. + +if BUILD_LIBHOSTNAME +noinst_LTLIBRARIES = libhostname.la +else +noinst_LTLIBRARIES = +endif + +if NO_UNDEFINED +# The -no-undefined flag is crucial to build fine on some platforms +UNDEF = -no-undefined +endif + +libhostname_la_SOURCES = sethostname.c sethostname.h + +libhostname_la_LIBADD = +libhostname_la_DEPENDENCIES = +libhostname_la_LDFLAGS = -module -avoid-version $(UNDEF) -rpath /nowhere + diff --git a/tests/libtest/Makefile.in b/tests/libtest/Makefile.in new file mode 100644 index 0000000..bce2c39 --- /dev/null +++ b/tests/libtest/Makefile.in @@ -0,0 +1,1720 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.inc +noinst_PROGRAMS = lib500$(EXEEXT) lib501$(EXEEXT) lib502$(EXEEXT) \ + lib503$(EXEEXT) lib504$(EXEEXT) lib505$(EXEEXT) \ + lib506$(EXEEXT) lib507$(EXEEXT) lib508$(EXEEXT) \ + lib510$(EXEEXT) lib511$(EXEEXT) lib512$(EXEEXT) \ + lib513$(EXEEXT) lib514$(EXEEXT) lib515$(EXEEXT) \ + lib516$(EXEEXT) lib517$(EXEEXT) lib518$(EXEEXT) \ + lib519$(EXEEXT) lib520$(EXEEXT) lib521$(EXEEXT) \ + lib523$(EXEEXT) lib524$(EXEEXT) lib525$(EXEEXT) \ + lib526$(EXEEXT) lib527$(EXEEXT) lib574$(EXEEXT) \ + lib575$(EXEEXT) lib576$(EXEEXT) lib577$(EXEEXT) \ + lib578$(EXEEXT) lib579$(EXEEXT) lib529$(EXEEXT) \ + lib530$(EXEEXT) lib532$(EXEEXT) lib533$(EXEEXT) \ + lib536$(EXEEXT) lib537$(EXEEXT) lib540$(EXEEXT) \ + lib541$(EXEEXT) lib542$(EXEEXT) lib543$(EXEEXT) \ + lib544$(EXEEXT) lib545$(EXEEXT) lib547$(EXEEXT) \ + lib548$(EXEEXT) lib549$(EXEEXT) lib552$(EXEEXT) \ + lib553$(EXEEXT) lib554$(EXEEXT) lib555$(EXEEXT) \ + lib556$(EXEEXT) lib539$(EXEEXT) lib557$(EXEEXT) \ + lib558$(EXEEXT) lib559$(EXEEXT) lib560$(EXEEXT) \ + lib562$(EXEEXT) lib564$(EXEEXT) lib565$(EXEEXT) \ + lib566$(EXEEXT) lib567$(EXEEXT) lib568$(EXEEXT) \ + lib569$(EXEEXT) lib570$(EXEEXT) lib571$(EXEEXT) \ + lib572$(EXEEXT) lib573$(EXEEXT) chkhostname$(EXEEXT) +subdir = tests/libtest +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am_libhostname_la_OBJECTS = sethostname.lo +libhostname_la_OBJECTS = $(am_libhostname_la_OBJECTS) +@BUILD_LIBHOSTNAME_TRUE@am_libhostname_la_rpath = +PROGRAMS = $(noinst_PROGRAMS) +am_chkhostname_OBJECTS = chkhostname-chkhostname.$(OBJEXT) \ + chkhostname-curl_gethostname.$(OBJEXT) +chkhostname_OBJECTS = $(am_chkhostname_OBJECTS) +am__objects_1 = first.$(OBJEXT) +am_lib500_OBJECTS = lib500.$(OBJEXT) $(am__objects_1) +lib500_OBJECTS = $(am_lib500_OBJECTS) +lib500_LDADD = $(LDADD) +lib500_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib501_OBJECTS = lib501.$(OBJEXT) $(am__objects_1) +lib501_OBJECTS = $(am_lib501_OBJECTS) +lib501_LDADD = $(LDADD) +lib501_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_2 = testutil.$(OBJEXT) +am_lib502_OBJECTS = lib502.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib502_OBJECTS = $(am_lib502_OBJECTS) +lib502_LDADD = $(LDADD) +lib502_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib503_OBJECTS = lib503.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib503_OBJECTS = $(am_lib503_OBJECTS) +lib503_LDADD = $(LDADD) +lib503_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib504_OBJECTS = lib504.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib504_OBJECTS = $(am_lib504_OBJECTS) +lib504_LDADD = $(LDADD) +lib504_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib505_OBJECTS = lib505.$(OBJEXT) $(am__objects_1) +lib505_OBJECTS = $(am_lib505_OBJECTS) +lib505_LDADD = $(LDADD) +lib505_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib506_OBJECTS = lib506.$(OBJEXT) $(am__objects_1) +lib506_OBJECTS = $(am_lib506_OBJECTS) +lib506_LDADD = $(LDADD) +lib506_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib507_OBJECTS = lib507.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib507_OBJECTS = $(am_lib507_OBJECTS) +lib507_LDADD = $(LDADD) +lib507_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib508_OBJECTS = lib508.$(OBJEXT) $(am__objects_1) +lib508_OBJECTS = $(am_lib508_OBJECTS) +lib508_LDADD = $(LDADD) +lib508_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib510_OBJECTS = lib510.$(OBJEXT) $(am__objects_1) +lib510_OBJECTS = $(am_lib510_OBJECTS) +lib510_LDADD = $(LDADD) +lib510_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib511_OBJECTS = lib511.$(OBJEXT) $(am__objects_1) +lib511_OBJECTS = $(am_lib511_OBJECTS) +lib511_LDADD = $(LDADD) +lib511_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib512_OBJECTS = lib512.$(OBJEXT) $(am__objects_1) +lib512_OBJECTS = $(am_lib512_OBJECTS) +lib512_LDADD = $(LDADD) +lib512_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib513_OBJECTS = lib513.$(OBJEXT) $(am__objects_1) +lib513_OBJECTS = $(am_lib513_OBJECTS) +lib513_LDADD = $(LDADD) +lib513_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib514_OBJECTS = lib514.$(OBJEXT) $(am__objects_1) +lib514_OBJECTS = $(am_lib514_OBJECTS) +lib514_LDADD = $(LDADD) +lib514_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib515_OBJECTS = lib515.$(OBJEXT) $(am__objects_1) +lib515_OBJECTS = $(am_lib515_OBJECTS) +lib515_LDADD = $(LDADD) +lib515_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib516_OBJECTS = lib516.$(OBJEXT) $(am__objects_1) +lib516_OBJECTS = $(am_lib516_OBJECTS) +lib516_LDADD = $(LDADD) +lib516_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib517_OBJECTS = lib517.$(OBJEXT) $(am__objects_1) +lib517_OBJECTS = $(am_lib517_OBJECTS) +lib517_LDADD = $(LDADD) +lib517_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib518_OBJECTS = lib518.$(OBJEXT) $(am__objects_1) +lib518_OBJECTS = $(am_lib518_OBJECTS) +lib518_LDADD = $(LDADD) +lib518_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib519_OBJECTS = lib519.$(OBJEXT) $(am__objects_1) +lib519_OBJECTS = $(am_lib519_OBJECTS) +lib519_LDADD = $(LDADD) +lib519_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib520_OBJECTS = lib520.$(OBJEXT) $(am__objects_1) +lib520_OBJECTS = $(am_lib520_OBJECTS) +lib520_LDADD = $(LDADD) +lib520_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib521_OBJECTS = lib521.$(OBJEXT) $(am__objects_1) +lib521_OBJECTS = $(am_lib521_OBJECTS) +lib521_LDADD = $(LDADD) +lib521_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib523_OBJECTS = lib523.$(OBJEXT) $(am__objects_1) +lib523_OBJECTS = $(am_lib523_OBJECTS) +lib523_LDADD = $(LDADD) +lib523_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib524_OBJECTS = lib524.$(OBJEXT) $(am__objects_1) +lib524_OBJECTS = $(am_lib524_OBJECTS) +lib524_LDADD = $(LDADD) +lib524_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib525_OBJECTS = lib525.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib525_OBJECTS = $(am_lib525_OBJECTS) +lib525_LDADD = $(LDADD) +lib525_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_3 = lib526-first.$(OBJEXT) +am__objects_4 = lib526-testutil.$(OBJEXT) +am_lib526_OBJECTS = lib526-lib526.$(OBJEXT) $(am__objects_3) \ + $(am__objects_4) +lib526_OBJECTS = $(am_lib526_OBJECTS) +lib526_LDADD = $(LDADD) +lib526_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_5 = lib527-first.$(OBJEXT) +am__objects_6 = lib527-testutil.$(OBJEXT) +am_lib527_OBJECTS = lib527-lib526.$(OBJEXT) $(am__objects_5) \ + $(am__objects_6) +lib527_OBJECTS = $(am_lib527_OBJECTS) +lib527_LDADD = $(LDADD) +lib527_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_7 = lib529-first.$(OBJEXT) +am__objects_8 = lib529-testutil.$(OBJEXT) +am_lib529_OBJECTS = lib529-lib525.$(OBJEXT) $(am__objects_7) \ + $(am__objects_8) +lib529_OBJECTS = $(am_lib529_OBJECTS) +lib529_LDADD = $(LDADD) +lib529_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_9 = lib530-first.$(OBJEXT) +am__objects_10 = lib530-testutil.$(OBJEXT) +am_lib530_OBJECTS = lib530-lib530.$(OBJEXT) $(am__objects_9) \ + $(am__objects_10) +lib530_OBJECTS = $(am_lib530_OBJECTS) +lib530_LDADD = $(LDADD) +lib530_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_11 = lib532-first.$(OBJEXT) +am__objects_12 = lib532-testutil.$(OBJEXT) +am_lib532_OBJECTS = lib532-lib526.$(OBJEXT) $(am__objects_11) \ + $(am__objects_12) +lib532_OBJECTS = $(am_lib532_OBJECTS) +lib532_LDADD = $(LDADD) +lib532_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib533_OBJECTS = lib533.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib533_OBJECTS = $(am_lib533_OBJECTS) +lib533_LDADD = $(LDADD) +lib533_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib536_OBJECTS = lib536.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib536_OBJECTS = $(am_lib536_OBJECTS) +lib536_LDADD = $(LDADD) +lib536_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib537_OBJECTS = lib537.$(OBJEXT) $(am__objects_1) +lib537_OBJECTS = $(am_lib537_OBJECTS) +lib537_LDADD = $(LDADD) +lib537_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib539_OBJECTS = lib539.$(OBJEXT) $(am__objects_1) +lib539_OBJECTS = $(am_lib539_OBJECTS) +lib539_LDADD = $(LDADD) +lib539_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib540_OBJECTS = lib540.$(OBJEXT) $(am__objects_1) +lib540_OBJECTS = $(am_lib540_OBJECTS) +lib540_LDADD = $(LDADD) +lib540_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib541_OBJECTS = lib541.$(OBJEXT) $(am__objects_1) +lib541_OBJECTS = $(am_lib541_OBJECTS) +lib541_LDADD = $(LDADD) +lib541_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib542_OBJECTS = lib542.$(OBJEXT) $(am__objects_1) +lib542_OBJECTS = $(am_lib542_OBJECTS) +lib542_LDADD = $(LDADD) +lib542_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib543_OBJECTS = lib543.$(OBJEXT) $(am__objects_1) +lib543_OBJECTS = $(am_lib543_OBJECTS) +lib543_LDADD = $(LDADD) +lib543_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib544_OBJECTS = lib544.$(OBJEXT) $(am__objects_1) +lib544_OBJECTS = $(am_lib544_OBJECTS) +lib544_LDADD = $(LDADD) +lib544_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_13 = lib545-first.$(OBJEXT) +am_lib545_OBJECTS = lib545-lib544.$(OBJEXT) $(am__objects_13) +lib545_OBJECTS = $(am_lib545_OBJECTS) +lib545_LDADD = $(LDADD) +lib545_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib547_OBJECTS = lib547.$(OBJEXT) $(am__objects_1) +lib547_OBJECTS = $(am_lib547_OBJECTS) +lib547_LDADD = $(LDADD) +lib547_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_14 = lib548-first.$(OBJEXT) +am_lib548_OBJECTS = lib548-lib547.$(OBJEXT) $(am__objects_14) +lib548_OBJECTS = $(am_lib548_OBJECTS) +lib548_LDADD = $(LDADD) +lib548_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib549_OBJECTS = lib549.$(OBJEXT) $(am__objects_1) +lib549_OBJECTS = $(am_lib549_OBJECTS) +lib549_LDADD = $(LDADD) +lib549_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib552_OBJECTS = lib552.$(OBJEXT) $(am__objects_1) +lib552_OBJECTS = $(am_lib552_OBJECTS) +lib552_LDADD = $(LDADD) +lib552_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib553_OBJECTS = lib553.$(OBJEXT) $(am__objects_1) +lib553_OBJECTS = $(am_lib553_OBJECTS) +lib553_LDADD = $(LDADD) +lib553_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib554_OBJECTS = lib554.$(OBJEXT) $(am__objects_1) +lib554_OBJECTS = $(am_lib554_OBJECTS) +lib554_LDADD = $(LDADD) +lib554_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib555_OBJECTS = lib555.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib555_OBJECTS = $(am_lib555_OBJECTS) +lib555_LDADD = $(LDADD) +lib555_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib556_OBJECTS = lib556.$(OBJEXT) $(am__objects_1) +lib556_OBJECTS = $(am_lib556_OBJECTS) +lib556_LDADD = $(LDADD) +lib556_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib557_OBJECTS = lib557.$(OBJEXT) $(am__objects_1) +lib557_OBJECTS = $(am_lib557_OBJECTS) +lib557_LDADD = $(LDADD) +lib557_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_15 = lib558-first.$(OBJEXT) +am_lib558_OBJECTS = lib558-lib558.$(OBJEXT) $(am__objects_15) +lib558_OBJECTS = $(am_lib558_OBJECTS) +lib558_LDADD = $(LDADD) +lib558_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_16 = lib559-first.$(OBJEXT) +am_lib559_OBJECTS = lib559-lib558.$(OBJEXT) $(am__objects_16) +lib559_OBJECTS = $(am_lib559_OBJECTS) +lib559_LDADD = $(LDADD) +lib559_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib560_OBJECTS = lib560.$(OBJEXT) $(am__objects_1) +lib560_OBJECTS = $(am_lib560_OBJECTS) +lib560_LDADD = $(LDADD) +lib560_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib562_OBJECTS = lib562.$(OBJEXT) $(am__objects_1) +lib562_OBJECTS = $(am_lib562_OBJECTS) +lib562_LDADD = $(LDADD) +lib562_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib564_OBJECTS = lib564.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib564_OBJECTS = $(am_lib564_OBJECTS) +lib564_LDADD = $(LDADD) +lib564_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am__objects_17 = lib565-first.$(OBJEXT) +am_lib565_OBJECTS = lib565-lib510.$(OBJEXT) $(am__objects_17) +lib565_OBJECTS = $(am_lib565_OBJECTS) +lib565_LDADD = $(LDADD) +lib565_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib566_OBJECTS = lib566.$(OBJEXT) $(am__objects_1) +lib566_OBJECTS = $(am_lib566_OBJECTS) +lib566_LDADD = $(LDADD) +lib566_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib567_OBJECTS = lib567.$(OBJEXT) $(am__objects_1) +lib567_OBJECTS = $(am_lib567_OBJECTS) +lib567_LDADD = $(LDADD) +lib567_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib568_OBJECTS = lib568.$(OBJEXT) $(am__objects_1) +lib568_OBJECTS = $(am_lib568_OBJECTS) +lib568_LDADD = $(LDADD) +lib568_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib569_OBJECTS = lib569.$(OBJEXT) $(am__objects_1) +lib569_OBJECTS = $(am_lib569_OBJECTS) +lib569_LDADD = $(LDADD) +lib569_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib570_OBJECTS = lib570.$(OBJEXT) $(am__objects_1) +lib570_OBJECTS = $(am_lib570_OBJECTS) +lib570_LDADD = $(LDADD) +lib570_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib571_OBJECTS = lib571.$(OBJEXT) $(am__objects_1) +lib571_OBJECTS = $(am_lib571_OBJECTS) +lib571_LDADD = $(LDADD) +lib571_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib572_OBJECTS = lib572.$(OBJEXT) $(am__objects_1) +lib572_OBJECTS = $(am_lib572_OBJECTS) +lib572_LDADD = $(LDADD) +lib572_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib573_OBJECTS = lib573.$(OBJEXT) $(am__objects_1) $(am__objects_2) +lib573_OBJECTS = $(am_lib573_OBJECTS) +lib573_LDADD = $(LDADD) +lib573_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib574_OBJECTS = lib574.$(OBJEXT) $(am__objects_1) +lib574_OBJECTS = $(am_lib574_OBJECTS) +lib574_LDADD = $(LDADD) +lib574_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib575_OBJECTS = lib575.$(OBJEXT) $(am__objects_1) +lib575_OBJECTS = $(am_lib575_OBJECTS) +lib575_LDADD = $(LDADD) +lib575_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib576_OBJECTS = lib576.$(OBJEXT) $(am__objects_1) +lib576_OBJECTS = $(am_lib576_OBJECTS) +lib576_LDADD = $(LDADD) +lib576_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib577_OBJECTS = lib577.$(OBJEXT) $(am__objects_1) +lib577_OBJECTS = $(am_lib577_OBJECTS) +lib577_LDADD = $(LDADD) +lib577_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib578_OBJECTS = lib578.$(OBJEXT) $(am__objects_1) +lib578_OBJECTS = $(am_lib578_OBJECTS) +lib578_LDADD = $(LDADD) +lib578_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +am_lib579_OBJECTS = lib579.$(OBJEXT) $(am__objects_1) +lib579_OBJECTS = $(am_lib579_OBJECTS) +lib579_LDADD = $(LDADD) +lib579_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libhostname_la_SOURCES) $(chkhostname_SOURCES) \ + $(lib500_SOURCES) $(lib501_SOURCES) $(lib502_SOURCES) \ + $(lib503_SOURCES) $(lib504_SOURCES) $(lib505_SOURCES) \ + $(lib506_SOURCES) $(lib507_SOURCES) $(lib508_SOURCES) \ + $(lib510_SOURCES) $(lib511_SOURCES) $(lib512_SOURCES) \ + $(lib513_SOURCES) $(lib514_SOURCES) $(lib515_SOURCES) \ + $(lib516_SOURCES) $(lib517_SOURCES) $(lib518_SOURCES) \ + $(lib519_SOURCES) $(lib520_SOURCES) $(lib521_SOURCES) \ + $(lib523_SOURCES) $(lib524_SOURCES) $(lib525_SOURCES) \ + $(lib526_SOURCES) $(lib527_SOURCES) $(lib529_SOURCES) \ + $(lib530_SOURCES) $(lib532_SOURCES) $(lib533_SOURCES) \ + $(lib536_SOURCES) $(lib537_SOURCES) $(lib539_SOURCES) \ + $(lib540_SOURCES) $(lib541_SOURCES) $(lib542_SOURCES) \ + $(lib543_SOURCES) $(lib544_SOURCES) $(lib545_SOURCES) \ + $(lib547_SOURCES) $(lib548_SOURCES) $(lib549_SOURCES) \ + $(lib552_SOURCES) $(lib553_SOURCES) $(lib554_SOURCES) \ + $(lib555_SOURCES) $(lib556_SOURCES) $(lib557_SOURCES) \ + $(lib558_SOURCES) $(lib559_SOURCES) $(lib560_SOURCES) \ + $(lib562_SOURCES) $(lib564_SOURCES) $(lib565_SOURCES) \ + $(lib566_SOURCES) $(lib567_SOURCES) $(lib568_SOURCES) \ + $(lib569_SOURCES) $(lib570_SOURCES) $(lib571_SOURCES) \ + $(lib572_SOURCES) $(lib573_SOURCES) $(lib574_SOURCES) \ + $(lib575_SOURCES) $(lib576_SOURCES) $(lib577_SOURCES) \ + $(lib578_SOURCES) $(lib579_SOURCES) +DIST_SOURCES = $(libhostname_la_SOURCES) $(chkhostname_SOURCES) \ + $(lib500_SOURCES) $(lib501_SOURCES) $(lib502_SOURCES) \ + $(lib503_SOURCES) $(lib504_SOURCES) $(lib505_SOURCES) \ + $(lib506_SOURCES) $(lib507_SOURCES) $(lib508_SOURCES) \ + $(lib510_SOURCES) $(lib511_SOURCES) $(lib512_SOURCES) \ + $(lib513_SOURCES) $(lib514_SOURCES) $(lib515_SOURCES) \ + $(lib516_SOURCES) $(lib517_SOURCES) $(lib518_SOURCES) \ + $(lib519_SOURCES) $(lib520_SOURCES) $(lib521_SOURCES) \ + $(lib523_SOURCES) $(lib524_SOURCES) $(lib525_SOURCES) \ + $(lib526_SOURCES) $(lib527_SOURCES) $(lib529_SOURCES) \ + $(lib530_SOURCES) $(lib532_SOURCES) $(lib533_SOURCES) \ + $(lib536_SOURCES) $(lib537_SOURCES) $(lib539_SOURCES) \ + $(lib540_SOURCES) $(lib541_SOURCES) $(lib542_SOURCES) \ + $(lib543_SOURCES) $(lib544_SOURCES) $(lib545_SOURCES) \ + $(lib547_SOURCES) $(lib548_SOURCES) $(lib549_SOURCES) \ + $(lib552_SOURCES) $(lib553_SOURCES) $(lib554_SOURCES) \ + $(lib555_SOURCES) $(lib556_SOURCES) $(lib557_SOURCES) \ + $(lib558_SOURCES) $(lib559_SOURCES) $(lib560_SOURCES) \ + $(lib562_SOURCES) $(lib564_SOURCES) $(lib565_SOURCES) \ + $(lib566_SOURCES) $(lib567_SOURCES) $(lib568_SOURCES) \ + $(lib569_SOURCES) $(lib570_SOURCES) $(lib571_SOURCES) \ + $(lib572_SOURCES) $(lib573_SOURCES) $(lib574_SOURCES) \ + $(lib575_SOURCES) $(lib576_SOURCES) $(lib577_SOURCES) \ + $(lib578_SOURCES) $(lib579_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +AUTOMAKE_OPTIONS = foreign nostdinc +@USE_EMBEDDED_ARES_FALSE@INCLUDES = -I$(top_builddir)/include/curl \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_builddir)/include \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_srcdir)/include \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_builddir)/lib \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_srcdir)/lib + + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h included from lib/setup.h +# $(top_srcdir)/include is for libcurl's external include files +# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file +# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "borrowed" files +# $(top_builddir)/ares is for in-tree c-ares's generated ares_build.h file +# $(top_srcdir)/ares is for in-tree c-ares's external include files +@USE_EMBEDDED_ARES_TRUE@INCLUDES = -I$(top_builddir)/include/curl \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_builddir)/include \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_srcdir)/include \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_builddir)/lib \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_srcdir)/lib \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_builddir)/ares \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_srcdir)/ares + +EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl test1013.pl \ +test1022.pl Makefile.inc + + +# Dependencies (may need to be overriden) +LDADD = $(top_builddir)/lib/libcurl.la @CURL_LIBS@ +DEPENDENCIES = $(top_builddir)/lib/libcurl.la + +# files used only in some libcurl test programs +TESTUTIL = testutil.c testutil.h + +# these files are used in every single test program below +SUPPORTFILES = first.c test.h +chkhostname_SOURCES = chkhostname.c $(top_srcdir)/lib/curl_gethostname.c +chkhostname_LDADD = @CURL_NETWORK_LIBS@ +chkhostname_DEPENDENCIES = +chkhostname_CFLAGS = $(AM_CFLAGS) +lib500_SOURCES = lib500.c $(SUPPORTFILES) +lib501_SOURCES = lib501.c $(SUPPORTFILES) +lib502_SOURCES = lib502.c $(SUPPORTFILES) $(TESTUTIL) +lib503_SOURCES = lib503.c $(SUPPORTFILES) $(TESTUTIL) +lib504_SOURCES = lib504.c $(SUPPORTFILES) $(TESTUTIL) +lib505_SOURCES = lib505.c $(SUPPORTFILES) +lib506_SOURCES = lib506.c $(SUPPORTFILES) +lib507_SOURCES = lib507.c $(SUPPORTFILES) $(TESTUTIL) +lib508_SOURCES = lib508.c $(SUPPORTFILES) +lib510_SOURCES = lib510.c $(SUPPORTFILES) +lib511_SOURCES = lib511.c $(SUPPORTFILES) +lib512_SOURCES = lib512.c $(SUPPORTFILES) +lib513_SOURCES = lib513.c $(SUPPORTFILES) +lib514_SOURCES = lib514.c $(SUPPORTFILES) +lib515_SOURCES = lib515.c $(SUPPORTFILES) +lib516_SOURCES = lib516.c $(SUPPORTFILES) +lib517_SOURCES = lib517.c $(SUPPORTFILES) +lib518_SOURCES = lib518.c $(SUPPORTFILES) +lib519_SOURCES = lib519.c $(SUPPORTFILES) +lib520_SOURCES = lib520.c $(SUPPORTFILES) +lib521_SOURCES = lib521.c $(SUPPORTFILES) +lib523_SOURCES = lib523.c $(SUPPORTFILES) +lib524_SOURCES = lib524.c $(SUPPORTFILES) +lib525_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL) +lib526_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) +lib526_CFLAGS = -DLIB526 +lib527_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) +lib527_CFLAGS = -DLIB527 +lib529_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL) +lib529_CFLAGS = -DLIB529 +lib530_SOURCES = lib530.c $(SUPPORTFILES) $(TESTUTIL) +lib530_CFLAGS = -DLIB530 +lib532_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) +lib532_CFLAGS = -DLIB532 +lib533_SOURCES = lib533.c $(SUPPORTFILES) $(TESTUTIL) +lib536_SOURCES = lib536.c $(SUPPORTFILES) $(TESTUTIL) +lib537_SOURCES = lib537.c $(SUPPORTFILES) +lib539_SOURCES = lib539.c $(SUPPORTFILES) +lib540_SOURCES = lib540.c $(SUPPORTFILES) +lib541_SOURCES = lib541.c $(SUPPORTFILES) +lib542_SOURCES = lib542.c $(SUPPORTFILES) +lib543_SOURCES = lib543.c $(SUPPORTFILES) +lib544_SOURCES = lib544.c $(SUPPORTFILES) +lib545_SOURCES = lib544.c $(SUPPORTFILES) +lib545_CFLAGS = -DLIB545 +lib547_SOURCES = lib547.c $(SUPPORTFILES) +lib548_SOURCES = lib547.c $(SUPPORTFILES) +lib548_CFLAGS = -DLIB548 +lib549_SOURCES = lib549.c $(SUPPORTFILES) +lib555_SOURCES = lib555.c $(SUPPORTFILES) $(TESTUTIL) +lib552_SOURCES = lib552.c $(SUPPORTFILES) +lib553_SOURCES = lib553.c $(SUPPORTFILES) +lib554_SOURCES = lib554.c $(SUPPORTFILES) +lib556_SOURCES = lib556.c $(SUPPORTFILES) +lib557_SOURCES = lib557.c $(SUPPORTFILES) +lib558_SOURCES = lib558.c $(SUPPORTFILES) +lib558_CFLAGS = -DLIB558 +lib559_SOURCES = lib558.c $(SUPPORTFILES) +lib559_CFLAGS = -DLIB559 +lib560_SOURCES = lib560.c $(SUPPORTFILES) +lib574_SOURCES = lib574.c $(SUPPORTFILES) +lib575_SOURCES = lib575.c $(SUPPORTFILES) +lib576_SOURCES = lib576.c $(SUPPORTFILES) +lib577_SOURCES = lib577.c $(SUPPORTFILES) +lib562_SOURCES = lib562.c $(SUPPORTFILES) +lib564_SOURCES = lib564.c $(SUPPORTFILES) $(TESTUTIL) +lib565_SOURCES = lib510.c $(SUPPORTFILES) +lib565_CFLAGS = -DLIB565 +lib566_SOURCES = lib566.c $(SUPPORTFILES) +lib567_SOURCES = lib567.c $(SUPPORTFILES) +lib568_SOURCES = lib568.c $(SUPPORTFILES) +lib569_SOURCES = lib569.c $(SUPPORTFILES) +lib570_SOURCES = lib570.c $(SUPPORTFILES) +lib571_SOURCES = lib571.c $(SUPPORTFILES) +lib572_SOURCES = lib572.c $(SUPPORTFILES) +lib573_SOURCES = lib573.c $(SUPPORTFILES) $(TESTUTIL) +lib578_SOURCES = lib578.c $(SUPPORTFILES) +lib579_SOURCES = lib579.c $(SUPPORTFILES) +@BUILD_LIBHOSTNAME_FALSE@noinst_LTLIBRARIES = + +# Makefile.inc provides the source defines (TESTUTIL, SUPPORTFILES, +# noinst_PROGRAMS, lib*_SOURCES, and lib*_CFLAGS) + +# Preloading of libhostname allows host name overriding, +# this is used to make some tests machine independent. +@BUILD_LIBHOSTNAME_TRUE@noinst_LTLIBRARIES = libhostname.la + +# The -no-undefined flag is crucial to build fine on some platforms +@NO_UNDEFINED_TRUE@UNDEF = -no-undefined +libhostname_la_SOURCES = sethostname.c sethostname.h +libhostname_la_LIBADD = +libhostname_la_DEPENDENCIES = +libhostname_la_LDFLAGS = -module -avoid-version $(UNDEF) -rpath /nowhere +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/libtest/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/libtest/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libhostname.la: $(libhostname_la_OBJECTS) $(libhostname_la_DEPENDENCIES) + $(LINK) $(am_libhostname_la_rpath) $(libhostname_la_LDFLAGS) $(libhostname_la_OBJECTS) $(libhostname_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +chkhostname$(EXEEXT): $(chkhostname_OBJECTS) $(chkhostname_DEPENDENCIES) + @rm -f chkhostname$(EXEEXT) + $(LINK) $(chkhostname_LDFLAGS) $(chkhostname_OBJECTS) $(chkhostname_LDADD) $(LIBS) +lib500$(EXEEXT): $(lib500_OBJECTS) $(lib500_DEPENDENCIES) + @rm -f lib500$(EXEEXT) + $(LINK) $(lib500_LDFLAGS) $(lib500_OBJECTS) $(lib500_LDADD) $(LIBS) +lib501$(EXEEXT): $(lib501_OBJECTS) $(lib501_DEPENDENCIES) + @rm -f lib501$(EXEEXT) + $(LINK) $(lib501_LDFLAGS) $(lib501_OBJECTS) $(lib501_LDADD) $(LIBS) +lib502$(EXEEXT): $(lib502_OBJECTS) $(lib502_DEPENDENCIES) + @rm -f lib502$(EXEEXT) + $(LINK) $(lib502_LDFLAGS) $(lib502_OBJECTS) $(lib502_LDADD) $(LIBS) +lib503$(EXEEXT): $(lib503_OBJECTS) $(lib503_DEPENDENCIES) + @rm -f lib503$(EXEEXT) + $(LINK) $(lib503_LDFLAGS) $(lib503_OBJECTS) $(lib503_LDADD) $(LIBS) +lib504$(EXEEXT): $(lib504_OBJECTS) $(lib504_DEPENDENCIES) + @rm -f lib504$(EXEEXT) + $(LINK) $(lib504_LDFLAGS) $(lib504_OBJECTS) $(lib504_LDADD) $(LIBS) +lib505$(EXEEXT): $(lib505_OBJECTS) $(lib505_DEPENDENCIES) + @rm -f lib505$(EXEEXT) + $(LINK) $(lib505_LDFLAGS) $(lib505_OBJECTS) $(lib505_LDADD) $(LIBS) +lib506$(EXEEXT): $(lib506_OBJECTS) $(lib506_DEPENDENCIES) + @rm -f lib506$(EXEEXT) + $(LINK) $(lib506_LDFLAGS) $(lib506_OBJECTS) $(lib506_LDADD) $(LIBS) +lib507$(EXEEXT): $(lib507_OBJECTS) $(lib507_DEPENDENCIES) + @rm -f lib507$(EXEEXT) + $(LINK) $(lib507_LDFLAGS) $(lib507_OBJECTS) $(lib507_LDADD) $(LIBS) +lib508$(EXEEXT): $(lib508_OBJECTS) $(lib508_DEPENDENCIES) + @rm -f lib508$(EXEEXT) + $(LINK) $(lib508_LDFLAGS) $(lib508_OBJECTS) $(lib508_LDADD) $(LIBS) +lib510$(EXEEXT): $(lib510_OBJECTS) $(lib510_DEPENDENCIES) + @rm -f lib510$(EXEEXT) + $(LINK) $(lib510_LDFLAGS) $(lib510_OBJECTS) $(lib510_LDADD) $(LIBS) +lib511$(EXEEXT): $(lib511_OBJECTS) $(lib511_DEPENDENCIES) + @rm -f lib511$(EXEEXT) + $(LINK) $(lib511_LDFLAGS) $(lib511_OBJECTS) $(lib511_LDADD) $(LIBS) +lib512$(EXEEXT): $(lib512_OBJECTS) $(lib512_DEPENDENCIES) + @rm -f lib512$(EXEEXT) + $(LINK) $(lib512_LDFLAGS) $(lib512_OBJECTS) $(lib512_LDADD) $(LIBS) +lib513$(EXEEXT): $(lib513_OBJECTS) $(lib513_DEPENDENCIES) + @rm -f lib513$(EXEEXT) + $(LINK) $(lib513_LDFLAGS) $(lib513_OBJECTS) $(lib513_LDADD) $(LIBS) +lib514$(EXEEXT): $(lib514_OBJECTS) $(lib514_DEPENDENCIES) + @rm -f lib514$(EXEEXT) + $(LINK) $(lib514_LDFLAGS) $(lib514_OBJECTS) $(lib514_LDADD) $(LIBS) +lib515$(EXEEXT): $(lib515_OBJECTS) $(lib515_DEPENDENCIES) + @rm -f lib515$(EXEEXT) + $(LINK) $(lib515_LDFLAGS) $(lib515_OBJECTS) $(lib515_LDADD) $(LIBS) +lib516$(EXEEXT): $(lib516_OBJECTS) $(lib516_DEPENDENCIES) + @rm -f lib516$(EXEEXT) + $(LINK) $(lib516_LDFLAGS) $(lib516_OBJECTS) $(lib516_LDADD) $(LIBS) +lib517$(EXEEXT): $(lib517_OBJECTS) $(lib517_DEPENDENCIES) + @rm -f lib517$(EXEEXT) + $(LINK) $(lib517_LDFLAGS) $(lib517_OBJECTS) $(lib517_LDADD) $(LIBS) +lib518$(EXEEXT): $(lib518_OBJECTS) $(lib518_DEPENDENCIES) + @rm -f lib518$(EXEEXT) + $(LINK) $(lib518_LDFLAGS) $(lib518_OBJECTS) $(lib518_LDADD) $(LIBS) +lib519$(EXEEXT): $(lib519_OBJECTS) $(lib519_DEPENDENCIES) + @rm -f lib519$(EXEEXT) + $(LINK) $(lib519_LDFLAGS) $(lib519_OBJECTS) $(lib519_LDADD) $(LIBS) +lib520$(EXEEXT): $(lib520_OBJECTS) $(lib520_DEPENDENCIES) + @rm -f lib520$(EXEEXT) + $(LINK) $(lib520_LDFLAGS) $(lib520_OBJECTS) $(lib520_LDADD) $(LIBS) +lib521$(EXEEXT): $(lib521_OBJECTS) $(lib521_DEPENDENCIES) + @rm -f lib521$(EXEEXT) + $(LINK) $(lib521_LDFLAGS) $(lib521_OBJECTS) $(lib521_LDADD) $(LIBS) +lib523$(EXEEXT): $(lib523_OBJECTS) $(lib523_DEPENDENCIES) + @rm -f lib523$(EXEEXT) + $(LINK) $(lib523_LDFLAGS) $(lib523_OBJECTS) $(lib523_LDADD) $(LIBS) +lib524$(EXEEXT): $(lib524_OBJECTS) $(lib524_DEPENDENCIES) + @rm -f lib524$(EXEEXT) + $(LINK) $(lib524_LDFLAGS) $(lib524_OBJECTS) $(lib524_LDADD) $(LIBS) +lib525$(EXEEXT): $(lib525_OBJECTS) $(lib525_DEPENDENCIES) + @rm -f lib525$(EXEEXT) + $(LINK) $(lib525_LDFLAGS) $(lib525_OBJECTS) $(lib525_LDADD) $(LIBS) +lib526$(EXEEXT): $(lib526_OBJECTS) $(lib526_DEPENDENCIES) + @rm -f lib526$(EXEEXT) + $(LINK) $(lib526_LDFLAGS) $(lib526_OBJECTS) $(lib526_LDADD) $(LIBS) +lib527$(EXEEXT): $(lib527_OBJECTS) $(lib527_DEPENDENCIES) + @rm -f lib527$(EXEEXT) + $(LINK) $(lib527_LDFLAGS) $(lib527_OBJECTS) $(lib527_LDADD) $(LIBS) +lib529$(EXEEXT): $(lib529_OBJECTS) $(lib529_DEPENDENCIES) + @rm -f lib529$(EXEEXT) + $(LINK) $(lib529_LDFLAGS) $(lib529_OBJECTS) $(lib529_LDADD) $(LIBS) +lib530$(EXEEXT): $(lib530_OBJECTS) $(lib530_DEPENDENCIES) + @rm -f lib530$(EXEEXT) + $(LINK) $(lib530_LDFLAGS) $(lib530_OBJECTS) $(lib530_LDADD) $(LIBS) +lib532$(EXEEXT): $(lib532_OBJECTS) $(lib532_DEPENDENCIES) + @rm -f lib532$(EXEEXT) + $(LINK) $(lib532_LDFLAGS) $(lib532_OBJECTS) $(lib532_LDADD) $(LIBS) +lib533$(EXEEXT): $(lib533_OBJECTS) $(lib533_DEPENDENCIES) + @rm -f lib533$(EXEEXT) + $(LINK) $(lib533_LDFLAGS) $(lib533_OBJECTS) $(lib533_LDADD) $(LIBS) +lib536$(EXEEXT): $(lib536_OBJECTS) $(lib536_DEPENDENCIES) + @rm -f lib536$(EXEEXT) + $(LINK) $(lib536_LDFLAGS) $(lib536_OBJECTS) $(lib536_LDADD) $(LIBS) +lib537$(EXEEXT): $(lib537_OBJECTS) $(lib537_DEPENDENCIES) + @rm -f lib537$(EXEEXT) + $(LINK) $(lib537_LDFLAGS) $(lib537_OBJECTS) $(lib537_LDADD) $(LIBS) +lib539$(EXEEXT): $(lib539_OBJECTS) $(lib539_DEPENDENCIES) + @rm -f lib539$(EXEEXT) + $(LINK) $(lib539_LDFLAGS) $(lib539_OBJECTS) $(lib539_LDADD) $(LIBS) +lib540$(EXEEXT): $(lib540_OBJECTS) $(lib540_DEPENDENCIES) + @rm -f lib540$(EXEEXT) + $(LINK) $(lib540_LDFLAGS) $(lib540_OBJECTS) $(lib540_LDADD) $(LIBS) +lib541$(EXEEXT): $(lib541_OBJECTS) $(lib541_DEPENDENCIES) + @rm -f lib541$(EXEEXT) + $(LINK) $(lib541_LDFLAGS) $(lib541_OBJECTS) $(lib541_LDADD) $(LIBS) +lib542$(EXEEXT): $(lib542_OBJECTS) $(lib542_DEPENDENCIES) + @rm -f lib542$(EXEEXT) + $(LINK) $(lib542_LDFLAGS) $(lib542_OBJECTS) $(lib542_LDADD) $(LIBS) +lib543$(EXEEXT): $(lib543_OBJECTS) $(lib543_DEPENDENCIES) + @rm -f lib543$(EXEEXT) + $(LINK) $(lib543_LDFLAGS) $(lib543_OBJECTS) $(lib543_LDADD) $(LIBS) +lib544$(EXEEXT): $(lib544_OBJECTS) $(lib544_DEPENDENCIES) + @rm -f lib544$(EXEEXT) + $(LINK) $(lib544_LDFLAGS) $(lib544_OBJECTS) $(lib544_LDADD) $(LIBS) +lib545$(EXEEXT): $(lib545_OBJECTS) $(lib545_DEPENDENCIES) + @rm -f lib545$(EXEEXT) + $(LINK) $(lib545_LDFLAGS) $(lib545_OBJECTS) $(lib545_LDADD) $(LIBS) +lib547$(EXEEXT): $(lib547_OBJECTS) $(lib547_DEPENDENCIES) + @rm -f lib547$(EXEEXT) + $(LINK) $(lib547_LDFLAGS) $(lib547_OBJECTS) $(lib547_LDADD) $(LIBS) +lib548$(EXEEXT): $(lib548_OBJECTS) $(lib548_DEPENDENCIES) + @rm -f lib548$(EXEEXT) + $(LINK) $(lib548_LDFLAGS) $(lib548_OBJECTS) $(lib548_LDADD) $(LIBS) +lib549$(EXEEXT): $(lib549_OBJECTS) $(lib549_DEPENDENCIES) + @rm -f lib549$(EXEEXT) + $(LINK) $(lib549_LDFLAGS) $(lib549_OBJECTS) $(lib549_LDADD) $(LIBS) +lib552$(EXEEXT): $(lib552_OBJECTS) $(lib552_DEPENDENCIES) + @rm -f lib552$(EXEEXT) + $(LINK) $(lib552_LDFLAGS) $(lib552_OBJECTS) $(lib552_LDADD) $(LIBS) +lib553$(EXEEXT): $(lib553_OBJECTS) $(lib553_DEPENDENCIES) + @rm -f lib553$(EXEEXT) + $(LINK) $(lib553_LDFLAGS) $(lib553_OBJECTS) $(lib553_LDADD) $(LIBS) +lib554$(EXEEXT): $(lib554_OBJECTS) $(lib554_DEPENDENCIES) + @rm -f lib554$(EXEEXT) + $(LINK) $(lib554_LDFLAGS) $(lib554_OBJECTS) $(lib554_LDADD) $(LIBS) +lib555$(EXEEXT): $(lib555_OBJECTS) $(lib555_DEPENDENCIES) + @rm -f lib555$(EXEEXT) + $(LINK) $(lib555_LDFLAGS) $(lib555_OBJECTS) $(lib555_LDADD) $(LIBS) +lib556$(EXEEXT): $(lib556_OBJECTS) $(lib556_DEPENDENCIES) + @rm -f lib556$(EXEEXT) + $(LINK) $(lib556_LDFLAGS) $(lib556_OBJECTS) $(lib556_LDADD) $(LIBS) +lib557$(EXEEXT): $(lib557_OBJECTS) $(lib557_DEPENDENCIES) + @rm -f lib557$(EXEEXT) + $(LINK) $(lib557_LDFLAGS) $(lib557_OBJECTS) $(lib557_LDADD) $(LIBS) +lib558$(EXEEXT): $(lib558_OBJECTS) $(lib558_DEPENDENCIES) + @rm -f lib558$(EXEEXT) + $(LINK) $(lib558_LDFLAGS) $(lib558_OBJECTS) $(lib558_LDADD) $(LIBS) +lib559$(EXEEXT): $(lib559_OBJECTS) $(lib559_DEPENDENCIES) + @rm -f lib559$(EXEEXT) + $(LINK) $(lib559_LDFLAGS) $(lib559_OBJECTS) $(lib559_LDADD) $(LIBS) +lib560$(EXEEXT): $(lib560_OBJECTS) $(lib560_DEPENDENCIES) + @rm -f lib560$(EXEEXT) + $(LINK) $(lib560_LDFLAGS) $(lib560_OBJECTS) $(lib560_LDADD) $(LIBS) +lib562$(EXEEXT): $(lib562_OBJECTS) $(lib562_DEPENDENCIES) + @rm -f lib562$(EXEEXT) + $(LINK) $(lib562_LDFLAGS) $(lib562_OBJECTS) $(lib562_LDADD) $(LIBS) +lib564$(EXEEXT): $(lib564_OBJECTS) $(lib564_DEPENDENCIES) + @rm -f lib564$(EXEEXT) + $(LINK) $(lib564_LDFLAGS) $(lib564_OBJECTS) $(lib564_LDADD) $(LIBS) +lib565$(EXEEXT): $(lib565_OBJECTS) $(lib565_DEPENDENCIES) + @rm -f lib565$(EXEEXT) + $(LINK) $(lib565_LDFLAGS) $(lib565_OBJECTS) $(lib565_LDADD) $(LIBS) +lib566$(EXEEXT): $(lib566_OBJECTS) $(lib566_DEPENDENCIES) + @rm -f lib566$(EXEEXT) + $(LINK) $(lib566_LDFLAGS) $(lib566_OBJECTS) $(lib566_LDADD) $(LIBS) +lib567$(EXEEXT): $(lib567_OBJECTS) $(lib567_DEPENDENCIES) + @rm -f lib567$(EXEEXT) + $(LINK) $(lib567_LDFLAGS) $(lib567_OBJECTS) $(lib567_LDADD) $(LIBS) +lib568$(EXEEXT): $(lib568_OBJECTS) $(lib568_DEPENDENCIES) + @rm -f lib568$(EXEEXT) + $(LINK) $(lib568_LDFLAGS) $(lib568_OBJECTS) $(lib568_LDADD) $(LIBS) +lib569$(EXEEXT): $(lib569_OBJECTS) $(lib569_DEPENDENCIES) + @rm -f lib569$(EXEEXT) + $(LINK) $(lib569_LDFLAGS) $(lib569_OBJECTS) $(lib569_LDADD) $(LIBS) +lib570$(EXEEXT): $(lib570_OBJECTS) $(lib570_DEPENDENCIES) + @rm -f lib570$(EXEEXT) + $(LINK) $(lib570_LDFLAGS) $(lib570_OBJECTS) $(lib570_LDADD) $(LIBS) +lib571$(EXEEXT): $(lib571_OBJECTS) $(lib571_DEPENDENCIES) + @rm -f lib571$(EXEEXT) + $(LINK) $(lib571_LDFLAGS) $(lib571_OBJECTS) $(lib571_LDADD) $(LIBS) +lib572$(EXEEXT): $(lib572_OBJECTS) $(lib572_DEPENDENCIES) + @rm -f lib572$(EXEEXT) + $(LINK) $(lib572_LDFLAGS) $(lib572_OBJECTS) $(lib572_LDADD) $(LIBS) +lib573$(EXEEXT): $(lib573_OBJECTS) $(lib573_DEPENDENCIES) + @rm -f lib573$(EXEEXT) + $(LINK) $(lib573_LDFLAGS) $(lib573_OBJECTS) $(lib573_LDADD) $(LIBS) +lib574$(EXEEXT): $(lib574_OBJECTS) $(lib574_DEPENDENCIES) + @rm -f lib574$(EXEEXT) + $(LINK) $(lib574_LDFLAGS) $(lib574_OBJECTS) $(lib574_LDADD) $(LIBS) +lib575$(EXEEXT): $(lib575_OBJECTS) $(lib575_DEPENDENCIES) + @rm -f lib575$(EXEEXT) + $(LINK) $(lib575_LDFLAGS) $(lib575_OBJECTS) $(lib575_LDADD) $(LIBS) +lib576$(EXEEXT): $(lib576_OBJECTS) $(lib576_DEPENDENCIES) + @rm -f lib576$(EXEEXT) + $(LINK) $(lib576_LDFLAGS) $(lib576_OBJECTS) $(lib576_LDADD) $(LIBS) +lib577$(EXEEXT): $(lib577_OBJECTS) $(lib577_DEPENDENCIES) + @rm -f lib577$(EXEEXT) + $(LINK) $(lib577_LDFLAGS) $(lib577_OBJECTS) $(lib577_LDADD) $(LIBS) +lib578$(EXEEXT): $(lib578_OBJECTS) $(lib578_DEPENDENCIES) + @rm -f lib578$(EXEEXT) + $(LINK) $(lib578_LDFLAGS) $(lib578_OBJECTS) $(lib578_LDADD) $(LIBS) +lib579$(EXEEXT): $(lib579_OBJECTS) $(lib579_DEPENDENCIES) + @rm -f lib579$(EXEEXT) + $(LINK) $(lib579_LDFLAGS) $(lib579_OBJECTS) $(lib579_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chkhostname-chkhostname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chkhostname-curl_gethostname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib500.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib501.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib502.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib503.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib504.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib505.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib506.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib507.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib508.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib510.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib511.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib512.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib513.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib514.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib515.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib516.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib517.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib518.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib519.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib520.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib521.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib523.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib524.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib525.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib526-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib526-lib526.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib526-testutil.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib527-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib527-lib526.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib527-testutil.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib529-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib529-lib525.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib529-testutil.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib530-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib530-lib530.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib530-testutil.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib532-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib532-lib526.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib532-testutil.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib533.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib536.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib537.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib539.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib540.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib541.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib542.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib543.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib544.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib545-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib545-lib544.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib547.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib548-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib548-lib547.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib549.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib552.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib553.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib554.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib555.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib556.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib557.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib558-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib558-lib558.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib559-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib559-lib558.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib560.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib562.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib564.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib565-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib565-lib510.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib566.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib567.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib568.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib569.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib570.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib571.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib572.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib573.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib574.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib575.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib576.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib577.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib578.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib579.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sethostname.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testutil.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +chkhostname-chkhostname.o: chkhostname.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chkhostname_CFLAGS) $(CFLAGS) -MT chkhostname-chkhostname.o -MD -MP -MF "$(DEPDIR)/chkhostname-chkhostname.Tpo" -c -o chkhostname-chkhostname.o `test -f 'chkhostname.c' || echo '$(srcdir)/'`chkhostname.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/chkhostname-chkhostname.Tpo" "$(DEPDIR)/chkhostname-chkhostname.Po"; else rm -f "$(DEPDIR)/chkhostname-chkhostname.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chkhostname.c' object='chkhostname-chkhostname.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chkhostname_CFLAGS) $(CFLAGS) -c -o chkhostname-chkhostname.o `test -f 'chkhostname.c' || echo '$(srcdir)/'`chkhostname.c + +chkhostname-chkhostname.obj: chkhostname.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chkhostname_CFLAGS) $(CFLAGS) -MT chkhostname-chkhostname.obj -MD -MP -MF "$(DEPDIR)/chkhostname-chkhostname.Tpo" -c -o chkhostname-chkhostname.obj `if test -f 'chkhostname.c'; then $(CYGPATH_W) 'chkhostname.c'; else $(CYGPATH_W) '$(srcdir)/chkhostname.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/chkhostname-chkhostname.Tpo" "$(DEPDIR)/chkhostname-chkhostname.Po"; else rm -f "$(DEPDIR)/chkhostname-chkhostname.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chkhostname.c' object='chkhostname-chkhostname.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chkhostname_CFLAGS) $(CFLAGS) -c -o chkhostname-chkhostname.obj `if test -f 'chkhostname.c'; then $(CYGPATH_W) 'chkhostname.c'; else $(CYGPATH_W) '$(srcdir)/chkhostname.c'; fi` + +chkhostname-curl_gethostname.o: $(top_srcdir)/lib/curl_gethostname.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chkhostname_CFLAGS) $(CFLAGS) -MT chkhostname-curl_gethostname.o -MD -MP -MF "$(DEPDIR)/chkhostname-curl_gethostname.Tpo" -c -o chkhostname-curl_gethostname.o `test -f '$(top_srcdir)/lib/curl_gethostname.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/curl_gethostname.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/chkhostname-curl_gethostname.Tpo" "$(DEPDIR)/chkhostname-curl_gethostname.Po"; else rm -f "$(DEPDIR)/chkhostname-curl_gethostname.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/curl_gethostname.c' object='chkhostname-curl_gethostname.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chkhostname_CFLAGS) $(CFLAGS) -c -o chkhostname-curl_gethostname.o `test -f '$(top_srcdir)/lib/curl_gethostname.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/curl_gethostname.c + +chkhostname-curl_gethostname.obj: $(top_srcdir)/lib/curl_gethostname.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chkhostname_CFLAGS) $(CFLAGS) -MT chkhostname-curl_gethostname.obj -MD -MP -MF "$(DEPDIR)/chkhostname-curl_gethostname.Tpo" -c -o chkhostname-curl_gethostname.obj `if test -f '$(top_srcdir)/lib/curl_gethostname.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/curl_gethostname.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/curl_gethostname.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/chkhostname-curl_gethostname.Tpo" "$(DEPDIR)/chkhostname-curl_gethostname.Po"; else rm -f "$(DEPDIR)/chkhostname-curl_gethostname.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/curl_gethostname.c' object='chkhostname-curl_gethostname.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(chkhostname_CFLAGS) $(CFLAGS) -c -o chkhostname-curl_gethostname.obj `if test -f '$(top_srcdir)/lib/curl_gethostname.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/curl_gethostname.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/curl_gethostname.c'; fi` + +lib526-lib526.o: lib526.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -MT lib526-lib526.o -MD -MP -MF "$(DEPDIR)/lib526-lib526.Tpo" -c -o lib526-lib526.o `test -f 'lib526.c' || echo '$(srcdir)/'`lib526.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib526-lib526.Tpo" "$(DEPDIR)/lib526-lib526.Po"; else rm -f "$(DEPDIR)/lib526-lib526.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib526.c' object='lib526-lib526.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -c -o lib526-lib526.o `test -f 'lib526.c' || echo '$(srcdir)/'`lib526.c + +lib526-lib526.obj: lib526.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -MT lib526-lib526.obj -MD -MP -MF "$(DEPDIR)/lib526-lib526.Tpo" -c -o lib526-lib526.obj `if test -f 'lib526.c'; then $(CYGPATH_W) 'lib526.c'; else $(CYGPATH_W) '$(srcdir)/lib526.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib526-lib526.Tpo" "$(DEPDIR)/lib526-lib526.Po"; else rm -f "$(DEPDIR)/lib526-lib526.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib526.c' object='lib526-lib526.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -c -o lib526-lib526.obj `if test -f 'lib526.c'; then $(CYGPATH_W) 'lib526.c'; else $(CYGPATH_W) '$(srcdir)/lib526.c'; fi` + +lib526-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -MT lib526-first.o -MD -MP -MF "$(DEPDIR)/lib526-first.Tpo" -c -o lib526-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib526-first.Tpo" "$(DEPDIR)/lib526-first.Po"; else rm -f "$(DEPDIR)/lib526-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib526-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -c -o lib526-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib526-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -MT lib526-first.obj -MD -MP -MF "$(DEPDIR)/lib526-first.Tpo" -c -o lib526-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib526-first.Tpo" "$(DEPDIR)/lib526-first.Po"; else rm -f "$(DEPDIR)/lib526-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib526-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -c -o lib526-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +lib526-testutil.o: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -MT lib526-testutil.o -MD -MP -MF "$(DEPDIR)/lib526-testutil.Tpo" -c -o lib526-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib526-testutil.Tpo" "$(DEPDIR)/lib526-testutil.Po"; else rm -f "$(DEPDIR)/lib526-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib526-testutil.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -c -o lib526-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c + +lib526-testutil.obj: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -MT lib526-testutil.obj -MD -MP -MF "$(DEPDIR)/lib526-testutil.Tpo" -c -o lib526-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib526-testutil.Tpo" "$(DEPDIR)/lib526-testutil.Po"; else rm -f "$(DEPDIR)/lib526-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib526-testutil.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib526_CFLAGS) $(CFLAGS) -c -o lib526-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi` + +lib527-lib526.o: lib526.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -MT lib527-lib526.o -MD -MP -MF "$(DEPDIR)/lib527-lib526.Tpo" -c -o lib527-lib526.o `test -f 'lib526.c' || echo '$(srcdir)/'`lib526.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib527-lib526.Tpo" "$(DEPDIR)/lib527-lib526.Po"; else rm -f "$(DEPDIR)/lib527-lib526.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib526.c' object='lib527-lib526.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -c -o lib527-lib526.o `test -f 'lib526.c' || echo '$(srcdir)/'`lib526.c + +lib527-lib526.obj: lib526.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -MT lib527-lib526.obj -MD -MP -MF "$(DEPDIR)/lib527-lib526.Tpo" -c -o lib527-lib526.obj `if test -f 'lib526.c'; then $(CYGPATH_W) 'lib526.c'; else $(CYGPATH_W) '$(srcdir)/lib526.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib527-lib526.Tpo" "$(DEPDIR)/lib527-lib526.Po"; else rm -f "$(DEPDIR)/lib527-lib526.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib526.c' object='lib527-lib526.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -c -o lib527-lib526.obj `if test -f 'lib526.c'; then $(CYGPATH_W) 'lib526.c'; else $(CYGPATH_W) '$(srcdir)/lib526.c'; fi` + +lib527-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -MT lib527-first.o -MD -MP -MF "$(DEPDIR)/lib527-first.Tpo" -c -o lib527-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib527-first.Tpo" "$(DEPDIR)/lib527-first.Po"; else rm -f "$(DEPDIR)/lib527-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib527-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -c -o lib527-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib527-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -MT lib527-first.obj -MD -MP -MF "$(DEPDIR)/lib527-first.Tpo" -c -o lib527-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib527-first.Tpo" "$(DEPDIR)/lib527-first.Po"; else rm -f "$(DEPDIR)/lib527-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib527-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -c -o lib527-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +lib527-testutil.o: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -MT lib527-testutil.o -MD -MP -MF "$(DEPDIR)/lib527-testutil.Tpo" -c -o lib527-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib527-testutil.Tpo" "$(DEPDIR)/lib527-testutil.Po"; else rm -f "$(DEPDIR)/lib527-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib527-testutil.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -c -o lib527-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c + +lib527-testutil.obj: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -MT lib527-testutil.obj -MD -MP -MF "$(DEPDIR)/lib527-testutil.Tpo" -c -o lib527-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib527-testutil.Tpo" "$(DEPDIR)/lib527-testutil.Po"; else rm -f "$(DEPDIR)/lib527-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib527-testutil.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib527_CFLAGS) $(CFLAGS) -c -o lib527-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi` + +lib529-lib525.o: lib525.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -MT lib529-lib525.o -MD -MP -MF "$(DEPDIR)/lib529-lib525.Tpo" -c -o lib529-lib525.o `test -f 'lib525.c' || echo '$(srcdir)/'`lib525.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib529-lib525.Tpo" "$(DEPDIR)/lib529-lib525.Po"; else rm -f "$(DEPDIR)/lib529-lib525.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib525.c' object='lib529-lib525.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -c -o lib529-lib525.o `test -f 'lib525.c' || echo '$(srcdir)/'`lib525.c + +lib529-lib525.obj: lib525.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -MT lib529-lib525.obj -MD -MP -MF "$(DEPDIR)/lib529-lib525.Tpo" -c -o lib529-lib525.obj `if test -f 'lib525.c'; then $(CYGPATH_W) 'lib525.c'; else $(CYGPATH_W) '$(srcdir)/lib525.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib529-lib525.Tpo" "$(DEPDIR)/lib529-lib525.Po"; else rm -f "$(DEPDIR)/lib529-lib525.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib525.c' object='lib529-lib525.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -c -o lib529-lib525.obj `if test -f 'lib525.c'; then $(CYGPATH_W) 'lib525.c'; else $(CYGPATH_W) '$(srcdir)/lib525.c'; fi` + +lib529-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -MT lib529-first.o -MD -MP -MF "$(DEPDIR)/lib529-first.Tpo" -c -o lib529-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib529-first.Tpo" "$(DEPDIR)/lib529-first.Po"; else rm -f "$(DEPDIR)/lib529-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib529-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -c -o lib529-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib529-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -MT lib529-first.obj -MD -MP -MF "$(DEPDIR)/lib529-first.Tpo" -c -o lib529-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib529-first.Tpo" "$(DEPDIR)/lib529-first.Po"; else rm -f "$(DEPDIR)/lib529-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib529-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -c -o lib529-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +lib529-testutil.o: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -MT lib529-testutil.o -MD -MP -MF "$(DEPDIR)/lib529-testutil.Tpo" -c -o lib529-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib529-testutil.Tpo" "$(DEPDIR)/lib529-testutil.Po"; else rm -f "$(DEPDIR)/lib529-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib529-testutil.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -c -o lib529-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c + +lib529-testutil.obj: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -MT lib529-testutil.obj -MD -MP -MF "$(DEPDIR)/lib529-testutil.Tpo" -c -o lib529-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib529-testutil.Tpo" "$(DEPDIR)/lib529-testutil.Po"; else rm -f "$(DEPDIR)/lib529-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib529-testutil.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib529_CFLAGS) $(CFLAGS) -c -o lib529-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi` + +lib530-lib530.o: lib530.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -MT lib530-lib530.o -MD -MP -MF "$(DEPDIR)/lib530-lib530.Tpo" -c -o lib530-lib530.o `test -f 'lib530.c' || echo '$(srcdir)/'`lib530.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib530-lib530.Tpo" "$(DEPDIR)/lib530-lib530.Po"; else rm -f "$(DEPDIR)/lib530-lib530.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib530.c' object='lib530-lib530.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -c -o lib530-lib530.o `test -f 'lib530.c' || echo '$(srcdir)/'`lib530.c + +lib530-lib530.obj: lib530.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -MT lib530-lib530.obj -MD -MP -MF "$(DEPDIR)/lib530-lib530.Tpo" -c -o lib530-lib530.obj `if test -f 'lib530.c'; then $(CYGPATH_W) 'lib530.c'; else $(CYGPATH_W) '$(srcdir)/lib530.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib530-lib530.Tpo" "$(DEPDIR)/lib530-lib530.Po"; else rm -f "$(DEPDIR)/lib530-lib530.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib530.c' object='lib530-lib530.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -c -o lib530-lib530.obj `if test -f 'lib530.c'; then $(CYGPATH_W) 'lib530.c'; else $(CYGPATH_W) '$(srcdir)/lib530.c'; fi` + +lib530-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -MT lib530-first.o -MD -MP -MF "$(DEPDIR)/lib530-first.Tpo" -c -o lib530-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib530-first.Tpo" "$(DEPDIR)/lib530-first.Po"; else rm -f "$(DEPDIR)/lib530-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib530-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -c -o lib530-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib530-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -MT lib530-first.obj -MD -MP -MF "$(DEPDIR)/lib530-first.Tpo" -c -o lib530-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib530-first.Tpo" "$(DEPDIR)/lib530-first.Po"; else rm -f "$(DEPDIR)/lib530-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib530-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -c -o lib530-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +lib530-testutil.o: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -MT lib530-testutil.o -MD -MP -MF "$(DEPDIR)/lib530-testutil.Tpo" -c -o lib530-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib530-testutil.Tpo" "$(DEPDIR)/lib530-testutil.Po"; else rm -f "$(DEPDIR)/lib530-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib530-testutil.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -c -o lib530-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c + +lib530-testutil.obj: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -MT lib530-testutil.obj -MD -MP -MF "$(DEPDIR)/lib530-testutil.Tpo" -c -o lib530-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib530-testutil.Tpo" "$(DEPDIR)/lib530-testutil.Po"; else rm -f "$(DEPDIR)/lib530-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib530-testutil.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib530_CFLAGS) $(CFLAGS) -c -o lib530-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi` + +lib532-lib526.o: lib526.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -MT lib532-lib526.o -MD -MP -MF "$(DEPDIR)/lib532-lib526.Tpo" -c -o lib532-lib526.o `test -f 'lib526.c' || echo '$(srcdir)/'`lib526.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib532-lib526.Tpo" "$(DEPDIR)/lib532-lib526.Po"; else rm -f "$(DEPDIR)/lib532-lib526.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib526.c' object='lib532-lib526.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -c -o lib532-lib526.o `test -f 'lib526.c' || echo '$(srcdir)/'`lib526.c + +lib532-lib526.obj: lib526.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -MT lib532-lib526.obj -MD -MP -MF "$(DEPDIR)/lib532-lib526.Tpo" -c -o lib532-lib526.obj `if test -f 'lib526.c'; then $(CYGPATH_W) 'lib526.c'; else $(CYGPATH_W) '$(srcdir)/lib526.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib532-lib526.Tpo" "$(DEPDIR)/lib532-lib526.Po"; else rm -f "$(DEPDIR)/lib532-lib526.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib526.c' object='lib532-lib526.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -c -o lib532-lib526.obj `if test -f 'lib526.c'; then $(CYGPATH_W) 'lib526.c'; else $(CYGPATH_W) '$(srcdir)/lib526.c'; fi` + +lib532-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -MT lib532-first.o -MD -MP -MF "$(DEPDIR)/lib532-first.Tpo" -c -o lib532-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib532-first.Tpo" "$(DEPDIR)/lib532-first.Po"; else rm -f "$(DEPDIR)/lib532-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib532-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -c -o lib532-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib532-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -MT lib532-first.obj -MD -MP -MF "$(DEPDIR)/lib532-first.Tpo" -c -o lib532-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib532-first.Tpo" "$(DEPDIR)/lib532-first.Po"; else rm -f "$(DEPDIR)/lib532-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib532-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -c -o lib532-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +lib532-testutil.o: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -MT lib532-testutil.o -MD -MP -MF "$(DEPDIR)/lib532-testutil.Tpo" -c -o lib532-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib532-testutil.Tpo" "$(DEPDIR)/lib532-testutil.Po"; else rm -f "$(DEPDIR)/lib532-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib532-testutil.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -c -o lib532-testutil.o `test -f 'testutil.c' || echo '$(srcdir)/'`testutil.c + +lib532-testutil.obj: testutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -MT lib532-testutil.obj -MD -MP -MF "$(DEPDIR)/lib532-testutil.Tpo" -c -o lib532-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib532-testutil.Tpo" "$(DEPDIR)/lib532-testutil.Po"; else rm -f "$(DEPDIR)/lib532-testutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testutil.c' object='lib532-testutil.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib532_CFLAGS) $(CFLAGS) -c -o lib532-testutil.obj `if test -f 'testutil.c'; then $(CYGPATH_W) 'testutil.c'; else $(CYGPATH_W) '$(srcdir)/testutil.c'; fi` + +lib545-lib544.o: lib544.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib545_CFLAGS) $(CFLAGS) -MT lib545-lib544.o -MD -MP -MF "$(DEPDIR)/lib545-lib544.Tpo" -c -o lib545-lib544.o `test -f 'lib544.c' || echo '$(srcdir)/'`lib544.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib545-lib544.Tpo" "$(DEPDIR)/lib545-lib544.Po"; else rm -f "$(DEPDIR)/lib545-lib544.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib544.c' object='lib545-lib544.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib545_CFLAGS) $(CFLAGS) -c -o lib545-lib544.o `test -f 'lib544.c' || echo '$(srcdir)/'`lib544.c + +lib545-lib544.obj: lib544.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib545_CFLAGS) $(CFLAGS) -MT lib545-lib544.obj -MD -MP -MF "$(DEPDIR)/lib545-lib544.Tpo" -c -o lib545-lib544.obj `if test -f 'lib544.c'; then $(CYGPATH_W) 'lib544.c'; else $(CYGPATH_W) '$(srcdir)/lib544.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib545-lib544.Tpo" "$(DEPDIR)/lib545-lib544.Po"; else rm -f "$(DEPDIR)/lib545-lib544.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib544.c' object='lib545-lib544.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib545_CFLAGS) $(CFLAGS) -c -o lib545-lib544.obj `if test -f 'lib544.c'; then $(CYGPATH_W) 'lib544.c'; else $(CYGPATH_W) '$(srcdir)/lib544.c'; fi` + +lib545-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib545_CFLAGS) $(CFLAGS) -MT lib545-first.o -MD -MP -MF "$(DEPDIR)/lib545-first.Tpo" -c -o lib545-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib545-first.Tpo" "$(DEPDIR)/lib545-first.Po"; else rm -f "$(DEPDIR)/lib545-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib545-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib545_CFLAGS) $(CFLAGS) -c -o lib545-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib545-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib545_CFLAGS) $(CFLAGS) -MT lib545-first.obj -MD -MP -MF "$(DEPDIR)/lib545-first.Tpo" -c -o lib545-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib545-first.Tpo" "$(DEPDIR)/lib545-first.Po"; else rm -f "$(DEPDIR)/lib545-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib545-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib545_CFLAGS) $(CFLAGS) -c -o lib545-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +lib548-lib547.o: lib547.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib548_CFLAGS) $(CFLAGS) -MT lib548-lib547.o -MD -MP -MF "$(DEPDIR)/lib548-lib547.Tpo" -c -o lib548-lib547.o `test -f 'lib547.c' || echo '$(srcdir)/'`lib547.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib548-lib547.Tpo" "$(DEPDIR)/lib548-lib547.Po"; else rm -f "$(DEPDIR)/lib548-lib547.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib547.c' object='lib548-lib547.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib548_CFLAGS) $(CFLAGS) -c -o lib548-lib547.o `test -f 'lib547.c' || echo '$(srcdir)/'`lib547.c + +lib548-lib547.obj: lib547.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib548_CFLAGS) $(CFLAGS) -MT lib548-lib547.obj -MD -MP -MF "$(DEPDIR)/lib548-lib547.Tpo" -c -o lib548-lib547.obj `if test -f 'lib547.c'; then $(CYGPATH_W) 'lib547.c'; else $(CYGPATH_W) '$(srcdir)/lib547.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib548-lib547.Tpo" "$(DEPDIR)/lib548-lib547.Po"; else rm -f "$(DEPDIR)/lib548-lib547.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib547.c' object='lib548-lib547.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib548_CFLAGS) $(CFLAGS) -c -o lib548-lib547.obj `if test -f 'lib547.c'; then $(CYGPATH_W) 'lib547.c'; else $(CYGPATH_W) '$(srcdir)/lib547.c'; fi` + +lib548-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib548_CFLAGS) $(CFLAGS) -MT lib548-first.o -MD -MP -MF "$(DEPDIR)/lib548-first.Tpo" -c -o lib548-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib548-first.Tpo" "$(DEPDIR)/lib548-first.Po"; else rm -f "$(DEPDIR)/lib548-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib548-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib548_CFLAGS) $(CFLAGS) -c -o lib548-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib548-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib548_CFLAGS) $(CFLAGS) -MT lib548-first.obj -MD -MP -MF "$(DEPDIR)/lib548-first.Tpo" -c -o lib548-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib548-first.Tpo" "$(DEPDIR)/lib548-first.Po"; else rm -f "$(DEPDIR)/lib548-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib548-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib548_CFLAGS) $(CFLAGS) -c -o lib548-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +lib558-lib558.o: lib558.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib558_CFLAGS) $(CFLAGS) -MT lib558-lib558.o -MD -MP -MF "$(DEPDIR)/lib558-lib558.Tpo" -c -o lib558-lib558.o `test -f 'lib558.c' || echo '$(srcdir)/'`lib558.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib558-lib558.Tpo" "$(DEPDIR)/lib558-lib558.Po"; else rm -f "$(DEPDIR)/lib558-lib558.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib558.c' object='lib558-lib558.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib558_CFLAGS) $(CFLAGS) -c -o lib558-lib558.o `test -f 'lib558.c' || echo '$(srcdir)/'`lib558.c + +lib558-lib558.obj: lib558.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib558_CFLAGS) $(CFLAGS) -MT lib558-lib558.obj -MD -MP -MF "$(DEPDIR)/lib558-lib558.Tpo" -c -o lib558-lib558.obj `if test -f 'lib558.c'; then $(CYGPATH_W) 'lib558.c'; else $(CYGPATH_W) '$(srcdir)/lib558.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib558-lib558.Tpo" "$(DEPDIR)/lib558-lib558.Po"; else rm -f "$(DEPDIR)/lib558-lib558.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib558.c' object='lib558-lib558.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib558_CFLAGS) $(CFLAGS) -c -o lib558-lib558.obj `if test -f 'lib558.c'; then $(CYGPATH_W) 'lib558.c'; else $(CYGPATH_W) '$(srcdir)/lib558.c'; fi` + +lib558-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib558_CFLAGS) $(CFLAGS) -MT lib558-first.o -MD -MP -MF "$(DEPDIR)/lib558-first.Tpo" -c -o lib558-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib558-first.Tpo" "$(DEPDIR)/lib558-first.Po"; else rm -f "$(DEPDIR)/lib558-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib558-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib558_CFLAGS) $(CFLAGS) -c -o lib558-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib558-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib558_CFLAGS) $(CFLAGS) -MT lib558-first.obj -MD -MP -MF "$(DEPDIR)/lib558-first.Tpo" -c -o lib558-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib558-first.Tpo" "$(DEPDIR)/lib558-first.Po"; else rm -f "$(DEPDIR)/lib558-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib558-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib558_CFLAGS) $(CFLAGS) -c -o lib558-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +lib559-lib558.o: lib558.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib559_CFLAGS) $(CFLAGS) -MT lib559-lib558.o -MD -MP -MF "$(DEPDIR)/lib559-lib558.Tpo" -c -o lib559-lib558.o `test -f 'lib558.c' || echo '$(srcdir)/'`lib558.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib559-lib558.Tpo" "$(DEPDIR)/lib559-lib558.Po"; else rm -f "$(DEPDIR)/lib559-lib558.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib558.c' object='lib559-lib558.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib559_CFLAGS) $(CFLAGS) -c -o lib559-lib558.o `test -f 'lib558.c' || echo '$(srcdir)/'`lib558.c + +lib559-lib558.obj: lib558.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib559_CFLAGS) $(CFLAGS) -MT lib559-lib558.obj -MD -MP -MF "$(DEPDIR)/lib559-lib558.Tpo" -c -o lib559-lib558.obj `if test -f 'lib558.c'; then $(CYGPATH_W) 'lib558.c'; else $(CYGPATH_W) '$(srcdir)/lib558.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib559-lib558.Tpo" "$(DEPDIR)/lib559-lib558.Po"; else rm -f "$(DEPDIR)/lib559-lib558.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib558.c' object='lib559-lib558.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib559_CFLAGS) $(CFLAGS) -c -o lib559-lib558.obj `if test -f 'lib558.c'; then $(CYGPATH_W) 'lib558.c'; else $(CYGPATH_W) '$(srcdir)/lib558.c'; fi` + +lib559-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib559_CFLAGS) $(CFLAGS) -MT lib559-first.o -MD -MP -MF "$(DEPDIR)/lib559-first.Tpo" -c -o lib559-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib559-first.Tpo" "$(DEPDIR)/lib559-first.Po"; else rm -f "$(DEPDIR)/lib559-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib559-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib559_CFLAGS) $(CFLAGS) -c -o lib559-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib559-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib559_CFLAGS) $(CFLAGS) -MT lib559-first.obj -MD -MP -MF "$(DEPDIR)/lib559-first.Tpo" -c -o lib559-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib559-first.Tpo" "$(DEPDIR)/lib559-first.Po"; else rm -f "$(DEPDIR)/lib559-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib559-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib559_CFLAGS) $(CFLAGS) -c -o lib559-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +lib565-lib510.o: lib510.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib565_CFLAGS) $(CFLAGS) -MT lib565-lib510.o -MD -MP -MF "$(DEPDIR)/lib565-lib510.Tpo" -c -o lib565-lib510.o `test -f 'lib510.c' || echo '$(srcdir)/'`lib510.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib565-lib510.Tpo" "$(DEPDIR)/lib565-lib510.Po"; else rm -f "$(DEPDIR)/lib565-lib510.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib510.c' object='lib565-lib510.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib565_CFLAGS) $(CFLAGS) -c -o lib565-lib510.o `test -f 'lib510.c' || echo '$(srcdir)/'`lib510.c + +lib565-lib510.obj: lib510.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib565_CFLAGS) $(CFLAGS) -MT lib565-lib510.obj -MD -MP -MF "$(DEPDIR)/lib565-lib510.Tpo" -c -o lib565-lib510.obj `if test -f 'lib510.c'; then $(CYGPATH_W) 'lib510.c'; else $(CYGPATH_W) '$(srcdir)/lib510.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib565-lib510.Tpo" "$(DEPDIR)/lib565-lib510.Po"; else rm -f "$(DEPDIR)/lib565-lib510.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib510.c' object='lib565-lib510.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib565_CFLAGS) $(CFLAGS) -c -o lib565-lib510.obj `if test -f 'lib510.c'; then $(CYGPATH_W) 'lib510.c'; else $(CYGPATH_W) '$(srcdir)/lib510.c'; fi` + +lib565-first.o: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib565_CFLAGS) $(CFLAGS) -MT lib565-first.o -MD -MP -MF "$(DEPDIR)/lib565-first.Tpo" -c -o lib565-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib565-first.Tpo" "$(DEPDIR)/lib565-first.Po"; else rm -f "$(DEPDIR)/lib565-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib565-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib565_CFLAGS) $(CFLAGS) -c -o lib565-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib565-first.obj: first.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib565_CFLAGS) $(CFLAGS) -MT lib565-first.obj -MD -MP -MF "$(DEPDIR)/lib565-first.Tpo" -c -o lib565-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lib565-first.Tpo" "$(DEPDIR)/lib565-first.Po"; else rm -f "$(DEPDIR)/lib565-first.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='first.c' object='lib565-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib565_CFLAGS) $(CFLAGS) -c -o lib565-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc new file mode 100644 index 0000000..a0f1c0e --- /dev/null +++ b/tests/libtest/Makefile.inc @@ -0,0 +1,166 @@ +# files used only in some libcurl test programs +TESTUTIL = testutil.c testutil.h + +# these files are used in every single test program below +SUPPORTFILES = first.c test.h + +# These are all libcurl test programs +noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 \ + lib507 lib508 lib510 lib511 lib512 lib513 lib514 lib515 lib516 \ + lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526 lib527 \ + lib574 lib575 lib576 lib577 lib578 lib579 \ + lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 lib543 \ + lib544 lib545 lib547 lib548 lib549 lib552 lib553 lib554 lib555 lib556 \ + lib539 lib557 lib558 lib559 lib560 lib562 lib564 lib565 lib566 lib567 \ + lib568 lib569 lib570 lib571 lib572 lib573 chkhostname + +chkhostname_SOURCES = chkhostname.c $(top_srcdir)/lib/curl_gethostname.c +chkhostname_LDADD = @CURL_NETWORK_LIBS@ +chkhostname_DEPENDENCIES = +chkhostname_CFLAGS = $(AM_CFLAGS) + +lib500_SOURCES = lib500.c $(SUPPORTFILES) + +lib501_SOURCES = lib501.c $(SUPPORTFILES) + +lib502_SOURCES = lib502.c $(SUPPORTFILES) $(TESTUTIL) + +lib503_SOURCES = lib503.c $(SUPPORTFILES) $(TESTUTIL) + +lib504_SOURCES = lib504.c $(SUPPORTFILES) $(TESTUTIL) + +lib505_SOURCES = lib505.c $(SUPPORTFILES) + +lib506_SOURCES = lib506.c $(SUPPORTFILES) + +lib507_SOURCES = lib507.c $(SUPPORTFILES) $(TESTUTIL) + +lib508_SOURCES = lib508.c $(SUPPORTFILES) + +lib510_SOURCES = lib510.c $(SUPPORTFILES) + +lib511_SOURCES = lib511.c $(SUPPORTFILES) + +lib512_SOURCES = lib512.c $(SUPPORTFILES) + +lib513_SOURCES = lib513.c $(SUPPORTFILES) + +lib514_SOURCES = lib514.c $(SUPPORTFILES) + +lib515_SOURCES = lib515.c $(SUPPORTFILES) + +lib516_SOURCES = lib516.c $(SUPPORTFILES) + +lib517_SOURCES = lib517.c $(SUPPORTFILES) + +lib518_SOURCES = lib518.c $(SUPPORTFILES) + +lib519_SOURCES = lib519.c $(SUPPORTFILES) + +lib520_SOURCES = lib520.c $(SUPPORTFILES) + +lib521_SOURCES = lib521.c $(SUPPORTFILES) + +lib523_SOURCES = lib523.c $(SUPPORTFILES) + +lib524_SOURCES = lib524.c $(SUPPORTFILES) + +lib525_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL) + +lib526_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) +lib526_CFLAGS = -DLIB526 + +lib527_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) +lib527_CFLAGS = -DLIB527 + +lib529_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL) +lib529_CFLAGS = -DLIB529 + +lib530_SOURCES = lib530.c $(SUPPORTFILES) $(TESTUTIL) +lib530_CFLAGS = -DLIB530 + +lib532_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) +lib532_CFLAGS = -DLIB532 + +lib533_SOURCES = lib533.c $(SUPPORTFILES) $(TESTUTIL) + +lib536_SOURCES = lib536.c $(SUPPORTFILES) $(TESTUTIL) + +lib537_SOURCES = lib537.c $(SUPPORTFILES) + +lib539_SOURCES = lib539.c $(SUPPORTFILES) + +lib540_SOURCES = lib540.c $(SUPPORTFILES) + +lib541_SOURCES = lib541.c $(SUPPORTFILES) + +lib542_SOURCES = lib542.c $(SUPPORTFILES) + +lib543_SOURCES = lib543.c $(SUPPORTFILES) + +lib544_SOURCES = lib544.c $(SUPPORTFILES) + +lib545_SOURCES = lib544.c $(SUPPORTFILES) +lib545_CFLAGS = -DLIB545 + +lib547_SOURCES = lib547.c $(SUPPORTFILES) + +lib548_SOURCES = lib547.c $(SUPPORTFILES) +lib548_CFLAGS = -DLIB548 + +lib549_SOURCES = lib549.c $(SUPPORTFILES) + +lib555_SOURCES = lib555.c $(SUPPORTFILES) $(TESTUTIL) + +lib552_SOURCES = lib552.c $(SUPPORTFILES) + +lib553_SOURCES = lib553.c $(SUPPORTFILES) + +lib554_SOURCES = lib554.c $(SUPPORTFILES) + +lib556_SOURCES = lib556.c $(SUPPORTFILES) + +lib557_SOURCES = lib557.c $(SUPPORTFILES) + +lib558_SOURCES = lib558.c $(SUPPORTFILES) +lib558_CFLAGS = -DLIB558 + +lib559_SOURCES = lib558.c $(SUPPORTFILES) +lib559_CFLAGS = -DLIB559 + +lib560_SOURCES = lib560.c $(SUPPORTFILES) + +lib574_SOURCES = lib574.c $(SUPPORTFILES) + +lib575_SOURCES = lib575.c $(SUPPORTFILES) + +lib576_SOURCES = lib576.c $(SUPPORTFILES) + +lib577_SOURCES = lib577.c $(SUPPORTFILES) + +lib562_SOURCES = lib562.c $(SUPPORTFILES) + +lib564_SOURCES = lib564.c $(SUPPORTFILES) $(TESTUTIL) + +lib565_SOURCES = lib510.c $(SUPPORTFILES) +lib565_CFLAGS = -DLIB565 + +lib566_SOURCES = lib566.c $(SUPPORTFILES) + +lib567_SOURCES = lib567.c $(SUPPORTFILES) + +lib568_SOURCES = lib568.c $(SUPPORTFILES) + +lib569_SOURCES = lib569.c $(SUPPORTFILES) + +lib570_SOURCES = lib570.c $(SUPPORTFILES) + +lib571_SOURCES = lib571.c $(SUPPORTFILES) + +lib572_SOURCES = lib572.c $(SUPPORTFILES) + +lib573_SOURCES = lib573.c $(SUPPORTFILES) $(TESTUTIL) + +lib578_SOURCES = lib578.c $(SUPPORTFILES) + +lib579_SOURCES = lib579.c $(SUPPORTFILES) diff --git a/tests/libtest/chkhostname.c b/tests/libtest/chkhostname.c new file mode 100644 index 0000000..72c8b6a --- /dev/null +++ b/tests/libtest/chkhostname.c @@ -0,0 +1,26 @@ +#include "setup.h" + +#include "curl_gethostname.h" + +#define HOSTNAME_MAX 1024 + +int main(int argc, char *argv[]) +{ + char buff[HOSTNAME_MAX]; + if (argc != 2) { + printf("Usage: %s EXPECTED_HOSTNAME\n", argv[0]); + return 1; + } + + if (Curl_gethostname(buff, HOSTNAME_MAX)) { + printf("Curl_gethostname() failed\n"); + return 1; + } + + /* compare the name returned by Curl_gethostname() with the expected one */ + if(strncmp(buff, argv[1], HOSTNAME_MAX)) { + printf("got unexpected host name back, LD_PRELOAD failed\n"); + return 1; + } + return 0; +} diff --git a/tests/libtest/first.c b/tests/libtest/first.c new file mode 100644 index 0000000..a0e713f --- /dev/null +++ b/tests/libtest/first.c @@ -0,0 +1,98 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_LOCALE_H +#include <locale.h> /* for setlocale() */ +#endif + +#ifdef CURLDEBUG +# define MEMDEBUG_NODEFINES +# include "memdebug.h" +#endif + +int select_test (int num_fds, fd_set *rd, fd_set *wr, fd_set *exc, + struct timeval *tv) +{ +#ifdef USE_WINSOCK + /* Winsock doesn't like no socket set in 'rd', 'wr' or 'exc'. This is + * case when 'num_fds <= 0. So sleep. + */ + if (num_fds <= 0) { + Sleep(1000*tv->tv_sec + tv->tv_usec/1000); + return 0; + } +#endif + return select(num_fds, rd, wr, exc, tv); +} + +char *libtest_arg2=NULL; +char *libtest_arg3=NULL; +int test_argc; +char **test_argv; + + +int main(int argc, char **argv) +{ + char *URL; + +#ifdef CURLDEBUG + /* this sends all memory debug messages to a logfile named memdump */ + char *env = curl_getenv("CURL_MEMDEBUG"); + if(env) { + /* use the value as file name */ + char *s = strdup(env); + curl_free(env); + curl_memdebug(s); + free(s); + /* this weird strdup() and stuff here is to make the curl_free() get + called before the memdebug() as otherwise the memdebug tracing will + with tracing a free() without an alloc! */ + } + /* this enables the fail-on-alloc-number-N functionality */ + env = curl_getenv("CURL_MEMLIMIT"); + if(env) { + char *endptr; + long num = strtol(env, &endptr, 10); + if((endptr != env) && (endptr == env + strlen(env)) && (num > 0)) + curl_memlimit(num); + curl_free(env); + } +#endif + + /* + * Setup proper locale from environment. This is needed to enable locale- + * specific behaviour by the C library in order to test for undesired side + * effects that could cause in libcurl. + */ +#ifdef HAVE_SETLOCALE + setlocale(LC_ALL, ""); +#endif + + if(argc< 2 ) { + fprintf(stderr, "Pass URL as argument please\n"); + return 1; + } + + test_argc = argc; + test_argv = argv; + + if(argc>2) + libtest_arg2=argv[2]; + + if(argc>3) + libtest_arg3=argv[3]; + + URL = argv[1]; /* provide this to the rest */ + + fprintf(stderr, "URL: %s\n", URL); + + return test(URL); +} diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c new file mode 100644 index 0000000..dc6967c --- /dev/null +++ b/tests/libtest/lib500.c @@ -0,0 +1,53 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + char *ipstr=NULL; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_HEADER, 1L); + + res = curl_easy_perform(curl); + + if(!res) { + FILE *moo; + res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ipstr); + moo = fopen(libtest_arg2, "wb"); + if(moo) { + fprintf(moo, "IP: %s\n", ipstr); + fclose(moo); + } + } + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib501.c b/tests/libtest/lib501.c new file mode 100644 index 0000000..770cf8f --- /dev/null +++ b/tests/libtest/lib501.c @@ -0,0 +1,43 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + (void)URL; /* we don't use this */ + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_HEADER, 1L); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib502.c b/tests/libtest/lib502.c new file mode 100644 index 0000000..f6be5aa --- /dev/null +++ b/tests/libtest/lib502.c @@ -0,0 +1,94 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +/* + * Get a single URL without select(). + */ + +int test(char *URL) +{ + CURL *c; + CURLM *m = NULL; + int res = 0; + int running=1; + struct timeval mp_start; + char mp_timedout = FALSE; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((c = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(c, CURLOPT_URL, URL); + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_easy_cleanup(c); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((res = (int)curl_multi_add_handle(m, c)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", res); + curl_multi_cleanup(m); + curl_easy_cleanup(c); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + while (running) { + res = (int)curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + if (running <= 0) { + fprintf(stderr, "nothing left running.\n"); + break; + } + } + + if (mp_timedout) { + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + +test_cleanup: + + if(m) { + curl_multi_remove_handle(m, c); + curl_multi_cleanup(m); + } + curl_easy_cleanup(c); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib503.c b/tests/libtest/lib503.c new file mode 100644 index 0000000..2301186 --- /dev/null +++ b/tests/libtest/lib503.c @@ -0,0 +1,152 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include <sys/types.h> + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +/* + * Source code in here hugely as reported in bug report 651460 by + * Christopher R. Palmer. + * + * Use multi interface to get HTTPS document over proxy, and provide + * auth info. + */ + +int test(char *URL) +{ + CURL *c; + CURLM *m = NULL; + int res = 0; + int running; + char done = FALSE; + struct timeval ml_start; + struct timeval mp_start; + char ml_timedout = FALSE; + char mp_timedout = FALSE; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((c = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(c, CURLOPT_PROXY, libtest_arg2); /* set in first.c */ + test_setopt(c, CURLOPT_URL, URL); + test_setopt(c, CURLOPT_USERPWD, "test:ing"); + test_setopt(c, CURLOPT_PROXYUSERPWD, "test:ing"); + test_setopt(c, CURLOPT_HTTPPROXYTUNNEL, 1L); + test_setopt(c, CURLOPT_HEADER, 1L); + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_easy_cleanup(c); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((res = (int)curl_multi_add_handle(m, c)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", res); + curl_multi_cleanup(m); + curl_easy_cleanup(c); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + ml_timedout = FALSE; + ml_start = tutil_tvnow(); + + while(!done) { + fd_set rd, wr, exc; + int max_fd; + struct timeval interval; + + interval.tv_sec = 1; + interval.tv_usec = 0; + + if (tutil_tvdiff(tutil_tvnow(), ml_start) > + MAIN_LOOP_HANG_TIMEOUT) { + ml_timedout = TRUE; + break; + } + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + while (res == CURLM_CALL_MULTI_PERFORM) { + res = (int)curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + if (running <= 0) { + done = TRUE; + break; + } + } + if (mp_timedout || done) + break; + + if (res != CURLM_OK) { + fprintf(stderr, "not okay???\n"); + break; + } + + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_ZERO(&exc); + max_fd = 0; + + if (curl_multi_fdset(m, &rd, &wr, &exc, &max_fd) != CURLM_OK) { + fprintf(stderr, "unexpected failured of fdset.\n"); + res = 89; + break; + } + + if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) { + fprintf(stderr, "bad select??\n"); + res = 95; + break; + } + + res = CURLM_CALL_MULTI_PERFORM; + } + + if (ml_timedout || mp_timedout) { + if (ml_timedout) fprintf(stderr, "ml_timedout\n"); + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + +test_cleanup: + + if(m) { + curl_multi_remove_handle(m, c); + curl_multi_cleanup(m); + } + curl_easy_cleanup(c); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib504.c b/tests/libtest/lib504.c new file mode 100644 index 0000000..b8091f6 --- /dev/null +++ b/tests/libtest/lib504.c @@ -0,0 +1,161 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include <sys/types.h> + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +/* + * Source code in here hugely as reported in bug report 651464 by + * Christopher R. Palmer. + * + * Use multi interface to get document over proxy with bad port number. + * This caused the interface to "hang" in libcurl 7.10.2. + */ +int test(char *URL) +{ + CURL *c; + int res = 0; + CURLM *m = NULL; + fd_set rd, wr, exc; + CURLMcode ret; + char done = FALSE; + int running; + int max_fd; + int rc; + struct timeval ml_start; + struct timeval mp_start; + char ml_timedout = FALSE; + char mp_timedout = FALSE; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((c = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* The point here is that there must not be anything running on the given + proxy port */ + if (libtest_arg2) + test_setopt(c, CURLOPT_PROXY, libtest_arg2); + test_setopt(c, CURLOPT_URL, URL); + test_setopt(c, CURLOPT_VERBOSE, 1L); + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_easy_cleanup(c); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((ret = curl_multi_add_handle(m, c)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", ret); + curl_multi_cleanup(m); + curl_easy_cleanup(c); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + ml_timedout = FALSE; + ml_start = tutil_tvnow(); + + while (!done) { + struct timeval interval; + + interval.tv_sec = 1; + interval.tv_usec = 0; + + if (tutil_tvdiff(tutil_tvnow(), ml_start) > + MAIN_LOOP_HANG_TIMEOUT) { + ml_timedout = TRUE; + break; + } + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + fprintf(stderr, "curl_multi_perform()\n"); + + ret = CURLM_CALL_MULTI_PERFORM; + + while (ret == CURLM_CALL_MULTI_PERFORM) { + ret = curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + } + if (mp_timedout) + break; + + if(!running) { + /* This is where this code is expected to reach */ + int numleft; + CURLMsg *msg = curl_multi_info_read(m, &numleft); + fprintf(stderr, "Expected: not running\n"); + if(msg && !numleft) + res = 100; /* this is where we should be */ + else + res = 99; /* not correct */ + break; + } + fprintf(stderr, "running == %d, ret == %d\n", running, ret); + + if (ret != CURLM_OK) { + res = 2; + break; + } + + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_ZERO(&exc); + max_fd = 0; + + fprintf(stderr, "curl_multi_fdset()\n"); + if (curl_multi_fdset(m, &rd, &wr, &exc, &max_fd) != CURLM_OK) { + fprintf(stderr, "unexpected failured of fdset.\n"); + res = 3; + break; + } + rc = select_test(max_fd+1, &rd, &wr, &exc, &interval); + fprintf(stderr, "select returned %d\n", rc); + } + + if (ml_timedout || mp_timedout) { + if (ml_timedout) fprintf(stderr, "ml_timedout\n"); + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + +test_cleanup: + + if(m) { + curl_multi_remove_handle(m, c); + curl_multi_cleanup(m); + } + curl_easy_cleanup(c); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c new file mode 100644 index 0000000..5af7ac0 --- /dev/null +++ b/tests/libtest/lib505.c @@ -0,0 +1,151 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include "memdebug.h" + +/* + * This example shows an FTP upload, with a rename of the file just after + * a successful upload. + * + * Example based on source code provided by Erick Nuwendam. Thanks! + */ + +int test(char *URL) +{ + CURL *curl; + CURLcode res = CURLE_OK; + FILE *hd_src ; + int hd ; + struct_stat file_info; + struct curl_slist *hl; + int error; + + struct curl_slist *headerlist=NULL; + const char *buf_1 = "RNFR 505"; + const char *buf_2 = "RNTO 505-forreal"; + + if (!libtest_arg2) { + fprintf(stderr, "Usage: <url> <file-to-upload>\n"); + return -1; + } + + hd_src = fopen(libtest_arg2, "rb"); + if(NULL == hd_src) { + error = ERRNO; + fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error)); + fprintf(stderr, "Error opening file: %s\n", libtest_arg2); + return -2; /* if this happens things are major weird */ + } + + /* get the file size of the local file */ + hd = fstat(fileno(hd_src), &file_info); + if(hd == -1) { + /* can't open file, bail out */ + error = ERRNO; + fprintf(stderr, "fstat() failed with error: %d %s\n", + error, strerror(error)); + fprintf(stderr, "ERROR: cannot open file %s\n", libtest_arg2); + fclose(hd_src); + return -1; + } + + if(! file_info.st_size) { + fprintf(stderr, "ERROR: file %s has zero size!\n", libtest_arg2); + fclose(hd_src); + return -4; + } + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + fclose(hd_src); + return TEST_ERR_MAJOR_BAD; + } + + /* get a curl handle */ + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + fclose(hd_src); + return TEST_ERR_MAJOR_BAD; + } + + /* build a list of commands to pass to libcurl */ + + if ((hl = curl_slist_append(headerlist, buf_1)) == NULL) { + fprintf(stderr, "curl_slist_append() failed\n"); + curl_easy_cleanup(curl); + curl_global_cleanup(); + fclose(hd_src); + return TEST_ERR_MAJOR_BAD; + } + if ((headerlist = curl_slist_append(hl, buf_2)) == NULL) { + fprintf(stderr, "curl_slist_append() failed\n"); + curl_slist_free_all(hl); + curl_easy_cleanup(curl); + curl_global_cleanup(); + fclose(hd_src); + return TEST_ERR_MAJOR_BAD; + } + headerlist = hl; + + /* enable uploading */ + test_setopt(curl, CURLOPT_UPLOAD, 1L); + + /* enable verbose */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* specify target */ + test_setopt(curl,CURLOPT_URL, URL); + + /* pass in that last of FTP commands to run after the transfer */ + test_setopt(curl, CURLOPT_POSTQUOTE, headerlist); + + /* now specify which file to upload */ + test_setopt(curl, CURLOPT_INFILE, hd_src); + + /* and give the size of the upload (optional) */ + test_setopt(curl, CURLOPT_INFILESIZE_LARGE, + (curl_off_t)file_info.st_size); + + /* Now run off and do what you've been told! */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* clean up the FTP commands list */ + curl_slist_free_all(headerlist); + + /* close the local file */ + fclose(hd_src); + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c new file mode 100644 index 0000000..9209056 --- /dev/null +++ b/tests/libtest/lib506.c @@ -0,0 +1,268 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" +#include <stdlib.h> +#include <ctype.h> +#include <errno.h> + +#include <curl/mprintf.h> + +#include "memdebug.h" + +static const char *HOSTHEADER = "Host: www.host.foo.com"; +static const char *JAR = "log/jar506"; +#define THREADS 2 + +/* struct containing data of a thread */ +struct Tdata { + CURLSH *share; + char *url; +}; + +struct userdata { + char *text; + int counter; +}; + +/* lock callback */ +static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess, + void *useptr ) +{ + const char *what; + struct userdata *user = (struct userdata *)useptr; + + (void)handle; + (void)laccess; + + switch ( data ) { + case CURL_LOCK_DATA_SHARE: + what = "share"; + break; + case CURL_LOCK_DATA_DNS: + what = "dns"; + break; + case CURL_LOCK_DATA_COOKIE: + what = "cookie"; + break; + default: + fprintf(stderr, "lock: no such data: %d\n", (int)data); + return; + } + printf("lock: %-6s [%s]: %d\n", what, user->text, user->counter); + user->counter++; +} + +/* unlock callback */ +static void my_unlock(CURL *handle, curl_lock_data data, void *useptr ) +{ + const char *what; + struct userdata *user = (struct userdata *)useptr; + (void)handle; + switch ( data ) { + case CURL_LOCK_DATA_SHARE: + what = "share"; + break; + case CURL_LOCK_DATA_DNS: + what = "dns"; + break; + case CURL_LOCK_DATA_COOKIE: + what = "cookie"; + break; + default: + fprintf(stderr, "unlock: no such data: %d\n", (int)data); + return; + } + printf("unlock: %-6s [%s]: %d\n", what, user->text, user->counter); + user->counter++; +} + + +/* build host entry */ +static struct curl_slist *sethost(struct curl_slist *headers) +{ + (void)headers; + return curl_slist_append(NULL, HOSTHEADER ); +} + + +/* the dummy thread function */ +static void *fire(void *ptr) +{ + CURLcode code; + struct curl_slist *headers; + struct Tdata *tdata = (struct Tdata*)ptr; + CURL *curl; + int i=0; + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + return NULL; + } + + headers = sethost(NULL); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + curl_easy_setopt(curl, CURLOPT_URL, tdata->url); + printf( "CURLOPT_SHARE\n" ); + curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share); + + printf( "PERFORM\n" ); + code = curl_easy_perform(curl); + if( code != CURLE_OK ) { + fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n", + tdata->url, i, (int)code); + } + + printf( "CLEANUP\n" ); + curl_easy_cleanup(curl); + curl_slist_free_all(headers); + + return NULL; +} + + +/* build request url */ +static char *suburl(const char *base, int i) +{ + return curl_maprintf("%s%.4d", base, i); +} + + +/* test function */ +int test(char *URL) +{ + int res; + CURLSHcode scode = CURLSHE_OK; + char *url; + struct Tdata tdata; + CURL *curl; + CURLSH *share; + struct curl_slist *headers; + int i; + struct userdata user; + + user.text = (char *)"Pigs in space"; + user.counter = 0; + + printf( "GLOBAL_INIT\n" ); + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + /* prepare share */ + printf( "SHARE_INIT\n" ); + if ((share = curl_share_init()) == NULL) { + fprintf(stderr, "curl_share_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ( CURLSHE_OK == scode ) { + printf( "CURLSHOPT_LOCKFUNC\n" ); + scode = curl_share_setopt( share, CURLSHOPT_LOCKFUNC, my_lock); + } + if ( CURLSHE_OK == scode ) { + printf( "CURLSHOPT_UNLOCKFUNC\n" ); + scode = curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, my_unlock); + } + if ( CURLSHE_OK == scode ) { + printf( "CURLSHOPT_USERDATA\n" ); + scode = curl_share_setopt( share, CURLSHOPT_USERDATA, &user); + } + if ( CURLSHE_OK == scode ) { + printf( "CURL_LOCK_DATA_COOKIE\n" ); + scode = curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE); + } + if ( CURLSHE_OK == scode ) { + printf( "CURL_LOCK_DATA_DNS\n" ); + scode = curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); + } + + if ( CURLSHE_OK != scode ) { + fprintf(stderr, "curl_share_setopt() failed\n"); + curl_share_cleanup(share); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + + res = 0; + + /* start treads */ + for (i=1; i<=THREADS; i++ ) { + + /* set thread data */ + tdata.url = suburl( URL, i ); /* must be curl_free()d */ + tdata.share = share; + + /* simulate thread, direct call of "thread" function */ + printf( "*** run %d\n",i ); + fire( &tdata ); + + curl_free( tdata.url ); + + } + + + /* fetch a another one and save cookies */ + printf( "*** run %d\n", i ); + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_share_cleanup(share); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + url = suburl( URL, i ); + headers = sethost( NULL ); + test_setopt( curl, CURLOPT_HTTPHEADER, headers ); + test_setopt( curl, CURLOPT_URL, url ); + printf( "CURLOPT_SHARE\n" ); + test_setopt( curl, CURLOPT_SHARE, share ); + printf( "CURLOPT_COOKIEJAR\n" ); + test_setopt( curl, CURLOPT_COOKIEJAR, JAR ); + + printf( "PERFORM\n" ); + curl_easy_perform( curl ); + + /* try to free share, expect to fail because share is in use*/ + printf( "try SHARE_CLEANUP...\n" ); + scode = curl_share_cleanup( share ); + if ( scode==CURLSHE_OK ) + { + fprintf(stderr, "curl_share_cleanup succeed but error expected\n"); + share = NULL; + } else { + printf( "SHARE_CLEANUP failed, correct\n" ); + } + +test_cleanup: + + /* clean up last handle */ + printf( "CLEANUP\n" ); + curl_easy_cleanup( curl ); + curl_slist_free_all( headers ); + + curl_free(url); + + /* free share */ + printf( "SHARE_CLEANUP\n" ); + scode = curl_share_cleanup( share ); + if ( scode!=CURLSHE_OK ) + fprintf(stderr, "curl_share_cleanup failed, code errno %d\n", + (int)scode); + + printf( "GLOBAL_CLEANUP\n" ); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib507.c b/tests/libtest/lib507.c new file mode 100644 index 0000000..9707c9b --- /dev/null +++ b/tests/libtest/lib507.c @@ -0,0 +1,141 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +int test(char *URL) +{ + CURL* curls; + CURLM* multi; + int still_running; + int i = -1; + int res = 0; + CURLMsg *msg; + CURLMcode ret; + struct timeval ml_start; + struct timeval mp_start; + char ml_timedout = FALSE; + char mp_timedout = FALSE; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((multi = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((curls = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_multi_cleanup(multi); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curls, CURLOPT_URL, URL); + + if ((ret = curl_multi_add_handle(multi, curls)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", ret); + curl_easy_cleanup(curls); + curl_multi_cleanup(multi); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + do { + ret = curl_multi_perform(multi, &still_running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + } while (ret == CURLM_CALL_MULTI_PERFORM); + + ml_timedout = FALSE; + ml_start = tutil_tvnow(); + + while ((!ml_timedout) && (!mp_timedout) && (still_running)) { + struct timeval timeout; + int rc; + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + if (tutil_tvdiff(tutil_tvnow(), ml_start) > + MAIN_LOOP_HANG_TIMEOUT) { + ml_timedout = TRUE; + break; + } + + curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd); + rc = select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + switch(rc) { + case -1: + break; + case 0: + default: + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + do { + ret = curl_multi_perform(multi, &still_running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + } while (ret == CURLM_CALL_MULTI_PERFORM); + break; + } + } + if (ml_timedout || mp_timedout) { + if (ml_timedout) fprintf(stderr, "ml_timedout\n"); + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + i = TEST_ERR_RUNS_FOREVER; + } + else { + msg = curl_multi_info_read(multi, &still_running); + if(msg) + /* this should now contain a result code from the easy handle, + get it */ + i = msg->data.result; + } + +test_cleanup: + + curl_multi_cleanup(multi); + curl_easy_cleanup(curls); + curl_global_cleanup(); + + if(res) + i = res; + + return i; /* return the final return code */ +} diff --git a/tests/libtest/lib508.c b/tests/libtest/lib508.c new file mode 100644 index 0000000..0fa5eb9 --- /dev/null +++ b/tests/libtest/lib508.c @@ -0,0 +1,95 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +static char data[]="this is what we post to the silly web server\n"; + +struct WriteThis { + char *readptr; + size_t sizeleft; +}; + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) +{ + struct WriteThis *pooh = (struct WriteThis *)userp; + + if(size*nmemb < 1) + return 0; + + if(pooh->sizeleft) { + *(char *)ptr = pooh->readptr[0]; /* copy one single byte */ + pooh->readptr++; /* advance pointer */ + pooh->sizeleft--; /* less data left */ + return 1; /* we return 1 byte at a time! */ + } + + return 0; /* no more data left to deliver */ +} + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + + struct WriteThis pooh; + + pooh.readptr = data; + pooh.sizeleft = strlen(data); + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + + /* Now specify we want to POST data */ + test_setopt(curl, CURLOPT_POST, 1L); + +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + + /* Set the expected POST size */ + test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)pooh.sizeleft); + + /* we want to use our own read function */ + test_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* pointer to pass to our read function */ + test_setopt(curl, CURLOPT_INFILE, &pooh); + + /* get verbose debug output please */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* include headers in the output */ + test_setopt(curl, CURLOPT_HEADER, 1L); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib510.c b/tests/libtest/lib510.c new file mode 100644 index 0000000..f3f8cdb --- /dev/null +++ b/tests/libtest/lib510.c @@ -0,0 +1,118 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +static const char *post[]={ + "one", + "two", + "three", + "and a final longer crap: four", + NULL +}; + + +struct WriteThis { + int counter; +}; + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) +{ + struct WriteThis *pooh = (struct WriteThis *)userp; + const char *data; + + if(size*nmemb < 1) + return 0; + + data = post[pooh->counter]; + + if(data) { + size_t len = strlen(data); + memcpy(ptr, data, len); + pooh->counter++; /* advance pointer */ + return len; + } + return 0; /* no more data left to deliver */ +} + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + struct curl_slist *slist = NULL; + struct WriteThis pooh; + pooh.counter = 0; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + slist = curl_slist_append(slist, "Transfer-Encoding: chunked"); + if (slist == NULL) { + fprintf(stderr, "curl_slist_append() failed\n"); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + + /* Now specify we want to POST data */ + test_setopt(curl, CURLOPT_POST, 1L); + +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + + /* we want to use our own read function */ + test_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* pointer to pass to our read function */ + test_setopt(curl, CURLOPT_INFILE, &pooh); + + /* get verbose debug output please */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* include headers in the output */ + test_setopt(curl, CURLOPT_HEADER, 1L); + + /* enforce chunked transfer by setting the header */ + test_setopt(curl, CURLOPT_HTTPHEADER, slist); + +#ifdef LIB565 + test_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + test_setopt(curl, CURLOPT_USERPWD, "foo:bar"); +#endif + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* clean up the headers list */ + if(slist) + curl_slist_free_all(slist); + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib511.c b/tests/libtest/lib511.c new file mode 100644 index 0000000..dea97c5 --- /dev/null +++ b/tests/libtest/lib511.c @@ -0,0 +1,43 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_FILETIME, 1L); + test_setopt(curl, CURLOPT_NOBODY, 1L); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} diff --git a/tests/libtest/lib512.c b/tests/libtest/lib512.c new file mode 100644 index 0000000..9f59f7b --- /dev/null +++ b/tests/libtest/lib512.c @@ -0,0 +1,65 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +/* Test case code based on source in a bug report filed by James Bursa on + 28 Apr 2004 */ + +int test(char *URL) +{ + CURLcode code; + CURL *curl; + CURL *curl2; + int rc = 99; + + code = curl_global_init(CURL_GLOBAL_ALL); + if(code == CURLE_OK) { + + curl = curl_easy_init(); + if(curl) { + + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_HEADER, 1L); + + curl2 = curl_easy_duphandle(curl); + if(curl2) { + + code = curl_easy_setopt(curl2, CURLOPT_URL, URL); + if(code == CURLE_OK) { + + code = curl_easy_perform(curl2); + if(code == CURLE_OK) + rc = 0; + else + rc = 1; + } + else + rc = 2; + + curl_easy_cleanup(curl2); + } + else + rc = 3; + + curl_easy_cleanup(curl); + } + else + rc = 4; + + curl_global_cleanup(); + } + else + rc = 5; + + return rc; +} + diff --git a/tests/libtest/lib513.c b/tests/libtest/lib513.c new file mode 100644 index 0000000..c85006e --- /dev/null +++ b/tests/libtest/lib513.c @@ -0,0 +1,70 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) +{ + (void)ptr; + (void)size; + (void)nmemb; + (void)userp; + return CURL_READFUNC_ABORT; +} + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + + /* Now specify we want to POST data */ + test_setopt(curl, CURLOPT_POST, 1L); + + /* Set the expected POST size */ + test_setopt(curl, CURLOPT_POSTFIELDSIZE, 1L); + + /* we want to use our own read function */ + test_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* pointer to pass to our read function */ + test_setopt(curl, CURLOPT_INFILE, NULL); + + /* get verbose debug output please */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* include headers in the output */ + test_setopt(curl, CURLOPT_HEADER, 1L); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} diff --git a/tests/libtest/lib514.c b/tests/libtest/lib514.c new file mode 100644 index 0000000..283f89e --- /dev/null +++ b/tests/libtest/lib514.c @@ -0,0 +1,66 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + + /* Based on a bug report by Niels van Tongeren on June 29, 2004: + + A weird situation occurs when request 1 is a POST request and the request + 2 is a HEAD request. For the POST request we set the CURLOPT_POSTFIELDS, + CURLOPT_POSTFIELDSIZE and CURLOPT_POST options. For the HEAD request we + set the CURLOPT_NOBODY option to '1'. + + */ + + test_setopt(curl, CURLOPT_POSTFIELDS, "moo"); + test_setopt(curl, CURLOPT_POSTFIELDSIZE, 3L); + test_setopt(curl, CURLOPT_POST, 1L); + + /* this is where transfer 1 would take place, but skip that and change + options right away instead */ + + test_setopt(curl, CURLOPT_NOBODY, 1L); + + test_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */ + test_setopt(curl, CURLOPT_HEADER, 1L); /* include header */ + + /* Now, we should be making a fine HEAD request */ + + /* Perform the request 2, res will get the return code */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c new file mode 100644 index 0000000..2660ae3 --- /dev/null +++ b/tests/libtest/lib515.c @@ -0,0 +1,47 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_POSTFIELDS, NULL); + test_setopt(curl, CURLOPT_POSTFIELDSIZE, 0L); + test_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */ + test_setopt(curl, CURLOPT_HEADER, 1L); /* include header */ + + /* Now, we should be making a zero byte POST request */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} diff --git a/tests/libtest/lib516.c b/tests/libtest/lib516.c new file mode 100644 index 0000000..b796dbb --- /dev/null +++ b/tests/libtest/lib516.c @@ -0,0 +1,46 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_HTTPPOST, NULL); + test_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */ + test_setopt(curl, CURLOPT_HEADER, 1L); /* include header */ + + /* Now, we should be making a zero byte POST request */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} diff --git a/tests/libtest/lib517.c b/tests/libtest/lib517.c new file mode 100644 index 0000000..38a65d3 --- /dev/null +++ b/tests/libtest/lib517.c @@ -0,0 +1,116 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +static const char *dates[]={ + "Sun, 06 Nov 1994 08:49:37 GMT", + "Sunday, 06-Nov-94 08:49:37 GMT", + "Sun Nov 6 08:49:37 1994", + "06 Nov 1994 08:49:37 GMT", + "06-Nov-94 08:49:37 GMT", + "Nov 6 08:49:37 1994", + "06 Nov 1994 08:49:37", + "06-Nov-94 08:49:37", + "1994 Nov 6 08:49:37", + "GMT 08:49:37 06-Nov-94 Sunday", + "94 6 Nov 08:49:37", + "1994 Nov 6", + "06-Nov-94", + "Sun Nov 6 94", + "1994.Nov.6", + "Sun/Nov/6/94/GMT", + "Sun, 06 Nov 1994 08:49:37 CET", + "06 Nov 1994 08:49:37 EST", + "Sun, 12 Sep 2004 15:05:58 -0700", + "Sat, 11 Sep 2004 21:32:11 +0200", + "20040912 15:05:58 -0700", + "20040911 +0200", + "Thu, 01-Jan-1970 00:59:59 GMT", + "Thu, 01-Jan-1970 01:00:00 GMT", +/* "2094 Nov 6", See ../data/test517 for details */ + "Sat, 15-Apr-17 21:01:22 GMT", + "Thu, 19-Apr-2007 16:00:00 GMT", + "Wed, 25 Apr 2007 21:02:13 GMT", + "Thu, 19/Apr\\2007 16:00:00 GMT", + "Fri, 1 Jan 2010 01:01:50 GMT", + "Wednesday, 1-Jan-2003 00:00:00 GMT", + ", 1-Jan-2003 00:00:00 GMT", + " 1-Jan-2003 00:00:00 GMT", + "1-Jan-2003 00:00:00 GMT", + "Wed,18-Apr-07 22:50:12 GMT", + "WillyWonka , 18-Apr-07 22:50:12 GMT", + "WillyWonka , 18-Apr-07 22:50:12", + "WillyWonka , 18-apr-07 22:50:12", + "Mon, 18-Apr-1977 22:50:13 GMT", + "Mon, 18-Apr-77 22:50:13 GMT", + "\"Sat, 15-Apr-17\\\"21:01:22\\\"GMT\"", + "Partyday, 18- April-07 22:50:12", + "Partyday, 18 - Apri-07 22:50:12", + "Wednes, 1-Januar-2003 00:00:00 GMT", + "Sat, 15-Apr-17 21:01:22", + "Sat, 15-Apr-17 21:01:22 GMT-2", + "Sat, 15-Apr-17 21:01:22 GMT BLAH", + "Sat, 15-Apr-17 21:01:22 GMT-0400", + "Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)", + "Sat, 15-Apr-17 21:01:22 DST", + "Sat, 15-Apr-17 21:01:22 -0400", + "Sat, 15-Apr-17 21:01:22 (hello there)", + "Sat, 15-Apr-17 21:01:22 11:22:33", + "Sat, 15-Apr-17 ::00 21:01:22", + "Sat, 15-Apr-17 boink:z 21:01:22", + "Sat, 15-Apr-17 91:22:33 21:01:22", + "Thu Apr 18 22:50:12 2007 GMT", + "22:50:12 Thu Apr 18 2007 GMT", + "Thu 22:50:12 Apr 18 2007 GMT", + "Thu Apr 22:50:12 18 2007 GMT", + "Thu Apr 18 22:50:12 2007 GMT", + "Thu Apr 18 2007 22:50:12 GMT", + "Thu Apr 18 2007 GMT 22:50:12", + "Sat, 15-Apr-17 21:01:22 GMT", + "15-Sat, Apr-17 21:01:22 GMT", + "15-Sat, Apr 21:01:22 GMT 17", + "15-Sat, Apr 21:01:22 GMT 2017", + "15 Apr 21:01:22 2017", + "15 17 Apr 21:01:22", + "Apr 15 17 21:01:22", + "Apr 15 21:01:22 17", + "2017 April 15 21:01:22", + "15 April 2017 21:01:22", + "98 April 17 21:01:22", + "Thu, 012-Aug-2008 20:49:07 GMT", +#if 0 + /* leaving out these strings since they differ between 32 and 64 bit + archs and the test suite has no good way to support two different outputs + like that */ + "Thu, 12-Aug-31841 20:49:07 GMT", + "Thu, 12-Aug-9999999999 20:49:07 GMT", +#endif + "Thu, 999999999999-Aug-2007 20:49:07 GMT", + "Thu, 12-Aug-2007 20:61:99999999999 GMT", + "IAintNoDateFool", + "Thu Apr 18 22:50 2007 GMT", /* without seconds */ + + NULL +}; + +int test(char *URL) +{ + int i; + + (void)URL; /* not used */ + + for(i=0; dates[i]; i++) { + printf("%d: %s => %ld\n", i, dates[i], (long)curl_getdate(dates[i], NULL)); + } + + return 0; +} diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c new file mode 100644 index 0000000..9e683d9 --- /dev/null +++ b/tests/libtest/lib518.c @@ -0,0 +1,509 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_RESOURCE_H +#include <sys/resource.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#include "memdebug.h" + +#ifndef FD_SETSIZE +#error "this test requires FD_SETSIZE" +#endif + +#define SAFETY_MARGIN (16) +#define NUM_OPEN (FD_SETSIZE + 10) +#define NUM_NEEDED (NUM_OPEN + SAFETY_MARGIN) + +#if defined(WIN32) || defined(_WIN32) || defined(MSDOS) +#define DEV_NULL "NUL" +#else +#define DEV_NULL "/dev/null" +#endif + +#if defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) + +static int *fd = NULL; +static struct rlimit num_open; +static char msgbuff[256]; + +static void store_errmsg(const char *msg, int err) +{ + if (!err) + sprintf(msgbuff, "%s", msg); + else + sprintf(msgbuff, "%s, errno %d, %s", msg, err, strerror(err)); +} + +static void close_file_descriptors(void) +{ + for (num_open.rlim_cur = 0; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) + if (fd[num_open.rlim_cur] > 0) + close(fd[num_open.rlim_cur]); + free(fd); + fd = NULL; +} + +static int fopen_works(void) +{ + FILE *fpa[3]; + int i; + int ret = 1; + + for (i = 0; i < 3; i++) { + fpa[i] = NULL; + } + for (i = 0; i < 3; i++) { + fpa[i] = fopen(DEV_NULL, "r"); + if (fpa[i] == NULL) { + store_errmsg("fopen() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + ret = 0; + break; + } + } + for (i = 0; i < 3; i++) { + if (fpa[i] != NULL) + fclose(fpa[i]); + } + return ret; +} + +static int rlimit(int keep_open) +{ + int nitems, i; + int *memchunk = NULL; + char *fmt; + struct rlimit rl; + char strbuff[256]; + char strbuff1[81]; + char strbuff2[81]; + char fmt_u[] = "%u"; + char fmt_lu[] = "%lu"; +#ifdef HAVE_LONGLONG + char fmt_llu[] = "%llu"; + + if (sizeof(rl.rlim_max) > sizeof(long)) + fmt = fmt_llu; + else +#endif + fmt = (sizeof(rl.rlim_max) < sizeof(long))?fmt_u:fmt_lu; + + /* get initial open file limits */ + + if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { + store_errmsg("getrlimit() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + return -1; + } + + /* show initial open file limits */ + +#ifdef RLIM_INFINITY + if (rl.rlim_cur == RLIM_INFINITY) + strcpy(strbuff, "INFINITY"); + else +#endif + sprintf(strbuff, fmt, rl.rlim_cur); + fprintf(stderr, "initial soft limit: %s\n", strbuff); + +#ifdef RLIM_INFINITY + if (rl.rlim_max == RLIM_INFINITY) + strcpy(strbuff, "INFINITY"); + else +#endif + sprintf(strbuff, fmt, rl.rlim_max); + fprintf(stderr, "initial hard limit: %s\n", strbuff); + + /* show our constants */ + + fprintf(stderr, "test518 FD_SETSIZE: %d\n", FD_SETSIZE); + fprintf(stderr, "test518 NUM_OPEN : %d\n", NUM_OPEN); + fprintf(stderr, "test518 NUM_NEEDED: %d\n", NUM_NEEDED); + + /* + * if soft limit and hard limit are different we ask the + * system to raise soft limit all the way up to the hard + * limit. Due to some other system limit the soft limit + * might not be raised up to the hard limit. So from this + * point the resulting soft limit is our limit. Trying to + * open more than soft limit file descriptors will fail. + */ + + if (rl.rlim_cur != rl.rlim_max) { + +#ifdef OPEN_MAX + if ((rl.rlim_cur > 0) && + (rl.rlim_cur < OPEN_MAX)) { + fprintf(stderr, "raising soft limit up to OPEN_MAX\n"); + rl.rlim_cur = OPEN_MAX; + if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { + /* on failure don't abort just issue a warning */ + store_errmsg("setrlimit() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + msgbuff[0] = '\0'; + } + } +#endif + + fprintf(stderr, "raising soft limit up to hard limit\n"); + rl.rlim_cur = rl.rlim_max; + if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { + /* on failure don't abort just issue a warning */ + store_errmsg("setrlimit() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + msgbuff[0] = '\0'; + } + + /* get current open file limits */ + + if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { + store_errmsg("getrlimit() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + return -3; + } + + /* show current open file limits */ + +#ifdef RLIM_INFINITY + if (rl.rlim_cur == RLIM_INFINITY) + strcpy(strbuff, "INFINITY"); + else +#endif + sprintf(strbuff, fmt, rl.rlim_cur); + fprintf(stderr, "current soft limit: %s\n", strbuff); + +#ifdef RLIM_INFINITY + if (rl.rlim_max == RLIM_INFINITY) + strcpy(strbuff, "INFINITY"); + else +#endif + sprintf(strbuff, fmt, rl.rlim_max); + fprintf(stderr, "current hard limit: %s\n", strbuff); + + } /* (rl.rlim_cur != rl.rlim_max) */ + + /* + * test 518 is all about testing libcurl functionality + * when more than FD_SETSIZE file descriptors are open. + * This means that if for any reason we are not able to + * open more than FD_SETSIZE file descriptors then test + * 518 should not be run. + */ + + /* + * verify that soft limit is higher than NUM_NEEDED, + * which is the number of file descriptors we would + * try to open plus SAFETY_MARGIN to not exhaust the + * file descriptor pool + */ + + num_open.rlim_cur = NUM_NEEDED; + + if ((rl.rlim_cur > 0) && +#ifdef RLIM_INFINITY + (rl.rlim_cur != RLIM_INFINITY) && +#endif + (rl.rlim_cur <= num_open.rlim_cur)) { + sprintf(strbuff2, fmt, rl.rlim_cur); + sprintf(strbuff1, fmt, num_open.rlim_cur); + sprintf(strbuff, "fds needed %s > system limit %s", + strbuff1, strbuff2); + store_errmsg(strbuff, 0); + fprintf(stderr, "%s\n", msgbuff); + return -4; + } + + /* + * reserve a chunk of memory before opening file descriptors to + * avoid a low memory condition once the file descriptors are + * open. System conditions that could make the test fail should + * be addressed in the precheck phase. This chunk of memory shall + * be always free()ed before exiting the rlimit() function so + * that it becomes available to the test. + */ + + for (nitems = i = 1; nitems <= i; i *= 2) + nitems = i; + if (nitems > 0x7fff) + nitems = 0x40000; + do { + num_open.rlim_max = sizeof(*memchunk) * (size_t)nitems; + sprintf(strbuff, fmt, num_open.rlim_max); + fprintf(stderr, "allocating memchunk %s byte array\n", strbuff); + memchunk = malloc(sizeof(*memchunk) * (size_t)nitems); + if (!memchunk) { + fprintf(stderr, "memchunk, malloc() failed\n"); + nitems /= 2; + } + } while (nitems && !memchunk); + if (!memchunk) { + store_errmsg("memchunk, malloc() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + return -5; + } + + /* initialize it to fight lazy allocation */ + + fprintf(stderr, "initializing memchunk array\n"); + + for (i = 0; i < nitems; i++) + memchunk[i] = -1; + + /* set the number of file descriptors we will try to open */ + + num_open.rlim_max = NUM_OPEN; + + /* verify that we won't overflow size_t in malloc() */ + + if ((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) { + sprintf(strbuff1, fmt, num_open.rlim_max); + sprintf(strbuff, "unable to allocate an array for %s " + "file descriptors, would overflow size_t", strbuff1); + store_errmsg(strbuff, 0); + fprintf(stderr, "%s\n", msgbuff); + free(memchunk); + return -6; + } + + /* allocate array for file descriptors */ + + sprintf(strbuff, fmt, num_open.rlim_max); + fprintf(stderr, "allocating array for %s file descriptors\n", strbuff); + + fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max)); + if (!fd) { + store_errmsg("fd, malloc() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + free(memchunk); + return -7; + } + + /* initialize it to fight lazy allocation */ + + fprintf(stderr, "initializing fd array\n"); + + for (num_open.rlim_cur = 0; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) + fd[num_open.rlim_cur] = -1; + + sprintf(strbuff, fmt, num_open.rlim_max); + fprintf(stderr, "trying to open %s file descriptors\n", strbuff); + + /* open a dummy descriptor */ + + fd[0] = open(DEV_NULL, O_RDONLY); + if (fd[0] < 0) { + sprintf(strbuff, "opening of %s failed", DEV_NULL); + store_errmsg(strbuff, ERRNO); + fprintf(stderr, "%s\n", msgbuff); + free(fd); + fd = NULL; + free(memchunk); + return -8; + } + + /* create a bunch of file descriptors */ + + for (num_open.rlim_cur = 1; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) { + + fd[num_open.rlim_cur] = dup(fd[0]); + + if (fd[num_open.rlim_cur] < 0) { + + fd[num_open.rlim_cur] = -1; + + sprintf(strbuff1, fmt, num_open.rlim_cur); + sprintf(strbuff, "dup() attempt %s failed", strbuff1); + fprintf(stderr, "%s\n", strbuff); + + sprintf(strbuff1, fmt, num_open.rlim_cur); + sprintf(strbuff, "fds system limit seems close to %s", strbuff1); + fprintf(stderr, "%s\n", strbuff); + + num_open.rlim_max = NUM_NEEDED; + + sprintf(strbuff2, fmt, num_open.rlim_max); + sprintf(strbuff1, fmt, num_open.rlim_cur); + sprintf(strbuff, "fds needed %s > system limit %s", + strbuff2, strbuff1); + store_errmsg(strbuff, 0); + fprintf(stderr, "%s\n", msgbuff); + + for (num_open.rlim_cur = 0; + fd[num_open.rlim_cur] >= 0; + num_open.rlim_cur++) + close(fd[num_open.rlim_cur]); + free(fd); + fd = NULL; + free(memchunk); + return -9; + + } + + } + + sprintf(strbuff, fmt, num_open.rlim_max); + fprintf(stderr, "%s file descriptors open\n", strbuff); + +#if !defined(HAVE_POLL_FINE) && \ + !defined(USE_WINSOCK) && \ + !defined(TPF) + + /* + * when using select() instead of poll() we cannot test + * libcurl functionality with a socket number equal or + * greater than FD_SETSIZE. In any case, macro VERIFY_SOCK + * in lib/select.c enforces this check and protects libcurl + * from a possible crash. The effect of this protection + * is that test 518 will always fail, since the actual + * call to select() never takes place. We skip test 518 + * with an indication that select limit would be exceeded. + */ + + num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN; + if (num_open.rlim_max > num_open.rlim_cur) { + sprintf(strbuff, "select limit is FD_SETSIZE %d", FD_SETSIZE); + store_errmsg(strbuff, 0); + fprintf(stderr, "%s\n", msgbuff); + close_file_descriptors(); + free(memchunk); + return -10; + } + + num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN; + for (rl.rlim_cur = 0; + rl.rlim_cur < num_open.rlim_max; + rl.rlim_cur++) { + if ((fd[rl.rlim_cur] > 0) && + ((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) { + sprintf(strbuff, "select limit is FD_SETSIZE %d", FD_SETSIZE); + store_errmsg(strbuff, 0); + fprintf(stderr, "%s\n", msgbuff); + close_file_descriptors(); + free(memchunk); + return -11; + } + } + +#endif /* using a FD_SETSIZE bound select() */ + + /* + * Old or 'backwards compatible' implementations of stdio do not allow + * handling of streams with an underlying file descriptor number greater + * than 255, even when allowing high numbered file descriptors for sockets. + * At this point we have a big number of file descriptors which have been + * opened using dup(), so lets test the stdio implementation and discover + * if it is capable of fopen()ing some additional files. + */ + + if (!fopen_works()) { + sprintf(strbuff1, fmt, num_open.rlim_max); + sprintf(strbuff, "stdio fopen() fails with %s fds open()", + strbuff1); + fprintf(stderr, "%s\n", msgbuff); + sprintf(strbuff, "stdio fopen() fails with lots of fds open()"); + store_errmsg(strbuff, 0); + close_file_descriptors(); + free(memchunk); + return -12; + } + + /* free the chunk of memory we were reserving so that it + becomes becomes available to the test */ + + free(memchunk); + + /* close file descriptors unless instructed to keep them */ + + if (!keep_open) { + close_file_descriptors(); + } + + return 0; +} + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if(!strcmp(URL, "check")) { + /* used by the test script to ask if we can run this test or not */ + if(rlimit(FALSE)) { + fprintf(stdout, "rlimit problem: %s\n", msgbuff); + return 1; + } + return 0; /* sure, run this! */ + } + + if (rlimit(TRUE)) { + /* failure */ + return TEST_ERR_MAJOR_BAD; + } + + /* run the test with the bunch of open file descriptors + and close them all once the test is over */ + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + close_file_descriptors(); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + close_file_descriptors(); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_HEADER, 1L); + + res = curl_easy_perform(curl); + +test_cleanup: + + close_file_descriptors(); + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + +#else /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */ + +int test(char *URL) +{ + (void)URL; + printf("system lacks necessary system function(s)"); + return 1; /* skip test */ +} + +#endif /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */ diff --git a/tests/libtest/lib519.c b/tests/libtest/lib519.c new file mode 100644 index 0000000..f885c5d --- /dev/null +++ b/tests/libtest/lib519.c @@ -0,0 +1,50 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_USERPWD, "monster:underbed"); + test_setopt(curl, CURLOPT_HEADER, 1L); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* get first page */ + res = curl_easy_perform(curl); + + test_setopt(curl, CURLOPT_USERPWD, "anothermonster:inwardrobe"); + + /* get second page */ + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib520.c b/tests/libtest/lib520.c new file mode 100644 index 0000000..a0e1244 --- /dev/null +++ b/tests/libtest/lib520.c @@ -0,0 +1,42 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_FILETIME, 1L); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} diff --git a/tests/libtest/lib521.c b/tests/libtest/lib521.c new file mode 100644 index 0000000..9e79cb4 --- /dev/null +++ b/tests/libtest/lib521.c @@ -0,0 +1,44 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_PORT, strtol(libtest_arg2, NULL, 10)); + test_setopt(curl, CURLOPT_USERPWD, "xxx:yyy"); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib523.c b/tests/libtest/lib523.c new file mode 100644 index 0000000..a1ac4a4 --- /dev/null +++ b/tests/libtest/lib523.c @@ -0,0 +1,45 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_PROXY, libtest_arg2); + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_PORT, 19999L); + test_setopt(curl, CURLOPT_USERPWD, "xxx:yyy"); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib524.c b/tests/libtest/lib524.c new file mode 100644 index 0000000..ee52062 --- /dev/null +++ b/tests/libtest/lib524.c @@ -0,0 +1,43 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_UPLOAD, 1L); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib525.c b/tests/libtest/lib525.c new file mode 100644 index 0000000..ade6370 --- /dev/null +++ b/tests/libtest/lib525.c @@ -0,0 +1,211 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +int test(char *URL) +{ + int res = 0; + CURL *curl; + FILE *hd_src ; + int hd ; + int error; + struct_stat file_info; + int running; + char done=FALSE; + CURLM *m = NULL; + struct timeval ml_start; + struct timeval mp_start; + char ml_timedout = FALSE; + char mp_timedout = FALSE; + + if (!libtest_arg2) { + fprintf(stderr, "Usage: lib525 [url] [uploadfile]\n"); + return -1; + } + + hd_src = fopen(libtest_arg2, "rb"); + if(NULL == hd_src) { + error = ERRNO; + fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error)); + fprintf(stderr, "Error opening file: %s\n", libtest_arg2); + return TEST_ERR_MAJOR_BAD; + } + + /* get the file size of the local file */ + hd = fstat(fileno(hd_src), &file_info); + if(hd == -1) { + /* can't open file, bail out */ + error = ERRNO; + fprintf(stderr, "fstat() failed with error: %d %s\n", + error, strerror(error)); + fprintf(stderr, "ERROR: cannot open file %s\n", libtest_arg2); + fclose(hd_src); + return -1; + } + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + fclose(hd_src); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + fclose(hd_src); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* enable uploading */ + test_setopt(curl, CURLOPT_UPLOAD, 1L); + + /* specify target */ + test_setopt(curl,CURLOPT_URL, URL); + + /* go verbose */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* use active FTP */ + test_setopt(curl, CURLOPT_FTPPORT, "-"); + + /* now specify which file to upload */ + test_setopt(curl, CURLOPT_READDATA, hd_src); + + /* NOTE: if you want this code to work on Windows with libcurl as a DLL, you + MUST also provide a read callback with CURLOPT_READFUNCTION. Failing to + do so will give you a crash since a DLL may not use the variable's memory + when passed in to it from an app like this. */ + + /* Set the size of the file to upload (optional). If you give a *_LARGE + option you MUST make sure that the type of the passed-in argument is a + curl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you must + make sure that to pass in a type 'long' argument. */ + test_setopt(curl, CURLOPT_INFILESIZE_LARGE, + (curl_off_t)file_info.st_size); + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_easy_cleanup(curl); + curl_global_cleanup(); + fclose(hd_src); + return TEST_ERR_MAJOR_BAD; + } + + if ((res = (int)curl_multi_add_handle(m, curl)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", res); + curl_multi_cleanup(m); + curl_easy_cleanup(curl); + curl_global_cleanup(); + fclose(hd_src); + return TEST_ERR_MAJOR_BAD; + } + + ml_timedout = FALSE; + ml_start = tutil_tvnow(); + + while (!done) { + fd_set rd, wr, exc; + int max_fd; + struct timeval interval; + + interval.tv_sec = 1; + interval.tv_usec = 0; + + if (tutil_tvdiff(tutil_tvnow(), ml_start) > + MAIN_LOOP_HANG_TIMEOUT) { + ml_timedout = TRUE; + break; + } + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + while (res == CURLM_CALL_MULTI_PERFORM) { + res = (int)curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + if (running <= 0) { + done = TRUE; + break; + } + } + if (mp_timedout || done) + break; + + if (res != CURLM_OK) { + fprintf(stderr, "not okay???\n"); + break; + } + + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_ZERO(&exc); + max_fd = 0; + + if (curl_multi_fdset(m, &rd, &wr, &exc, &max_fd) != CURLM_OK) { + fprintf(stderr, "unexpected failured of fdset.\n"); + res = 189; + break; + } + + if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) { + fprintf(stderr, "bad select??\n"); + res = 195; + break; + } + + res = CURLM_CALL_MULTI_PERFORM; + } + + if (ml_timedout || mp_timedout) { + if (ml_timedout) fprintf(stderr, "ml_timedout\n"); + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + +test_cleanup: + +#ifdef LIB529 + /* test 529 */ + if(m) { + curl_multi_remove_handle(m, curl); + curl_multi_cleanup(m); + } + curl_easy_cleanup(curl); +#else + /* test 525 */ + if(m) + curl_multi_remove_handle(m, curl); + curl_easy_cleanup(curl); + if(m) + curl_multi_cleanup(m); +#endif + + fclose(hd_src); /* close the local file */ + + curl_global_cleanup(); + return res; +} diff --git a/tests/libtest/lib526.c b/tests/libtest/lib526.c new file mode 100644 index 0000000..0418b6b --- /dev/null +++ b/tests/libtest/lib526.c @@ -0,0 +1,236 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +/* + * This code sets up multiple easy handles that transfer a single file from + * the same URL, in a serial manner after each other. Due to the connection + * sharing within the multi handle all transfers are performed on the same + * persistent connection. + * + * This source code is used for lib526, lib527 and lib532 with only #ifdefs + * controlling the small differences. + * + * - lib526 closes all easy handles after + * they all have transfered the file over the single connection + * - lib527 closes each easy handle after each single transfer. + * - lib532 uses only a single easy handle that is removed, reset and then + * re-added for each transfer + * + * Test case 526, 527 and 532 use FTP, while test 528 uses the lib526 tool but + * with HTTP. + */ + +#include "test.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +#define NUM_HANDLES 4 + +int test(char *URL) +{ + int res = 0; + CURL *curl[NUM_HANDLES]; + int running; + char done=FALSE; + CURLM *m = NULL; + int current=0; + int i, j; + struct timeval ml_start; + struct timeval mp_start; + char ml_timedout = FALSE; + char mp_timedout = FALSE; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + /* get NUM_HANDLES easy handles */ + for(i=0; i < NUM_HANDLES; i++) { + curl[i] = curl_easy_init(); + if(!curl[i]) { + fprintf(stderr, "curl_easy_init() failed " + "on handle #%d\n", i); + for (j=i-1; j >= 0; j--) { + curl_easy_cleanup(curl[j]); + } + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD + i; + } + res = curl_easy_setopt(curl[i], CURLOPT_URL, URL); + if(res) { + fprintf(stderr, "curl_easy_setopt() failed " + "on handle #%d\n", i); + for (j=i; j >= 0; j--) { + curl_easy_cleanup(curl[j]); + } + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD + i; + } + + /* go verbose */ + res = curl_easy_setopt(curl[i], CURLOPT_VERBOSE, 1L); + if(res) { + fprintf(stderr, "curl_easy_setopt() failed " + "on handle #%d\n", i); + for (j=i; j >= 0; j--) { + curl_easy_cleanup(curl[j]); + } + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD + i; + } + } + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + for(i=0; i < NUM_HANDLES; i++) { + curl_easy_cleanup(curl[i]); + } + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((res = (int)curl_multi_add_handle(m, curl[current])) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", res); + curl_multi_cleanup(m); + for(i=0; i < NUM_HANDLES; i++) { + curl_easy_cleanup(curl[i]); + } + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + ml_timedout = FALSE; + ml_start = tutil_tvnow(); + + fprintf(stderr, "Start at URL 0\n"); + + while (!done) { + fd_set rd, wr, exc; + int max_fd; + struct timeval interval; + + interval.tv_sec = 1; + interval.tv_usec = 0; + + if (tutil_tvdiff(tutil_tvnow(), ml_start) > + MAIN_LOOP_HANG_TIMEOUT) { + ml_timedout = TRUE; + break; + } + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + while (res == CURLM_CALL_MULTI_PERFORM) { + res = (int)curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + if (running <= 0) { +#ifdef LIB527 + /* NOTE: this code does not remove the handle from the multi handle + here, which would be the nice, sane and documented way of working. + This however tests that the API survives this abuse gracefully. */ + curl_easy_cleanup(curl[current]); +#endif + if(++current < NUM_HANDLES) { + fprintf(stderr, "Advancing to URL %d\n", current); +#ifdef LIB532 + /* first remove the only handle we use */ + curl_multi_remove_handle(m, curl[0]); + + /* make us re-use the same handle all the time, and try resetting + the handle first too */ + curl_easy_reset(curl[0]); + test_setopt(curl[0], CURLOPT_URL, URL); + test_setopt(curl[0], CURLOPT_VERBOSE, 1L); + + /* re-add it */ + res = (int)curl_multi_add_handle(m, curl[0]); +#else + res = (int)curl_multi_add_handle(m, curl[current]); +#endif + if(res) { + fprintf(stderr, "add handle failed: %d.\n", res); + res = 243; + break; + } + } + else + done = TRUE; /* bail out */ + break; + } + } + if (mp_timedout || done) + break; + + if (res != CURLM_OK) { + fprintf(stderr, "not okay???\n"); + break; + } + + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_ZERO(&exc); + max_fd = 0; + + if (curl_multi_fdset(m, &rd, &wr, &exc, &max_fd) != CURLM_OK) { + fprintf(stderr, "unexpected failured of fdset.\n"); + res = 189; + break; + } + + if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) { + fprintf(stderr, "bad select??\n"); + res = 195; + break; + } + + res = CURLM_CALL_MULTI_PERFORM; + } + + if (ml_timedout || mp_timedout) { + if (ml_timedout) fprintf(stderr, "ml_timedout\n"); + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + +#ifdef LIB532 +test_cleanup: +#endif + +#ifndef LIB527 + /* get NUM_HANDLES easy handles */ + for(i=0; i < NUM_HANDLES; i++) { +#ifdef LIB526 + if(m) + curl_multi_remove_handle(m, curl[i]); +#endif + curl_easy_cleanup(curl[i]); + } +#endif + if(m) + curl_multi_cleanup(m); + + curl_global_cleanup(); + return res; +} diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c new file mode 100644 index 0000000..abefc92 --- /dev/null +++ b/tests/libtest/lib530.c @@ -0,0 +1,211 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +#define NUM_HANDLES 4 + +int test(char *URL) +{ + int res = 0; + CURL *curl[NUM_HANDLES]; + int running; + char done=FALSE; + CURLM *m; + int i, j; + struct timeval ml_start; + struct timeval mp_start; + char ml_timedout = FALSE; + char mp_timedout = FALSE; + char target_url[256]; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* get NUM_HANDLES easy handles */ + for(i=0; i < NUM_HANDLES; i++) { + curl[i] = curl_easy_init(); + if(!curl[i]) { + fprintf(stderr, "curl_easy_init() failed " + "on handle #%d\n", i); + for (j=i-1; j >= 0; j--) { + curl_multi_remove_handle(m, curl[j]); + curl_easy_cleanup(curl[j]); + } + curl_multi_cleanup(m); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD + i; + } + sprintf(target_url, "%s%04i", URL, i + 1); + target_url[sizeof(target_url) - 1] = '\0'; + + res = curl_easy_setopt(curl[i], CURLOPT_URL, target_url); + if(res) { + fprintf(stderr, "curl_easy_setopt() failed " + "on handle #%d\n", i); + for (j=i; j >= 0; j--) { + curl_multi_remove_handle(m, curl[j]); + curl_easy_cleanup(curl[j]); + } + curl_multi_cleanup(m); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD + i; + } + + /* go verbose */ + res = curl_easy_setopt(curl[i], CURLOPT_VERBOSE, 1L); + if(res) { + fprintf(stderr, "curl_easy_setopt() failed " + "on handle #%d\n", i); + for (j=i; j >= 0; j--) { + curl_multi_remove_handle(m, curl[j]); + curl_easy_cleanup(curl[j]); + } + curl_multi_cleanup(m); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD + i; + } + + /* include headers */ + res = curl_easy_setopt(curl[i], CURLOPT_HEADER, 1L); + if(res) { + fprintf(stderr, "curl_easy_setopt() failed " + "on handle #%d\n", i); + for (j=i; j >= 0; j--) { + curl_multi_remove_handle(m, curl[j]); + curl_easy_cleanup(curl[j]); + } + curl_multi_cleanup(m); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD + i; + } + + /* add handle to multi */ + if ((res = (int)curl_multi_add_handle(m, curl[i])) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "on handle #%d with code %d\n", i, res); + curl_easy_cleanup(curl[i]); + for (j=i-1; j >= 0; j--) { + curl_multi_remove_handle(m, curl[j]); + curl_easy_cleanup(curl[j]); + } + curl_multi_cleanup(m); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD + i; + } + } + + curl_multi_setopt(m, CURLMOPT_PIPELINING, 1L); + + ml_timedout = FALSE; + ml_start = tutil_tvnow(); + + fprintf(stderr, "Start at URL 0\n"); + + while (!done) { + fd_set rd, wr, exc; + int max_fd; + struct timeval interval; + + interval.tv_sec = 1; + interval.tv_usec = 0; + + if (tutil_tvdiff(tutil_tvnow(), ml_start) > + MAIN_LOOP_HANG_TIMEOUT) { + ml_timedout = TRUE; + break; + } + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + while (res == CURLM_CALL_MULTI_PERFORM) { + res = (int)curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + if (running <= 0) { + done = TRUE; /* bail out */ + break; + } + } + if (mp_timedout || done) + break; + + if (res != CURLM_OK) { + fprintf(stderr, "not okay???\n"); + break; + } + + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_ZERO(&exc); + max_fd = 0; + + if (curl_multi_fdset(m, &rd, &wr, &exc, &max_fd) != CURLM_OK) { + fprintf(stderr, "unexpected failured of fdset.\n"); + res = 189; + break; + } + + if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) { + fprintf(stderr, "bad select??\n"); + res = 195; + break; + } + + res = CURLM_CALL_MULTI_PERFORM; + } + + if (ml_timedout || mp_timedout) { + if (ml_timedout) fprintf(stderr, "ml_timedout\n"); + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + +/* test_cleanup: */ + + /* cleanup NUM_HANDLES easy handles */ + for(i=0; i < NUM_HANDLES; i++) { + curl_multi_remove_handle(m, curl[i]); + curl_easy_cleanup(curl[i]); + } + + curl_multi_cleanup(m); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib533.c b/tests/libtest/lib533.c new file mode 100644 index 0000000..89ac7bf --- /dev/null +++ b/tests/libtest/lib533.c @@ -0,0 +1,166 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +/* used for test case 533, 534 and 535 */ + +#include "test.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +int test(char *URL) +{ + int res = 0; + CURL *curl; + int running; + char done=FALSE; + CURLM *m = NULL; + int current=0; + struct timeval ml_start; + struct timeval mp_start; + char ml_timedout = FALSE; + char mp_timedout = FALSE; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_VERBOSE, 1); + test_setopt(curl, CURLOPT_FAILONERROR, 1); + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((res = (int)curl_multi_add_handle(m, curl)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", res); + curl_multi_cleanup(m); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + ml_timedout = FALSE; + ml_start = tutil_tvnow(); + + fprintf(stderr, "Start at URL 0\n"); + + while (!done) { + fd_set rd, wr, exc; + int max_fd; + struct timeval interval; + + interval.tv_sec = 1; + interval.tv_usec = 0; + + if (tutil_tvdiff(tutil_tvnow(), ml_start) > + MAIN_LOOP_HANG_TIMEOUT) { + ml_timedout = TRUE; + break; + } + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + while (res == CURLM_CALL_MULTI_PERFORM) { + res = (int)curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + if (running <= 0) { + if(!current++) { + fprintf(stderr, "Advancing to URL 1\n"); + /* remove the handle we use */ + curl_multi_remove_handle(m, curl); + + /* make us re-use the same handle all the time, and try resetting + the handle first too */ + curl_easy_reset(curl); + test_setopt(curl, CURLOPT_URL, libtest_arg2); + test_setopt(curl, CURLOPT_VERBOSE, 1); + test_setopt(curl, CURLOPT_FAILONERROR, 1); + + /* re-add it */ + res = (int)curl_multi_add_handle(m, curl); + if(res) { + fprintf(stderr, "add handle failed: %d.\n", res); + res = 243; + break; + } + } + else + done = TRUE; /* bail out */ + break; + } + } + if (mp_timedout || done) + break; + + if (res != CURLM_OK) { + fprintf(stderr, "not okay???\n"); + break; + } + + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_ZERO(&exc); + max_fd = 0; + + if (curl_multi_fdset(m, &rd, &wr, &exc, &max_fd) != CURLM_OK) { + fprintf(stderr, "unexpected failured of fdset.\n"); + res = 189; + break; + } + + if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) { + fprintf(stderr, "bad select??\n"); + res = 195; + break; + } + + res = CURLM_CALL_MULTI_PERFORM; + } + + if (ml_timedout || mp_timedout) { + if (ml_timedout) fprintf(stderr, "ml_timedout\n"); + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + +test_cleanup: + + curl_easy_cleanup(curl); + if(m) + curl_multi_cleanup(m); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib536.c b/tests/libtest/lib536.c new file mode 100644 index 0000000..e0c19f6 --- /dev/null +++ b/tests/libtest/lib536.c @@ -0,0 +1,140 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +static CURLMcode perform(CURLM * multi) +{ + int handles; + CURLMcode code; + fd_set fdread, fdwrite, fdexcep; + struct timeval mp_start; + char mp_timedout = FALSE; + + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + for (;;) { + static struct timeval timeout = /* 100 ms */ { 0, 100000L }; + int maxfd = -1; + + code = curl_multi_perform(multi, &handles); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + if (handles <= 0) + return CURLM_OK; + + switch (code) { + case CURLM_OK: + break; + case CURLM_CALL_MULTI_PERFORM: + continue; + default: + return code; + } + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd); + + /* In a real-world program you OF COURSE check the return code of the + function calls. On success, the value of maxfd is guaranteed to be + greater or equal than -1. We call select(maxfd + 1, ...), specially in + case of (maxfd == -1), we call select(0, ...), which is basically equal + to sleep. */ + + if (select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout) == -1) + return (CURLMcode) ~CURLM_OK; + } + + /* We only reach this point if (mp_timedout) */ + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + return (CURLMcode) ~CURLM_OK; +} + +int test(char *URL) +{ + CURLM *multi; + CURL *easy; + int res = 0; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((multi = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((easy = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_multi_cleanup(multi); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + curl_multi_setopt(multi, CURLMOPT_PIPELINING, 1L); + + test_setopt(easy, CURLOPT_WRITEFUNCTION, fwrite); + test_setopt(easy, CURLOPT_FAILONERROR, 1L); + test_setopt(easy, CURLOPT_URL, URL); + + if (curl_multi_add_handle(multi, easy) != CURLM_OK) { + printf("curl_multi_add_handle() failed\n"); + res = TEST_ERR_MAJOR_BAD; + } else { + if (perform(multi) != CURLM_OK) + printf("retrieve 1 failed\n"); + + curl_multi_remove_handle(multi, easy); + } + curl_easy_reset(easy); + + test_setopt(easy, CURLOPT_FAILONERROR, 1L); + test_setopt(easy, CURLOPT_URL, libtest_arg2); + + if (curl_multi_add_handle(multi, easy) != CURLM_OK) { + printf("curl_multi_add_handle() 2 failed\n"); + res = TEST_ERR_MAJOR_BAD; + } else { + if (perform(multi) != CURLM_OK) + printf("retrieve 2 failed\n"); + + curl_multi_remove_handle(multi, easy); + } + +test_cleanup: + + curl_easy_cleanup(easy); + curl_multi_cleanup(multi); + curl_global_cleanup(); + + printf("Finished!\n"); + + return res; +} diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c new file mode 100644 index 0000000..842dbab --- /dev/null +++ b/tests/libtest/lib537.c @@ -0,0 +1,512 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_RESOURCE_H +#include <sys/resource.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#include "memdebug.h" + +#if !defined(HAVE_POLL_FINE) && \ + !defined(USE_WINSOCK) && \ + !defined(TPF) && \ + !defined(FD_SETSIZE) +#error "this test requires FD_SETSIZE" +#endif + +#define SAFETY_MARGIN (10) + +#if defined(WIN32) || defined(_WIN32) || defined(MSDOS) +#define DEV_NULL "NUL" +#else +#define DEV_NULL "/dev/null" +#endif + +#if defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) + +static int *fd = NULL; +static struct rlimit num_open; +static char msgbuff[256]; + +static void store_errmsg(const char *msg, int err) +{ + if (!err) + sprintf(msgbuff, "%s", msg); + else + sprintf(msgbuff, "%s, errno %d, %s", msg, err, strerror(err)); +} + +static void close_file_descriptors(void) +{ + for (num_open.rlim_cur = 0; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) + if (fd[num_open.rlim_cur] > 0) + close(fd[num_open.rlim_cur]); + free(fd); + fd = NULL; +} + +static int fopen_works(void) +{ + FILE *fpa[3]; + int i; + int ret = 1; + + for (i = 0; i < 3; i++) { + fpa[i] = NULL; + } + for (i = 0; i < 3; i++) { + fpa[i] = fopen(DEV_NULL, "r"); + if (fpa[i] == NULL) { + store_errmsg("fopen() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + ret = 0; + break; + } + } + for (i = 0; i < 3; i++) { + if (fpa[i] != NULL) + fclose(fpa[i]); + } + return ret; +} + +static int rlimit(int keep_open) +{ + int *tmpfd; + int nitems, i; + int *memchunk = NULL; + char *fmt; + struct rlimit rl; + char strbuff[256]; + char strbuff1[81]; + char fmt_u[] = "%u"; + char fmt_lu[] = "%lu"; +#ifdef HAVE_LONGLONG + char fmt_llu[] = "%llu"; + + if (sizeof(rl.rlim_max) > sizeof(long)) + fmt = fmt_llu; + else +#endif + fmt = (sizeof(rl.rlim_max) < sizeof(long))?fmt_u:fmt_lu; + + /* get initial open file limits */ + + if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { + store_errmsg("getrlimit() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + return -1; + } + + /* show initial open file limits */ + +#ifdef RLIM_INFINITY + if (rl.rlim_cur == RLIM_INFINITY) + strcpy(strbuff, "INFINITY"); + else +#endif + sprintf(strbuff, fmt, rl.rlim_cur); + fprintf(stderr, "initial soft limit: %s\n", strbuff); + +#ifdef RLIM_INFINITY + if (rl.rlim_max == RLIM_INFINITY) + strcpy(strbuff, "INFINITY"); + else +#endif + sprintf(strbuff, fmt, rl.rlim_max); + fprintf(stderr, "initial hard limit: %s\n", strbuff); + + /* + * if soft limit and hard limit are different we ask the + * system to raise soft limit all the way up to the hard + * limit. Due to some other system limit the soft limit + * might not be raised up to the hard limit. So from this + * point the resulting soft limit is our limit. Trying to + * open more than soft limit file descriptors will fail. + */ + + if (rl.rlim_cur != rl.rlim_max) { + +#ifdef OPEN_MAX + if ((rl.rlim_cur > 0) && + (rl.rlim_cur < OPEN_MAX)) { + fprintf(stderr, "raising soft limit up to OPEN_MAX\n"); + rl.rlim_cur = OPEN_MAX; + if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { + /* on failure don't abort just issue a warning */ + store_errmsg("setrlimit() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + msgbuff[0] = '\0'; + } + } +#endif + + fprintf(stderr, "raising soft limit up to hard limit\n"); + rl.rlim_cur = rl.rlim_max; + if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { + /* on failure don't abort just issue a warning */ + store_errmsg("setrlimit() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + msgbuff[0] = '\0'; + } + + /* get current open file limits */ + + if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { + store_errmsg("getrlimit() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + return -3; + } + + /* show current open file limits */ + +#ifdef RLIM_INFINITY + if (rl.rlim_cur == RLIM_INFINITY) + strcpy(strbuff, "INFINITY"); + else +#endif + sprintf(strbuff, fmt, rl.rlim_cur); + fprintf(stderr, "current soft limit: %s\n", strbuff); + +#ifdef RLIM_INFINITY + if (rl.rlim_max == RLIM_INFINITY) + strcpy(strbuff, "INFINITY"); + else +#endif + sprintf(strbuff, fmt, rl.rlim_max); + fprintf(stderr, "current hard limit: %s\n", strbuff); + + } /* (rl.rlim_cur != rl.rlim_max) */ + + /* + * test 537 is all about testing libcurl functionality + * when the system has nearly exhausted the number of + * available file descriptors. Test 537 will try to run + * with a very small number of file descriptors available. + * This implies that any file descriptor which is open + * when the test runs will have a number in the high range + * of whatever the system supports. + */ + + /* + * reserve a chunk of memory before opening file descriptors to + * avoid a low memory condition once the file descriptors are + * open. System conditions that could make the test fail should + * be addressed in the precheck phase. This chunk of memory shall + * be always free()ed before exiting the rlimit() function so + * that it becomes available to the test. + */ + + for (nitems = i = 1; nitems <= i; i *= 2) + nitems = i; + if (nitems > 0x7fff) + nitems = 0x40000; + do { + num_open.rlim_max = sizeof(*memchunk) * (size_t)nitems; + sprintf(strbuff, fmt, num_open.rlim_max); + fprintf(stderr, "allocating memchunk %s byte array\n", strbuff); + memchunk = malloc(sizeof(*memchunk) * (size_t)nitems); + if (!memchunk) { + fprintf(stderr, "memchunk, malloc() failed\n"); + nitems /= 2; + } + } while (nitems && !memchunk); + if (!memchunk) { + store_errmsg("memchunk, malloc() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + return -4; + } + + /* initialize it to fight lazy allocation */ + + fprintf(stderr, "initializing memchunk array\n"); + + for (i = 0; i < nitems; i++) + memchunk[i] = -1; + + /* set the number of file descriptors we will try to open */ + +#ifdef RLIM_INFINITY + if ((rl.rlim_cur > 0) && (rl.rlim_cur != RLIM_INFINITY)) { +#else + if (rl.rlim_cur > 0) { +#endif + /* soft limit minus SAFETY_MARGIN */ + num_open.rlim_max = rl.rlim_cur - SAFETY_MARGIN; + } + else { + /* a huge number of file descriptors */ + for (nitems = i = 1; nitems <= i; i *= 2) + nitems = i; + if (nitems > 0x7fff) + nitems = 0x40000; + num_open.rlim_max = nitems; + } + + /* verify that we won't overflow size_t in malloc() */ + + if ((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) { + sprintf(strbuff1, fmt, num_open.rlim_max); + sprintf(strbuff, "unable to allocate an array for %s " + "file descriptors, would overflow size_t", strbuff1); + store_errmsg(strbuff, 0); + fprintf(stderr, "%s\n", msgbuff); + free(memchunk); + return -5; + } + + /* allocate array for file descriptors */ + + do { + sprintf(strbuff, fmt, num_open.rlim_max); + fprintf(stderr, "allocating array for %s file descriptors\n", strbuff); + fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max)); + if (!fd) { + fprintf(stderr, "fd, malloc() failed\n"); + num_open.rlim_max /= 2; + } + } while (num_open.rlim_max && !fd); + if (!fd) { + store_errmsg("fd, malloc() failed", ERRNO); + fprintf(stderr, "%s\n", msgbuff); + free(memchunk); + return -6; + } + + /* initialize it to fight lazy allocation */ + + fprintf(stderr, "initializing fd array\n"); + + for (num_open.rlim_cur = 0; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) + fd[num_open.rlim_cur] = -1; + + sprintf(strbuff, fmt, num_open.rlim_max); + fprintf(stderr, "trying to open %s file descriptors\n", strbuff); + + /* open a dummy descriptor */ + + fd[0] = open(DEV_NULL, O_RDONLY); + if (fd[0] < 0) { + sprintf(strbuff, "opening of %s failed", DEV_NULL); + store_errmsg(strbuff, ERRNO); + fprintf(stderr, "%s\n", msgbuff); + free(fd); + fd = NULL; + free(memchunk); + return -7; + } + + /* create a bunch of file descriptors */ + + for (num_open.rlim_cur = 1; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) { + + fd[num_open.rlim_cur] = dup(fd[0]); + + if (fd[num_open.rlim_cur] < 0) { + + fd[num_open.rlim_cur] = -1; + + sprintf(strbuff1, fmt, num_open.rlim_cur); + sprintf(strbuff, "dup() attempt %s failed", strbuff1); + fprintf(stderr, "%s\n", strbuff); + + sprintf(strbuff1, fmt, num_open.rlim_cur); + sprintf(strbuff, "fds system limit seems close to %s", strbuff1); + fprintf(stderr, "%s\n", strbuff); + + num_open.rlim_max = num_open.rlim_cur - SAFETY_MARGIN; + + num_open.rlim_cur -= num_open.rlim_max; + sprintf(strbuff1, fmt, num_open.rlim_cur); + sprintf(strbuff, "closing %s file descriptors", strbuff1); + fprintf(stderr, "%s\n", strbuff); + + for (num_open.rlim_cur = num_open.rlim_max; + fd[num_open.rlim_cur] >= 0; + num_open.rlim_cur++) { + close(fd[num_open.rlim_cur]); + fd[num_open.rlim_cur] = -1; + } + + sprintf(strbuff, fmt, num_open.rlim_max); + fprintf(stderr, "shrinking array for %s file descriptors\n", strbuff); + + /* we don't care if we can't shrink it */ + + tmpfd = realloc(fd, sizeof(*fd) * (size_t)(num_open.rlim_max)); + if (tmpfd) { + fd = tmpfd; + tmpfd = NULL; + } + + break; + + } + + } + + sprintf(strbuff, fmt, num_open.rlim_max); + fprintf(stderr, "%s file descriptors open\n", strbuff); + +#if !defined(HAVE_POLL_FINE) && \ + !defined(USE_WINSOCK) && \ + !defined(TPF) + + /* + * when using select() instead of poll() we cannot test + * libcurl functionality with a socket number equal or + * greater than FD_SETSIZE. In any case, macro VERIFY_SOCK + * in lib/select.c enforces this check and protects libcurl + * from a possible crash. The effect of this protection + * is that test 537 will always fail, since the actual + * call to select() never takes place. We skip test 537 + * with an indication that select limit would be exceeded. + */ + + num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN; + if (num_open.rlim_max > num_open.rlim_cur) { + sprintf(strbuff, "select limit is FD_SETSIZE %d", FD_SETSIZE); + store_errmsg(strbuff, 0); + fprintf(stderr, "%s\n", msgbuff); + close_file_descriptors(); + free(memchunk); + return -8; + } + + num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN; + for (rl.rlim_cur = 0; + rl.rlim_cur < num_open.rlim_max; + rl.rlim_cur++) { + if ((fd[rl.rlim_cur] > 0) && + ((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) { + sprintf(strbuff, "select limit is FD_SETSIZE %d", FD_SETSIZE); + store_errmsg(strbuff, 0); + fprintf(stderr, "%s\n", msgbuff); + close_file_descriptors(); + free(memchunk); + return -9; + } + } + +#endif /* using a FD_SETSIZE bound select() */ + + /* + * Old or 'backwards compatible' implementations of stdio do not allow + * handling of streams with an underlying file descriptor number greater + * than 255, even when allowing high numbered file descriptors for sockets. + * At this point we have a big number of file descriptors which have been + * opened using dup(), so lets test the stdio implementation and discover + * if it is capable of fopen()ing some additional files. + */ + + if (!fopen_works()) { + sprintf(strbuff1, fmt, num_open.rlim_max); + sprintf(strbuff, "stdio fopen() fails with %s fds open()", + strbuff1); + fprintf(stderr, "%s\n", msgbuff); + sprintf(strbuff, "stdio fopen() fails with lots of fds open()"); + store_errmsg(strbuff, 0); + close_file_descriptors(); + free(memchunk); + return -10; + } + + /* free the chunk of memory we were reserving so that it + becomes becomes available to the test */ + + free(memchunk); + + /* close file descriptors unless instructed to keep them */ + + if (!keep_open) { + close_file_descriptors(); + } + + return 0; +} + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if(!strcmp(URL, "check")) { + /* used by the test script to ask if we can run this test or not */ + if(rlimit(FALSE)) { + fprintf(stdout, "rlimit problem: %s\n", msgbuff); + return 1; + } + return 0; /* sure, run this! */ + } + + if (rlimit(TRUE)) { + /* failure */ + return TEST_ERR_MAJOR_BAD; + } + + /* run the test with the bunch of open file descriptors + and close them all once the test is over */ + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + close_file_descriptors(); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + close_file_descriptors(); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_HEADER, 1L); + + res = curl_easy_perform(curl); + +test_cleanup: + + close_file_descriptors(); + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + +#else /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */ + +int test(char *URL) +{ + (void)URL; + printf("system lacks necessary system function(s)"); + return 1; /* skip test */ +} + +#endif /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */ diff --git a/tests/libtest/lib539.c b/tests/libtest/lib539.c new file mode 100644 index 0000000..9909d01 --- /dev/null +++ b/tests/libtest/lib539.c @@ -0,0 +1,80 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + char *newURL = NULL; + struct curl_slist *slist = NULL; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* + * Begin with cURL set to use a single CWD to the URL's directory. + */ + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD); + + res = curl_easy_perform(curl); + + /* + * Change the FTP_FILEMETHOD option to use full paths rather than a CWD + * command. Alter the URL's path a bit, appending a "./". Use an innocuous + * QUOTE command, after which cURL will CWD to ftp_conn->entrypath and then + * (on the next call to ftp_statemach_act) find a non-zero ftpconn->dirdepth + * even though no directories are stored in the ftpconn->dirs array (after a + * call to freedirs). + */ + newURL = malloc(strlen(URL) + 3); + if (newURL == NULL) { + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + newURL = strcat(strcpy(newURL, URL), "./"); + + slist = curl_slist_append (NULL, "SYST"); + if (slist == NULL) { + free(newURL); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, newURL); + test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD); + test_setopt(curl, CURLOPT_QUOTE, slist); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_slist_free_all(slist); + if(newURL) + free(newURL); + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c new file mode 100644 index 0000000..bf4cd52 --- /dev/null +++ b/tests/libtest/lib540.c @@ -0,0 +1,178 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * + * This is the 'proxyauth.c' test app posted by Shmulik Regev on the libcurl + * mailing list on 10 Jul 2007, converted to a test case. + * + * argv1 = URL + * argv2 = proxy + * argv3 = proxyuser:password + * argv4 = host name to use for the custom Host: header + */ + +#include "test.h" + +#include "memdebug.h" + +#define PROXY libtest_arg2 +#define PROXYUSERPWD libtest_arg3 +#define HOST test_argv[4] + +static int init(CURLM *cm, const char* url, const char* userpwd, + struct curl_slist *headers) +{ + CURL *eh; + int res; + + if ((eh = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + return 1; /* failure */ + } + + res = curl_easy_setopt(eh, CURLOPT_URL, url); + if(res) return 1; + res = curl_easy_setopt(eh, CURLOPT_PROXY, PROXY); + if(res) return 1; + res = curl_easy_setopt(eh, CURLOPT_PROXYUSERPWD, userpwd); + if(res) return 1; + res = curl_easy_setopt(eh, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY); + if(res) return 1; + res = curl_easy_setopt(eh, CURLOPT_VERBOSE, 1L); + if(res) return 1; + res = curl_easy_setopt(eh, CURLOPT_HEADER, 1L); + if(res) return 1; + res = curl_easy_setopt(eh, CURLOPT_HTTPHEADER, headers); /* custom Host: */ + if(res) return 1; + + if ((res = (int)curl_multi_add_handle(cm, eh)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", res); + return 1; /* failure */ + } + + return 0; /* success */ +} + +static int loop(CURLM *cm, const char* url, const char* userpwd, + struct curl_slist *headers) +{ + CURLMsg *msg; + CURLMcode code; + long L; + int M, Q, U = -1; + fd_set R, W, E; + struct timeval T; + + if(init(cm, url, userpwd, headers)) + return 1; /* failure */ + + while (U) { + + do { + code = curl_multi_perform(cm, &U); + } while (code == CURLM_CALL_MULTI_PERFORM); + + if (U) { + FD_ZERO(&R); + FD_ZERO(&W); + FD_ZERO(&E); + + if (curl_multi_fdset(cm, &R, &W, &E, &M)) { + fprintf(stderr, "E: curl_multi_fdset\n"); + return 1; /* failure */ + } + + /* In a real-world program you OF COURSE check the return that maxfd is + bigger than -1 so that the call to select() below makes sense! */ + + if (curl_multi_timeout(cm, &L)) { + fprintf(stderr, "E: curl_multi_timeout\n"); + return 1; /* failure */ + } + + if(L != -1) { + T.tv_sec = L/1000; + T.tv_usec = (L%1000)*1000; + } + else { + T.tv_sec = 5; + T.tv_usec = 0; + } + + if (0 > select(M+1, &R, &W, &E, &T)) { + fprintf(stderr, "E: select\n"); + return 1; /* failure */ + } + } + + while ((msg = curl_multi_info_read(cm, &Q))) { + if (msg->msg == CURLMSG_DONE) { + CURL *e = msg->easy_handle; + fprintf(stderr, "R: %d - %s\n", (int)msg->data.result, + curl_easy_strerror(msg->data.result)); + curl_multi_remove_handle(cm, e); + curl_easy_cleanup(e); + } + else { + fprintf(stderr, "E: CURLMsg (%d)\n", (int)msg->msg); + } + } + } + + return 0; /* success */ +} + +int test(char *URL) +{ + CURLM *cm = NULL; + struct curl_slist *headers = NULL; + char buffer[246]; /* naively fixed-size */ + int res; + + if(test_argc < 4) + return 99; + + sprintf(buffer, "Host: %s", HOST); + + /* now add a custom Host: header */ + headers = curl_slist_append(headers, buffer); + if(!headers) { + fprintf(stderr, "curl_slist_append() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + curl_slist_free_all(headers); + return TEST_ERR_MAJOR_BAD; + } + + if ((cm = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_slist_free_all(headers); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + res = loop(cm, URL, PROXYUSERPWD, headers); + if(res) + goto test_cleanup; + + fprintf(stderr, "lib540: now we do the request again\n"); + res = loop(cm, URL, PROXYUSERPWD, headers); + +test_cleanup: + + curl_multi_cleanup(cm); + + curl_global_cleanup(); + + curl_slist_free_all(headers); + + return res; +} diff --git a/tests/libtest/lib541.c b/tests/libtest/lib541.c new file mode 100644 index 0000000..2fc85b9 --- /dev/null +++ b/tests/libtest/lib541.c @@ -0,0 +1,118 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include "memdebug.h" + +/* + * Two FTP uploads, the second with no content sent. + */ + +int test(char *URL) +{ + CURL *curl; + CURLcode res = CURLE_OK; + FILE *hd_src ; + int hd ; + struct_stat file_info; + int error; + + if (!libtest_arg2) { + fprintf(stderr, "Usage: <url> <file-to-upload>\n"); + return -1; + } + + hd_src = fopen(libtest_arg2, "rb"); + if(NULL == hd_src) { + error = ERRNO; + fprintf(stderr, "fopen() failed with error: %d %s\n", + error, strerror(error)); + fprintf(stderr, "Error opening file: %s\n", libtest_arg2); + return -2; /* if this happens things are major weird */ + } + + /* get the file size of the local file */ + hd = fstat(fileno(hd_src), &file_info); + if(hd == -1) { + /* can't open file, bail out */ + error = ERRNO; + fprintf(stderr, "fstat() failed with error: %d %s\n", + error, strerror(error)); + fprintf(stderr, "ERROR: cannot open file %s\n", libtest_arg2); + fclose(hd_src); + return -1; + } + + if(! file_info.st_size) { + fprintf(stderr, "ERROR: file %s has zero size!\n", libtest_arg2); + fclose(hd_src); + return -4; + } + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + fclose(hd_src); + return TEST_ERR_MAJOR_BAD; + } + + /* get a curl handle */ + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + fclose(hd_src); + return TEST_ERR_MAJOR_BAD; + } + + /* enable uploading */ + test_setopt(curl, CURLOPT_UPLOAD, 1L); + + /* enable verbose */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* specify target */ + test_setopt(curl,CURLOPT_URL, URL); + + /* now specify which file to upload */ + test_setopt(curl, CURLOPT_INFILE, hd_src); + + /* Now run off and do what you've been told! */ + res = curl_easy_perform(curl); + + /* and now upload the exact same again, but without rewinding so it already + is at end of file */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* close the local file */ + fclose(hd_src); + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib542.c b/tests/libtest/lib542.c new file mode 100644 index 0000000..ef7b483 --- /dev/null +++ b/tests/libtest/lib542.c @@ -0,0 +1,73 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include "memdebug.h" + +/* + * FTP get with NOBODY but no HEADER + */ + +int test(char *URL) +{ + CURL *curl; + CURLcode res = CURLE_OK; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + /* get a curl handle */ + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* enable verbose */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* enable NOBODY */ + test_setopt(curl, CURLOPT_NOBODY, 1L); + + /* disable HEADER */ + test_setopt(curl, CURLOPT_HEADER, 0L); + + /* specify target */ + test_setopt(curl,CURLOPT_URL, URL); + + /* Now run off and do what you've been told! */ + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c new file mode 100644 index 0000000..8f14f84 --- /dev/null +++ b/tests/libtest/lib543.c @@ -0,0 +1,42 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * + * Based on Alex Fishman's bug report on September 30, 2007 + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + unsigned char a[] = {0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1, + 0xe0, 0xd8, 0x7c, 0x20, 0xb7, 0xef, 0x53, 0x29, 0xfa, + 0x1d, 0x57, 0xe1}; + + CURL *easy; + int asize; + char *s; + (void)URL; + + if ((easy = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + asize = (int)sizeof(a); + + s = curl_easy_escape(easy, (char*)a, asize); + + printf("%s\n", s); + + curl_free(s); + curl_easy_cleanup(easy); + + return 0; +} diff --git a/tests/libtest/lib544.c b/tests/libtest/lib544.c new file mode 100644 index 0000000..6bc899c --- /dev/null +++ b/tests/libtest/lib544.c @@ -0,0 +1,66 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +static char teststring[] = +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape sequences for non-ASCII platforms */ + "\x54\x68\x69\x73\x00\x20\x69\x73\x20\x74\x65\x73\x74\x20\x62\x69\x6e\x61" + "\x72\x79\x20\x64\x61\x74\x61\x20\x77\x69\x74\x68\x20\x61\x6e\x20\x65\x6d" + "\x62\x65\x64\x64\x65\x64\x20\x4e\x55\x4c\x20\x62\x79\x74\x65\x0a"; +#else + "This\0 is test binary data with an embedded NUL byte\n"; +#endif + + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + +#ifdef LIB545 + test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) sizeof teststring - 1); +#endif + + test_setopt(curl, CURLOPT_COPYPOSTFIELDS, teststring); + + test_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */ + test_setopt(curl, CURLOPT_HEADER, 1L); /* include header */ + + /* Update the original data to detect non-copy. */ + strcpy(teststring, "FAIL"); + + /* Now, this is a POST request with binary 0 embedded in POST data. */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} diff --git a/tests/libtest/lib547.c b/tests/libtest/lib547.c new file mode 100644 index 0000000..4ef3037 --- /dev/null +++ b/tests/libtest/lib547.c @@ -0,0 +1,116 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * + * argv1 = URL + * argv2 = proxy + * argv3 = proxyuser:password + */ + +#include "test.h" + +#include "memdebug.h" + +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape sequences for non-ASCII platforms */ +# define UPLOADTHIS "\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x62" \ + "\x6c\x75\x72\x62\x20\x77\x65\x20\x77\x61\x6e\x74\x20" \ + "\x74\x6f\x20\x75\x70\x6c\x6f\x61\x64\x0a" +#else +# define UPLOADTHIS "this is the blurb we want to upload\n" +#endif + +#ifndef LIB548 +static size_t readcallback(void *ptr, + size_t size, + size_t nmemb, + void *clientp) +{ + int *counter = (int *)clientp; + + if(*counter) { + /* only do this once and then require a clearing of this */ + fprintf(stderr, "READ ALREADY DONE!\n"); + return 0; + } + (*counter)++; /* bump */ + + if(size * nmemb > strlen(UPLOADTHIS)) { + fprintf(stderr, "READ!\n"); + strcpy(ptr, UPLOADTHIS); + return strlen(UPLOADTHIS); + } + fprintf(stderr, "READ NOT FINE!\n"); + return 0; +} +static curlioerr ioctlcallback(CURL *handle, + int cmd, + void *clientp) +{ + int *counter = (int *)clientp; + (void)handle; /* unused */ + if(cmd == CURLIOCMD_RESTARTREAD) { + fprintf(stderr, "REWIND!\n"); + *counter = 0; /* clear counter to make the read callback restart */ + } + return CURLIOE_OK; +} + + + +#endif + +int test(char *URL) +{ + CURLcode res; + CURL *curl; +#ifndef LIB548 + int counter=0; +#endif + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + test_setopt(curl, CURLOPT_HEADER, 1L); +#ifdef LIB548 + /* set the data to POST with a mere pointer to a zero-terminated string */ + test_setopt(curl, CURLOPT_POSTFIELDS, UPLOADTHIS); +#else + /* 547 style, which means reading the POST data from a callback */ + test_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctlcallback); + test_setopt(curl, CURLOPT_IOCTLDATA, &counter); + test_setopt(curl, CURLOPT_READFUNCTION, readcallback); + test_setopt(curl, CURLOPT_READDATA, &counter); + /* We CANNOT do the POST fine without setting the size (or choose chunked)! */ + test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(UPLOADTHIS)); +#endif + test_setopt(curl, CURLOPT_POST, 1L); + test_setopt(curl, CURLOPT_PROXY, libtest_arg2); + test_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3); + test_setopt(curl, CURLOPT_PROXYAUTH, + (long) (CURLAUTH_NTLM | CURLAUTH_DIGEST | CURLAUTH_BASIC) ); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib549.c b/tests/libtest/lib549.c new file mode 100644 index 0000000..9fd18b2 --- /dev/null +++ b/tests/libtest/lib549.c @@ -0,0 +1,52 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * + * argv1 = URL + * argv2 = proxy + * argv3 = non-zero means ASCII transfer + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_PROXY, libtest_arg2); + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_PROXY_TRANSFER_MODE, 1L); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + if(libtest_arg3) { + /* enable ascii/text mode */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); + } + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c new file mode 100644 index 0000000..eeecf6f --- /dev/null +++ b/tests/libtest/lib552.c @@ -0,0 +1,205 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * + * argv1 = URL + * argv2 = proxy with embedded user+password + */ + +#include "test.h" + +#include "memdebug.h" + +struct data { + char trace_ascii; /* 1 or 0 */ +}; + +static +void dump(const char *text, + FILE *stream, unsigned char *ptr, size_t size, + char nohex) +{ + size_t i; + size_t c; + + unsigned int width=0x10; + + if(nohex) + /* without the hex output, we can fit more on screen */ + width = 0x40; + + fprintf(stream, "%s, %d bytes (0x%x)\n", text, (int)size, (int)size); + + for(i=0; i<size; i+= width) { + + fprintf(stream, "%04x: ", (int)i); + + if(!nohex) { + /* hex not disabled, show it */ + for(c = 0; c < width; c++) + if(i+c < size) + fprintf(stream, "%02x ", ptr[i+c]); + else + fputs(" ", stream); + } + + for(c = 0; (c < width) && (i+c < size); c++) { + /* check for 0D0A; if found, skip past and start a new line of output */ + if (nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + i+=(c+2-width); + break; + } + fprintf(stream, "%c", + (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + /* check again for 0D0A, to avoid an extra \n if it's at width */ + if (nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + i+=(c+3-width); + break; + } + } + fputc('\n', stream); /* newline */ + } + fflush(stream); +} + +static +int my_trace(CURL *handle, curl_infotype type, + char *data, size_t size, + void *userp) +{ + struct data *config = (struct data *)userp; + const char *text; + (void)handle; /* prevent compiler warning */ + + switch (type) { + case CURLINFO_TEXT: + fprintf(stderr, "== Info: %s", (char *)data); + default: /* in case a new one is introduced to shock us */ + return 0; + + case CURLINFO_HEADER_OUT: + text = "=> Send header"; + break; + case CURLINFO_DATA_OUT: + text = "=> Send data"; + break; + case CURLINFO_SSL_DATA_OUT: + text = "=> Send SSL data"; + break; + case CURLINFO_HEADER_IN: + text = "<= Recv header"; + break; + case CURLINFO_DATA_IN: + text = "<= Recv data"; + break; + case CURLINFO_SSL_DATA_IN: + text = "<= Recv SSL data"; + break; + } + + dump(text, stderr, (unsigned char *)data, size, config->trace_ascii); + return 0; +} + + +static size_t current_offset = 0; +static char databuf[70000]; /* MUST be more than 64k OR MAX_INITIAL_POST_SIZE */ + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) +{ + size_t amount = nmemb * size; /* Total bytes curl wants */ + size_t available = sizeof(databuf) - current_offset; /* What we have to give */ + size_t given = amount < available ? amount : available; /* What is given */ + (void)stream; + memcpy(ptr, databuf + current_offset, given); + current_offset += given; + return given; +} + + +static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *stream) +{ + printf("%.*s", (int)(size * nmemb), (char *)ptr); + (void)stream; + return size * nmemb; +} + + +static curlioerr ioctl_callback(CURL * handle, int cmd, void *clientp) +{ + (void)clientp; + if (cmd == CURLIOCMD_RESTARTREAD ) { + printf("APPLICATION: recieved a CURLIOCMD_RESTARTREAD request\n"); + printf("APPLICATION: ** REWINDING! **\n"); + current_offset = 0; + return CURLIOE_OK; + } + (void)handle; + return CURLIOE_UNKNOWNCMD; +} + + + +int test(char *URL) +{ + CURL *curl; + CURLcode res = CURLE_OUT_OF_MEMORY; + struct data config; + size_t i; + static const char fill[] = "test data"; + + config.trace_ascii = 1; /* enable ascii tracing */ + + if((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace); + test_setopt(curl, CURLOPT_DEBUGDATA, &config); + /* the DEBUGFUNCTION has no effect until we enable VERBOSE */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* setup repeated data string */ + for (i=0; i < sizeof(databuf); ++i) + databuf[i] = fill[i % sizeof fill]; + + /* Post */ + test_setopt(curl, CURLOPT_POST, 1L); + +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + + /* Setup read callback */ + test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) sizeof(databuf)); + test_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* Write callback */ + test_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); + + /* Ioctl function */ + test_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback); + + test_setopt(curl, CURLOPT_PROXY, libtest_arg2); + + test_setopt(curl, CURLOPT_URL, URL); + + /* Accept any auth. But for this bug configure proxy with DIGEST, basic might work too, not NTLM */ + test_setopt(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY); + + res = curl_easy_perform(curl); + fprintf(stderr, "curl_easy_perform = %d\n", (int)res); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + return (int)res; +} diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c new file mode 100644 index 0000000..8694daf --- /dev/null +++ b/tests/libtest/lib553.c @@ -0,0 +1,100 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * + * This test case and code is based on the bug recipe Joe Malicki provided for + * bug report #1871269, fixed on Jan 14 2008 before the 7.18.0 release. + */ + +#include "test.h" + +#include "memdebug.h" + +#define POSTLEN 40960 + +static size_t myreadfunc(void *ptr, size_t size, size_t nmemb, void *stream) +{ + static size_t total=POSTLEN; + static char buf[1024]; + (void)stream; + + memset(buf, 'A', sizeof(buf)); + + size *= nmemb; + if (size > total) + size = total; + + if(size > sizeof(buf)) + size = sizeof(buf); + + memcpy(ptr, buf, size); + total -= size; + return size; +} + +#define NUM_HEADERS 8 +#define SIZE_HEADERS 5000 + +static char buf[SIZE_HEADERS + 100]; + +int test(char *URL) +{ + CURL *curl; + CURLcode res = CURLE_FAILED_INIT; + int i; + struct curl_slist *headerlist=NULL, *hl; + + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + for (i = 0; i < NUM_HEADERS; i++) { + int len = sprintf(buf, "Header%d: ", i); + memset(&buf[len], 'A', SIZE_HEADERS); + buf[len + SIZE_HEADERS]=0; /* zero terminate */ + hl = curl_slist_append(headerlist, buf); + if (!hl) + goto test_cleanup; + headerlist = hl; + } + + hl = curl_slist_append(headerlist, "Expect: "); + if (!hl) + goto test_cleanup; + headerlist = hl; + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_HTTPHEADER, headerlist); + test_setopt(curl, CURLOPT_POST, 1L); +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)POSTLEN); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + test_setopt(curl, CURLOPT_HEADER, 1L); + test_setopt(curl, CURLOPT_READFUNCTION, myreadfunc); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + + curl_slist_free_all(headerlist); + + curl_global_cleanup(); + + return (int)res; +} diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c new file mode 100644 index 0000000..d7c6824 --- /dev/null +++ b/tests/libtest/lib554.c @@ -0,0 +1,150 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +static char data[]= +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape sequences for non-ASCII platforms */ + "\x74\x68\x69\x73\x20\x69\x73\x20\x77\x68\x61\x74\x20\x77\x65\x20\x70" + "\x6f\x73\x74\x20\x74\x6f\x20\x74\x68\x65\x20\x73\x69\x6c\x6c\x79\x20" + "\x77\x65\x62\x20\x73\x65\x72\x76\x65\x72\x0a"; +#else + "this is what we post to the silly web server\n"; +#endif + +struct WriteThis { + char *readptr; + size_t sizeleft; +}; + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) +{ + struct WriteThis *pooh = (struct WriteThis *)userp; + + if(size*nmemb < 1) + return 0; + + if(pooh->sizeleft) { + *(char *)ptr = pooh->readptr[0]; /* copy one single byte */ + pooh->readptr++; /* advance pointer */ + pooh->sizeleft--; /* less data left */ + return 1; /* we return 1 byte at a time! */ + } + + return 0; /* no more data left to deliver */ +} + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + CURLFORMcode formrc; + + struct curl_httppost *formpost=NULL; + struct curl_httppost *lastptr=NULL; + struct WriteThis pooh; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + pooh.readptr = data; + pooh.sizeleft = strlen(data); + + /* Fill in the file upload field */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "sendfile", + CURLFORM_STREAM, &pooh, + CURLFORM_CONTENTSLENGTH, pooh.sizeleft, + CURLFORM_FILENAME, "postit2.c", + CURLFORM_END); + + if(formrc) + printf("curl_formadd(1) = %d\n", (int)formrc); + + /* Fill in the filename field */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "filename", +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape + sequences for non-ASCII platforms */ + CURLFORM_COPYCONTENTS, + "\x70\x6f\x73\x74\x69\x74\x32\x2e\x63", +#else + CURLFORM_COPYCONTENTS, "postit2.c", +#endif + CURLFORM_END); + + if(formrc) + printf("curl_formadd(2) = %d\n", (int)formrc); + + /* Fill in a submit field too */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "submit", +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape + sequences for non-ASCII platforms */ + CURLFORM_COPYCONTENTS, "\x73\x65\x6e\x64", +#else + CURLFORM_COPYCONTENTS, "send", +#endif + CURLFORM_END); + + if(formrc) + printf("curl_formadd(3) = %d\n", (int)formrc); + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_formfree(formpost); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + + /* Now specify we want to POST data */ + test_setopt(curl, CURLOPT_POST, 1L); + + /* Set the expected POST size */ + test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)pooh.sizeleft); + + /* we want to use our own read function */ + test_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* send a multi-part formpost */ + test_setopt(curl, CURLOPT_HTTPPOST, formpost); + + /* get verbose debug output please */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* include headers in the output */ + test_setopt(curl, CURLOPT_HEADER, 1L); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + /* now cleanup the formpost chain */ + curl_formfree(formpost); + + return res; +} diff --git a/tests/libtest/lib555.c b/tests/libtest/lib555.c new file mode 100644 index 0000000..55b3f13 --- /dev/null +++ b/tests/libtest/lib555.c @@ -0,0 +1,157 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * + * This test case is supposed to be identical to 547 except that this uses the + * multi interface and 547 is easy interface. + * + * argv1 = URL + * argv2 = proxy + * argv3 = proxyuser:password + */ + +#include "test.h" +#include "testutil.h" +#include "memdebug.h" + +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +#define UPLOADTHIS "this is the blurb we want to upload\n" + +static size_t readcallback(void *ptr, + size_t size, + size_t nmemb, + void *clientp) +{ + int *counter = (int *)clientp; + + if(*counter) { + /* only do this once and then require a clearing of this */ + fprintf(stderr, "READ ALREADY DONE!\n"); + return 0; + } + (*counter)++; /* bump */ + + if(size * nmemb > strlen(UPLOADTHIS)) { + fprintf(stderr, "READ!\n"); + strcpy(ptr, UPLOADTHIS); + return strlen(UPLOADTHIS); + } + fprintf(stderr, "READ NOT FINE!\n"); + return 0; +} +static curlioerr ioctlcallback(CURL *handle, + int cmd, + void *clientp) +{ + int *counter = (int *)clientp; + (void)handle; /* unused */ + if(cmd == CURLIOCMD_RESTARTREAD) { + fprintf(stderr, "REWIND!\n"); + *counter = 0; /* clear counter to make the read callback restart */ + } + return CURLIOE_OK; +} + + +int test(char *URL) +{ + int res; + CURL *curl; + int counter=0; + CURLM *m = NULL; + int running=1; + struct timeval mp_start; + char mp_timedout = FALSE; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + test_setopt(curl, CURLOPT_HEADER, 1L); + + /* read the POST data from a callback */ + test_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctlcallback); + test_setopt(curl, CURLOPT_IOCTLDATA, &counter); + test_setopt(curl, CURLOPT_READFUNCTION, readcallback); + test_setopt(curl, CURLOPT_READDATA, &counter); + /* We CANNOT do the POST fine without setting the size (or choose chunked)! */ + test_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(UPLOADTHIS)); + + test_setopt(curl, CURLOPT_POST, 1L); +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII. */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + test_setopt(curl, CURLOPT_PROXY, libtest_arg2); + test_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3); + test_setopt(curl, CURLOPT_PROXYAUTH, + (long) (CURLAUTH_NTLM | CURLAUTH_DIGEST | CURLAUTH_BASIC) ); + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((res = (int)curl_multi_add_handle(m, curl)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", res); + curl_multi_cleanup(m); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + while (running) { + res = (int)curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } +#ifdef TPF + sleep(1); /* avoid ctl-10 dump */ +#endif + if (running <= 0) { + fprintf(stderr, "nothing left running.\n"); + break; + } + } + + if (mp_timedout) { + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + +test_cleanup: + + if(m) { + curl_multi_remove_handle(m, curl); + curl_multi_cleanup(m); + } + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c new file mode 100644 index 0000000..78d123b --- /dev/null +++ b/tests/libtest/lib556.c @@ -0,0 +1,91 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +/* For Windows, mainly (may be moved in a config file?) */ +#ifndef STDIN_FILENO + #define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO + #define STDOUT_FILENO 1 +#endif +#ifndef STDERR_FILENO + #define STDERR_FILENO 2 +#endif + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); + + res = curl_easy_perform(curl); + + if(!res) { + /* we are connected, now get a HTTP document the raw way */ + const char *request = +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape sequences for non-ASCII platforms */ + "\x47\x45\x54\x20\x2f\x35\x35\x36\x20\x48\x54\x54\x50\x2f\x31\x2e" + "\x32\x0d\x0a\x48\x6f\x73\x74\x3a\x20\x6e\x69\x6e\x6a\x61\x0d\x0a" + "\x0d\x0a"; +#else + "GET /556 HTTP/1.2\r\n" + "Host: ninja\r\n\r\n"; +#endif + size_t iolen; + char buf[1024]; + + res = curl_easy_send(curl, request, strlen(request), &iolen); + + if(!res) { + /* we assume that sending always work */ + size_t total=0; + + do { + /* busy-read like crazy */ + res = curl_easy_recv(curl, buf, 1024, &iolen); + +#ifdef TPF + sleep(1); /* avoid ctl-10 dump */ +#endif + + if(iolen) + /* send received stuff to stdout */ + write(STDOUT_FILENO, buf, iolen); + total += iolen; + + } while(((res == CURLE_OK) || (res == CURLE_AGAIN)) && (total < 129)); + } + } + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c new file mode 100644 index 0000000..48ccaf3 --- /dev/null +++ b/tests/libtest/lib557.c @@ -0,0 +1,1388 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +/* + * The purpose of this test is to minimally exercise libcurl's internal + * curl_m*printf formatting capabilities and handling of some data types. + */ + +#include "test.h" + +#include <curl/mprintf.h> + +#include "memdebug.h" + + +#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG) +# define MPRNT_SUFFIX_CURL_OFF_T LL +#else +# define MPRNT_SUFFIX_CURL_OFF_T L +#endif + + +#ifdef CURL_ISOCPP +# define MPRNT_OFF_T_C_HELPER2(Val,Suffix) Val ## Suffix +#else +# define MPRNT_OFF_T_C_HELPER2(Val,Suffix) Val/**/Suffix +#endif +#define MPRNT_OFF_T_C_HELPER1(Val,Suffix) MPRNT_OFF_T_C_HELPER2(Val,Suffix) +#define MPRNT_OFF_T_C(Val) MPRNT_OFF_T_C_HELPER1(Val,MPRNT_SUFFIX_CURL_OFF_T) + + +#define BUFSZ 256 +#define USHORT_TESTS_ARRSZ 1 + 100 +#define SSHORT_TESTS_ARRSZ 1 + 100 +#define UINT_TESTS_ARRSZ 1 + 100 +#define SINT_TESTS_ARRSZ 1 + 100 +#define ULONG_TESTS_ARRSZ 1 + 100 +#define SLONG_TESTS_ARRSZ 1 + 100 +#define COFFT_TESTS_ARRSZ 1 + 100 + + +struct unsshort_st { + unsigned short num; /* unsigned short */ + const char *expected; /* expected string */ + char result[BUFSZ]; /* result string */ +}; + + +struct sigshort_st { + short num; /* signed short */ + const char *expected; /* expected string */ + char result[BUFSZ]; /* result string */ +}; + + +struct unsint_st { + unsigned int num; /* unsigned int */ + const char *expected; /* expected string */ + char result[BUFSZ]; /* result string */ +}; + + +struct sigint_st { + int num; /* signed int */ + const char *expected; /* expected string */ + char result[BUFSZ]; /* result string */ +}; + + +struct unslong_st { + unsigned long num; /* unsigned long */ + const char *expected; /* expected string */ + char result[BUFSZ]; /* result string */ +}; + + +struct siglong_st { + long num; /* signed long */ + const char *expected; /* expected string */ + char result[BUFSZ]; /* result string */ +}; + + +struct curloff_st { + curl_off_t num; /* curl_off_t */ + const char *expected; /* expected string */ + char result[BUFSZ]; /* result string */ +}; + + +static struct unsshort_st us_test[USHORT_TESTS_ARRSZ]; +static struct sigshort_st ss_test[SSHORT_TESTS_ARRSZ]; +static struct unsint_st ui_test[UINT_TESTS_ARRSZ]; +static struct sigint_st si_test[SINT_TESTS_ARRSZ]; +static struct unslong_st ul_test[ULONG_TESTS_ARRSZ]; +static struct siglong_st sl_test[SLONG_TESTS_ARRSZ]; +static struct curloff_st co_test[COFFT_TESTS_ARRSZ]; + + +static int test_unsigned_short_formatting(void) +{ + int i, j; + int num_ushort_tests; + int failed = 0; + +#if (SIZEOF_SHORT == 1) + + i=1; us_test[i].num = 0xFFU; us_test[i].expected = "256"; + i++; us_test[i].num = 0xF0U; us_test[i].expected = "240"; + i++; us_test[i].num = 0x0FU; us_test[i].expected = "15"; + + i++; us_test[i].num = 0xE0U; us_test[i].expected = "224"; + i++; us_test[i].num = 0x0EU; us_test[i].expected = "14"; + + i++; us_test[i].num = 0xC0U; us_test[i].expected = "192"; + i++; us_test[i].num = 0x0CU; us_test[i].expected = "12"; + + i++; us_test[i].num = 0x01U; us_test[i].expected = "1"; + i++; us_test[i].num = 0x00U; us_test[i].expected = "0"; + + num_ushort_tests = i; + +#elif (SIZEOF_SHORT == 2) + + i=1; us_test[i].num = 0xFFFFU; us_test[i].expected = "65535"; + i++; us_test[i].num = 0xFF00U; us_test[i].expected = "65280"; + i++; us_test[i].num = 0x00FFU; us_test[i].expected = "255"; + + i++; us_test[i].num = 0xF000U; us_test[i].expected = "61440"; + i++; us_test[i].num = 0x0F00U; us_test[i].expected = "3840"; + i++; us_test[i].num = 0x00F0U; us_test[i].expected = "240"; + i++; us_test[i].num = 0x000FU; us_test[i].expected = "15"; + + i++; us_test[i].num = 0xC000U; us_test[i].expected = "49152"; + i++; us_test[i].num = 0x0C00U; us_test[i].expected = "3072"; + i++; us_test[i].num = 0x00C0U; us_test[i].expected = "192"; + i++; us_test[i].num = 0x000CU; us_test[i].expected = "12"; + + i++; us_test[i].num = 0x0001U; us_test[i].expected = "1"; + i++; us_test[i].num = 0x0000U; us_test[i].expected = "0"; + + num_ushort_tests = i; + +#elif (SIZEOF_SHORT == 4) + + i=1; us_test[i].num = 0xFFFFFFFFU; us_test[i].expected = "4294967295"; + i++; us_test[i].num = 0xFFFF0000U; us_test[i].expected = "4294901760"; + i++; us_test[i].num = 0x0000FFFFU; us_test[i].expected = "65535"; + + i++; us_test[i].num = 0xFF000000U; us_test[i].expected = "4278190080"; + i++; us_test[i].num = 0x00FF0000U; us_test[i].expected = "16711680"; + i++; us_test[i].num = 0x0000FF00U; us_test[i].expected = "65280"; + i++; us_test[i].num = 0x000000FFU; us_test[i].expected = "255"; + + i++; us_test[i].num = 0xF0000000U; us_test[i].expected = "4026531840"; + i++; us_test[i].num = 0x0F000000U; us_test[i].expected = "251658240"; + i++; us_test[i].num = 0x00F00000U; us_test[i].expected = "15728640"; + i++; us_test[i].num = 0x000F0000U; us_test[i].expected = "983040"; + i++; us_test[i].num = 0x0000F000U; us_test[i].expected = "61440"; + i++; us_test[i].num = 0x00000F00U; us_test[i].expected = "3840"; + i++; us_test[i].num = 0x000000F0U; us_test[i].expected = "240"; + i++; us_test[i].num = 0x0000000FU; us_test[i].expected = "15"; + + i++; us_test[i].num = 0xC0000000U; us_test[i].expected = "3221225472"; + i++; us_test[i].num = 0x0C000000U; us_test[i].expected = "201326592"; + i++; us_test[i].num = 0x00C00000U; us_test[i].expected = "12582912"; + i++; us_test[i].num = 0x000C0000U; us_test[i].expected = "786432"; + i++; us_test[i].num = 0x0000C000U; us_test[i].expected = "49152"; + i++; us_test[i].num = 0x00000C00U; us_test[i].expected = "3072"; + i++; us_test[i].num = 0x000000C0U; us_test[i].expected = "192"; + i++; us_test[i].num = 0x0000000CU; us_test[i].expected = "12"; + + i++; us_test[i].num = 0x00000001U; us_test[i].expected = "1"; + i++; us_test[i].num = 0x00000000U; us_test[i].expected = "0"; + + num_ushort_tests = i; + +#endif + + for(i=1; i<=num_ushort_tests; i++) { + + for(j=0; j<BUFSZ; j++) + us_test[i].result[j] = 'X'; + us_test[i].result[BUFSZ-1] = '\0'; + + (void)curl_msprintf(us_test[i].result, "%hu", us_test[i].num); + + if(memcmp(us_test[i].result, + us_test[i].expected, + strlen(us_test[i].expected))) { + printf("unsigned short test #%.2d: Failed (Expected: %s Got: %s)\n", + i, us_test[i].expected, us_test[i].result); + failed++; + } + + } + + if(!failed) + printf("All curl_mprintf() unsigned short tests OK!\n"); + else + printf("Some curl_mprintf() unsigned short tests Failed!\n"); + + return failed; +} + + +static int test_signed_short_formatting(void) +{ + int i, j; + int num_sshort_tests; + int failed = 0; + +#if (SIZEOF_SHORT == 1) + + i=1; ss_test[i].num = 0x7F; ss_test[i].expected = "127"; + + i++; ss_test[i].num = 0x70; ss_test[i].expected = "112"; + i++; ss_test[i].num = 0x07; ss_test[i].expected = "7"; + + i++; ss_test[i].num = 0x50; ss_test[i].expected = "80"; + i++; ss_test[i].num = 0x05; ss_test[i].expected = "5"; + + i++; ss_test[i].num = 0x01; ss_test[i].expected = "1"; + i++; ss_test[i].num = 0x00; ss_test[i].expected = "0"; + + i++; ss_test[i].num = -0x7F -1; ss_test[i].expected = "-128"; + + i++; ss_test[i].num = -0x70 -1; ss_test[i].expected = "-113"; + i++; ss_test[i].num = -0x07 -1; ss_test[i].expected = "-8"; + + i++; ss_test[i].num = -0x50 -1; ss_test[i].expected = "-81"; + i++; ss_test[i].num = -0x05 -1; ss_test[i].expected = "-6"; + + i++; ss_test[i].num = 0x00 -1; ss_test[i].expected = "-1"; + + num_sshort_tests = i; + +#elif (SIZEOF_SHORT == 2) + + i=1; ss_test[i].num = 0x7FFF; ss_test[i].expected = "32767"; + i++; ss_test[i].num = 0x7FFE; ss_test[i].expected = "32766"; + i++; ss_test[i].num = 0x7FFD; ss_test[i].expected = "32765"; + i++; ss_test[i].num = 0x7F00; ss_test[i].expected = "32512"; + i++; ss_test[i].num = 0x07F0; ss_test[i].expected = "2032"; + i++; ss_test[i].num = 0x007F; ss_test[i].expected = "127"; + + i++; ss_test[i].num = 0x7000; ss_test[i].expected = "28672"; + i++; ss_test[i].num = 0x0700; ss_test[i].expected = "1792"; + i++; ss_test[i].num = 0x0070; ss_test[i].expected = "112"; + i++; ss_test[i].num = 0x0007; ss_test[i].expected = "7"; + + i++; ss_test[i].num = 0x5000; ss_test[i].expected = "20480"; + i++; ss_test[i].num = 0x0500; ss_test[i].expected = "1280"; + i++; ss_test[i].num = 0x0050; ss_test[i].expected = "80"; + i++; ss_test[i].num = 0x0005; ss_test[i].expected = "5"; + + i++; ss_test[i].num = 0x0001; ss_test[i].expected = "1"; + i++; ss_test[i].num = 0x0000; ss_test[i].expected = "0"; + + i++; ss_test[i].num = -0x7FFF -1; ss_test[i].expected = "-32768"; + i++; ss_test[i].num = -0x7FFE -1; ss_test[i].expected = "-32767"; + i++; ss_test[i].num = -0x7FFD -1; ss_test[i].expected = "-32766"; + i++; ss_test[i].num = -0x7F00 -1; ss_test[i].expected = "-32513"; + i++; ss_test[i].num = -0x07F0 -1; ss_test[i].expected = "-2033"; + i++; ss_test[i].num = -0x007F -1; ss_test[i].expected = "-128"; + + i++; ss_test[i].num = -0x7000 -1; ss_test[i].expected = "-28673"; + i++; ss_test[i].num = -0x0700 -1; ss_test[i].expected = "-1793"; + i++; ss_test[i].num = -0x0070 -1; ss_test[i].expected = "-113"; + i++; ss_test[i].num = -0x0007 -1; ss_test[i].expected = "-8"; + + i++; ss_test[i].num = -0x5000 -1; ss_test[i].expected = "-20481"; + i++; ss_test[i].num = -0x0500 -1; ss_test[i].expected = "-1281"; + i++; ss_test[i].num = -0x0050 -1; ss_test[i].expected = "-81"; + i++; ss_test[i].num = -0x0005 -1; ss_test[i].expected = "-6"; + + i++; ss_test[i].num = 0x0000 -1; ss_test[i].expected = "-1"; + + num_sshort_tests = i; + +#elif (SIZEOF_SHORT == 4) + + i=1; ss_test[i].num = 0x7FFFFFFF; ss_test[i].expected = "2147483647"; + i++; ss_test[i].num = 0x7FFFFFFE; ss_test[i].expected = "2147483646"; + i++; ss_test[i].num = 0x7FFFFFFD; ss_test[i].expected = "2147483645"; + i++; ss_test[i].num = 0x7FFF0000; ss_test[i].expected = "2147418112"; + i++; ss_test[i].num = 0x00007FFF; ss_test[i].expected = "32767"; + + i++; ss_test[i].num = 0x7F000000; ss_test[i].expected = "2130706432"; + i++; ss_test[i].num = 0x007F0000; ss_test[i].expected = "8323072"; + i++; ss_test[i].num = 0x00007F00; ss_test[i].expected = "32512"; + i++; ss_test[i].num = 0x0000007F; ss_test[i].expected = "127"; + + i++; ss_test[i].num = 0x70000000; ss_test[i].expected = "1879048192"; + i++; ss_test[i].num = 0x07000000; ss_test[i].expected = "117440512"; + i++; ss_test[i].num = 0x00700000; ss_test[i].expected = "7340032"; + i++; ss_test[i].num = 0x00070000; ss_test[i].expected = "458752"; + i++; ss_test[i].num = 0x00007000; ss_test[i].expected = "28672"; + i++; ss_test[i].num = 0x00000700; ss_test[i].expected = "1792"; + i++; ss_test[i].num = 0x00000070; ss_test[i].expected = "112"; + i++; ss_test[i].num = 0x00000007; ss_test[i].expected = "7"; + + i++; ss_test[i].num = 0x50000000; ss_test[i].expected = "1342177280"; + i++; ss_test[i].num = 0x05000000; ss_test[i].expected = "83886080"; + i++; ss_test[i].num = 0x00500000; ss_test[i].expected = "5242880"; + i++; ss_test[i].num = 0x00050000; ss_test[i].expected = "327680"; + i++; ss_test[i].num = 0x00005000; ss_test[i].expected = "20480"; + i++; ss_test[i].num = 0x00000500; ss_test[i].expected = "1280"; + i++; ss_test[i].num = 0x00000050; ss_test[i].expected = "80"; + i++; ss_test[i].num = 0x00000005; ss_test[i].expected = "5"; + + i++; ss_test[i].num = 0x00000001; ss_test[i].expected = "1"; + i++; ss_test[i].num = 0x00000000; ss_test[i].expected = "0"; + + i++; ss_test[i].num = -0x7FFFFFFF -1; ss_test[i].expected = "-2147483648"; + i++; ss_test[i].num = -0x7FFFFFFE -1; ss_test[i].expected = "-2147483647"; + i++; ss_test[i].num = -0x7FFFFFFD -1; ss_test[i].expected = "-2147483646"; + i++; ss_test[i].num = -0x7FFF0000 -1; ss_test[i].expected = "-2147418113"; + i++; ss_test[i].num = -0x00007FFF -1; ss_test[i].expected = "-32768"; + + i++; ss_test[i].num = -0x7F000000 -1; ss_test[i].expected = "-2130706433"; + i++; ss_test[i].num = -0x007F0000 -1; ss_test[i].expected = "-8323073"; + i++; ss_test[i].num = -0x00007F00 -1; ss_test[i].expected = "-32513"; + i++; ss_test[i].num = -0x0000007F -1; ss_test[i].expected = "-128"; + + i++; ss_test[i].num = -0x70000000 -1; ss_test[i].expected = "-1879048193"; + i++; ss_test[i].num = -0x07000000 -1; ss_test[i].expected = "-117440513"; + i++; ss_test[i].num = -0x00700000 -1; ss_test[i].expected = "-7340033"; + i++; ss_test[i].num = -0x00070000 -1; ss_test[i].expected = "-458753"; + i++; ss_test[i].num = -0x00007000 -1; ss_test[i].expected = "-28673"; + i++; ss_test[i].num = -0x00000700 -1; ss_test[i].expected = "-1793"; + i++; ss_test[i].num = -0x00000070 -1; ss_test[i].expected = "-113"; + i++; ss_test[i].num = -0x00000007 -1; ss_test[i].expected = "-8"; + + i++; ss_test[i].num = -0x50000000 -1; ss_test[i].expected = "-1342177281"; + i++; ss_test[i].num = -0x05000000 -1; ss_test[i].expected = "-83886081"; + i++; ss_test[i].num = -0x00500000 -1; ss_test[i].expected = "-5242881"; + i++; ss_test[i].num = -0x00050000 -1; ss_test[i].expected = "-327681"; + i++; ss_test[i].num = -0x00005000 -1; ss_test[i].expected = "-20481"; + i++; ss_test[i].num = -0x00000500 -1; ss_test[i].expected = "-1281"; + i++; ss_test[i].num = -0x00000050 -1; ss_test[i].expected = "-81"; + i++; ss_test[i].num = -0x00000005 -1; ss_test[i].expected = "-6"; + + i++; ss_test[i].num = 0x00000000 -1; ss_test[i].expected = "-1"; + + num_sshort_tests = i; + +#endif + + for(i=1; i<=num_sshort_tests; i++) { + + for(j=0; j<BUFSZ; j++) + ss_test[i].result[j] = 'X'; + ss_test[i].result[BUFSZ-1] = '\0'; + + (void)curl_msprintf(ss_test[i].result, "%hd", ss_test[i].num); + + if(memcmp(ss_test[i].result, + ss_test[i].expected, + strlen(ss_test[i].expected))) { + printf("signed short test #%.2d: Failed (Expected: %s Got: %s)\n", + i, ss_test[i].expected, ss_test[i].result); + failed++; + } + + } + + if(!failed) + printf("All curl_mprintf() signed short tests OK!\n"); + else + printf("Some curl_mprintf() signed short tests Failed!\n"); + + return failed; +} + + +static int test_unsigned_int_formatting(void) +{ + int i, j; + int num_uint_tests; + int failed = 0; + +#if (SIZEOF_INT == 2) + + i=1; ui_test[i].num = 0xFFFFU; ui_test[i].expected = "65535"; + i++; ui_test[i].num = 0xFF00U; ui_test[i].expected = "65280"; + i++; ui_test[i].num = 0x00FFU; ui_test[i].expected = "255"; + + i++; ui_test[i].num = 0xF000U; ui_test[i].expected = "61440"; + i++; ui_test[i].num = 0x0F00U; ui_test[i].expected = "3840"; + i++; ui_test[i].num = 0x00F0U; ui_test[i].expected = "240"; + i++; ui_test[i].num = 0x000FU; ui_test[i].expected = "15"; + + i++; ui_test[i].num = 0xC000U; ui_test[i].expected = "49152"; + i++; ui_test[i].num = 0x0C00U; ui_test[i].expected = "3072"; + i++; ui_test[i].num = 0x00C0U; ui_test[i].expected = "192"; + i++; ui_test[i].num = 0x000CU; ui_test[i].expected = "12"; + + i++; ui_test[i].num = 0x0001U; ui_test[i].expected = "1"; + i++; ui_test[i].num = 0x0000U; ui_test[i].expected = "0"; + + num_uint_tests = i; + +#elif (SIZEOF_INT == 4) + + i=1; ui_test[i].num = 0xFFFFFFFFU; ui_test[i].expected = "4294967295"; + i++; ui_test[i].num = 0xFFFF0000U; ui_test[i].expected = "4294901760"; + i++; ui_test[i].num = 0x0000FFFFU; ui_test[i].expected = "65535"; + + i++; ui_test[i].num = 0xFF000000U; ui_test[i].expected = "4278190080"; + i++; ui_test[i].num = 0x00FF0000U; ui_test[i].expected = "16711680"; + i++; ui_test[i].num = 0x0000FF00U; ui_test[i].expected = "65280"; + i++; ui_test[i].num = 0x000000FFU; ui_test[i].expected = "255"; + + i++; ui_test[i].num = 0xF0000000U; ui_test[i].expected = "4026531840"; + i++; ui_test[i].num = 0x0F000000U; ui_test[i].expected = "251658240"; + i++; ui_test[i].num = 0x00F00000U; ui_test[i].expected = "15728640"; + i++; ui_test[i].num = 0x000F0000U; ui_test[i].expected = "983040"; + i++; ui_test[i].num = 0x0000F000U; ui_test[i].expected = "61440"; + i++; ui_test[i].num = 0x00000F00U; ui_test[i].expected = "3840"; + i++; ui_test[i].num = 0x000000F0U; ui_test[i].expected = "240"; + i++; ui_test[i].num = 0x0000000FU; ui_test[i].expected = "15"; + + i++; ui_test[i].num = 0xC0000000U; ui_test[i].expected = "3221225472"; + i++; ui_test[i].num = 0x0C000000U; ui_test[i].expected = "201326592"; + i++; ui_test[i].num = 0x00C00000U; ui_test[i].expected = "12582912"; + i++; ui_test[i].num = 0x000C0000U; ui_test[i].expected = "786432"; + i++; ui_test[i].num = 0x0000C000U; ui_test[i].expected = "49152"; + i++; ui_test[i].num = 0x00000C00U; ui_test[i].expected = "3072"; + i++; ui_test[i].num = 0x000000C0U; ui_test[i].expected = "192"; + i++; ui_test[i].num = 0x0000000CU; ui_test[i].expected = "12"; + + i++; ui_test[i].num = 0x00000001U; ui_test[i].expected = "1"; + i++; ui_test[i].num = 0x00000000U; ui_test[i].expected = "0"; + + num_uint_tests = i; + +#elif (SIZEOF_INT == 8) + + i=1; ui_test[i].num = 0xFFFFFFFFFFFFFFFFU; ui_test[i].expected = "18446744073709551615"; + i++; ui_test[i].num = 0xFFFFFFFF00000000U; ui_test[i].expected = "18446744069414584320"; + i++; ui_test[i].num = 0x00000000FFFFFFFFU; ui_test[i].expected = "4294967295"; + + i++; ui_test[i].num = 0xFFFF000000000000U; ui_test[i].expected = "18446462598732840960"; + i++; ui_test[i].num = 0x0000FFFF00000000U; ui_test[i].expected = "281470681743360"; + i++; ui_test[i].num = 0x00000000FFFF0000U; ui_test[i].expected = "4294901760"; + i++; ui_test[i].num = 0x000000000000FFFFU; ui_test[i].expected = "65535"; + + i++; ui_test[i].num = 0xFF00000000000000U; ui_test[i].expected = "18374686479671623680"; + i++; ui_test[i].num = 0x00FF000000000000U; ui_test[i].expected = "71776119061217280"; + i++; ui_test[i].num = 0x0000FF0000000000U; ui_test[i].expected = "280375465082880"; + i++; ui_test[i].num = 0x000000FF00000000U; ui_test[i].expected = "1095216660480"; + i++; ui_test[i].num = 0x00000000FF000000U; ui_test[i].expected = "4278190080"; + i++; ui_test[i].num = 0x0000000000FF0000U; ui_test[i].expected = "16711680"; + i++; ui_test[i].num = 0x000000000000FF00U; ui_test[i].expected = "65280"; + i++; ui_test[i].num = 0x00000000000000FFU; ui_test[i].expected = "255"; + + i++; ui_test[i].num = 0xF000000000000000U; ui_test[i].expected = "17293822569102704640"; + i++; ui_test[i].num = 0x0F00000000000000U; ui_test[i].expected = "1080863910568919040"; + i++; ui_test[i].num = 0x00F0000000000000U; ui_test[i].expected = "67553994410557440"; + i++; ui_test[i].num = 0x000F000000000000U; ui_test[i].expected = "4222124650659840"; + i++; ui_test[i].num = 0x0000F00000000000U; ui_test[i].expected = "263882790666240"; + i++; ui_test[i].num = 0x00000F0000000000U; ui_test[i].expected = "16492674416640"; + i++; ui_test[i].num = 0x000000F000000000U; ui_test[i].expected = "1030792151040"; + i++; ui_test[i].num = 0x0000000F00000000U; ui_test[i].expected = "64424509440"; + i++; ui_test[i].num = 0x00000000F0000000U; ui_test[i].expected = "4026531840"; + i++; ui_test[i].num = 0x000000000F000000U; ui_test[i].expected = "251658240"; + i++; ui_test[i].num = 0x0000000000F00000U; ui_test[i].expected = "15728640"; + i++; ui_test[i].num = 0x00000000000F0000U; ui_test[i].expected = "983040"; + i++; ui_test[i].num = 0x000000000000F000U; ui_test[i].expected = "61440"; + i++; ui_test[i].num = 0x0000000000000F00U; ui_test[i].expected = "3840"; + i++; ui_test[i].num = 0x00000000000000F0U; ui_test[i].expected = "240"; + i++; ui_test[i].num = 0x000000000000000FU; ui_test[i].expected = "15"; + + i++; ui_test[i].num = 0xC000000000000000U; ui_test[i].expected = "13835058055282163712"; + i++; ui_test[i].num = 0x0C00000000000000U; ui_test[i].expected = "864691128455135232"; + i++; ui_test[i].num = 0x00C0000000000000U; ui_test[i].expected = "54043195528445952"; + i++; ui_test[i].num = 0x000C000000000000U; ui_test[i].expected = "3377699720527872"; + i++; ui_test[i].num = 0x0000C00000000000U; ui_test[i].expected = "211106232532992"; + i++; ui_test[i].num = 0x00000C0000000000U; ui_test[i].expected = "13194139533312"; + i++; ui_test[i].num = 0x000000C000000000U; ui_test[i].expected = "824633720832"; + i++; ui_test[i].num = 0x0000000C00000000U; ui_test[i].expected = "51539607552"; + i++; ui_test[i].num = 0x00000000C0000000U; ui_test[i].expected = "3221225472"; + i++; ui_test[i].num = 0x000000000C000000U; ui_test[i].expected = "201326592"; + i++; ui_test[i].num = 0x0000000000C00000U; ui_test[i].expected = "12582912"; + i++; ui_test[i].num = 0x00000000000C0000U; ui_test[i].expected = "786432"; + i++; ui_test[i].num = 0x000000000000C000U; ui_test[i].expected = "49152"; + i++; ui_test[i].num = 0x0000000000000C00U; ui_test[i].expected = "3072"; + i++; ui_test[i].num = 0x00000000000000C0U; ui_test[i].expected = "192"; + i++; ui_test[i].num = 0x000000000000000CU; ui_test[i].expected = "12"; + + i++; ui_test[i].num = 0x00000001U; ui_test[i].expected = "1"; + i++; ui_test[i].num = 0x00000000U; ui_test[i].expected = "0"; + + num_uint_tests = i; + +#endif + + for(i=1; i<=num_uint_tests; i++) { + + for(j=0; j<BUFSZ; j++) + ui_test[i].result[j] = 'X'; + ui_test[i].result[BUFSZ-1] = '\0'; + + (void)curl_msprintf(ui_test[i].result, "%u", ui_test[i].num); + + if(memcmp(ui_test[i].result, + ui_test[i].expected, + strlen(ui_test[i].expected))) { + printf("unsigned int test #%.2d: Failed (Expected: %s Got: %s)\n", + i, ui_test[i].expected, ui_test[i].result); + failed++; + } + + } + + if(!failed) + printf("All curl_mprintf() unsigned int tests OK!\n"); + else + printf("Some curl_mprintf() unsigned int tests Failed!\n"); + + return failed; +} + + +static int test_signed_int_formatting(void) +{ + int i, j; + int num_sint_tests; + int failed = 0; + +#if (SIZEOF_INT == 2) + + i=1; si_test[i].num = 0x7FFF; si_test[i].expected = "32767"; + i++; si_test[i].num = 0x7FFE; si_test[i].expected = "32766"; + i++; si_test[i].num = 0x7FFD; si_test[i].expected = "32765"; + i++; si_test[i].num = 0x7F00; si_test[i].expected = "32512"; + i++; si_test[i].num = 0x07F0; si_test[i].expected = "2032"; + i++; si_test[i].num = 0x007F; si_test[i].expected = "127"; + + i++; si_test[i].num = 0x7000; si_test[i].expected = "28672"; + i++; si_test[i].num = 0x0700; si_test[i].expected = "1792"; + i++; si_test[i].num = 0x0070; si_test[i].expected = "112"; + i++; si_test[i].num = 0x0007; si_test[i].expected = "7"; + + i++; si_test[i].num = 0x5000; si_test[i].expected = "20480"; + i++; si_test[i].num = 0x0500; si_test[i].expected = "1280"; + i++; si_test[i].num = 0x0050; si_test[i].expected = "80"; + i++; si_test[i].num = 0x0005; si_test[i].expected = "5"; + + i++; si_test[i].num = 0x0001; si_test[i].expected = "1"; + i++; si_test[i].num = 0x0000; si_test[i].expected = "0"; + + i++; si_test[i].num = -0x7FFF -1; si_test[i].expected = "-32768"; + i++; si_test[i].num = -0x7FFE -1; si_test[i].expected = "-32767"; + i++; si_test[i].num = -0x7FFD -1; si_test[i].expected = "-32766"; + i++; si_test[i].num = -0x7F00 -1; si_test[i].expected = "-32513"; + i++; si_test[i].num = -0x07F0 -1; si_test[i].expected = "-2033"; + i++; si_test[i].num = -0x007F -1; si_test[i].expected = "-128"; + + i++; si_test[i].num = -0x7000 -1; si_test[i].expected = "-28673"; + i++; si_test[i].num = -0x0700 -1; si_test[i].expected = "-1793"; + i++; si_test[i].num = -0x0070 -1; si_test[i].expected = "-113"; + i++; si_test[i].num = -0x0007 -1; si_test[i].expected = "-8"; + + i++; si_test[i].num = -0x5000 -1; si_test[i].expected = "-20481"; + i++; si_test[i].num = -0x0500 -1; si_test[i].expected = "-1281"; + i++; si_test[i].num = -0x0050 -1; si_test[i].expected = "-81"; + i++; si_test[i].num = -0x0005 -1; si_test[i].expected = "-6"; + + i++; si_test[i].num = 0x0000 -1; si_test[i].expected = "-1"; + + num_sint_tests = i; + +#elif (SIZEOF_INT == 4) + + i=1; si_test[i].num = 0x7FFFFFFF; si_test[i].expected = "2147483647"; + i++; si_test[i].num = 0x7FFFFFFE; si_test[i].expected = "2147483646"; + i++; si_test[i].num = 0x7FFFFFFD; si_test[i].expected = "2147483645"; + i++; si_test[i].num = 0x7FFF0000; si_test[i].expected = "2147418112"; + i++; si_test[i].num = 0x00007FFF; si_test[i].expected = "32767"; + + i++; si_test[i].num = 0x7F000000; si_test[i].expected = "2130706432"; + i++; si_test[i].num = 0x007F0000; si_test[i].expected = "8323072"; + i++; si_test[i].num = 0x00007F00; si_test[i].expected = "32512"; + i++; si_test[i].num = 0x0000007F; si_test[i].expected = "127"; + + i++; si_test[i].num = 0x70000000; si_test[i].expected = "1879048192"; + i++; si_test[i].num = 0x07000000; si_test[i].expected = "117440512"; + i++; si_test[i].num = 0x00700000; si_test[i].expected = "7340032"; + i++; si_test[i].num = 0x00070000; si_test[i].expected = "458752"; + i++; si_test[i].num = 0x00007000; si_test[i].expected = "28672"; + i++; si_test[i].num = 0x00000700; si_test[i].expected = "1792"; + i++; si_test[i].num = 0x00000070; si_test[i].expected = "112"; + i++; si_test[i].num = 0x00000007; si_test[i].expected = "7"; + + i++; si_test[i].num = 0x50000000; si_test[i].expected = "1342177280"; + i++; si_test[i].num = 0x05000000; si_test[i].expected = "83886080"; + i++; si_test[i].num = 0x00500000; si_test[i].expected = "5242880"; + i++; si_test[i].num = 0x00050000; si_test[i].expected = "327680"; + i++; si_test[i].num = 0x00005000; si_test[i].expected = "20480"; + i++; si_test[i].num = 0x00000500; si_test[i].expected = "1280"; + i++; si_test[i].num = 0x00000050; si_test[i].expected = "80"; + i++; si_test[i].num = 0x00000005; si_test[i].expected = "5"; + + i++; si_test[i].num = 0x00000001; si_test[i].expected = "1"; + i++; si_test[i].num = 0x00000000; si_test[i].expected = "0"; + + i++; si_test[i].num = -0x7FFFFFFF -1; si_test[i].expected = "-2147483648"; + i++; si_test[i].num = -0x7FFFFFFE -1; si_test[i].expected = "-2147483647"; + i++; si_test[i].num = -0x7FFFFFFD -1; si_test[i].expected = "-2147483646"; + i++; si_test[i].num = -0x7FFF0000 -1; si_test[i].expected = "-2147418113"; + i++; si_test[i].num = -0x00007FFF -1; si_test[i].expected = "-32768"; + + i++; si_test[i].num = -0x7F000000 -1; si_test[i].expected = "-2130706433"; + i++; si_test[i].num = -0x007F0000 -1; si_test[i].expected = "-8323073"; + i++; si_test[i].num = -0x00007F00 -1; si_test[i].expected = "-32513"; + i++; si_test[i].num = -0x0000007F -1; si_test[i].expected = "-128"; + + i++; si_test[i].num = -0x70000000 -1; si_test[i].expected = "-1879048193"; + i++; si_test[i].num = -0x07000000 -1; si_test[i].expected = "-117440513"; + i++; si_test[i].num = -0x00700000 -1; si_test[i].expected = "-7340033"; + i++; si_test[i].num = -0x00070000 -1; si_test[i].expected = "-458753"; + i++; si_test[i].num = -0x00007000 -1; si_test[i].expected = "-28673"; + i++; si_test[i].num = -0x00000700 -1; si_test[i].expected = "-1793"; + i++; si_test[i].num = -0x00000070 -1; si_test[i].expected = "-113"; + i++; si_test[i].num = -0x00000007 -1; si_test[i].expected = "-8"; + + i++; si_test[i].num = -0x50000000 -1; si_test[i].expected = "-1342177281"; + i++; si_test[i].num = -0x05000000 -1; si_test[i].expected = "-83886081"; + i++; si_test[i].num = -0x00500000 -1; si_test[i].expected = "-5242881"; + i++; si_test[i].num = -0x00050000 -1; si_test[i].expected = "-327681"; + i++; si_test[i].num = -0x00005000 -1; si_test[i].expected = "-20481"; + i++; si_test[i].num = -0x00000500 -1; si_test[i].expected = "-1281"; + i++; si_test[i].num = -0x00000050 -1; si_test[i].expected = "-81"; + i++; si_test[i].num = -0x00000005 -1; si_test[i].expected = "-6"; + + i++; si_test[i].num = 0x00000000 -1; si_test[i].expected = "-1"; + + num_sint_tests = i; + +#elif (SIZEOF_INT == 8) + + i=1; si_test[i].num = 0x7FFFFFFFFFFFFFFF; si_test[i].expected = "9223372036854775807"; + i++; si_test[i].num = 0x7FFFFFFFFFFFFFFE; si_test[i].expected = "9223372036854775806"; + i++; si_test[i].num = 0x7FFFFFFFFFFFFFFD; si_test[i].expected = "9223372036854775805"; + i++; si_test[i].num = 0x7FFFFFFF00000000; si_test[i].expected = "9223372032559808512"; + i++; si_test[i].num = 0x000000007FFFFFFF; si_test[i].expected = "2147483647"; + + i++; si_test[i].num = 0x7FFF000000000000; si_test[i].expected = "9223090561878065152"; + i++; si_test[i].num = 0x00007FFF00000000; si_test[i].expected = "140733193388032"; + i++; si_test[i].num = 0x000000007FFF0000; si_test[i].expected = "2147418112"; + i++; si_test[i].num = 0x0000000000007FFF; si_test[i].expected = "32767"; + + i++; si_test[i].num = 0x7F00000000000000; si_test[i].expected = "9151314442816847872"; + i++; si_test[i].num = 0x007F000000000000; si_test[i].expected = "35747322042253312"; + i++; si_test[i].num = 0x00007F0000000000; si_test[i].expected = "139637976727552"; + i++; si_test[i].num = 0x0000007F00000000; si_test[i].expected = "545460846592"; + i++; si_test[i].num = 0x000000007F000000; si_test[i].expected = "2130706432"; + i++; si_test[i].num = 0x00000000007F0000; si_test[i].expected = "8323072"; + i++; si_test[i].num = 0x0000000000007F00; si_test[i].expected = "32512"; + i++; si_test[i].num = 0x000000000000007F; si_test[i].expected = "127"; + + i++; si_test[i].num = 0x7000000000000000; si_test[i].expected = "8070450532247928832"; + i++; si_test[i].num = 0x0700000000000000; si_test[i].expected = "504403158265495552"; + i++; si_test[i].num = 0x0070000000000000; si_test[i].expected = "31525197391593472"; + i++; si_test[i].num = 0x0007000000000000; si_test[i].expected = "1970324836974592"; + i++; si_test[i].num = 0x0000700000000000; si_test[i].expected = "123145302310912"; + i++; si_test[i].num = 0x0000070000000000; si_test[i].expected = "7696581394432"; + i++; si_test[i].num = 0x0000007000000000; si_test[i].expected = "481036337152"; + i++; si_test[i].num = 0x0000000700000000; si_test[i].expected = "30064771072"; + i++; si_test[i].num = 0x0000000070000000; si_test[i].expected = "1879048192"; + i++; si_test[i].num = 0x0000000007000000; si_test[i].expected = "117440512"; + i++; si_test[i].num = 0x0000000000700000; si_test[i].expected = "7340032"; + i++; si_test[i].num = 0x0000000000070000; si_test[i].expected = "458752"; + i++; si_test[i].num = 0x0000000000007000; si_test[i].expected = "28672"; + i++; si_test[i].num = 0x0000000000000700; si_test[i].expected = "1792"; + i++; si_test[i].num = 0x0000000000000070; si_test[i].expected = "112"; + i++; si_test[i].num = 0x0000000000000007; si_test[i].expected = "7"; + + i++; si_test[i].num = 0x0000000000000001; si_test[i].expected = "1"; + i++; si_test[i].num = 0x0000000000000000; si_test[i].expected = "0"; + + i++; si_test[i].num = -0x7FFFFFFFFFFFFFFF -1; si_test[i].expected = "-9223372036854775808"; + i++; si_test[i].num = -0x7FFFFFFFFFFFFFFE -1; si_test[i].expected = "-9223372036854775807"; + i++; si_test[i].num = -0x7FFFFFFFFFFFFFFD -1; si_test[i].expected = "-9223372036854775806"; + i++; si_test[i].num = -0x7FFFFFFF00000000 -1; si_test[i].expected = "-9223372032559808513"; + i++; si_test[i].num = -0x000000007FFFFFFF -1; si_test[i].expected = "-2147483648"; + + i++; si_test[i].num = -0x7FFF000000000000 -1; si_test[i].expected = "-9223090561878065153"; + i++; si_test[i].num = -0x00007FFF00000000 -1; si_test[i].expected = "-140733193388033"; + i++; si_test[i].num = -0x000000007FFF0000 -1; si_test[i].expected = "-2147418113"; + i++; si_test[i].num = -0x0000000000007FFF -1; si_test[i].expected = "-32768"; + + i++; si_test[i].num = -0x7F00000000000000 -1; si_test[i].expected = "-9151314442816847873"; + i++; si_test[i].num = -0x007F000000000000 -1; si_test[i].expected = "-35747322042253313"; + i++; si_test[i].num = -0x00007F0000000000 -1; si_test[i].expected = "-139637976727553"; + i++; si_test[i].num = -0x0000007F00000000 -1; si_test[i].expected = "-545460846593"; + i++; si_test[i].num = -0x000000007F000000 -1; si_test[i].expected = "-2130706433"; + i++; si_test[i].num = -0x00000000007F0000 -1; si_test[i].expected = "-8323073"; + i++; si_test[i].num = -0x0000000000007F00 -1; si_test[i].expected = "-32513"; + i++; si_test[i].num = -0x000000000000007F -1; si_test[i].expected = "-128"; + + i++; si_test[i].num = -0x7000000000000000 -1; si_test[i].expected = "-8070450532247928833"; + i++; si_test[i].num = -0x0700000000000000 -1; si_test[i].expected = "-504403158265495553"; + i++; si_test[i].num = -0x0070000000000000 -1; si_test[i].expected = "-31525197391593473"; + i++; si_test[i].num = -0x0007000000000000 -1; si_test[i].expected = "-1970324836974593"; + i++; si_test[i].num = -0x0000700000000000 -1; si_test[i].expected = "-123145302310913"; + i++; si_test[i].num = -0x0000070000000000 -1; si_test[i].expected = "-7696581394433"; + i++; si_test[i].num = -0x0000007000000000 -1; si_test[i].expected = "-481036337153"; + i++; si_test[i].num = -0x0000000700000000 -1; si_test[i].expected = "-30064771073"; + i++; si_test[i].num = -0x0000000070000000 -1; si_test[i].expected = "-1879048193"; + i++; si_test[i].num = -0x0000000007000000 -1; si_test[i].expected = "-117440513"; + i++; si_test[i].num = -0x0000000000700000 -1; si_test[i].expected = "-7340033"; + i++; si_test[i].num = -0x0000000000070000 -1; si_test[i].expected = "-458753"; + i++; si_test[i].num = -0x0000000000007000 -1; si_test[i].expected = "-28673"; + i++; si_test[i].num = -0x0000000000000700 -1; si_test[i].expected = "-1793"; + i++; si_test[i].num = -0x0000000000000070 -1; si_test[i].expected = "-113"; + i++; si_test[i].num = -0x0000000000000007 -1; si_test[i].expected = "-8"; + + i++; si_test[i].num = 0x0000000000000000 -1; si_test[i].expected = "-1"; + + num_sint_tests = i; + +#endif + + for(i=1; i<=num_sint_tests; i++) { + + for(j=0; j<BUFSZ; j++) + si_test[i].result[j] = 'X'; + si_test[i].result[BUFSZ-1] = '\0'; + + (void)curl_msprintf(si_test[i].result, "%d", si_test[i].num); + + if(memcmp(si_test[i].result, + si_test[i].expected, + strlen(si_test[i].expected))) { + printf("signed int test #%.2d: Failed (Expected: %s Got: %s)\n", + i, si_test[i].expected, si_test[i].result); + failed++; + } + + } + + if(!failed) + printf("All curl_mprintf() signed int tests OK!\n"); + else + printf("Some curl_mprintf() signed int tests Failed!\n"); + + return failed; +} + + +static int test_unsigned_long_formatting(void) +{ + int i, j; + int num_ulong_tests; + int failed = 0; + +#if (CURL_SIZEOF_LONG == 2) + + i=1; ul_test[i].num = 0xFFFFUL; ul_test[i].expected = "65535"; + i++; ul_test[i].num = 0xFF00UL; ul_test[i].expected = "65280"; + i++; ul_test[i].num = 0x00FFUL; ul_test[i].expected = "255"; + + i++; ul_test[i].num = 0xF000UL; ul_test[i].expected = "61440"; + i++; ul_test[i].num = 0x0F00UL; ul_test[i].expected = "3840"; + i++; ul_test[i].num = 0x00F0UL; ul_test[i].expected = "240"; + i++; ul_test[i].num = 0x000FUL; ul_test[i].expected = "15"; + + i++; ul_test[i].num = 0xC000UL; ul_test[i].expected = "49152"; + i++; ul_test[i].num = 0x0C00UL; ul_test[i].expected = "3072"; + i++; ul_test[i].num = 0x00C0UL; ul_test[i].expected = "192"; + i++; ul_test[i].num = 0x000CUL; ul_test[i].expected = "12"; + + i++; ul_test[i].num = 0x0001UL; ul_test[i].expected = "1"; + i++; ul_test[i].num = 0x0000UL; ul_test[i].expected = "0"; + + num_ulong_tests = i; + +#elif (CURL_SIZEOF_LONG == 4) + + i=1; ul_test[i].num = 0xFFFFFFFFUL; ul_test[i].expected = "4294967295"; + i++; ul_test[i].num = 0xFFFF0000UL; ul_test[i].expected = "4294901760"; + i++; ul_test[i].num = 0x0000FFFFUL; ul_test[i].expected = "65535"; + + i++; ul_test[i].num = 0xFF000000UL; ul_test[i].expected = "4278190080"; + i++; ul_test[i].num = 0x00FF0000UL; ul_test[i].expected = "16711680"; + i++; ul_test[i].num = 0x0000FF00UL; ul_test[i].expected = "65280"; + i++; ul_test[i].num = 0x000000FFUL; ul_test[i].expected = "255"; + + i++; ul_test[i].num = 0xF0000000UL; ul_test[i].expected = "4026531840"; + i++; ul_test[i].num = 0x0F000000UL; ul_test[i].expected = "251658240"; + i++; ul_test[i].num = 0x00F00000UL; ul_test[i].expected = "15728640"; + i++; ul_test[i].num = 0x000F0000UL; ul_test[i].expected = "983040"; + i++; ul_test[i].num = 0x0000F000UL; ul_test[i].expected = "61440"; + i++; ul_test[i].num = 0x00000F00UL; ul_test[i].expected = "3840"; + i++; ul_test[i].num = 0x000000F0UL; ul_test[i].expected = "240"; + i++; ul_test[i].num = 0x0000000FUL; ul_test[i].expected = "15"; + + i++; ul_test[i].num = 0xC0000000UL; ul_test[i].expected = "3221225472"; + i++; ul_test[i].num = 0x0C000000UL; ul_test[i].expected = "201326592"; + i++; ul_test[i].num = 0x00C00000UL; ul_test[i].expected = "12582912"; + i++; ul_test[i].num = 0x000C0000UL; ul_test[i].expected = "786432"; + i++; ul_test[i].num = 0x0000C000UL; ul_test[i].expected = "49152"; + i++; ul_test[i].num = 0x00000C00UL; ul_test[i].expected = "3072"; + i++; ul_test[i].num = 0x000000C0UL; ul_test[i].expected = "192"; + i++; ul_test[i].num = 0x0000000CUL; ul_test[i].expected = "12"; + + i++; ul_test[i].num = 0x00000001UL; ul_test[i].expected = "1"; + i++; ul_test[i].num = 0x00000000UL; ul_test[i].expected = "0"; + + num_ulong_tests = i; + +#elif (CURL_SIZEOF_LONG == 8) + + i=1; ul_test[i].num = 0xFFFFFFFFFFFFFFFFUL; ul_test[i].expected = "18446744073709551615"; + i++; ul_test[i].num = 0xFFFFFFFF00000000UL; ul_test[i].expected = "18446744069414584320"; + i++; ul_test[i].num = 0x00000000FFFFFFFFUL; ul_test[i].expected = "4294967295"; + + i++; ul_test[i].num = 0xFFFF000000000000UL; ul_test[i].expected = "18446462598732840960"; + i++; ul_test[i].num = 0x0000FFFF00000000UL; ul_test[i].expected = "281470681743360"; + i++; ul_test[i].num = 0x00000000FFFF0000UL; ul_test[i].expected = "4294901760"; + i++; ul_test[i].num = 0x000000000000FFFFUL; ul_test[i].expected = "65535"; + + i++; ul_test[i].num = 0xFF00000000000000UL; ul_test[i].expected = "18374686479671623680"; + i++; ul_test[i].num = 0x00FF000000000000UL; ul_test[i].expected = "71776119061217280"; + i++; ul_test[i].num = 0x0000FF0000000000UL; ul_test[i].expected = "280375465082880"; + i++; ul_test[i].num = 0x000000FF00000000UL; ul_test[i].expected = "1095216660480"; + i++; ul_test[i].num = 0x00000000FF000000UL; ul_test[i].expected = "4278190080"; + i++; ul_test[i].num = 0x0000000000FF0000UL; ul_test[i].expected = "16711680"; + i++; ul_test[i].num = 0x000000000000FF00UL; ul_test[i].expected = "65280"; + i++; ul_test[i].num = 0x00000000000000FFUL; ul_test[i].expected = "255"; + + i++; ul_test[i].num = 0xF000000000000000UL; ul_test[i].expected = "17293822569102704640"; + i++; ul_test[i].num = 0x0F00000000000000UL; ul_test[i].expected = "1080863910568919040"; + i++; ul_test[i].num = 0x00F0000000000000UL; ul_test[i].expected = "67553994410557440"; + i++; ul_test[i].num = 0x000F000000000000UL; ul_test[i].expected = "4222124650659840"; + i++; ul_test[i].num = 0x0000F00000000000UL; ul_test[i].expected = "263882790666240"; + i++; ul_test[i].num = 0x00000F0000000000UL; ul_test[i].expected = "16492674416640"; + i++; ul_test[i].num = 0x000000F000000000UL; ul_test[i].expected = "1030792151040"; + i++; ul_test[i].num = 0x0000000F00000000UL; ul_test[i].expected = "64424509440"; + i++; ul_test[i].num = 0x00000000F0000000UL; ul_test[i].expected = "4026531840"; + i++; ul_test[i].num = 0x000000000F000000UL; ul_test[i].expected = "251658240"; + i++; ul_test[i].num = 0x0000000000F00000UL; ul_test[i].expected = "15728640"; + i++; ul_test[i].num = 0x00000000000F0000UL; ul_test[i].expected = "983040"; + i++; ul_test[i].num = 0x000000000000F000UL; ul_test[i].expected = "61440"; + i++; ul_test[i].num = 0x0000000000000F00UL; ul_test[i].expected = "3840"; + i++; ul_test[i].num = 0x00000000000000F0UL; ul_test[i].expected = "240"; + i++; ul_test[i].num = 0x000000000000000FUL; ul_test[i].expected = "15"; + + i++; ul_test[i].num = 0xC000000000000000UL; ul_test[i].expected = "13835058055282163712"; + i++; ul_test[i].num = 0x0C00000000000000UL; ul_test[i].expected = "864691128455135232"; + i++; ul_test[i].num = 0x00C0000000000000UL; ul_test[i].expected = "54043195528445952"; + i++; ul_test[i].num = 0x000C000000000000UL; ul_test[i].expected = "3377699720527872"; + i++; ul_test[i].num = 0x0000C00000000000UL; ul_test[i].expected = "211106232532992"; + i++; ul_test[i].num = 0x00000C0000000000UL; ul_test[i].expected = "13194139533312"; + i++; ul_test[i].num = 0x000000C000000000UL; ul_test[i].expected = "824633720832"; + i++; ul_test[i].num = 0x0000000C00000000UL; ul_test[i].expected = "51539607552"; + i++; ul_test[i].num = 0x00000000C0000000UL; ul_test[i].expected = "3221225472"; + i++; ul_test[i].num = 0x000000000C000000UL; ul_test[i].expected = "201326592"; + i++; ul_test[i].num = 0x0000000000C00000UL; ul_test[i].expected = "12582912"; + i++; ul_test[i].num = 0x00000000000C0000UL; ul_test[i].expected = "786432"; + i++; ul_test[i].num = 0x000000000000C000UL; ul_test[i].expected = "49152"; + i++; ul_test[i].num = 0x0000000000000C00UL; ul_test[i].expected = "3072"; + i++; ul_test[i].num = 0x00000000000000C0UL; ul_test[i].expected = "192"; + i++; ul_test[i].num = 0x000000000000000CUL; ul_test[i].expected = "12"; + + i++; ul_test[i].num = 0x00000001UL; ul_test[i].expected = "1"; + i++; ul_test[i].num = 0x00000000UL; ul_test[i].expected = "0"; + + num_ulong_tests = i; + +#endif + + for(i=1; i<=num_ulong_tests; i++) { + + for(j=0; j<BUFSZ; j++) + ul_test[i].result[j] = 'X'; + ul_test[i].result[BUFSZ-1] = '\0'; + + (void)curl_msprintf(ul_test[i].result, "%lu", ul_test[i].num); + + if(memcmp(ul_test[i].result, + ul_test[i].expected, + strlen(ul_test[i].expected))) { + printf("unsigned long test #%.2d: Failed (Expected: %s Got: %s)\n", + i, ul_test[i].expected, ul_test[i].result); + failed++; + } + + } + + if(!failed) + printf("All curl_mprintf() unsigned long tests OK!\n"); + else + printf("Some curl_mprintf() unsigned long tests Failed!\n"); + + return failed; +} + + +static int test_signed_long_formatting(void) +{ + int i, j; + int num_slong_tests; + int failed = 0; + +#if (CURL_SIZEOF_LONG == 2) + + i=1; sl_test[i].num = 0x7FFFL; sl_test[i].expected = "32767"; + i++; sl_test[i].num = 0x7FFEL; sl_test[i].expected = "32766"; + i++; sl_test[i].num = 0x7FFDL; sl_test[i].expected = "32765"; + i++; sl_test[i].num = 0x7F00L; sl_test[i].expected = "32512"; + i++; sl_test[i].num = 0x07F0L; sl_test[i].expected = "2032"; + i++; sl_test[i].num = 0x007FL; sl_test[i].expected = "127"; + + i++; sl_test[i].num = 0x7000L; sl_test[i].expected = "28672"; + i++; sl_test[i].num = 0x0700L; sl_test[i].expected = "1792"; + i++; sl_test[i].num = 0x0070L; sl_test[i].expected = "112"; + i++; sl_test[i].num = 0x0007L; sl_test[i].expected = "7"; + + i++; sl_test[i].num = 0x5000L; sl_test[i].expected = "20480"; + i++; sl_test[i].num = 0x0500L; sl_test[i].expected = "1280"; + i++; sl_test[i].num = 0x0050L; sl_test[i].expected = "80"; + i++; sl_test[i].num = 0x0005L; sl_test[i].expected = "5"; + + i++; sl_test[i].num = 0x0001L; sl_test[i].expected = "1"; + i++; sl_test[i].num = 0x0000L; sl_test[i].expected = "0"; + + i++; sl_test[i].num = -0x7FFFL -1L; sl_test[i].expected = "-32768"; + i++; sl_test[i].num = -0x7FFEL -1L; sl_test[i].expected = "-32767"; + i++; sl_test[i].num = -0x7FFDL -1L; sl_test[i].expected = "-32766"; + i++; sl_test[i].num = -0x7F00L -1L; sl_test[i].expected = "-32513"; + i++; sl_test[i].num = -0x07F0L -1L; sl_test[i].expected = "-2033"; + i++; sl_test[i].num = -0x007FL -1L; sl_test[i].expected = "-128"; + + i++; sl_test[i].num = -0x7000L -1L; sl_test[i].expected = "-28673"; + i++; sl_test[i].num = -0x0700L -1L; sl_test[i].expected = "-1793"; + i++; sl_test[i].num = -0x0070L -1L; sl_test[i].expected = "-113"; + i++; sl_test[i].num = -0x0007L -1L; sl_test[i].expected = "-8"; + + i++; sl_test[i].num = -0x5000L -1L; sl_test[i].expected = "-20481"; + i++; sl_test[i].num = -0x0500L -1L; sl_test[i].expected = "-1281"; + i++; sl_test[i].num = -0x0050L -1L; sl_test[i].expected = "-81"; + i++; sl_test[i].num = -0x0005L -1L; sl_test[i].expected = "-6"; + + i++; sl_test[i].num = 0x0000L -1L; sl_test[i].expected = "-1"; + + num_slong_tests = i; + +#elif (CURL_SIZEOF_LONG == 4) + + i=1; sl_test[i].num = 0x7FFFFFFFL; sl_test[i].expected = "2147483647"; + i++; sl_test[i].num = 0x7FFFFFFEL; sl_test[i].expected = "2147483646"; + i++; sl_test[i].num = 0x7FFFFFFDL; sl_test[i].expected = "2147483645"; + i++; sl_test[i].num = 0x7FFF0000L; sl_test[i].expected = "2147418112"; + i++; sl_test[i].num = 0x00007FFFL; sl_test[i].expected = "32767"; + + i++; sl_test[i].num = 0x7F000000L; sl_test[i].expected = "2130706432"; + i++; sl_test[i].num = 0x007F0000L; sl_test[i].expected = "8323072"; + i++; sl_test[i].num = 0x00007F00L; sl_test[i].expected = "32512"; + i++; sl_test[i].num = 0x0000007FL; sl_test[i].expected = "127"; + + i++; sl_test[i].num = 0x70000000L; sl_test[i].expected = "1879048192"; + i++; sl_test[i].num = 0x07000000L; sl_test[i].expected = "117440512"; + i++; sl_test[i].num = 0x00700000L; sl_test[i].expected = "7340032"; + i++; sl_test[i].num = 0x00070000L; sl_test[i].expected = "458752"; + i++; sl_test[i].num = 0x00007000L; sl_test[i].expected = "28672"; + i++; sl_test[i].num = 0x00000700L; sl_test[i].expected = "1792"; + i++; sl_test[i].num = 0x00000070L; sl_test[i].expected = "112"; + i++; sl_test[i].num = 0x00000007L; sl_test[i].expected = "7"; + + i++; sl_test[i].num = 0x50000000L; sl_test[i].expected = "1342177280"; + i++; sl_test[i].num = 0x05000000L; sl_test[i].expected = "83886080"; + i++; sl_test[i].num = 0x00500000L; sl_test[i].expected = "5242880"; + i++; sl_test[i].num = 0x00050000L; sl_test[i].expected = "327680"; + i++; sl_test[i].num = 0x00005000L; sl_test[i].expected = "20480"; + i++; sl_test[i].num = 0x00000500L; sl_test[i].expected = "1280"; + i++; sl_test[i].num = 0x00000050L; sl_test[i].expected = "80"; + i++; sl_test[i].num = 0x00000005L; sl_test[i].expected = "5"; + + i++; sl_test[i].num = 0x00000001L; sl_test[i].expected = "1"; + i++; sl_test[i].num = 0x00000000L; sl_test[i].expected = "0"; + + i++; sl_test[i].num = -0x7FFFFFFFL -1L; sl_test[i].expected = "-2147483648"; + i++; sl_test[i].num = -0x7FFFFFFEL -1L; sl_test[i].expected = "-2147483647"; + i++; sl_test[i].num = -0x7FFFFFFDL -1L; sl_test[i].expected = "-2147483646"; + i++; sl_test[i].num = -0x7FFF0000L -1L; sl_test[i].expected = "-2147418113"; + i++; sl_test[i].num = -0x00007FFFL -1L; sl_test[i].expected = "-32768"; + + i++; sl_test[i].num = -0x7F000000L -1L; sl_test[i].expected = "-2130706433"; + i++; sl_test[i].num = -0x007F0000L -1L; sl_test[i].expected = "-8323073"; + i++; sl_test[i].num = -0x00007F00L -1L; sl_test[i].expected = "-32513"; + i++; sl_test[i].num = -0x0000007FL -1L; sl_test[i].expected = "-128"; + + i++; sl_test[i].num = -0x70000000L -1L; sl_test[i].expected = "-1879048193"; + i++; sl_test[i].num = -0x07000000L -1L; sl_test[i].expected = "-117440513"; + i++; sl_test[i].num = -0x00700000L -1L; sl_test[i].expected = "-7340033"; + i++; sl_test[i].num = -0x00070000L -1L; sl_test[i].expected = "-458753"; + i++; sl_test[i].num = -0x00007000L -1L; sl_test[i].expected = "-28673"; + i++; sl_test[i].num = -0x00000700L -1L; sl_test[i].expected = "-1793"; + i++; sl_test[i].num = -0x00000070L -1L; sl_test[i].expected = "-113"; + i++; sl_test[i].num = -0x00000007L -1L; sl_test[i].expected = "-8"; + + i++; sl_test[i].num = -0x50000000L -1L; sl_test[i].expected = "-1342177281"; + i++; sl_test[i].num = -0x05000000L -1L; sl_test[i].expected = "-83886081"; + i++; sl_test[i].num = -0x00500000L -1L; sl_test[i].expected = "-5242881"; + i++; sl_test[i].num = -0x00050000L -1L; sl_test[i].expected = "-327681"; + i++; sl_test[i].num = -0x00005000L -1L; sl_test[i].expected = "-20481"; + i++; sl_test[i].num = -0x00000500L -1L; sl_test[i].expected = "-1281"; + i++; sl_test[i].num = -0x00000050L -1L; sl_test[i].expected = "-81"; + i++; sl_test[i].num = -0x00000005L -1L; sl_test[i].expected = "-6"; + + i++; sl_test[i].num = 0x00000000L -1L; sl_test[i].expected = "-1"; + + num_slong_tests = i; + +#elif (CURL_SIZEOF_LONG == 8) + + i=1; sl_test[i].num = 0x7FFFFFFFFFFFFFFFL; sl_test[i].expected = "9223372036854775807"; + i++; sl_test[i].num = 0x7FFFFFFFFFFFFFFEL; sl_test[i].expected = "9223372036854775806"; + i++; sl_test[i].num = 0x7FFFFFFFFFFFFFFDL; sl_test[i].expected = "9223372036854775805"; + i++; sl_test[i].num = 0x7FFFFFFF00000000L; sl_test[i].expected = "9223372032559808512"; + i++; sl_test[i].num = 0x000000007FFFFFFFL; sl_test[i].expected = "2147483647"; + + i++; sl_test[i].num = 0x7FFF000000000000L; sl_test[i].expected = "9223090561878065152"; + i++; sl_test[i].num = 0x00007FFF00000000L; sl_test[i].expected = "140733193388032"; + i++; sl_test[i].num = 0x000000007FFF0000L; sl_test[i].expected = "2147418112"; + i++; sl_test[i].num = 0x0000000000007FFFL; sl_test[i].expected = "32767"; + + i++; sl_test[i].num = 0x7F00000000000000L; sl_test[i].expected = "9151314442816847872"; + i++; sl_test[i].num = 0x007F000000000000L; sl_test[i].expected = "35747322042253312"; + i++; sl_test[i].num = 0x00007F0000000000L; sl_test[i].expected = "139637976727552"; + i++; sl_test[i].num = 0x0000007F00000000L; sl_test[i].expected = "545460846592"; + i++; sl_test[i].num = 0x000000007F000000L; sl_test[i].expected = "2130706432"; + i++; sl_test[i].num = 0x00000000007F0000L; sl_test[i].expected = "8323072"; + i++; sl_test[i].num = 0x0000000000007F00L; sl_test[i].expected = "32512"; + i++; sl_test[i].num = 0x000000000000007FL; sl_test[i].expected = "127"; + + i++; sl_test[i].num = 0x7000000000000000L; sl_test[i].expected = "8070450532247928832"; + i++; sl_test[i].num = 0x0700000000000000L; sl_test[i].expected = "504403158265495552"; + i++; sl_test[i].num = 0x0070000000000000L; sl_test[i].expected = "31525197391593472"; + i++; sl_test[i].num = 0x0007000000000000L; sl_test[i].expected = "1970324836974592"; + i++; sl_test[i].num = 0x0000700000000000L; sl_test[i].expected = "123145302310912"; + i++; sl_test[i].num = 0x0000070000000000L; sl_test[i].expected = "7696581394432"; + i++; sl_test[i].num = 0x0000007000000000L; sl_test[i].expected = "481036337152"; + i++; sl_test[i].num = 0x0000000700000000L; sl_test[i].expected = "30064771072"; + i++; sl_test[i].num = 0x0000000070000000L; sl_test[i].expected = "1879048192"; + i++; sl_test[i].num = 0x0000000007000000L; sl_test[i].expected = "117440512"; + i++; sl_test[i].num = 0x0000000000700000L; sl_test[i].expected = "7340032"; + i++; sl_test[i].num = 0x0000000000070000L; sl_test[i].expected = "458752"; + i++; sl_test[i].num = 0x0000000000007000L; sl_test[i].expected = "28672"; + i++; sl_test[i].num = 0x0000000000000700L; sl_test[i].expected = "1792"; + i++; sl_test[i].num = 0x0000000000000070L; sl_test[i].expected = "112"; + i++; sl_test[i].num = 0x0000000000000007L; sl_test[i].expected = "7"; + + i++; sl_test[i].num = 0x0000000000000001L; sl_test[i].expected = "1"; + i++; sl_test[i].num = 0x0000000000000000L; sl_test[i].expected = "0"; + + i++; sl_test[i].num = -0x7FFFFFFFFFFFFFFFL -1L; sl_test[i].expected = "-9223372036854775808"; + i++; sl_test[i].num = -0x7FFFFFFFFFFFFFFEL -1L; sl_test[i].expected = "-9223372036854775807"; + i++; sl_test[i].num = -0x7FFFFFFFFFFFFFFDL -1L; sl_test[i].expected = "-9223372036854775806"; + i++; sl_test[i].num = -0x7FFFFFFF00000000L -1L; sl_test[i].expected = "-9223372032559808513"; + i++; sl_test[i].num = -0x000000007FFFFFFFL -1L; sl_test[i].expected = "-2147483648"; + + i++; sl_test[i].num = -0x7FFF000000000000L -1L; sl_test[i].expected = "-9223090561878065153"; + i++; sl_test[i].num = -0x00007FFF00000000L -1L; sl_test[i].expected = "-140733193388033"; + i++; sl_test[i].num = -0x000000007FFF0000L -1L; sl_test[i].expected = "-2147418113"; + i++; sl_test[i].num = -0x0000000000007FFFL -1L; sl_test[i].expected = "-32768"; + + i++; sl_test[i].num = -0x7F00000000000000L -1L; sl_test[i].expected = "-9151314442816847873"; + i++; sl_test[i].num = -0x007F000000000000L -1L; sl_test[i].expected = "-35747322042253313"; + i++; sl_test[i].num = -0x00007F0000000000L -1L; sl_test[i].expected = "-139637976727553"; + i++; sl_test[i].num = -0x0000007F00000000L -1L; sl_test[i].expected = "-545460846593"; + i++; sl_test[i].num = -0x000000007F000000L -1L; sl_test[i].expected = "-2130706433"; + i++; sl_test[i].num = -0x00000000007F0000L -1L; sl_test[i].expected = "-8323073"; + i++; sl_test[i].num = -0x0000000000007F00L -1L; sl_test[i].expected = "-32513"; + i++; sl_test[i].num = -0x000000000000007FL -1L; sl_test[i].expected = "-128"; + + i++; sl_test[i].num = -0x7000000000000000L -1L; sl_test[i].expected = "-8070450532247928833"; + i++; sl_test[i].num = -0x0700000000000000L -1L; sl_test[i].expected = "-504403158265495553"; + i++; sl_test[i].num = -0x0070000000000000L -1L; sl_test[i].expected = "-31525197391593473"; + i++; sl_test[i].num = -0x0007000000000000L -1L; sl_test[i].expected = "-1970324836974593"; + i++; sl_test[i].num = -0x0000700000000000L -1L; sl_test[i].expected = "-123145302310913"; + i++; sl_test[i].num = -0x0000070000000000L -1L; sl_test[i].expected = "-7696581394433"; + i++; sl_test[i].num = -0x0000007000000000L -1L; sl_test[i].expected = "-481036337153"; + i++; sl_test[i].num = -0x0000000700000000L -1L; sl_test[i].expected = "-30064771073"; + i++; sl_test[i].num = -0x0000000070000000L -1L; sl_test[i].expected = "-1879048193"; + i++; sl_test[i].num = -0x0000000007000000L -1L; sl_test[i].expected = "-117440513"; + i++; sl_test[i].num = -0x0000000000700000L -1L; sl_test[i].expected = "-7340033"; + i++; sl_test[i].num = -0x0000000000070000L -1L; sl_test[i].expected = "-458753"; + i++; sl_test[i].num = -0x0000000000007000L -1L; sl_test[i].expected = "-28673"; + i++; sl_test[i].num = -0x0000000000000700L -1L; sl_test[i].expected = "-1793"; + i++; sl_test[i].num = -0x0000000000000070L -1L; sl_test[i].expected = "-113"; + i++; sl_test[i].num = -0x0000000000000007L -1L; sl_test[i].expected = "-8"; + + i++; sl_test[i].num = 0x0000000000000000L -1L; sl_test[i].expected = "-1"; + + num_slong_tests = i; + +#endif + + for(i=1; i<=num_slong_tests; i++) { + + for(j=0; j<BUFSZ; j++) + sl_test[i].result[j] = 'X'; + sl_test[i].result[BUFSZ-1] = '\0'; + + (void)curl_msprintf(sl_test[i].result, "%ld", sl_test[i].num); + + if(memcmp(sl_test[i].result, + sl_test[i].expected, + strlen(sl_test[i].expected))) { + printf("signed long test #%.2d: Failed (Expected: %s Got: %s)\n", + i, sl_test[i].expected, sl_test[i].result); + failed++; + } + + } + + if(!failed) + printf("All curl_mprintf() signed long tests OK!\n"); + else + printf("Some curl_mprintf() signed long tests Failed!\n"); + + return failed; +} + + +static int test_curl_off_t_formatting(void) +{ + int i, j; + int num_cofft_tests; + int failed = 0; + +#if (CURL_SIZEOF_CURL_OFF_T == 2) + + i=1; co_test[i].num = MPRNT_OFF_T_C(0x7FFF); co_test[i].expected = "32767"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFE); co_test[i].expected = "32766"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFD); co_test[i].expected = "32765"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x7F00); co_test[i].expected = "32512"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x07F0); co_test[i].expected = "2032"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x007F); co_test[i].expected = "127"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x7000); co_test[i].expected = "28672"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0700); co_test[i].expected = "1792"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0070); co_test[i].expected = "112"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0007); co_test[i].expected = "7"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x5000); co_test[i].expected = "20480"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0500); co_test[i].expected = "1280"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0050); co_test[i].expected = "80"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0005); co_test[i].expected = "5"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x0001); co_test[i].expected = "1"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000); co_test[i].expected = "0"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFF) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32768"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFE) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32767"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFD) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32766"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7F00) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32513"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x07F0) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2033"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x007F) -MPRNT_OFF_T_C(1); co_test[i].expected = "-128"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-28673"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0700) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1793"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0070) -MPRNT_OFF_T_C(1); co_test[i].expected = "-113"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0007) -MPRNT_OFF_T_C(1); co_test[i].expected = "-8"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x5000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-20481"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0500) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1281"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0050) -MPRNT_OFF_T_C(1); co_test[i].expected = "-81"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0005) -MPRNT_OFF_T_C(1); co_test[i].expected = "-6"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1"; + + num_cofft_tests = i; + +#elif (CURL_SIZEOF_CURL_OFF_T == 4) + + i=1; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFF); co_test[i].expected = "2147483647"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFE); co_test[i].expected = "2147483646"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFD); co_test[i].expected = "2147483645"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFF0000); co_test[i].expected = "2147418112"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00007FFF); co_test[i].expected = "32767"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x7F000000); co_test[i].expected = "2130706432"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x007F0000); co_test[i].expected = "8323072"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00007F00); co_test[i].expected = "32512"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000007F); co_test[i].expected = "127"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x70000000); co_test[i].expected = "1879048192"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x07000000); co_test[i].expected = "117440512"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00700000); co_test[i].expected = "7340032"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00070000); co_test[i].expected = "458752"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00007000); co_test[i].expected = "28672"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000700); co_test[i].expected = "1792"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000070); co_test[i].expected = "112"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000007); co_test[i].expected = "7"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x50000000); co_test[i].expected = "1342177280"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x05000000); co_test[i].expected = "83886080"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00500000); co_test[i].expected = "5242880"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00050000); co_test[i].expected = "327680"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00005000); co_test[i].expected = "20480"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000500); co_test[i].expected = "1280"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000050); co_test[i].expected = "80"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000005); co_test[i].expected = "5"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000001); co_test[i].expected = "1"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000000); co_test[i].expected = "0"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFF) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147483648"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFE) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147483647"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFD) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147483646"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFF0000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147418113"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00007FFF) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32768"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7F000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2130706433"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x007F0000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-8323073"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00007F00) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32513"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000007F) -MPRNT_OFF_T_C(1); co_test[i].expected = "-128"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x70000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1879048193"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x07000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-117440513"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00700000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-7340033"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00070000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-458753"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00007000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-28673"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000700) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1793"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000070) -MPRNT_OFF_T_C(1); co_test[i].expected = "-113"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000007) -MPRNT_OFF_T_C(1); co_test[i].expected = "-8"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x50000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1342177281"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x05000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-83886081"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00500000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-5242881"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00050000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-327681"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00005000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-20481"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000500) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1281"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000050) -MPRNT_OFF_T_C(1); co_test[i].expected = "-81"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000005) -MPRNT_OFF_T_C(1); co_test[i].expected = "-6"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1"; + + num_cofft_tests = i; + +#elif (CURL_SIZEOF_CURL_OFF_T == 8) + + i=1; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFF); co_test[i].expected = "9223372036854775807"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFE); co_test[i].expected = "9223372036854775806"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFD); co_test[i].expected = "9223372036854775805"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFF00000000); co_test[i].expected = "9223372032559808512"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x000000007FFFFFFF); co_test[i].expected = "2147483647"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFF000000000000); co_test[i].expected = "9223090561878065152"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00007FFF00000000); co_test[i].expected = "140733193388032"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x000000007FFF0000); co_test[i].expected = "2147418112"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000007FFF); co_test[i].expected = "32767"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x7F00000000000000); co_test[i].expected = "9151314442816847872"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x007F000000000000); co_test[i].expected = "35747322042253312"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00007F0000000000); co_test[i].expected = "139637976727552"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000007F00000000); co_test[i].expected = "545460846592"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x000000007F000000); co_test[i].expected = "2130706432"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x00000000007F0000); co_test[i].expected = "8323072"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000007F00); co_test[i].expected = "32512"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x000000000000007F); co_test[i].expected = "127"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x7000000000000000); co_test[i].expected = "8070450532247928832"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0700000000000000); co_test[i].expected = "504403158265495552"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0070000000000000); co_test[i].expected = "31525197391593472"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0007000000000000); co_test[i].expected = "1970324836974592"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000700000000000); co_test[i].expected = "123145302310912"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000070000000000); co_test[i].expected = "7696581394432"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000007000000000); co_test[i].expected = "481036337152"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000700000000); co_test[i].expected = "30064771072"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000070000000); co_test[i].expected = "1879048192"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000007000000); co_test[i].expected = "117440512"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000700000); co_test[i].expected = "7340032"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000070000); co_test[i].expected = "458752"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000007000); co_test[i].expected = "28672"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000000700); co_test[i].expected = "1792"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000000070); co_test[i].expected = "112"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000000007); co_test[i].expected = "7"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000000001); co_test[i].expected = "1"; + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000000000); co_test[i].expected = "0"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFF) -MPRNT_OFF_T_C(1); co_test[i].expected = "-9223372036854775808"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFE) -MPRNT_OFF_T_C(1); co_test[i].expected = "-9223372036854775807"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFD) -MPRNT_OFF_T_C(1); co_test[i].expected = "-9223372036854775806"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFF00000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-9223372032559808513"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x000000007FFFFFFF) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147483648"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFF000000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-9223090561878065153"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00007FFF00000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-140733193388033"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x000000007FFF0000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147418113"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000000007FFF) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32768"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7F00000000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-9151314442816847873"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x007F000000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-35747322042253313"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00007F0000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-139637976727553"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000007F00000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-545460846593"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x000000007F000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2130706433"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000000007F0000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-8323073"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000000007F00) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32513"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x000000000000007F) -MPRNT_OFF_T_C(1); co_test[i].expected = "-128"; + + i++; co_test[i].num = -MPRNT_OFF_T_C(0x7000000000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-8070450532247928833"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0700000000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-504403158265495553"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0070000000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-31525197391593473"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0007000000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1970324836974593"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000700000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-123145302310913"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000070000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-7696581394433"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000007000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-481036337153"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000700000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-30064771073"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000070000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1879048193"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000007000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-117440513"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000000700000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-7340033"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000000070000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-458753"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000000007000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-28673"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000000000700) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1793"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000000000070) -MPRNT_OFF_T_C(1); co_test[i].expected = "-113"; + i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000000000000007) -MPRNT_OFF_T_C(1); co_test[i].expected = "-8"; + + i++; co_test[i].num = MPRNT_OFF_T_C(0x0000000000000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1"; + + num_cofft_tests = i; + +#endif + + for(i=1; i<=num_cofft_tests; i++) { + + for(j=0; j<BUFSZ; j++) + co_test[i].result[j] = 'X'; + co_test[i].result[BUFSZ-1] = '\0'; + + (void)curl_msprintf(co_test[i].result, "%" FORMAT_OFF_T, co_test[i].num); + + if(memcmp(co_test[i].result, + co_test[i].expected, + strlen(co_test[i].expected))) { + printf("curl_off_t test #%.2d: Failed (Expected: %s Got: %s)\n", + i, co_test[i].expected, co_test[i].result); + failed++; + } + + } + + if(!failed) + printf("All curl_mprintf() curl_off_t tests OK!\n"); + else + printf("Some curl_mprintf() curl_off_t tests Failed!\n"); + + return failed; +} + + +int test(char *URL) +{ + int errors = 0; + (void)URL; /* not used */ + + errors += test_unsigned_short_formatting(); + + errors += test_signed_short_formatting(); + + errors += test_unsigned_int_formatting(); + + errors += test_signed_int_formatting(); + + errors += test_unsigned_long_formatting(); + + errors += test_signed_long_formatting(); + + errors += test_curl_off_t_formatting(); + + if(errors) + return TEST_ERR_MAJOR_BAD; + else + return 0; +} diff --git a/tests/libtest/lib558.c b/tests/libtest/lib558.c new file mode 100644 index 0000000..56f2a26 --- /dev/null +++ b/tests/libtest/lib558.c @@ -0,0 +1,188 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif +#ifdef HAVE_NETDB_H +# include <netdb.h> +#endif +#ifdef HAVE_ARPA_INET_H +# include <arpa/inet.h> +#endif + +#define ENABLE_CURLX_PRINTF +#include "curlx.h" + +#include "hash.h" +#include "hostip.h" + +#include "curl_memory.h" +#include "memdebug.h" + +/* This source file is used for test # 558 and 559 */ + +/* + * This hacky test bypasses the library external API, + * using internal only libcurl functions. So don't be + * surprised if we cannot run it when the library has + * been built with hidden symbols, exporting only the + * ones in the public API. + */ + +#if defined(CURL_HIDDEN_SYMBOLS) +# define SKIP_TEST 1 +#elif defined(WIN32) && !defined(CURL_STATICLIB) +# define SKIP_TEST 1 +#else +# undef SKIP_TEST +#endif + + +#if !defined(SKIP_TEST) + +#ifdef LIB559 +static Curl_addrinfo *fake_ai(void) +{ + Curl_addrinfo *ai; + int ss_size; + + ss_size = sizeof (struct sockaddr_in); + + if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) + return NULL; + + if((ai->ai_canonname = strdup("dummy")) == NULL) { + free(ai); + return NULL; + } + + if((ai->ai_addr = calloc(1, ss_size)) == NULL) { + free(ai->ai_canonname); + free(ai); + return NULL; + } + + ai->ai_family = AF_INET; + ai->ai_addrlen = ss_size; + + return ai; +} +#endif /* LIB559 */ + + +int test(char *URL) +{ + CURL *easyh = NULL; + struct curl_hash *hp = NULL; + int result = 0; + + if(!strcmp(URL, "check")) { + /* test harness script verifying if this test can run */ + return 0; /* sure, run this! */ + } + + easyh = curl_easy_init(); + if(!easyh) { + fprintf(stdout, "easy handle init failed\n"); + result = TEST_ERR_MAJOR_BAD; + goto cleanup; + } + fprintf(stdout, "easy handle init OK\n"); + + fprintf(stdout, "creating hash...\n"); + hp = Curl_mk_dnscache(); + if(!hp) { + fprintf(stdout, "hash creation failed\n"); + result = TEST_ERR_MAJOR_BAD; + goto cleanup; + } + fprintf(stdout, "hash creation OK\n"); + + /**/ +#ifdef LIB559 + { + char *data_key; + struct Curl_dns_entry *data_node; + struct Curl_dns_entry *nodep; + size_t key_len; + + data_key = aprintf("%s:%d", "dummy", 0); + if(!data_key) { + fprintf(stdout, "data key creation failed\n"); + result = TEST_ERR_MAJOR_BAD; + goto cleanup; + } + key_len = strlen(data_key); + + data_node = calloc(1, sizeof(struct Curl_dns_entry)); + if(!data_node) { + fprintf(stdout, "data node creation failed\n"); + result = TEST_ERR_MAJOR_BAD; + free(data_key); + goto cleanup; + } + + data_node->addr = fake_ai(); + if(!data_node->addr) { + fprintf(stdout, "actual data creation failed\n"); + result = TEST_ERR_MAJOR_BAD; + free(data_node); + free(data_key); + goto cleanup; + } + + nodep = Curl_hash_add(hp, data_key, key_len+1, (void *)data_node); + if(!nodep) { + fprintf(stdout, "insertion into hash failed\n"); + result = TEST_ERR_MAJOR_BAD; + Curl_freeaddrinfo(data_node->addr); + free(data_node); + free(data_key); + goto cleanup; + } + + free(data_key); + } +#endif /* LIB559 */ + /**/ + +cleanup: + + fprintf(stdout, "destroying hash...\n"); + Curl_hash_destroy(hp); + fprintf(stdout, "hash destruction OK\n"); + + fprintf(stdout, "destroying easy handle...\n"); + curl_easy_cleanup(easyh); + fprintf(stdout, "easy handle destruction OK\n"); + + curl_global_cleanup(); + + return result; +} + + +#else /* !defined(SKIP_TEST) */ + + +int test(char *URL) +{ + (void)URL; + fprintf(stdout, "libcurl built with hidden symbols"); + return 1; /* skip test */ +} + + +#endif /* !defined(SKIP_TEST) */ diff --git a/tests/libtest/lib560.c b/tests/libtest/lib560.c new file mode 100644 index 0000000..87e8545 --- /dev/null +++ b/tests/libtest/lib560.c @@ -0,0 +1,105 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * + */ +#include "test.h" + +/* + * Simply download a HTTPS file! + * + * This test was added after the HTTPS-using-multi-interface with OpenSSL + * regression of 7.19.1 to hopefully prevent this embarassing mistake from + * appearing again... Unfortunately the bug wasn't triggered by this test, + * which presumably is because the connect to a local server is too + * fast/different compared to the real/distant servers we saw the bug happen + * with. + */ +int test(char *URL) +{ + CURL *http_handle; + CURLM *multi_handle = NULL; + CURLMcode code; + int res; + + int still_running; /* keep number of running handles */ + + http_handle = curl_easy_init(); + if (!http_handle) + return TEST_ERR_MAJOR_BAD; + + /* set options */ + test_setopt(http_handle, CURLOPT_URL, URL); + test_setopt(http_handle, CURLOPT_HEADER, 1L); + test_setopt(http_handle, CURLOPT_SSL_VERIFYPEER, 0L); + test_setopt(http_handle, CURLOPT_SSL_VERIFYHOST, 0L); + + /* init a multi stack */ + multi_handle = curl_multi_init(); + if (!multi_handle) { + curl_easy_cleanup(http_handle); + return TEST_ERR_MAJOR_BAD; + } + + /* add the individual transfers */ + curl_multi_add_handle(multi_handle, http_handle); + + /* we start some action by calling perform right away */ + do { + code = curl_multi_perform(multi_handle, &still_running); + } while(code == CURLM_CALL_MULTI_PERFORM); + + while(still_running) { + struct timeval timeout; + int rc; /* select() return code */ + + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* set a suitable timeout to play around with */ + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + /* get file descriptors from the transfers */ + curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + + /* In a real-world program you OF COURSE check the return code of the + function calls, *and* you make sure that maxfd is bigger than -1 so + that the call to select() below makes sense! */ + + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + + switch(rc) { + case -1: + /* select error */ + break; + case 0: + default: + /* timeout or readable/writable sockets */ + do { + code = curl_multi_perform(multi_handle, &still_running); + } while(code == CURLM_CALL_MULTI_PERFORM); + break; + } + } + +test_cleanup: + + if(multi_handle) + curl_multi_cleanup(multi_handle); + + curl_easy_cleanup(http_handle); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib562.c b/tests/libtest/lib562.c new file mode 100644 index 0000000..acdd79a --- /dev/null +++ b/tests/libtest/lib562.c @@ -0,0 +1,74 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include "memdebug.h" + +/* + * From "KNOWN_BUGS" April 2009: + + 59. If the CURLOPT_PORT option is used on an FTP URL like + "ftp://example.com/file;type=A" the ";type=A" is stripped off. + + */ + +int test(char *URL) +{ + CURL *curl; + CURLcode res = CURLE_OK; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + /* get a curl handle */ + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* enable verbose */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* set port number */ + test_setopt(curl, CURLOPT_PORT, strtol(libtest_arg2, NULL, 10)); + + /* specify target */ + test_setopt(curl,CURLOPT_URL, URL); + + /* Now run off and do what you've been told! */ + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib564.c b/tests/libtest/lib564.c new file mode 100644 index 0000000..d33f230 --- /dev/null +++ b/tests/libtest/lib564.c @@ -0,0 +1,143 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +int test(char *URL) +{ + int res = 0; + CURL *curl; + int running; + char done=FALSE; + CURLM *m = NULL; + struct timeval ml_start; + struct timeval mp_start; + char ml_timedout = FALSE; + char mp_timedout = FALSE; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_VERBOSE, 1); + test_setopt(curl, CURLOPT_PROXY, libtest_arg2); + test_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((res = (int)curl_multi_add_handle(m, curl)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", res); + curl_multi_cleanup(m); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + ml_timedout = FALSE; + ml_start = tutil_tvnow(); + + fprintf(stderr, "Start at URL 0\n"); + + while (!done) { + fd_set rd, wr, exc; + int max_fd; + struct timeval interval; + + interval.tv_sec = 1; + interval.tv_usec = 0; + + if (tutil_tvdiff(tutil_tvnow(), ml_start) > + MAIN_LOOP_HANG_TIMEOUT) { + ml_timedout = TRUE; + break; + } + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + while (res == CURLM_CALL_MULTI_PERFORM) { + res = (int)curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + if (running <= 0) { + done = TRUE; /* bail out */ + break; + } + } + if (mp_timedout || done) + break; + + if (res != CURLM_OK) { + fprintf(stderr, "not okay???\n"); + break; + } + + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_ZERO(&exc); + max_fd = 0; + + if (curl_multi_fdset(m, &rd, &wr, &exc, &max_fd) != CURLM_OK) { + fprintf(stderr, "unexpected failured of fdset.\n"); + res = 189; + break; + } + + if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) { + fprintf(stderr, "bad select??\n"); + res = 195; + break; + } + + res = CURLM_CALL_MULTI_PERFORM; + } + + if (ml_timedout || mp_timedout) { + if (ml_timedout) fprintf(stderr, "ml_timedout\n"); + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + +test_cleanup: + + curl_easy_cleanup(curl); + if(m) + curl_multi_cleanup(m); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib566.c b/tests/libtest/lib566.c new file mode 100644 index 0000000..889f15b --- /dev/null +++ b/tests/libtest/lib566.c @@ -0,0 +1,55 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + double content_length = 3; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_HEADER, 1L); + + res = curl_easy_perform(curl); + + if(!res) { + FILE *moo; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, + &content_length); + moo = fopen(libtest_arg2, "wb"); + if(moo) { + fprintf(moo, "CL: %.0f\n", content_length); + fclose(moo); + } + } + +test_cleanup: + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib567.c b/tests/libtest/lib567.c new file mode 100644 index 0000000..e1df0c1 --- /dev/null +++ b/tests/libtest/lib567.c @@ -0,0 +1,56 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" +#include "memdebug.h" + +/* + * Test a simple OPTIONS request with a custom header + */ +int test(char *URL) +{ + CURLcode res; + CURL *curl; + struct curl_slist *custom_headers=NULL; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* Dump data to stdout for protocol verification */ + test_setopt(curl, CURLOPT_HEADERDATA, stdout); + test_setopt(curl, CURLOPT_WRITEDATA, stdout); + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, URL); + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS); + test_setopt(curl, CURLOPT_USERAGENT, "test567"); + + custom_headers = curl_slist_append(custom_headers, "Test-Number: 567"); + test_setopt(curl, CURLOPT_RTSPHEADER, custom_headers); + + res = curl_easy_perform(curl); + +test_cleanup: + + if(custom_headers) + curl_slist_free_all(custom_headers); + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + diff --git a/tests/libtest/lib568.c b/tests/libtest/lib568.c new file mode 100644 index 0000000..1f16664 --- /dev/null +++ b/tests/libtest/lib568.c @@ -0,0 +1,163 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#include <curl/mprintf.h> + +#include "memdebug.h" + +/* build request url */ +static char *suburl(const char *base, int i) +{ + return curl_maprintf("%s%.4d", base, i); +} + +/* + * Test the Client->Server ANNOUNCE functionality (PUT style) + */ +int test(char *URL) +{ + int res; + CURL *curl; + int sdp; + FILE *sdpf = NULL; + struct_stat file_info; + char *stream_uri = NULL; + int request=1; + struct curl_slist *custom_headers=NULL; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_HEADERDATA, stdout); + test_setopt(curl, CURLOPT_WRITEDATA, stdout); + + test_setopt(curl, CURLOPT_URL, URL); + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + sdp = open("log/file568.txt", O_RDONLY); + fstat(sdp, &file_info); + close(sdp); + + sdpf = fopen("log/file568.txt", "rb"); + if(sdpf == NULL) { + fprintf(stderr, "can't open log/file568.txt\n"); + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_ANNOUNCE); + + test_setopt(curl, CURLOPT_READDATA, sdpf); + test_setopt(curl, CURLOPT_UPLOAD, 1L); + test_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t) file_info.st_size); + + /* Do the ANNOUNCE */ + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + test_setopt(curl, CURLOPT_UPLOAD, 0L); + fclose(sdpf); + sdpf = NULL; + + /* Make sure we can do a normal request now */ + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_DESCRIBE); + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + /* Now do a POST style one */ + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + custom_headers = curl_slist_append(custom_headers, + "Content-Type: posty goodness"); + if(!custom_headers) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSPHEADER, custom_headers); + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_ANNOUNCE); + test_setopt(curl, CURLOPT_POSTFIELDS, "postyfield=postystuff&project=curl\n"); + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + test_setopt(curl, CURLOPT_POSTFIELDS, NULL); + test_setopt(curl, CURLOPT_RTSPHEADER, NULL); + curl_slist_free_all(custom_headers); + custom_headers = NULL; + + /* Make sure we can do a normal request now */ + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS); + res = curl_easy_perform(curl); + +test_cleanup: + + if(sdpf) + fclose(sdpf); + + if(stream_uri) + free(stream_uri); + + if(custom_headers) + curl_slist_free_all(custom_headers); + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib569.c b/tests/libtest/lib569.c new file mode 100644 index 0000000..b5182d6 --- /dev/null +++ b/tests/libtest/lib569.c @@ -0,0 +1,117 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include <curl/mprintf.h> + +#include "memdebug.h" + +/* build request url */ +static char *suburl(const char *base, int i) +{ + return curl_maprintf("%s%.4d", base, i); +} + +/* + * Test Session ID capture + */ +int test(char *URL) +{ + int res; + CURL *curl; + char *stream_uri = NULL; + char *rtsp_session_id; + int request=1; + int i; + FILE *idfile = NULL; + + idfile = fopen(libtest_arg2, "wb"); + if(idfile == NULL) { + fprintf(stderr, "couldn't open the Session ID File\n"); + return TEST_ERR_MAJOR_BAD; + } + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + fclose(idfile); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + fclose(idfile); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_HEADERDATA, stdout); + test_setopt(curl, CURLOPT_WRITEDATA, stdout); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + test_setopt(curl, CURLOPT_URL, URL); + + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP); + res = curl_easy_perform(curl); + if(res != (int)CURLE_BAD_FUNCTION_ARGUMENT) { + fprintf(stderr, "This should have failed. " + "Cannot setup without a Transport: header"); + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + + /* Go through the various Session IDs */ + for(i = 0; i < 3; i++) { + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP); + test_setopt(curl, CURLOPT_RTSP_TRANSPORT, "Fake/NotReal/JustATest;foo=baz"); + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + curl_easy_getinfo(curl, CURLINFO_RTSP_SESSION_ID, &rtsp_session_id); + fprintf(idfile, "Got Session ID: [%s]\n", rtsp_session_id); + rtsp_session_id = NULL; + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_TEARDOWN); + res = curl_easy_perform(curl); + + /* Clear for the next go-round */ + test_setopt(curl, CURLOPT_RTSP_SESSION_ID, NULL); + } + +test_cleanup: + + if(idfile) + fclose(idfile); + + if(stream_uri) + free(stream_uri); + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib570.c b/tests/libtest/lib570.c new file mode 100644 index 0000000..9fe2ece --- /dev/null +++ b/tests/libtest/lib570.c @@ -0,0 +1,105 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include <curl/mprintf.h> + +#include "memdebug.h" + +/* build request url */ +static char *suburl(const char *base, int i) +{ + return curl_maprintf("%s%.4d", base, i); +} + +int test(char *URL) +{ + int res; + CURL *curl; + int request=1; + char *stream_uri = NULL; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_HEADERDATA, stdout); + test_setopt(curl, CURLOPT_WRITEDATA, stdout); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + test_setopt(curl, CURLOPT_URL, URL); + + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS); + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + res = curl_easy_perform(curl); + if(res != (int)CURLE_RTSP_CSEQ_ERROR) { + fprintf(stderr, "Failed to detect CSeq mismatch"); + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + + test_setopt(curl, CURLOPT_RTSP_CLIENT_CSEQ, 999); + test_setopt(curl, CURLOPT_RTSP_TRANSPORT, + "RAW/RAW/UDP;unicast;client_port=3056-3057"); + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP); + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY); + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + res = curl_easy_perform(curl); + if(res != CURLE_RTSP_SESSION_ERROR) { + fprintf(stderr, "Failed to detect a Session ID mismatch"); + } + +test_cleanup: + + if(stream_uri) + free(stream_uri); + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib571.c b/tests/libtest/lib571.c new file mode 100644 index 0000000..2892211 --- /dev/null +++ b/tests/libtest/lib571.c @@ -0,0 +1,200 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#ifdef HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif +#ifdef HAVE_NETDB_H +# include <netdb.h> +#endif +#ifdef HAVE_ARPA_INET_H +# include <arpa/inet.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef HAVE_FCNTL_H +# include <fcntl.h> +#endif + +#include <curl/mprintf.h> + +#include "memdebug.h" + +#define RTP_PKT_CHANNEL(p) ((int)((unsigned char)((p)[1]))) + +#define RTP_PKT_LENGTH(p) ((((int)((unsigned char)((p)[2]))) << 8) | \ + ((int)((unsigned char)((p)[3])))) + +#define RTP_DATA_SIZE 12 +static const char *RTP_DATA = "$_1234\n\0asdf"; + +static int rtp_packet_count = 0; + +static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *stream) { + char *data = (char *)ptr; + int channel = RTP_PKT_CHANNEL(data); + int message_size = (int)(size * nmemb) - 4; + int coded_size = RTP_PKT_LENGTH(data); + size_t failure = (size * nmemb) ? 0 : 1; + int i; + (void)stream; + + printf("RTP: message size %d, channel %d\n", message_size, channel); + if(message_size != coded_size) { + printf("RTP embedded size (%d) does not match the write size (%d).\n", + coded_size, message_size); + return failure; + } + + data += 4; + for(i = 0; i < message_size; i+= RTP_DATA_SIZE) { + if(message_size - i > RTP_DATA_SIZE) { + if(memcmp(RTP_DATA, data + i, RTP_DATA_SIZE) != 0) { + printf("RTP PAYLOAD CORRUPTED [%s]\n", data + i); + return failure; + } + } else { + if (memcmp(RTP_DATA, data + i, message_size - i) != 0) { + printf("RTP PAYLOAD END CORRUPTED (%d), [%s]\n", + message_size - i, data + i); + return failure; + } + } + } + + rtp_packet_count++; + fprintf(stderr, "packet count is %d\n", rtp_packet_count); + + return size * nmemb; +} + +/* build request url */ +static char *suburl(const char *base, int i) +{ + return curl_maprintf("%s%.4d", base, i); +} + +int test(char *URL) +{ + int res; + CURL *curl; + char *stream_uri = NULL; + int request=1; + FILE *protofile = NULL; + + protofile = fopen(libtest_arg2, "wb"); + if(protofile == NULL) { + fprintf(stderr, "Couldn't open the protocol dump file\n"); + return TEST_ERR_MAJOR_BAD; + } + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + fclose(protofile); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + fclose(protofile); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + test_setopt(curl, CURLOPT_URL, URL); + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + test_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write); + test_setopt(curl, CURLOPT_TIMEOUT, 3); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + test_setopt(curl, CURLOPT_WRITEDATA, protofile); + + test_setopt(curl, CURLOPT_RTSP_TRANSPORT, "RTP/AVP/TCP;interleaved=0-1"); + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP); + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + /* This PLAY starts the interleave */ + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY); + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + /* The DESCRIBE request will try to consume data after the Content */ + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_DESCRIBE); + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY); + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + fprintf(stderr, "PLAY COMPLETE\n"); + + /* Use Receive to get the rest of the data */ + while(!res && rtp_packet_count < 13) { + fprintf(stderr, "LOOPY LOOP!\n"); + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_RECEIVE); + res = curl_easy_perform(curl); + } + +test_cleanup: + + if(stream_uri) + free(stream_uri); + + if(protofile) + fclose(protofile); + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib572.c b/tests/libtest/lib572.c new file mode 100644 index 0000000..18e74d4 --- /dev/null +++ b/tests/libtest/lib572.c @@ -0,0 +1,169 @@ + +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + */ + +#include "test.h" + +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#include <curl/mprintf.h> + +#include "memdebug.h" + +/* build request url */ +static char *suburl(const char *base, int i) +{ + return curl_maprintf("%s%.4d", base, i); +} + +/* + * Test GET_PARAMETER: PUT, HEARTBEAT, and POST + */ +int test(char *URL) +{ + int res; + CURL *curl; + int params; + FILE *paramsf = NULL; + struct_stat file_info; + char *stream_uri = NULL; + int request=1; + struct curl_slist *custom_headers=NULL; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + + test_setopt(curl, CURLOPT_HEADERDATA, stdout); + test_setopt(curl, CURLOPT_WRITEDATA, stdout); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + test_setopt(curl, CURLOPT_URL, URL); + + /* SETUP */ + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + test_setopt(curl, CURLOPT_RTSP_TRANSPORT, "Planes/Trains/Automobiles"); + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP); + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + /* PUT style GET_PARAMETERS */ + params = open("log/file572.txt", O_RDONLY); + fstat(params, &file_info); + close(params); + + paramsf = fopen("log/file572.txt", "rb"); + if(paramsf == NULL) { + fprintf(stderr, "can't open log/file572.txt\n"); + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_GET_PARAMETER); + + test_setopt(curl, CURLOPT_READDATA, paramsf); + test_setopt(curl, CURLOPT_UPLOAD, 1L); + test_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t) file_info.st_size); + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + test_setopt(curl, CURLOPT_UPLOAD, 0L); + fclose(paramsf); + paramsf = NULL; + + /* Heartbeat GET_PARAMETERS */ + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + /* POST GET_PARAMETERS */ + + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_GET_PARAMETER); + test_setopt(curl, CURLOPT_POSTFIELDS, "packets_received\njitter\n"); + + res = curl_easy_perform(curl); + if(res) + goto test_cleanup; + + test_setopt(curl, CURLOPT_POSTFIELDS, NULL); + + /* Make sure we can do a normal request now */ + if((stream_uri = suburl(URL, request++)) == NULL) { + res = TEST_ERR_MAJOR_BAD; + goto test_cleanup; + } + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri); + free(stream_uri); + stream_uri = NULL; + + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS); + res = curl_easy_perform(curl); + +test_cleanup: + + if(paramsf) + fclose(paramsf); + + if(stream_uri) + free(stream_uri); + + if(custom_headers) + curl_slist_free_all(custom_headers); + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib573.c b/tests/libtest/lib573.c new file mode 100644 index 0000000..5edb181 --- /dev/null +++ b/tests/libtest/lib573.c @@ -0,0 +1,102 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "testutil.h" +#include "memdebug.h" + +#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000 +#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 + +/* + * Get a single URL without select(). + */ + +int test(char *URL) +{ + CURL *c; + CURLM *m = NULL; + int res = 0; + int running=1; + double connect_time = 0.0; + struct timeval mp_start; + char mp_timedout = FALSE; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((c = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(c, CURLOPT_HEADER, 1L); + test_setopt(c, CURLOPT_URL, URL); + + if ((m = curl_multi_init()) == NULL) { + fprintf(stderr, "curl_multi_init() failed\n"); + curl_easy_cleanup(c); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + if ((res = (int)curl_multi_add_handle(m, c)) != CURLM_OK) { + fprintf(stderr, "curl_multi_add_handle() failed, " + "with code %d\n", res); + curl_multi_cleanup(m); + curl_easy_cleanup(c); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + mp_timedout = FALSE; + mp_start = tutil_tvnow(); + + while (running) { + res = (int)curl_multi_perform(m, &running); + if (tutil_tvdiff(tutil_tvnow(), mp_start) > + MULTI_PERFORM_HANG_TIMEOUT) { + mp_timedout = TRUE; + break; + } + if (running <= 0) { + fprintf(stderr, "nothing left running.\n"); + break; + } + } + + if (mp_timedout) { + if (mp_timedout) fprintf(stderr, "mp_timedout\n"); + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = TEST_ERR_RUNS_FOREVER; + } + + curl_easy_getinfo(c, CURLINFO_CONNECT_TIME, &connect_time); + if (connect_time <= 0.0) { + fprintf(stderr, "connect time is <=0.0\n"); + res = TEST_ERR_MAJOR_BAD; + } + +test_cleanup: + + if(m) { + curl_multi_remove_handle(m, c); + curl_multi_cleanup(m); + } + curl_easy_cleanup(c); + curl_global_cleanup(); + + return res; +} + diff --git a/tests/libtest/lib574.c b/tests/libtest/lib574.c new file mode 100644 index 0000000..69b2979 --- /dev/null +++ b/tests/libtest/lib574.c @@ -0,0 +1,56 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +static int new_fnmatch(const char *pattern, const char *string) +{ + (void)pattern; + (void)string; + return CURL_FNMATCHFUNC_MATCH; +} + +int test(char *URL) +{ + int res; + CURL *curl; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_WILDCARDMATCH, 1L); + test_setopt(curl, CURLOPT_FNMATCH_FUNCTION, new_fnmatch); + + res = curl_easy_perform(curl); + if(res) { + fprintf(stderr, "curl_easy_perform() failed %d\n", res); + goto test_cleanup; + } + res = curl_easy_perform(curl); + if(res) { + fprintf(stderr, "curl_easy_perform() failed %d\n", res); + goto test_cleanup; + } + +test_cleanup: + curl_easy_cleanup(curl); + curl_global_cleanup(); + return res; +} diff --git a/tests/libtest/lib575.c b/tests/libtest/lib575.c new file mode 100644 index 0000000..521720e --- /dev/null +++ b/tests/libtest/lib575.c @@ -0,0 +1,109 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include "testutil.h" +#include "memdebug.h" + +/* 3x download! + * 1. normal + * 2. dup handle + * 3. with multi interface + */ + +int test(char *URL) +{ + CURLMcode m; + CURL *handle = NULL, *duphandle; + CURLM *mhandle = NULL; + int res = 0; + int still_running = 0; + + if(curl_global_init(CURL_GLOBAL_ALL)) { + fprintf(stderr, "curl_global_init() failed\n"); + goto test_cleanup; + } + + handle = curl_easy_init(); + if(!handle) { + res = CURLE_OUT_OF_MEMORY; + goto test_cleanup; + } + + test_setopt(handle, CURLOPT_URL, URL); + test_setopt(handle, CURLOPT_WILDCARDMATCH, 1L); + test_setopt(handle, CURLOPT_VERBOSE, 1L); + + res = curl_easy_perform(handle); + if(res) + goto test_cleanup; + + res = curl_easy_perform(handle); + if(res) + goto test_cleanup; + + duphandle = curl_easy_duphandle(handle); + if(!duphandle) + goto test_cleanup; + curl_easy_cleanup(handle); + handle = duphandle; + + mhandle = curl_multi_init(); + if(!mhandle) { + fprintf(stderr, "curl_multi_init() failed\n"); + goto test_cleanup; + } + + curl_multi_add_handle(mhandle, handle); + + while(CURLM_CALL_MULTI_PERFORM == + curl_multi_perform(mhandle, &still_running)); + + while(still_running) { + static struct timeval timeout = /* 100 ms */ { 0, 100000L }; + int rc; + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int max_fdset = -1; + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + m = curl_multi_fdset(mhandle, &fdread, &fdwrite, &fdexcep, &max_fdset); + if(m != CURLM_OK) { + fprintf(stderr, "curl_multi_fdset() error\n"); + goto test_cleanup; + } + /* We call select(max_fdset + 1, ...), specially in case of (maxfd == -1), + * we call select(0, ...), which is basically equal to sleep. */ + rc = select(max_fdset + 1, &fdread, &fdwrite, &fdexcep, &timeout); + if(rc == -1) { + fprintf(stderr, "select() error\n"); + goto test_cleanup; + } + else { + while(CURLM_CALL_MULTI_PERFORM == + curl_multi_perform(mhandle, &still_running)); + } + } + +test_cleanup: + if(mhandle) + curl_multi_cleanup(mhandle); + if(handle) + curl_easy_cleanup(handle); + curl_global_cleanup(); + return res; +} diff --git a/tests/libtest/lib576.c b/tests/libtest/lib576.c new file mode 100644 index 0000000..821eb61 --- /dev/null +++ b/tests/libtest/lib576.c @@ -0,0 +1,111 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" +#include "testutil.h" +#include "memdebug.h" + +typedef struct { + int remains; + int print_content; +} chunk_data_t; + +static +long chunk_bgn(const struct curl_fileinfo *finfo, void *ptr, int remains); +static +long chunk_end(void *ptr); + +static +long chunk_bgn(const struct curl_fileinfo *finfo, void *ptr, int remains) +{ + chunk_data_t *ch_d = ptr; + ch_d->remains = remains; + + printf("=============================================================\n"); + printf("Remains: %d\n", remains); + printf("Filename: %s\n", finfo->filename); + if(finfo->strings.perm) { + printf("Permissions: %s", finfo->strings.perm); + if(finfo->flags & CURLFINFOFLAG_KNOWN_PERM) + printf(" (parsed => %o)", finfo->perm); + printf("\n"); + } + printf("Size: %ldB\n", (long)finfo->size); + if(finfo->strings.user) + printf("User: %s\n", finfo->strings.user); + if(finfo->strings.group) + printf("Group: %s\n", finfo->strings.group); + if(finfo->strings.time) + printf("Time: %s\n", finfo->strings.time); + printf("Filetype: "); + switch(finfo->filetype) { + case CURLFILETYPE_FILE: + printf("regular file\n"); + break; + case CURLFILETYPE_DIRECTORY: + printf("directory\n"); + break; + case CURLFILETYPE_SYMLINK: + printf("symlink\n"); + printf("Target: %s\n", finfo->strings.target); + break; + default: + printf("other type\n"); + break; + } + if(finfo->filetype == CURLFILETYPE_FILE) { + ch_d->print_content = 1; + printf("Content:\n-------------------------------------------------------------\n"); + } + if(strcmp(finfo->filename, "someothertext.txt") == 0) { + printf("# THIS CONTENT WAS SKIPPED IN CHUNK_BGN CALLBACK #\n"); + return CURL_CHUNK_BGN_FUNC_SKIP; + } + return CURL_CHUNK_BGN_FUNC_OK; +} + +static +long chunk_end(void *ptr) +{ + chunk_data_t *ch_d = ptr; + if(ch_d->print_content) { + ch_d->print_content = 0; + printf("-------------------------------------------------------------\n"); + } + if(ch_d->remains == 1) + printf("=============================================================\n"); + return CURL_CHUNK_END_FUNC_OK; +} + +int test(char *URL) +{ + CURL *handle = NULL; + CURLcode res = CURLE_OK; + chunk_data_t chunk_data = {0,0}; + curl_global_init(CURL_GLOBAL_ALL); + handle = curl_easy_init(); + if(!handle) { + res = CURLE_OUT_OF_MEMORY; + goto test_cleanup; + } + + test_setopt(handle, CURLOPT_URL, URL); + test_setopt(handle, CURLOPT_WILDCARDMATCH, 1L); + test_setopt(handle, CURLOPT_CHUNK_BGN_FUNCTION, chunk_bgn); + test_setopt(handle, CURLOPT_CHUNK_END_FUNCTION, chunk_end); + test_setopt(handle, CURLOPT_CHUNK_DATA, &chunk_data); + + res = curl_easy_perform(handle); + +test_cleanup: + if(handle) + curl_easy_cleanup(handle); + curl_global_cleanup(); + return res; +} diff --git a/tests/libtest/lib577.c b/tests/libtest/lib577.c new file mode 100644 index 0000000..bd52c62 --- /dev/null +++ b/tests/libtest/lib577.c @@ -0,0 +1,255 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +/* + * This hacky test bypasses the library external API, + * using internal only libcurl functions. So don't be + * surprised if we cannot run it when the library has + * been built with hidden symbols, exporting only the + * ones in the public API. + */ + +#if defined(CURL_HIDDEN_SYMBOLS) +# define SKIP_TEST 1 +#elif defined(WIN32) && !defined(CURL_STATICLIB) +# define SKIP_TEST 1 +#else +# undef SKIP_TEST +#endif + + +#if !defined(SKIP_TEST) + +#include "memdebug.h" + +#include "curl_fnmatch.h" + +#define MATCH CURL_FNMATCH_MATCH +#define NOMATCH CURL_FNMATCH_NOMATCH +#define RE_ERR CURL_FNMATCH_FAIL + +#define MAX_PATTERN_L 100 +#define MAX_STRING_L 100 + +struct testcase { + char pattern[MAX_PATTERN_L]; + char string[MAX_STRING_L]; + int result; +}; + +static const struct testcase tests[] = { + /* brackets syntax */ + { "\\[", "[", MATCH }, + { "[", "[", RE_ERR }, + { "[]", "[]", RE_ERR }, + { "[][]", "[", MATCH }, + { "[][]", "]", MATCH }, + { "[[]", "[", MATCH }, + { "[[[]", "[", MATCH }, + { "[[[[]", "[", MATCH }, + { "[[[[]", "[", MATCH }, + + { "[][[]", "]", MATCH }, + { "[][[[]", "[", MATCH }, + { "[[]", "]", NOMATCH }, + + { "[a-z]", "a", MATCH }, + { "[a-z]", "A", NOMATCH }, + { "?[a-z]", "?Z", NOMATCH }, + { "[A-Z]", "C", MATCH }, + { "[A-Z]", "c", NOMATCH }, + { "[0-9]", "7", MATCH }, + { "[7-8]", "7", MATCH }, + { "[7-]", "7", MATCH }, + { "[7-]", "-", MATCH }, + { "[7-]", "[", NOMATCH }, + { "[a-bA-F]", "F", MATCH }, + { "[a-bA-B9]", "9", MATCH }, + { "[a-bA-B98]", "8", MATCH }, + { "[a-bA-B98]", "C", NOMATCH }, + { "[a-bA-Z9]", "F", MATCH }, + { "[a-bA-Z9]ero*", "Zero chance.", MATCH }, + { "S[a-][x]opho*", "Saxophone", MATCH }, + { "S[a-][x]opho*", "SaXophone", NOMATCH }, + { "S[a-][x]*.txt", "S-x.txt", MATCH }, + { "[\\a-\\b]", "a", MATCH }, + { "[\\a-\\b]", "b", MATCH }, + { "[?*[][?*[][?*[]", "?*[", MATCH }, + { "[][?*-]", "]", MATCH }, + { "[][?*-]", "[", MATCH }, + { "[][?*-]", "?", MATCH }, + { "[][?*-]", "*", MATCH }, + { "[][?*-]", "-", MATCH }, + { "[]?*-]", "-", MATCH }, + { "?/b/c", "a/b/c", MATCH }, + { "^_{}~", "^_{}~", MATCH }, + { "!#%+,-./01234567889", "!#%+,-./01234567889", MATCH }, + { "PQRSTUVWXYZ]abcdefg", "PQRSTUVWXYZ]abcdefg", MATCH }, + { ":;=@ABCDEFGHIJKLMNO", ":;=@ABCDEFGHIJKLMNO", MATCH }, + + /* negate */ + { "[!a]", "b", MATCH }, + { "[!a]", "a", NOMATCH }, + { "[^a]", "b", MATCH }, + { "[^a]", "a", NOMATCH }, + { "[^a-z0-9A-Z]", "a", NOMATCH }, + { "[^a-z0-9A-Z]", "-", MATCH }, + { "curl[!a-z]lib", "curl lib", MATCH }, + { "curl[! ]lib", "curl lib", NOMATCH }, + { "[! ][ ]", " ", NOMATCH }, + { "[! ][ ]", "a ", MATCH }, + { "*[^a].t?t", "a.txt", NOMATCH }, + { "*[^a].t?t", "ba.txt", NOMATCH }, + { "*[^a].t?t", "ab.txt", MATCH }, + { "[!?*[]", "?", NOMATCH }, + { "[!!]", "!", NOMATCH }, + { "[!!]", "x", MATCH }, + + { "[[:alpha:]]", "a", MATCH }, + { "[[:alpha:]]", "9", NOMATCH }, + { "[[:alnum:]]", "a", MATCH }, + { "[[:alnum:]]", "[", NOMATCH }, + { "[[:alnum:]]", "]", NOMATCH }, + { "[[:alnum:]]", "9", MATCH }, + { "[[:digit:]]", "9", MATCH }, + { "[[:xdigit:]]", "9", MATCH }, + { "[[:xdigit:]]", "F", MATCH }, + { "[[:xdigit:]]", "G", NOMATCH }, + { "[[:upper:]]", "U", MATCH }, + { "[[:upper:]]", "u", NOMATCH }, + { "[[:lower:]]", "l", MATCH }, + { "[[:lower:]]", "L", NOMATCH }, + { "[[:print:]]", "L", MATCH }, + { "[[:print:]]", {'\10'}, NOMATCH }, + { "[[:print:]]", {'\10'}, NOMATCH }, + { "[[:space:]]", " ", MATCH }, + { "[[:space:]]", "x", NOMATCH }, + { "[[:graph:]]", " ", NOMATCH }, + { "[[:graph:]]", "x", MATCH }, + { "[[:blank:]]", {'\t'}, MATCH }, + { "[[:blank:]]", {' '}, MATCH }, + { "[[:blank:]]", {'\r'}, NOMATCH }, + { "[^[:blank:]]", {'\t'}, NOMATCH }, + { "[^[:print:]]", {'\10'}, MATCH }, + { "[[:lower:]][[:lower:]]", "ll", MATCH }, + + { "Curl[[:blank:]];-)", "Curl ;-)", MATCH }, + { "*[[:blank:]]*", " ", MATCH }, + { "*[[:blank:]]*", "", NOMATCH }, + { "*[[:blank:]]*", "hi, im_Pavel", MATCH }, + + /* common using */ + { "filename.dat", "filename.dat", MATCH }, + { "*curl*", "lets use curl!!", MATCH }, + { "filename.txt", "filename.dat", NOMATCH }, + { "*.txt", "text.txt", MATCH }, + { "*.txt", "a.txt", MATCH }, + { "*.txt", ".txt", MATCH }, + { "*.txt", "txt", NOMATCH }, + { "??.txt", "99.txt", MATCH }, + { "??.txt", "a99.txt", NOMATCH }, + { "?.???", "a.txt", MATCH }, + { "*.???", "somefile.dat", MATCH }, + { "*.???", "photo.jpeg", NOMATCH }, + { ".*", ".htaccess", MATCH }, + { ".*", ".", MATCH }, + { ".*", "..", MATCH }, + + /* many stars => one star */ + { "**.txt", "text.txt", MATCH }, + { "***.txt", "t.txt", MATCH }, + { "****.txt", ".txt", MATCH }, + + /* empty string or pattern */ + { "", "", MATCH } , + { "", "hello", NOMATCH }, + { "file", "", NOMATCH }, + { "?", "", NOMATCH }, + { "*", "", MATCH }, + { "x", "", NOMATCH }, + + /* backslash */ + { "\\", "\\", RE_ERR }, + { "\\\\", "\\", MATCH }, + { "\\\\", "\\\\", NOMATCH }, + { "\\?", "?", MATCH }, + { "\\*", "*", MATCH }, + { "?.txt", "?.txt", MATCH }, + { "*.txt", "*.txt", MATCH }, + { "\\?.txt", "?.txt", MATCH }, + { "\\*.txt", "*.txt", MATCH }, + { "\\?.txt", "x.txt", NOMATCH }, + { "\\*.txt", "x.txt", NOMATCH }, + { "\\*\\\\.txt", "*\\.txt", MATCH }, + { "*\\**\\?*\\\\*", "cc*cc?cc\\cc*cc", MATCH }, + { "*\\**\\?*\\\\*", "cc*cc?cccc", NOMATCH }, + { "*\\**\\?*\\\\*", "cc*cc?cc\\cc*cc", MATCH }, + { "*\\?*\\**", "cc?c*c", MATCH }, + { "*\\?*\\**curl*", "cc?c*curl", MATCH }, + { "*\\?*\\**", "cc?cc", NOMATCH }, + { "\\\"\\$\\&\\'\\(\\)", "\"$&'()", MATCH }, + { "\\*\\?\\[\\\\\\`\\|", "*?[\\`|", MATCH }, + { "[\\a\\b]c", "ac", MATCH }, + { "[\\a\\b]c", "bc", MATCH }, + { "[\\a\\b]d", "bc", NOMATCH }, + { "[a-bA-B\\?]", "?", MATCH }, + { "cu[a-ab-b\\r]l", "curl", MATCH }, + { "[\\a-z]", "c", MATCH }, + + { "?*?*?.*?*", "abc.c", MATCH }, + { "?*?*?.*?*", "abcc", NOMATCH }, + { "?*?*?.*?*", "abc.", NOMATCH }, + { "?*?*?.*?*", "abc.c++", MATCH }, + { "?*?*?.*?*", "abcdef.c++", MATCH }, + { "?*?*?.?", "abcdef.c", MATCH }, + { "?*?*?.?", "abcdef.cd", NOMATCH }, + + { "Lindmätarv", "Lindmätarv", MATCH }, + + { "", "", MATCH } +}; + + +int test(char *URL) +{ + int testnum = sizeof(tests) / sizeof(struct testcase); + int i, rc; + (void)URL; /* not used */ + + if(!strcmp(URL, "check")) { + /* test harness script verifying if this test can run */ + return 0; /* sure, run this! */ + } + + printf("===========================\n"); + for(i = 0; i < testnum; i++) { + rc = Curl_fnmatch(NULL, tests[i].pattern, tests[i].string); + if(rc != tests[i].result) { + printf("Curl_fnmatch(\"%s\", \"%s\") should return %d (returns %d)\n", + tests[i].pattern, tests[i].string, tests[i].result, rc); + } + } + printf("===========================\n"); + return 0; +} + +#else /* !defined(SKIP_TEST) */ + + +int test(char *URL) +{ + (void)URL; + fprintf(stdout, "libcurl built with hidden symbols"); + return 1; /* skip test */ +} + + +#endif /* !defined(SKIP_TEST) */ diff --git a/tests/libtest/lib578.c b/tests/libtest/lib578.c new file mode 100644 index 0000000..2efb003 --- /dev/null +++ b/tests/libtest/lib578.c @@ -0,0 +1,90 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +/* The size of data should be kept below MAX_INITIAL_POST_SIZE! */ +static char data[]="this is a short string.\n"; + +static size_t data_size = sizeof(data) / sizeof(char); + +static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) +{ + FILE *moo = fopen(libtest_arg2, "wb"); + + (void)clientp; /* UNUSED */ + (void)dltotal; /* UNUSED */ + (void)dlnow; /* UNUSED */ + + if(moo) { + if ((size_t)ultotal == data_size && (size_t)ulnow == data_size) + fprintf(moo, "PASSED, UL data matched data size\n"); + else + fprintf(moo, "Progress callback called with UL %f out of %f\n", ulnow, ultotal); + fclose(moo); + } + return 0; +} + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + + /* Now specify we want to POST data */ + test_setopt(curl, CURLOPT_POST, 1L); + +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + + /* Set the expected POST size */ + test_setopt(curl, CURLOPT_POSTFIELDSIZE, data_size); + test_setopt(curl, CURLOPT_POSTFIELDS, data); + + /* we want to use our own progress function */ + test_setopt(curl, CURLOPT_NOPROGRESS, 0L); + test_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); + + /* pointer to pass to our read function */ + + /* get verbose debug output please */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* include headers in the output */ + test_setopt(curl, CURLOPT_HEADER, 1L); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib579.c b/tests/libtest/lib579.c new file mode 100644 index 0000000..2b80ab0 --- /dev/null +++ b/tests/libtest/lib579.c @@ -0,0 +1,149 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "test.h" + +#include "memdebug.h" + +static const char * const post[]={ + "one", + "two", + "three", + "and a final longer crap: four", + NULL +}; + + +struct WriteThis { + int counter; +}; + +static int progress_callback(void *clientp, double dltotal, double dlnow, + double ultotal, double ulnow) +{ + FILE *moo; + static int prev_ultotal = -1; + static int prev_ulnow = -1; + (void)clientp; /* UNUSED */ + (void)dltotal; /* UNUSED */ + (void)dlnow; /* UNUSED */ + + /* to avoid depending on timing, which will cause this progress function to + get called a different number of times depending on circumstances, we + only log these lines if the numbers are different from the previous + invoke */ + if((prev_ultotal != (int)ultotal) || + (prev_ulnow != (int)ulnow)) { + + moo = fopen(libtest_arg2, "ab"); + if(moo) { + fprintf(moo, "Progress callback called with UL %d out of %d\n", + (int)ulnow, (int)ultotal); + fclose(moo); + } + prev_ulnow = (int) ulnow; + prev_ultotal = (int) ultotal; + } + return 0; +} + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) +{ + struct WriteThis *pooh = (struct WriteThis *)userp; + const char *data; + + if(size*nmemb < 1) + return 0; + + data = post[pooh->counter]; + + if(data) { + size_t len = strlen(data); + memcpy(ptr, data, len); + pooh->counter++; /* advance pointer */ + return len; + } + return 0; /* no more data left to deliver */ +} + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + struct curl_slist *slist = NULL; + struct WriteThis pooh; + pooh.counter = 0; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + slist = curl_slist_append(slist, "Transfer-Encoding: chunked"); + if (slist == NULL) { + fprintf(stderr, "curl_slist_append() failed\n"); + curl_easy_cleanup(curl); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + + /* Now specify we want to POST data */ + test_setopt(curl, CURLOPT_POST, 1L); + +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + + /* we want to use our own read function */ + test_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* pointer to pass to our read function */ + test_setopt(curl, CURLOPT_INFILE, &pooh); + + /* get verbose debug output please */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* include headers in the output */ + test_setopt(curl, CURLOPT_HEADER, 1L); + + /* enforce chunked transfer by setting the header */ + test_setopt(curl, CURLOPT_HTTPHEADER, slist); + + test_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + test_setopt(curl, CURLOPT_USERPWD, "foo:bar"); + + /* we want to use our own progress function */ + test_setopt(curl, CURLOPT_NOPROGRESS, 0L); + test_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* clean up the headers list */ + if(slist) + curl_slist_free_all(slist); + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/sethostname.c b/tests/libtest/sethostname.c new file mode 100644 index 0000000..3dabb82 --- /dev/null +++ b/tests/libtest/sethostname.c @@ -0,0 +1,29 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#include "setup.h" + +#include "sethostname.h" + +/* + * we force our own host name, in order to make some tests machine independent + */ + +int gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) +{ + const char *force_hostname = getenv("CURL_GETHOSTNAME"); + if(force_hostname) { + strncpy(name, force_hostname, namelen); + name[namelen-1] = '\0'; + return 0; + } + + /* LD_PRELOAD used, but no hostname set, we'll just return a failure */ + return -1; +} diff --git a/tests/libtest/sethostname.h b/tests/libtest/sethostname.h new file mode 100644 index 0000000..83034a5 --- /dev/null +++ b/tests/libtest/sethostname.h @@ -0,0 +1,32 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +#if (defined(WIN32) || defined(__SYMBIAN32__)) && !defined(CURL_STATICLIB) +# if defined(BUILDING_LIBCURL) +# define LIBHOSTNAME_EXTERN __declspec(dllexport) +# else +# define LIBHOSTNAME_EXTERN __declspec(dllimport) +# endif +#else +# ifdef CURL_HIDDEN_SYMBOLS +# define LIBHOSTNAME_EXTERN CURL_EXTERN_SYMBOL +# else +# define LIBHOSTNAME_EXTERN +# endif +#endif + +#ifdef USE_WINSOCK +# define FUNCALLCONV __stdcall +#else +# define FUNCALLCONV +#endif + +LIBHOSTNAME_EXTERN int FUNCALLCONV + gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen); + diff --git a/tests/libtest/test.h b/tests/libtest/test.h new file mode 100644 index 0000000..2a36711 --- /dev/null +++ b/tests/libtest/test.h @@ -0,0 +1,59 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + */ + +/* Now include the setup.h file from libcurl's private libdir (the source + version, but that might include "curl_config.h" from the build dir so we + need both of them in the include path), so that we get good in-depth + knowledge about the system we're building this on */ + +#define CURL_NO_OLDIES + +#include "setup.h" + +#include <curl/curl.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <errno.h> + +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_SELECT_H +/* since so many tests use select(), we can just as well include it here */ +#include <sys/select.h> +#endif +#ifdef HAVE_UNISTD_H +/* at least somewhat oldish FreeBSD systems need this for select() */ +#include <unistd.h> +#endif + +#ifdef TPF +# include "select.h" +#endif + +#define TEST_ERR_MAJOR_BAD 100 +#define TEST_ERR_RUNS_FOREVER 99 + +#define test_setopt(A,B,C) \ + if((res = curl_easy_setopt((A),(B),(C))) != CURLE_OK) goto test_cleanup + +extern char *libtest_arg2; /* set by first.c to the argv[2] or NULL */ +extern char *libtest_arg3; /* set by first.c to the argv[3] or NULL */ + +/* argc and argv as passed in to the main() function */ +extern int test_argc; +extern char **test_argv; + +extern int select_test(int num_fds, fd_set *rd, fd_set *wr, fd_set *exc, + struct timeval *tv); + +extern int test(char *URL); /* the actual test function provided by each + individual libXXX.c file */ + diff --git a/tests/libtest/test1013.pl b/tests/libtest/test1013.pl new file mode 100755 index 0000000..99ad524 --- /dev/null +++ b/tests/libtest/test1013.pl @@ -0,0 +1,49 @@ +#!/usr/bin/env perl +# Determine if curl-config --protocols/--features matches the +# curl --version protocols/features +if ( $#ARGV != 2 ) +{ + print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n"; + exit 3; +} + +my $what=$ARGV[2]; + +# Read the output of curl --version +my $curl_protocols=""; +open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n"; +while( <CURL> ) +{ + $curl_protocols = lc($_) if ( /$what:/i ); +} +close CURL; + +$curl_protocols =~ /\w+: (.*)$/; +@curl = split / /,$1; + +# These features are not supported by curl-config +@curl = grep(!/^(Debug|TrackMemory|Largefile|CharConv|GSS-Negotiate|SPNEGO)$/i, @curl); +@curl = sort @curl; + +# Read the output of curl-config +my @curl_config; +open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n"; +while( <CURLCONFIG> ) +{ + chomp; + push @curl_config, lc($_); +} +close CURLCONFIG; + +@curl_config = sort @curl_config; + +my $curlproto = join ' ', @curl; +my $curlconfigproto = join ' ', @curl_config; + +my $different = $curlproto ne $curlconfigproto; +if ($different) { + print "Mismatch in $what lists:\n"; + print "curl: $curlproto\n"; + print "curl-config: $curlconfigproto\n"; +} +exit $different; diff --git a/tests/libtest/test1022.pl b/tests/libtest/test1022.pl new file mode 100755 index 0000000..60eee38 --- /dev/null +++ b/tests/libtest/test1022.pl @@ -0,0 +1,45 @@ +#!/usr/bin/env perl +# Determine if curl-config --version matches the curl --version +if ( $#ARGV != 2 ) +{ + print "Usage: $0 curl-config-script curl-version-output-file version|vernum\n"; + exit 3; +} + +my $what=$ARGV[2]; + +# Read the output of curl --version +open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n"; +$_ = <CURL>; +chomp; +/libcurl\/([\.\d]+(-DEV)?)/; +my $version = $1; +close CURL; + +my $curlconfigversion; + +# Read the output of curl-config --version/--vernum +open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config --$what list\n"; +$_ = <CURLCONFIG>; +chomp; +if ( $what eq "version" ) { + /^libcurl ([\.\d]+(-DEV)?)$/ ; + $curlconfigversion = $1; +} +else { + # Convert hex version to decimal for comparison's sake + /^(..)(..)(..)$/ ; + $curlconfigversion = hex($1) . "." . hex($2) . "." . hex($3); + + # Strip off the -DEV from the curl version if it's there + $version =~ s/-DEV$//; +} +close CURLCONFIG; + +my $different = $version ne $curlconfigversion; +if ($different || !$version) { + print "Mismatch in --version:\n"; + print "curl: $version\n"; + print "curl-config: $curlconfigversion\n"; + exit 1; +} diff --git a/tests/libtest/test307.pl b/tests/libtest/test307.pl new file mode 100755 index 0000000..469af3c --- /dev/null +++ b/tests/libtest/test307.pl @@ -0,0 +1,19 @@ +#!/usr/bin/env perl +# Determine if the given curl executable supports the 'openssl' SSL engine +if ( $#ARGV != 0 ) +{ + print "Usage: $0 curl-executable\n"; + exit 3; +} +if (!open(CURL, "@ARGV[0] -s --engine list|")) +{ + print "Can't get SSL engine list\n"; + exit 2; +} +while( <CURL> ) +{ + exit 0 if ( /openssl/ ); +} +close CURL; +print "openssl engine not supported\n"; +exit 1; diff --git a/tests/libtest/test610.pl b/tests/libtest/test610.pl new file mode 100755 index 0000000..a900d94 --- /dev/null +++ b/tests/libtest/test610.pl @@ -0,0 +1,33 @@ +#!/usr/bin/env perl +# Perform simple file and directory manipulation in a portable way +if ( $#ARGV <= 0 ) +{ + print "Usage: $0 mkdir|rmdir|rm|move|gone path1 [path2] [more commands...]\n"; + exit 1; +} + +use File::Copy; +while(@ARGV) { + my $cmd = shift @ARGV; + my $arg = shift @ARGV; + if ($cmd eq "mkdir") { + mkdir $arg || die "$!"; + } + elsif ($cmd eq "rmdir") { + rmdir $arg || die "$!"; + } + elsif ($cmd eq "rm") { + unlink $arg || die "$!"; + } + elsif ($cmd eq "move") { + my $arg2 = shift @ARGV; + move($arg,$arg2) || die "$!"; + } + elsif ($cmd eq "gone") { + ! -e $arg || die "Path $arg exists"; + } else { + print "Unsupported command $cmd\n"; + exit 1; + } +} +exit 0; diff --git a/tests/libtest/test613.pl b/tests/libtest/test613.pl new file mode 100755 index 0000000..b4caaae --- /dev/null +++ b/tests/libtest/test613.pl @@ -0,0 +1,105 @@ +#!/usr/bin/env perl +# Prepare a directory with known files and clean up afterwards +use Time::Local; + +if ( $#ARGV < 1 ) +{ + print "Usage: $0 prepare|postprocess dir [logfile]\n"; + exit 1; +} + +# <precheck> expects an error message on stdout +sub errout { + print $_[0] . "\n"; + exit 1; +} + +if ($ARGV[0] eq "prepare") +{ + my $dirname = $ARGV[1]; + mkdir $dirname || errout "$!"; + chdir $dirname; + + # Create the files in alphabetical order, to increase the chances + # of receiving a consistent set of directory contents regardless + # of whether the server alphabetizes the results or not. + mkdir "asubdir" || errout "$!"; + chmod 0777, "asubdir"; + + open(FILE, ">plainfile.txt") || errout "$!"; + binmode FILE; + print FILE "Test file to support curl test suite\n"; + close(FILE); + utime time, timegm(0,0,12,1,0,100), "plainfile.txt"; + chmod 0666, "plainfile.txt"; + + open(FILE, ">rofile.txt") || errout "$!"; + binmode FILE; + print FILE "Read-only test file to support curl test suite\n"; + close(FILE); + utime time, timegm(0,0,12,31,11,100), "rofile.txt"; + chmod 0444, "rofile.txt"; + + exit 0; +} +elsif ($ARGV[0] eq "postprocess") +{ + my $dirname = $ARGV[1]; + my $logfile = $ARGV[2]; + + # Clean up the test directory + unlink "$dirname/rofile.txt"; + unlink "$dirname/plainfile.txt"; + rmdir "$dirname/asubdir"; + + rmdir $dirname || die "$!"; + + if ($logfile) { + # Process the directory file to remove all information that + # could be inconsistent from one test run to the next (e.g. + # file date) or may be unsupported on some platforms (e.g. + # Windows). Also, since 7.17.0, the sftp directory listing + # format can be dependent on the server (with a recent + # enough version of libssh2) so this script must also + # canonicalize the format. Here are examples of the general + # format supported: + # -r--r--r-- 12 ausername grp 47 Dec 31 2000 rofile.txt + # -r--r--r-- 1 1234 4321 47 Dec 31 2000 rofile.txt + # The "canonical" format is similar to the first (which is + # the one generated on a typical Linux installation): + # -r-?r-?r-? 12 U U 47 Dec 31 2000 rofile.txt + + my @canondir; + open(IN, "<$logfile") || die "$!"; + while (<IN>) { + /^(.)(..).(..).(..).\s*(\S+)\s+\S+\s+\S+\s+(\S+)\s+(\S+\s+\S+\s+\S+)(.*)$/; + if ($1 eq "d") { + # Erase all directory metadata except for the name, as it is not + # consistent for across all test systems and filesystems + push @canondir, "d????????? N U U N ??? N NN:NN$8\n"; + } elsif ($1 eq "-") { + # Erase user and group names, as they are not consistent across + # all test systems + my $line = sprintf("%s%s?%s?%s?%5d U U %15d %s%s\n", $1,$2,$3,$4,$5,$6,$7,$8); + push @canondir, $line; + } else { + # Unexpected format; just pass it through and let the test fail + push @canondir, $_; + } + } + close(IN); + + @canondir = sort {substr($a,57) cmp substr($b,57)} @canondir; + my $newfile = $logfile . ".new"; + open(OUT, ">$newfile") || die "$!"; + print OUT join('', @canondir); + close(OUT); + + unlink $logfile; + rename $newfile, $logfile; + } + + exit 0; +} +print "Unsupported command $ARGV[0]\n"; +exit 1; diff --git a/tests/libtest/test75.pl b/tests/libtest/test75.pl new file mode 100755 index 0000000..31cdfb8 --- /dev/null +++ b/tests/libtest/test75.pl @@ -0,0 +1,13 @@ +#!/usr/bin/env perl +# Check that the length of a given URL is correct +if ( $#ARGV != 1 ) +{ + print "Usage: $0 string length\n"; + exit 3; +} +if (length(@ARGV[0]) != @ARGV[1]) +{ + print "Given host IP and port not supported\n"; + exit 1; +} +exit 0; diff --git a/tests/libtest/testutil.c b/tests/libtest/testutil.c new file mode 100644 index 0000000..63393c5 --- /dev/null +++ b/tests/libtest/testutil.c @@ -0,0 +1,135 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "testutil.h" +#include "memdebug.h" + +#if defined(WIN32) && !defined(MSDOS) + +struct timeval tutil_tvnow(void) +{ + /* + ** GetTickCount() is available on _all_ Windows versions from W95 up + ** to nowadays. Returns milliseconds elapsed since last system boot, + ** increases monotonically and wraps once 49.7 days have elapsed. + */ + struct timeval now; + DWORD milliseconds = GetTickCount(); + now.tv_sec = milliseconds / 1000; + now.tv_usec = (milliseconds % 1000) * 1000; + return now; +} + +#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) + +struct timeval tutil_tvnow(void) +{ + /* + ** clock_gettime() is granted to be increased monotonically when the + ** monotonic clock is queried. Time starting point is unspecified, it + ** could be the system start-up time, the Epoch, or something else, + ** in any case the time starting point does not change once that the + ** system has started up. + */ + struct timeval now; + struct timespec tsnow; + if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) { + now.tv_sec = tsnow.tv_sec; + now.tv_usec = tsnow.tv_nsec / 1000; + } + /* + ** Even when the configure process has truly detected monotonic clock + ** availability, it might happen that it is not actually available at + ** run-time. When this occurs simply fallback to other time source. + */ +#ifdef HAVE_GETTIMEOFDAY + else + (void)gettimeofday(&now, NULL); +#else + else { + now.tv_sec = (long)time(NULL); + now.tv_usec = 0; + } +#endif + return now; +} + +#elif defined(HAVE_GETTIMEOFDAY) + +struct timeval tutil_tvnow(void) +{ + /* + ** gettimeofday() is not granted to be increased monotonically, due to + ** clock drifting and external source time synchronization it can jump + ** forward or backward in time. + */ + struct timeval now; + (void)gettimeofday(&now, NULL); + return now; +} + +#else + +struct timeval tutil_tvnow(void) +{ + /* + ** time() returns the value of time in seconds since the Epoch. + */ + struct timeval now; + now.tv_sec = (long)time(NULL); + now.tv_usec = 0; + return now; +} + +#endif + +/* + * Make sure that the first argument is the more recent time, as otherwise + * we'll get a weird negative time-diff back... + * + * Returns: the time difference in number of milliseconds. + */ +long tutil_tvdiff(struct timeval newer, struct timeval older) +{ + return (newer.tv_sec-older.tv_sec)*1000+ + (newer.tv_usec-older.tv_usec)/1000; +} + +/* + * Same as tutil_tvdiff but with full usec resolution. + * + * Returns: the time difference in seconds with subsecond resolution. + */ +double tutil_tvdiff_secs(struct timeval newer, struct timeval older) +{ + return (double)(newer.tv_sec-older.tv_sec)+ + (double)(newer.tv_usec-older.tv_usec)/1000000.0; +} + +/* return the number of seconds in the given input timeval struct */ +long tutil_tvlong(struct timeval t1) +{ + return t1.tv_sec; +} + diff --git a/tests/libtest/testutil.h b/tests/libtest/testutil.h new file mode 100644 index 0000000..6a322e3 --- /dev/null +++ b/tests/libtest/testutil.h @@ -0,0 +1,49 @@ +#ifndef __LIBTEST_TESTUTIL_H +#define __LIBTEST_TESTUTIL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + + +struct timeval tutil_tvnow(void); + +/* + * Make sure that the first argument (t1) is the more recent time and t2 is + * the older time, as otherwise you get a weird negative time-diff back... + * + * Returns: the time difference in number of milliseconds. + */ +long tutil_tvdiff(struct timeval t1, struct timeval t2); + +/* + * Same as tutil_tvdiff but with full usec resolution. + * + * Returns: the time difference in seconds with subsecond resolution. + */ +double tutil_tvdiff_secs(struct timeval t1, struct timeval t2); + +long tutil_tvlong(struct timeval t1); + + +#endif /* __LIBTEST_TESTUTIL_H */ + |