[Libreoffice-commits] core.git: 2 commits - desktop/source vcl/inc vcl/source vcl/test vcl/workben
Caolán McNamara
caolanm at redhat.com
Tue Oct 6 08:24:40 PDT 2015
desktop/source/app/cmdlineargs.cxx | 1
vcl/inc/svdata.hxx | 6 +++
vcl/source/app/svapp.cxx | 65 +++++++++++++++++++++++++++++++++++++
vcl/test/makefile.mk | 64 ------------------------------------
vcl/workben/README.eventtesting | 13 +++++++
vcl/workben/eventtesting |binary
6 files changed, 85 insertions(+), 64 deletions(-)
New commits:
commit 2ad231f9e90071ad2d83dae7a879ce1295db39ee
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 6 16:18:18 2015 +0100
experimental afl driven ui testing
Change-Id: I1933951c52adc75ed36db2c083c232f29b6140d6
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index 1aab714..a388f7d 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -494,6 +494,7 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
// vcl/unx/generic/app/sm.cxx:
oArg != "session=" &&
#endif
+ oArg != "eventtesting" &&
//ignore additional legacy options that don't do anything anymore
oArg != "nocrashreport" &&
m_unknown.isEmpty())
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 52ea411..87e6589 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -31,6 +31,7 @@
#include "tools/debug.hxx"
#include "tools/solar.h"
#include "vcl/bitmapex.hxx"
+#include "vcl/idle.hxx"
#include "vcl/dllapi.h"
#include "vcl/keycod.hxx"
#include "vcl/svapp.hxx"
@@ -156,7 +157,12 @@ struct ImplSVAppData
*/
ImeStatusWindowMode meShowImeStatusWindow;
+ SvFileStream* mpEventTestInput;
+ Idle* mpEventTestingIdle;
+ int mnEventTestLimit;
+
DECL_STATIC_LINK_TYPED( ImplSVAppData, ImplQuitMsg, void*, void );
+ DECL_LINK_TYPED(VclEventTestingHdl, Idle*, void);
};
struct ImplSVGDIData
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 320ea64..7fb612b 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -327,11 +327,76 @@ const vcl::KeyCode* Application::GetReservedKeyCode( sal_uLong i )
return &ImplReservedKeys::get()->first[i].mKeyCode;
}
+namespace
+{
+ bool InjectKeyEvent(SvStream& rStream)
+ {
+ VclPtr<vcl::Window> xWin(Application::GetActiveTopWindow());
+ if (!xWin)
+ return false;
+
+ SalKeyEvent aKeyEvent;
+ rStream.ReadUInt64(aKeyEvent.mnTime);
+ rStream.ReadUInt16(aKeyEvent.mnCode);
+ rStream.ReadUInt16(aKeyEvent.mnCharCode);
+ rStream.ReadUInt16(aKeyEvent.mnRepeat);
+ if (!rStream.good())
+ return false;
+
+ ImplWindowFrameProc(xWin.get(), NULL, SALEVENT_KEYINPUT, &aKeyEvent);
+ ImplWindowFrameProc(xWin.get(), NULL, SALEVENT_KEYUP, &aKeyEvent);
+ return true;
+ }
+}
+
+IMPL_LINK_NOARG_TYPED(ImplSVAppData, VclEventTestingHdl, Idle *, void)
+{
+ SAL_INFO("vcl.eventtesting", "EventTestLimit is " << mnEventTestLimit);
+ if (mnEventTestLimit == 0)
+ {
+ delete mpEventTestInput;
+ delete mpEventTestingIdle;
+ SAL_INFO("vcl.eventtesting", "Event Limit reached, exiting" << mnEventTestLimit);
+ Application::Quit();
+ }
+ else
+ {
+ Scheduler::ProcessTaskScheduling(true);
+ if (InjectKeyEvent(*mpEventTestInput))
+ --mnEventTestLimit;
+ if (!mpEventTestInput->good())
+ {
+ delete mpEventTestInput;
+ delete mpEventTestingIdle;
+ SAL_INFO("vcl.eventtesting", "Event Input exhausted, exiting" << mnEventTestLimit);
+ Application::Quit();
+ return;
+ }
+ Scheduler::ProcessTaskScheduling(true);
+ mpEventTestingIdle->Start();
+ }
+}
+
void Application::Execute()
{
ImplSVData* pSVData = ImplGetSVData();
pSVData->maAppData.mbInAppExecute = true;
+ sal_uInt16 n = GetCommandLineParamCount();
+ for (sal_uInt16 i = 0; i != n; ++i)
+ {
+ if (GetCommandLineParam(i) == "--eventtesting")
+ {
+ pSVData->maAppData.mnEventTestLimit = 10;
+ pSVData->maAppData.mpEventTestingIdle = new Idle("eventtesting");
+ pSVData->maAppData.mpEventTestingIdle->SetIdleHdl(LINK(&(pSVData->maAppData), ImplSVAppData, VclEventTestingHdl));
+ pSVData->maAppData.mpEventTestingIdle->SetPriority(SchedulerPriority::LOWEST);
+ pSVData->maAppData.mpEventTestInput = new SvFileStream("eventtesting", StreamMode::READ);
+ pSVData->maAppData.mpEventTestingIdle->Start();
+ break;
+ }
+ }
+
while ( !pSVData->maAppData.mbAppQuit )
Application::Yield();
diff --git a/vcl/workben/README.eventtesting b/vcl/workben/README.eventtesting
new file mode 100644
index 0000000..0336f22
--- /dev/null
+++ b/vcl/workben/README.eventtesting
@@ -0,0 +1,13 @@
+Notes on experimental afl driven ui fuzzing
+
+only keyboard events for now
+
+vcl/workben/eventtesting is just serialized "helloworld" keystrokes to get
+things started
+
+currently an arbitrary limit of 10 keystrokes before application quits in
+order to initially explore that shallow space
+
+Xnest :1
+cp vcl/workben/eventtesting .
+afl-fuzz -f eventtesting -t 10000 -i ~/fuzz/in.vcl -o ~/fuzz/out.vcl -d -T vcl -m 50000000 instdir/program/soffice.bin --nologo --writer --eventtesting --norestore --display :1
diff --git a/vcl/workben/eventtesting b/vcl/workben/eventtesting
new file mode 100644
index 0000000..363260a
Binary files /dev/null and b/vcl/workben/eventtesting differ
commit c43cf1d2b6b6307e9455cbd12bbcd8310e135eac
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 6 16:15:36 2015 +0100
dead makefile.mk
Change-Id: I03b10f2cda6bf9305e724f2a547924d1c8ec316b
diff --git a/vcl/test/makefile.mk b/vcl/test/makefile.mk
deleted file mode 100644
index a3211c4..0000000
--- a/vcl/test/makefile.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# 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/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-PRJ=..
-
-PRJNAME=vcl
-TARGET=dndtest
-LIBTARGET=NO
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-# --- Files --------------------------------------------------------
-
-APP1OBJS= \
- $(OBJ)$/dndtest.obj
-
-
-APP1NOSAL= TRUE
-APP1TARGET= $(TARGET)
-APP1STDLIBS= $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(TOOLSLIB) \
- $(SALLIB) \
- $(SOTLIB) \
- $(COMPHELPERLIB) \
- $(VCLLIB)
-
-# --- Targets ------------------------------------------------------
-
-APP2TARGET= canvasbitmaptest
-APP2OBJS= \
- $(OBJ)$/canvasbitmaptest.obj
-
-APP2NOSAL= TRUE
-APP2STDLIBS=$(TOOLSLIB) \
- $(COMPHELPERLIB) \
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(UCBHELPERLIB) \
- $(SALLIB) \
- $(VCLLIB)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-
More information about the Libreoffice-commits
mailing list