[Libreoffice-commits] online.git: loolwsd/test
Michael Meeks
michael.meeks at collabora.com
Thu Sep 1 09:11:24 UTC 2016
loolwsd/test/Makefile.am | 4 +-
loolwsd/test/UnitFuzz.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+), 1 deletion(-)
New commits:
commit 1dce882fd13d676add9b50a4f4006e2f52b782af
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Jun 22 14:57:01 2016 +0100
Start of simpler input fuzzer.
diff --git a/loolwsd/test/Makefile.am b/loolwsd/test/Makefile.am
index 2723dc2..53f7d97 100644
--- a/loolwsd/test/Makefile.am
+++ b/loolwsd/test/Makefile.am
@@ -10,7 +10,8 @@ AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
noinst_LTLIBRARIES = \
unit-timeout.la unit-prefork.la \
unit-storage.la unit-fonts.la \
- unit-admin.la unit-tilecache.la
+ unit-admin.la unit-tilecache.la \
+ unit-fuzz.la
MAGIC_TO_FORCE_SHLIB_CREATION = -rpath /dummy
AM_LDFLAGS = -pthread -module $(MAGIC_TO_FORCE_SHLIB_CREATION)
@@ -32,6 +33,7 @@ test_SOURCES = TileCacheTests.cpp WhiteBoxTests.cpp integration-http-server.cpp
test_LDADD = $(CPPUNIT_LIBS)
# unit test modules:
+unit_fuzz_la_SOURCES = UnitFuzz.cpp
unit_admin_la_SOURCES = UnitAdmin.cpp
unit_admin_la_CPPFLAGS = -DTDOC=\"$(top_srcdir)/test/data\"
unit_fonts_la_SOURCES = UnitFonts.cpp
diff --git a/loolwsd/test/UnitFuzz.cpp b/loolwsd/test/UnitFuzz.cpp
new file mode 100644
index 0000000..57622b3
--- /dev/null
+++ b/loolwsd/test/UnitFuzz.cpp
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <dlfcn.h>
+#include <ftw.h>
+#include <cassert>
+#include <iostream>
+#include <sys/types.h>
+#include <dirent.h>
+
+#include "Common.hpp"
+#include "IoUtil.hpp"
+#include "LOOLProtocol.hpp"
+#include "Unit.hpp"
+#include "Util.hpp"
+
+#include <Poco/Timestamp.h>
+#include <Poco/StringTokenizer.h>
+#include <Poco/Net/WebSocket.h>
+
+// Inside the WSD process
+class UnitFuzz : public UnitWSD
+{
+public:
+ UnitFuzz()
+ {
+ std::cerr << "UnitFuzz startup\n";
+ setHasKitHooks();
+ }
+
+ virtual bool filterHandleRequest(
+ TestRequest /* type */,
+ Poco::Net::HTTPServerRequest& /* request */,
+ Poco::Net::HTTPServerResponse& /* response */) override
+ {
+ return false;
+ }
+};
+
+// Inside the forkit & kit processes
+class UnitKitFuzz : public UnitKit
+{
+public:
+ UnitKitFuzz()
+ {
+ std::cerr << "UnitKit Fuzz init !\n";
+ }
+ ~UnitKitFuzz()
+ {
+ }
+
+ virtual bool filterKitMessage(const std::shared_ptr<Poco::Net::WebSocket> & /* ws */,
+ std::string & /* message */) override
+ {
+ return false;
+ }
+};
+
+UnitBase *unit_create_wsd(void)
+{
+ return new UnitFuzz();
+}
+
+UnitBase *unit_create_kit(void)
+{
+ return new UnitKitFuzz();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list