Permalink
Browse files

add a test to run the cgi_main()

git-svn-id: http://svn.kfish.org/fastphoto/trunk@156 9c49b5d1-7df3-0310-bce2-b7278e68f44c
  • Loading branch information...
conrad
conrad committed Feb 19, 2006
1 parent 63a08ab commit 351f654a6928a0c465e35391763256e41eecdfe9
Showing with 34 additions and 2 deletions.
  1. +5 −2 src/Makefile.am
  2. +29 −0 src/cgi_test.c
  3. BIN src/test.jpg
View
@@ -3,15 +3,18 @@
AM_CFLAGS = $(EPEG_CFLAGS)
bin_PROGRAMS = fastphoto
-noinst_PROGRAMS = httpdate_test
+noinst_PROGRAMS = httpdate_test cgi_test
TESTS_ENVIRONMENT = $(VALGRIND_ENVIRONMENT)
-TESTS = httpdate_test
+TESTS = httpdate_test cgi_test
noinst_HEADERS = alloc_snprintf.h cache.h cgi.h cmd.h header.h httpdate.h memory.h photo.h resize.h
fastphoto_SOURCES = main.c alloc_snprintf.c cache.c cgi.c cmd.c header.c httpdate.c memory.c photo.c resize.c
fastphoto_LDADD = $(EPEG_LIBS)
httpdate_test_SOURCES = httpdate.c httpdate_test.c
+
+cgi_test_SOURCES = cgi_test.c cgi.c alloc_snprintf.c cache.c httpdate.c header.c photo.c resize.c memory.c
+cgi_test_LDADD = $(EPEG_LIBS)
View
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "fastphoto.h"
+#include "cgi.h"
+#include "httpdate.h"
+
+int
+main (int argc, char * argv[])
+{
+ fastphoto_t params;
+ int err = 0;
+
+ memset (&params, 0, sizeof (fastphoto_t));
+
+ httpdate_init ();
+
+ setenv ("PATH_INFO", "/TEST/test.jpg", 1);
+ setenv ("PATH_TRANSLATED", "./test.jpg", 1);
+ setenv ("QUERY_STRING", "width=100", 1);
+
+ err = cgi_main (&params);
+
+ if (params.data) free (params.data);
+
+ if (err) return 1;
+ else return 0;
+}
View
Binary file not shown.

0 comments on commit 351f654

Please sign in to comment.