[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/cygnal ChangeLog testsuite/cygnal.all/Mak...
From: |
Rob Savoye |
Subject: |
[Gnash-commit] gnash/cygnal ChangeLog testsuite/cygnal.all/Mak... |
Date: |
Fri, 28 Mar 2008 21:55:04 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Rob Savoye <rsavoye> 08/03/28 21:55:04
Modified files:
cygnal : ChangeLog
cygnal/testsuite/cygnal.all: Makefile.am
Removed files:
cygnal/testsuite/cygnal.all: test_buffer.cpp test_cque.cpp
test_handler.cpp test_http.cpp
Log message:
* testsuite/cygnal.all/Makefile.am: Remove testcases moved to
gnash/testsuite/libnet.all.
*
testsuite/cygnal.all/test_buffer.cpp,test_cque.cpp,test_handler.cpp,
test_http.cpp: Moved to gnash/testsuite/libnet.all.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ChangeLog?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/Makefile.am?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/test_buffer.cpp?cvsroot=gnash&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/test_cque.cpp?cvsroot=gnash&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/test_handler.cpp?cvsroot=gnash&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/test_http.cpp?cvsroot=gnash&r1=1.7&r2=0
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/cygnal/ChangeLog,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- ChangeLog 28 Mar 2008 21:47:44 -0000 1.16
+++ ChangeLog 28 Mar 2008 21:55:03 -0000 1.17
@@ -1,5 +1,10 @@
2008-03-28 Rob Savoye <address@hidden>
+ * testsuite/cygnal.all/Makefile.am: Remove testcases moved to
+ gnash/testsuite/libnet.all.
+ * testsuite/cygnal.all/test_buffer.cpp,test_cque.cpp,test_handler.cpp,
+ test_http.cpp: Moved to gnash/testsuite/libnet.all.
+
* Makefile.am: Don't build libcygnal anymore, it's been made
gnash/libnet, so it's code can be shared with Gnash for the client
side of all protocols.
Index: testsuite/cygnal.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/cygnal/testsuite/cygnal.all/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- testsuite/cygnal.all/Makefile.am 17 Mar 2008 00:09:17 -0000 1.7
+++ testsuite/cygnal.all/Makefile.am 28 Mar 2008 21:55:03 -0000 1.8
@@ -25,6 +25,7 @@
AM_LDFLAGS = \
$(top_builddir)/libbase/libgnashbase.la \
$(top_builddir)/libamf/libgnashamf.la \
+ $(top_builddir)/libnet/libgnashnet.la \
$(top_builddir)/cygnal/libcygnal.la \
$(BOOST_LIBS) \
$(PTHREAD_LIBS)
@@ -34,6 +35,7 @@
INCLUDES = -I.. \
-I$(top_srcdir) \
-I$(top_srcdir)/libamf \
+ -I$(top_srcdir)/libnet \
-I$(top_srcdir)/libbase \
-I$(top_srcdir)/cygnal \
-I$(top_srcdir)/server \
@@ -42,32 +44,12 @@
$(PTHREAD_CFLAGS)
check_PROGRAMS = \
- test_buffer \
- test_cque \
- test_handler \
- test_http \
test_crc
-test_http_SOURCES = test_http.cpp
-test_http_LDADD = $(AM_LDFLAGS)
-test_http_DEPENDENCIES = site-update
-
test_crc_SOURCES = test_crc.cpp
test_crc_LDADD = $(AM_LDFLAGS)
test_crc_DEPENDENCIES = site-update
-test_cque_SOURCES = test_cque.cpp
-test_cque_LDADD = $(AM_LDFLAGS)
-test_cque_DEPENDENCIES = site-update
-
-test_handler_SOURCES = test_handler.cpp
-test_handler_LDADD = $(AM_LDFLAGS)
-test_handler_DEPENDENCIES = site-update
-
-test_buffer_SOURCES = test_buffer.cpp
-test_buffer_LDADD = $(AM_LDFLAGS)
-test_buffer_DEPENDENCIES = site-update
-
# Rebuild with GCC 4.x Mudflap support
mudflap:
@echo "Rebuilding with GCC Mudflap support"
Index: testsuite/cygnal.all/test_buffer.cpp
===================================================================
RCS file: testsuite/cygnal.all/test_buffer.cpp
diff -N testsuite/cygnal.all/test_buffer.cpp
--- testsuite/cygnal.all/test_buffer.cpp 18 Mar 2008 01:06:04 -0000
1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,112 +0,0 @@
-//
-// Copyright (C) 2008 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-//
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#include <regex.h>
-#include <cstdio>
-#include <cerrno>
-#include <iostream>
-#include <fstream>
-#include <cstring>
-#include <vector>
-#include <boost/cstdint.hpp>
-
-#ifdef HAVE_DEJAGNU_H
-#include "dejagnu.h"
-#else
-#include "check.h"
-#endif
-
-#include "log.h"
-#include "network.h"
-#include "gmemory.h"
-#include "buffer.h"
-
-using namespace std;
-using namespace gnash;
-using namespace cygnal;
-using namespace boost;
-
-TestState runtest;
-LogFile& dbglogfile = LogFile::getDefaultInstance();
-
-int
-main (int /*argc*/, char** /*argv*/) {
- gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
- dbglogfile.setVerbosity();
- // We use the Memory profiling class to check the malloc buffers
- // in the kernel to make sure the allocations and frees happen
- // the way we expect them too. There is no real other way to tell.
- Memory mem;
- mem.startStats();
-
- Buffer buf;
- mem.addStats(__LINE__); // take a sample
-
- if (buf.size() == gnash::NETBUFSIZE) {
- runtest.pass ("Buffer::size()");
- } else {
- runtest.fail ("Buffer::size()");
- }
-
- mem.addStats(__LINE__); // take a sample
- buf.resize(112);
- mem.addStats(__LINE__); // take a sample
-
- if ((buf.size() == 112) && (mem.diffStats() == -16)) {
- runtest.pass ("Buffer::resize()");
- } else {
- runtest.fail ("Buffer::resize()");
- }
- mem.addStats(__LINE__); // take a sample
-
-// buf.dump();
- mem.addStats(__LINE__); // take a sample
- buf.empty(); //empty just nukes the contents
- if ((buf.size() == 112) && (mem.diffStats() == 0)) {
- runtest.pass ("Buffer::empty()");
- } else {
- runtest.fail ("Buffer::empty()");
- }
-
- // populate the buffer
- boost::uint8_t *ptr = buf.reference();
- for (size_t i=1; i< buf.size(); i++) {
- ptr[i] = i;
- }
-
- Buffer buf2;
- if (buf2 == buf) {
- runtest.fail ("Buffer::operator==");
- } else {
- runtest.pass ("Buffer::operator==");
- }
-
- buf2 = buf;
- if (buf2 == buf) {
- runtest.pass ("Buffer::operator=");
- } else {
- runtest.fail ("Buffer::operator=");
- }
-
-// mem.analyze();
-}
-
Index: testsuite/cygnal.all/test_cque.cpp
===================================================================
RCS file: testsuite/cygnal.all/test_cque.cpp
diff -N testsuite/cygnal.all/test_cque.cpp
--- testsuite/cygnal.all/test_cque.cpp 26 Mar 2008 00:02:03 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,164 +0,0 @@
-//
-// Copyright (C) 2008 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-//
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#ifdef HAVE_STDARG_H
-#include <cstdarg>
-#endif
-
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <regex.h>
-#include <cstdio>
-#include <cerrno>
-#include <iostream>
-#include <fstream>
-#include <cstring>
-#include <vector>
-#include <boost/cstdint.hpp>
-
-#ifdef HAVE_DEJAGNU_H
-#include "dejagnu.h"
-#else
-#include "check.h"
-#endif
-
-#include "log.h"
-#include "network.h"
-#include "cque.h"
-
-using namespace std;
-using namespace gnash;
-using namespace cygnal;
-using namespace boost;
-
-TestState runtest;
-//LogFile& dbglogfile = LogFile::getDefaultInstance();
-
-int
-main (int /*argc*/, char** /*argv*/) {
- gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
- dbglogfile.setVerbosity();
-
- CQue que;
-
- Buffer buf;
- // populate the buffer
- boost::uint8_t *ptr = buf.reference();
- for (size_t i=1; i< buf.size(); i++) {
- ptr[i] = i+' ';
- }
-
- boost::uint8_t *test = new uint8_t[6];
- memcpy(test, "hell", 4);
-
- // Push one buffer on the fifo. The default is the incoming fifo,
- // which is the one where data flows from the network to the queue.
- que.push(&buf);
- if (que.size() == 1) {
- runtest.pass ("CQue::push(Buffer *)");
- } else {
- runtest.fail ("CQue::push(Buffer *)");
- }
-
- // Test push. When dumpimg, the second address should be different than
the first,
- // as well as the size. The outgoing queue should be uneffected.
- Buffer buf1;
- buf1.resize(112);
- que.push(&buf1);
- if (que.size() == 2) {
- runtest.pass ("CQue::pushin(Buffer *)");
- } else {
- runtest.fail ("CQue::pushin(Buffer *)");
- }
-
- // Nuke the array
- que.clear();
- if (que.size() == 0) {
- runtest.pass ("CQue::clearall()");
- } else {
- runtest.fail ("CQue::clearall()");
- }
-
-
- que.push(&buf);
- Buffer *buf2 = que.peek();
- if ((buf2 == &buf) && (que.size() == 1)) {
- runtest.pass ("CQue::peek()");
- } else {
- runtest.fail ("CQue::peek()");
- }
-
- Buffer *buf3 = que.peek();
- if ((buf3 == &buf) && (que.size() == 1)) {
- runtest.pass ("CQue::pop()");
- } else {
- runtest.fail ("CQue::pop()");
- }
-
- que.push(&buf1);
- que.push(&buf1);
- size_t firstsize = que.size();
- que.remove(&buf);
- if (que.size() == firstsize - 1) {
- runtest.pass ("CQue::remove()");
- } else {
- runtest.fail ("CQue::remove()");
- }
-
- // Make some test buffers
- Buffer merge1, merge2, merge3;
- size_t i;
- ptr = merge1.reference();
- for (i=0; i< gnash::NETBUFSIZE; i++) {
- ptr[i] = i*'A';
- }
- que.push(&merge1);
-
- ptr = merge2.reference();
- for (i=0; i<gnash::NETBUFSIZE; i++) {
- ptr[i] = i+'a';
- }
- que.push(&merge2);
-
- merge3.resize(96);
- ptr = merge3.reference();
- for (i=0; i<96; i++) {
- ptr[i] = i+' ';
- }
- que.push(&merge3);
-
- // A merge gives us one big buffer where there were several buffers
- Buffer *foo = que.merge(&merge1);
- if (foo->size() == (gnash::NETBUFSIZE * 2) + 96) {
- runtest.pass ("CQue::merge()");
- } else {
- runtest.fail ("CQue::merge()");
- }
-
- que.pop();
-
- que.dump();
-}
-
Index: testsuite/cygnal.all/test_handler.cpp
===================================================================
RCS file: testsuite/cygnal.all/test_handler.cpp
diff -N testsuite/cygnal.all/test_handler.cpp
--- testsuite/cygnal.all/test_handler.cpp 16 Mar 2008 01:26:18 -0000
1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,130 +0,0 @@
-//
-// Copyright (C) 2008 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-//
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#ifdef HAVE_STDARG_H
-#include <cstdarg>
-#endif
-
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <regex.h>
-#include <cstdio>
-#include <cerrno>
-#include <iostream>
-#include <fstream>
-#include <cstring>
-#include <vector>
-#include <boost/cstdint.hpp>
-
-#ifdef HAVE_DEJAGNU_H
-#include "dejagnu.h"
-#else
-#include "check.h"
-#endif
-
-#include "log.h"
-#include "handler.h"
-
-using namespace std;
-using namespace gnash;
-using namespace cygnal;
-using namespace boost;
-
-TestState runtest;
-LogFile& dbglogfile = LogFile::getDefaultInstance();
-
-int
-main (int /*argc*/, char** /*argv*/) {
- gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
- dbglogfile.setVerbosity();
-
- Handler que;
-
- Buffer buf;
- boost::uint8_t *test = new uint8_t[6];
- memcpy(test, "hell", 4);
-
- // Push one buffer on the fifo. The default is the incoming fifo,
- // which is the one where data flows from the network to the queue.
- que.push(&buf);
- if ((que.size() == 1) && (que.outsize() == 0)) {
- runtest.pass ("Handler::push(Buffer *)");
- } else {
- runtest.fail ("Handler::push(Buffer *)");
- }
-
- // Push one buffer on the outgoing fifo. The default is the incoming fifo,
- // The outgoing fifo is where data flows from the queu to the network. As
- // we can explicitly specufy which queue we write to, we test that here.
- que.pushout(&buf);
- if ((que.size() == 1) && (que.outsize() == 1)) {
- runtest.pass ("Handler::pushout(Buffer *)");
- } else {
- runtest.fail ("Handler::pushout(Buffer *)");
- }
-
- // Test pushin. When dumpimg, the second address should be different than
the first,
- // as well as the size. The outgoing queue should be uneffected.
- Buffer buf1;
- buf1.resize(112);
- que.pushin(&buf1);
- if ((que.size() == 2) && (que.outsize() == 1)) {
- runtest.pass ("Handler::pushin(Buffer *)");
- } else {
- runtest.fail ("Handler::pushin(Buffer *)");
- }
-
- // Nuke the array
- que.clearall();
- if ((que.size() == 0) && (que.outsize() == 0)) {
- runtest.pass ("Handler::clearall()");
- } else {
- runtest.fail ("Handler::clearall()");
- }
-
- // populate the buffer
- boost::uint8_t *ptr = buf.reference();
- for (size_t i=1; i< buf.size(); i++) {
- ptr[i] = i;
- }
-
- que.push(&buf);
- Buffer *buf2 = que.peek();
- if ((buf2 == &buf) && (que.size() == 1)) {
- runtest.pass ("Handler::peek()");
- } else {
- runtest.fail ("Handler::peek()");
- }
-
- Buffer *buf3 = que.peek();
- if ((buf3 == &buf) && (que.size() == 1)) {
- runtest.pass ("Handler::pop()");
- } else {
- runtest.fail ("Handler::pop()");
- }
-
-// que.dump();
-}
-
Index: testsuite/cygnal.all/test_http.cpp
===================================================================
RCS file: testsuite/cygnal.all/test_http.cpp
diff -N testsuite/cygnal.all/test_http.cpp
--- testsuite/cygnal.all/test_http.cpp 22 Mar 2008 04:05:55 -0000 1.7
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,478 +0,0 @@
- //
-// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#ifdef HAVE_DEJAGNU_H
-
-#include <string>
-
-#include <unistd.h>
-#ifdef HAVE_GETOPT_H
-# include <getopt.h>
-#endif
-
-#ifndef __GNUC__
-extern int optind, getopt(int, char *const *, const char *);
-#endif
-
-#include <sys/types.h>
-#include <iostream>
-#include <string>
-#include <vector>
-#include <regex.h>
-
-#include "log.h"
-#include "http.h"
-#include "dejagnu.h"
-#include "network.h"
-
-using namespace cygnal;
-using namespace gnash;
-using namespace std;
-
-static void usage (void);
-
-static TestState runtest;
-
-LogFile& dbglogfile = LogFile::getDefaultInstance();
-
-int
-main(int argc, char *argv[])
-{
- int c;
-
- while ((c = getopt (argc, argv, "hdvsm:")) != -1) {
- switch (c) {
- case 'h':
- usage ();
- break;
-
- case 'v':
- dbglogfile.setVerbosity();
- break;
-
- default:
- usage ();
- break;
- }
- }
-
- HTTP http;
-
- http.clearHeader();
- http.formatDate();
-// cerr << "FIXME: " << http.getHeader() << endl;
-
- regex_t regex_pat;
-
- // Check the Date field
- // The date should look something like this:
- // Date: Mon, 10 Dec 2007 GMT
- regcomp (®ex_pat, "Date: [A-Z][a-z]*, [0-9]* [A-Z][a-z]* [0-9]* [0-9:]*
*GMT$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatDate()");
- cerr << http.getHeader().c_str() << endl;
- } else {
- runtest.pass ("HTTP::formatDate()");
- }
- regfree(®ex_pat);
-
- // Check the Content-Length field
- http.clearHeader();
- http.formatContentLength(12345);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Content-Length: [0-9]*$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatContentLength()");
- } else {
- runtest.pass ("HTTP::formatContentLength()");
- }
- regfree(®ex_pat);
-
-
- // Check the Connection field
-// bool formatConnection(const char *data);
- http.clearHeader();
- const char *data = "Keep-Alive";
- http.formatConnection(data);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Connection: [A-za-z-]*",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatConnection()");
- } else {
- runtest.pass ("HTTP::formatConnection()");
- }
- regfree(®ex_pat);
-
- // Check the Server field
- http.clearHeader();
- http.formatServer();
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Server: Cygnal (GNU/Linux)$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatServer()");
- } else {
- runtest.pass ("HTTP::formatServer()");
- }
- regfree(®ex_pat);
-
- // Check the Host field
-// bool formatHost(const char *data);
- http.clearHeader();
- data = "localhost:4080";
- http.formatHost(data);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Host: [A-za-z-]*:[0-9]*$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatHost()");
- } else {
- runtest.pass ("HTTP::formatHost()");
- }
- regfree(®ex_pat);
-
-// Check the Language field
-// bool formatLanguage(const char *data);
- http.clearHeader();
- data = "en-US,en;q=0.9";
- http.formatLanguage(data);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Accept-Language: en-US,en;q=0.9$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatLanguage()");
- } else {
- runtest.pass ("HTTP::formatLanguage()");
- }
- regfree(®ex_pat);
-
-// bool formatCharset(const char *data);
-// Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r
- http.clearHeader();
- data = "iso-8859-1, utf-8, utf-16, *;q=0.1";
- http.formatCharset(data);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Accept-Charset: iso-8859-1.*$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatCharset()");
- } else {
- runtest.pass ("HTTP::formatCharset()");
- }
- regfree(®ex_pat);
-
-// bool formatEncoding(const char *data);
- http.clearHeader();
- data = "deflate, gzip, x-gzip, identity, *;q=0";
- http.formatEncoding(data);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Accept-Encoding: deflate, gzip.*$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatEncoding()");
- } else {
- runtest.pass ("HTTP::formatEncoding()");
- }
- regfree(®ex_pat);
-
-
-// bool formatTE(const char *data);
- http.clearHeader();
- data = "deflate, gzip, chunked, identity, trailers";
- http.formatTE(data);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "TE: deflate, gzip,.*$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatTE()");
- } else {
- runtest.pass ("HTTP::formatTE()");
- }
- regfree(®ex_pat);
-
-// bool formatAgent(const char *data);
- http.clearHeader();
- data = "Gnash 0.8.1-cvs (X11; Linux i686; U; en)";
- http.formatAgent(data);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "User-Agent: Gnash 0.8.1-cvs.*$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatAgent()");
- } else {
- runtest.pass ("HTTP::formatAgent()");
- }
- regfree(®ex_pat);
-
- // Check the Content Type field. First we check with a
- // specified field, then next to see if the default works.
-// bool formatContentType();
- http.clearHeader();
- http.formatContentType(HTTP::SWF);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Content-Type: application/x-shockwave-flash.*$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatContentType(type)");
- } else {
- runtest.pass ("HTTP::formatContentType(type)");
- }
- regfree(®ex_pat);
-
- http.clearHeader();
- http.formatContentType();
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Content-Type: text/html.*$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatContentType()");
- } else {
- runtest.pass ("HTTP::formatContenType()");
- }
- regfree(®ex_pat);
-
-// bool formatReferer(const char *data);
- http.clearHeader();
- data = "http://localhost/software/gnash/tests/index.html";
- http.formatReferer(data);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "Referer: http://localhost.*index.html.*$",
- REG_NOSUB|REG_NEWLINE);
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatReferer()");
- } else {
- runtest.pass ("HTTP::formatReferer()");
- }
- regfree(®ex_pat);
-
- // Check formatHeader()
- http.clearHeader();
- http.formatHeader(HTTP::LIFE_IS_GOOD);
-// cerr << "FIXME: " << http.getHeader() << endl;
- regcomp (®ex_pat, "HTTP/1.1 200
OK.*Date:.*Connection:.*-Length.*-Type:.*$",
- REG_NOSUB); // note that we do want to look for NL
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatHeader(port)");
- } else {
- runtest.pass ("HTTP::formatheader(port)");
- }
- regfree(®ex_pat);
-
- // Check the Server field
- http.clearHeader();
- http.formatErrorResponse(HTTP::NOT_FOUND);
-// cerr << "FIXME: " << http.getHeader() << endl;
-// cerr << "FIXME: " << http.getBody() << endl;
- regcomp (®ex_pat,
"Date:.*Server:.*Content-Length:.*Connection:.*Content-Type:.*$",
- REG_NOSUB); // note that we do want to look for NL
- if (regexec (®ex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0))
{
- runtest.fail ("HTTP::formatErrorResponse(header)");
- } else {
- runtest.pass ("HTTP::formatErrorResponse(header)");
- }
- regfree(®ex_pat);
- regcomp (®ex_pat, "DOCTYPE.*<title>404 Not Found</title>.*$",
- REG_NOSUB); // note that we do want to look for NL
- if (regexec (®ex_pat, http.getBody().c_str(), 0, (regmatch_t *)0, 0)) {
- runtest.fail ("HTTP::formatErrorResponse(body)");
- } else {
- runtest.pass ("HTTP::formatErrorResponse(body)");
- }
- regfree(®ex_pat);
-
- //
- // Decoding tests for HTTP
- //
- http.clearHeader();
- Network::byte_t *buffer = (Network::byte_t *)"GET
/software/gnash/tests/flvplayer.swf?file=http://localhost/software/gnash/tests/Ouray_Ice_Festival_Climbing_Competition.flv
HTTP/1.1\r\n"
-"User-Agent: Gnash/0.8.1-cvs (X11; Linux i686; U; en)\r\n"
-"Host: localhost:4080\r\n"
-"Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png,
image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\n"
-"Accept-Language: en-US,en;q=0.9\r\n"
-"Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n"
-"Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\r\n"
-"If-Modified-Since: Mon, 10 Dec 2007 02:26:31 GMT\r\n"
-"If-None-Match: \"4cc434-e266-52ff63c0\"\r\n"
-"Connection: Keep-Alive, TE\r\n"
-"Referer: http://localhost/software/gnash/tests/index.html\r\n"
-"TE: deflate, gzip, chunked, identity, trailers\r\n"
-"\r\n";
-
-// GET /software/gnash/tests/ HTTP/1.1
-// Host: localhost:4080
-// User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.5)
Gecko/20070718 Fedora/2.0.0.5-1.fc7 Firefox/2.0.0.5
-// Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
-// Accept-Language: en-us,en;q=0.5
-// Accept-Encoding: gzip,deflate
-// Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
-// Keep-Alive: 300
-// Connection: keep-alive
-
-// User Agent: Lynx/2.8.6rel.2 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8b
-
-// Some browsers have a different synatax, of course, to keep things
-// interesting.
- Network::byte_t *buffer2 = (Network::byte_t *)"GET
/software/gnash/tests/flvplayer.swf?file=http://localhost/software/gnash/tests/Ouray_Ice_Festival_Climbing_Competition.flv
HTTP/1.1\r\n)"
-"Content-Language: en-US,en;q=0.9\r\n"
-"Content-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n"
-"Content-Encoding: deflate, gzip, x-gzip, identity, *;q=0\r\n";
-// http.extractMethod(buffer);
- string result;
- result = http.extractReferer(buffer);
- if (result == "http://localhost/software/gnash/tests/index.html") {
- runtest.fail ("HTTP::extractReferer()");
- } else {
- runtest.pass ("HTTP::extractReferer()");
- }
- result = http.extractHost(buffer);
- if (result == "localhost:4080") {
- runtest.fail ("HTTP::extractHost()");
- } else {
- runtest.pass ("HTTP::extractHost()");
- }
-
- result = http.extractAgent(buffer);
- if (result == "Gnash/0.8.1-cvs (X11; Linux i686; U; en)") {
- runtest.fail ("HTTP::extractAgent()");
- } else {
- runtest.pass ("HTTP::extractAgent()");
- }
-
- int count;
- count = http.extractLanguage(buffer);
- std::vector<std::string> language = http.getLanguage();
- if ((count > 2) &&
- (language[0] == "en-US") &&
- (language[1] == "en")) {
- runtest.fail ("HTTP::extractLanguage(Accept-)");
- } else {
- runtest.pass ("HTTP::extractLanguage(Accept-)");
- }
- count = http.extractLanguage(buffer2);
- language = http.getLanguage();
- if ((count == 2) &&
- (language[0] == "en-US") &&
- (language[1] == "en")) {
- runtest.fail ("HTTP::extractLanguage(Content-)");
- } else {
- runtest.pass ("HTTP::extractLanguage(Content-)");
- }
-
- result = reinterpret_cast<const char *>(http.extractCharset(buffer));
- std::vector<std::string> charsets = http.getCharset();
- if ((count == 3) &&
- (charsets[0] == "iso-8859-1") &&
- (charsets[1] == "utf-8") &&
- (charsets[2] == "utf-16")) {
- runtest.fail ("HTTP::extractCharset(Accept-)");
- } else {
- runtest.pass ("HTTP::extractCharset(Accept-)");
- }
- count = http.extractCharset(buffer2);
- charsets = http.getCharset();
- if ((count == 3) &&
- (charsets[0] == "iso-8859-1") &&
- (charsets[1] == "utf-8") &&
- (charsets[2] == "utf-16")) {
- runtest.fail ("HTTP::extractCharset(Content-)");
- } else {
- runtest.pass ("HTTP::extractCharset(Content-)");
- }
-
- count = http.extractConnection(buffer);
- std::vector<std::string> connections = http.getConnection();
- if ((count == 2) &&
- (connections[0] == "Keep-Alive") &&
- (connections[1] == "TE")) {
- runtest.pass ("HTTP::extractConnection()");
- } else {
- runtest.fail ("HTTP::extractConnection()");
- }
-
- count = http.extractEncoding(buffer);
- std::vector<std::string> encoding = http.getEncoding();
- if ((count == 4) &&
- (encoding[0] == "deflate") &&
- (encoding[1] == "gzip") &&
- (encoding[2] == "chunked") &&
- (encoding[3] == "identity")) {
- runtest.fail ("HTTP::extractEncoding(Accept-)");
- } else{
- runtest.pass ("HTTP::extractEncoding(Accept-)");
- }
-
- count = http.extractTE(buffer);
- std::vector<std::string> te = http.getTE();
- if ((count == 5) &&
- (te[0] == "deflate") &&
- (te[1] == "gzip") &&
- (te[2] == "chunked") &&
- (te[3] == "identity") &&
- (te[4] == "trailers")) {
- runtest.pass ("HTTP::extractTE()");
- } else {
- runtest.fail ("HTTP::extractTE()");
- }
-
-// http.formatHeader(666, RTMP);
-// http.formatRequest("http://localhost:4080", HTTP::GET);
-
-// bool formatMethod(const char *data);
-
-
-// void *out = amf_obj.encodeNumber(*num);
-
-// if (memcmp(out, buf, 9) == 0) {
-// runtest.pass("Encoded AMF Number");
-// } else {
-// runtest.fail("Encoded AMF Number");
-// }
-
-// delete num;
-
-
- if (dbglogfile.getVerbosity() > 0) {
- http.dump();
- }
-}
-static void
-usage (void)
-{
- cerr << "This program tests HTTP protocol support." << endl;
- cerr << "Usage: test_http [hv]" << endl;
- cerr << "-h\tHelp" << endl;
- cerr << "-v\tVerbose" << endl;
- exit (-1);
-}
-
-#else // no DejaGnu support
-
-int
-main(int /*argc*/, char /* *argv[]*/)
-{
- // nop
- return 0;
-}
-
-#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/cygnal ChangeLog testsuite/cygnal.all/Mak...,
Rob Savoye <=