OSDN Git Service

implement unittest binary.
authorornse01 <ornse01@users.sourceforge.jp>
Sun, 8 Jan 2012 07:39:28 +0000 (07:39 +0000)
committerornse01 <ornse01@users.sourceforge.jp>
Sun, 8 Jan 2012 07:39:28 +0000 (07:39 +0000)
git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchanf/trunk@330 20a0b8eb-f62a-4a12-8fe1-b598822500fb

src/Makefile.test
src/test_main.c

index e69de29..10024f6 100644 (file)
@@ -0,0 +1,102 @@
+#
+#      @(#)Makefile (testing binary for bchanf)
+#              GNU make ÍÑ
+#
+#      make ¤ÎÊýË¡
+#      ¡¦make
+#              ¥ê¥ê¡¼¥¹ÍѤÎÀµ¼°ÈǤòºîÀ®
+#      ¡¦make mode=debug
+#              ¥Ç¥Ð¥Ã¥°ÍѤ˺îÀ®
+#      ¡¦make clean
+#              make ¤ÇºîÀ®¤·¤¿Á´¤Æ¤Î¥Õ¥¡¥¤¥ë¤òºï½ü
+#      ¡¦make install
+#              µ¬Äê¤Î¾ì½ê¤Ë¥¤¥ó¥¹¥È¡¼¥ë (¼Âµ¡ÍѤΤß)
+#
+
+# ¥Ð¡¼¥¸¥ç¥ó
+version = 0x0010
+
+# ¥ê¥ê¡¼¥¹ÍѤò¥Ç¥Õ¥©¥ë¥È¤Ë¤¹¤ë
+mode =
+
+# ¥½¡¼¥¹¤Î°Í¸´Ø·¸¥Õ¥¡¥¤¥ë (¼«Æ°À¸À®)
+DEPS = Dependencies
+DEPENDENCIES_OUTPUT := $(DEPS)
+
+# ¥¢¥×¥ê¥±¡¼¥·¥ç¥óɸ½à¥ë¡¼¥ë
+include ../../etc/makerules
+
+#----------------------------------------------------------------------
+# ºîÀ®ÂоÝ
+TARGET = bchanf_test
+
+# ¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Î¥µ¡¼¥Á¥Ñ¥¹
+S = ../src ../src/unittest ../src/http
+VPATH = $(S)
+
+# ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤Î¥Ç¥£¥ì¥¯¥È¥êÄɲÃ
+HEADER := $(S) $(HEADER)
+
+# ¥½¡¼¥¹¥Õ¥¡¥¤¥ë
+SRC_UNITTEST = unittest_driver.c
+
+SRC_HTTP =     http_connection.c \
+               http_transferdecoder.c
+
+SRC_HTTP_TEST =        test_http_transferdecoder.c
+
+SRC =  test_main.c $(SRC_UNITTEST) $(SRC_HTTP) $(SRC_HTTP_TEST)
+
+# ¥Ç¡¼¥¿¥Ü¥Ã¥¯¥¹¥½¡¼¥¹¥Õ¥¡¥¤¥ë
+DBSRC =
+
+SRC += $(DBSRC)
+
+WC_SRC = $(filter %.C, $(SRC))
+
+# ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë
+OBJ = $(addsuffix .o, $(basename $(SRC)))
+
+# ¥³¥ó¥Ñ¥¤¥ë¥ª¥×¥·¥ç¥ó
+ifneq ($(mode), debug)
+  CFLAGS += -Wall
+endif
+
+CFLAGS += $(BUILDOPTIONS) -DBCHAN_CONFIG_DEBUG
+
+LOADLIBES += -limg
+
+#----------------------------------------------------------------------
+.PHONY: all clean install
+
+INST = $(addprefix $(TARGET), .map)
+NOINST = $(addprefix $(TARGET), .out)
+
+all: $(INST)
+
+$(TARGET).out: $(OBJ)
+       $(LINK.o) $(LDOBJS) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
+
+clean:
+       $(RM) $(OBJ)
+       $(RM) $(WC_SRC:%.C=%.c) $(DBSRC)
+       $(RM) $(INST) $(NOINST) *.lst $(DEPS)
+
+install: $(INST:%=$(EXE_INSTALLDIR)/%)
+
+$(EXE_INSTALLDIR)/$(TARGET).out: $(EXE_INSTALLDIR)/%: %
+       $(EXE_INSTALL_STRIP)
+
+# ¥½¡¼¥¹¤Î°Í¸´Ø·¸
+
+$(WC_SRC:%.C=%.c):
+
+$(DBSRC):
+
+ifdef DEPENDENCIES_OUTPUT
+$(DEPS):       ; touch $(DEPS)
+else
+$(DEPS): $(SRC)        ; $(MAKEDEPS) $@ $?
+endif
+
+include $(DEPS)
index e69de29..e511c20 100644 (file)
@@ -0,0 +1,53 @@
+/*
+ * test_main.c
+ *
+ * Copyright (c) 2012 project bchan
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software. If you use this software
+ *    in a product, an acknowledgment in the product documentation would be
+ *    appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ */
+
+#include       <basic.h>
+#include       <bstdlib.h>
+#include       <bstdio.h>
+#include       <errcode.h>
+#include       <btron/btron.h>
+
+#include    <unittest_driver.h>
+
+#include    <test_http.h>
+
+
+EXPORT W       MAIN(MESSAGE *msg)
+{
+       unittest_driver_t *driver;
+
+       driver = unittest_driver_new();
+       if (driver == NULL) {
+               return 0;
+       }
+
+       test_httptransferdecoder_main(driver);
+
+       unittest_driver_runnning(driver);
+       unittest_driver_delete(driver);
+
+       return 0;
+}