dev/null |binary vcl/inc/svdata.hxx | 1 vcl/source/app/svapp.cxx | 53 +++++++++++++++++++++++++-------------- vcl/workben/README.eventtesting | 18 +++++++++++-- vcl/workben/eventtesting.impress |binary vcl/workben/eventtesting.writer |binary 6 files changed, 51 insertions(+), 21 deletions(-)
New commits: commit 639854d77bafb19bda031505daad038916a11593 Author: Caolán McNamara <[email protected]> Date: Fri Oct 16 16:21:03 2015 +0100 afl-eventtesting: add a realistic impress workout Change-Id: Ie40071dd91e28131ddb62c03834fda097a1d90ea diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 14b34c2a..fe4fb71 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -434,7 +434,7 @@ void Application::Execute() { if (GetCommandLineParam(i) == "--eventtesting") { - pSVData->maAppData.mnEventTestLimit = 10; + pSVData->maAppData.mnEventTestLimit = 50; pSVData->maAppData.mpEventTestingIdle = new Idle("eventtesting"); pSVData->maAppData.mpEventTestingIdle->SetIdleHdl(LINK(&(pSVData->maAppData), ImplSVAppData, VclEventTestingHdl)); pSVData->maAppData.mpEventTestingIdle->SetPriority(SchedulerPriority::MEDIUM); diff --git a/vcl/workben/README.eventtesting b/vcl/workben/README.eventtesting index 79472cd..963bed1 100644 --- a/vcl/workben/README.eventtesting +++ b/vcl/workben/README.eventtesting @@ -2,11 +2,23 @@ Notes on experimental afl driven ui fuzzing only keyboard events for now -vcl/workben/eventtesting is just serialized "hello" + ctrl+a + ctrl+b keystrokes to get things started +vcl/workben/eventtesting.writer is just serialized "hello" + ctrl+a + ctrl+b +keystrokes to get things started -currently an arbitrary limit of 10 keystrokes before application quits in +vcl/workben/eventtesting.impress is a bit more involved and inserts text, +a new slide via the menu, bullets and undos for all of that + +currently an arbitrary limit of 50 keystrokes before application quits in order to initially explore that shallow space +writer: Xnest :1 -cp vcl/workben/eventtesting . +cp vcl/workben/eventtesting.writer 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 + +impress: +Xnest :1 +cp vcl/workben/eventtesting.impress 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 --impress --eventtesting --norestore --display :1 + +This also works with --headless and no --display entry and thus no Xnest required diff --git a/vcl/workben/eventtesting.impress b/vcl/workben/eventtesting.impress new file mode 100644 index 0000000..ac79918 Binary files /dev/null and b/vcl/workben/eventtesting.impress differ diff --git a/vcl/workben/eventtesting b/vcl/workben/eventtesting.writer similarity index 100% rename from vcl/workben/eventtesting rename to vcl/workben/eventtesting.writer commit 6a627d6c5a94dbfae38bc1a6b1f716df19e47fd1 Author: Caolán McNamara <[email protected]> Date: Fri Oct 16 15:53:32 2015 +0100 afl-eventtesting: tweak key event injection lowest idles have a minimum time out associated with them. So just post events and use higher idle time priority as launcher for min-wait-for-opportune time to start inserting Change-Id: I8088e142199e880b198da11473558b4bd972a8d9 diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 0559cd8..0c850c03 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -163,6 +163,7 @@ struct ImplSVAppData DECL_STATIC_LINK_TYPED(ImplSVAppData, ImplQuitMsg, void*, void); DECL_STATIC_LINK_TYPED(ImplSVAppData, ImplEndAllDialogsMsg, void*, void); + DECL_STATIC_LINK_TYPED(ImplSVAppData, ImplVclEventTestingHdl, void*, void); DECL_LINK_TYPED(VclEventTestingHdl, Idle*, void); }; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 1d92469..14b34c2a 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -347,9 +347,6 @@ namespace { bool InjectKeyEvent(SvStream& rStream) { - if (Application::AnyInput()) - return false; - VclPtr<vcl::Window> xWin(Application::GetFirstTopLevelWindow()); while (xWin) { @@ -360,6 +357,17 @@ namespace if (!xWin) return false; + // skip the first available cycle and insert on the next one when we + // are trying the initial event, flagged by a triggered but undeleted + // mpEventTestingIdle + ImplSVData* pSVData = ImplGetSVData(); + if (pSVData->maAppData.mpEventTestingIdle) + { + delete pSVData->maAppData.mpEventTestingIdle; + pSVData->maAppData.mpEventTestingIdle = nullptr; + return false; + } + SalKeyEvent aKeyEvent; aKeyEvent.mnTime = 0; rStream.ReadUInt16(aKeyEvent.mnCode); @@ -375,7 +383,6 @@ namespace void CloseDialogsAndQuit() { - Scheduler::ProcessTaskScheduling(false); Application::EndAllDialogs(); Application::Quit(); } @@ -383,26 +390,36 @@ namespace IMPL_LINK_NOARG_TYPED(ImplSVAppData, VclEventTestingHdl, Idle *, void) { - SAL_INFO("vcl.eventtesting", "EventTestLimit is " << mnEventTestLimit); - if (mnEventTestLimit == 0) + if (Application::AnyInput()) { - delete mpEventTestInput; - delete mpEventTestingIdle; - SAL_INFO("vcl.eventtesting", "Event Limit reached, exiting" << mnEventTestLimit); + mpEventTestingIdle->Start(); + } + else + { + Application::PostUserEvent( LINK( NULL, ImplSVAppData, ImplVclEventTestingHdl ) ); + } +} + +IMPL_STATIC_LINK_NOARG_TYPED( ImplSVAppData, ImplVclEventTestingHdl, void*, void ) +{ + ImplSVData* pSVData = ImplGetSVData(); + SAL_INFO("vcl.eventtesting", "EventTestLimit is " << pSVData->maAppData.mnEventTestLimit); + if (pSVData->maAppData.mnEventTestLimit == 0) + { + delete pSVData->maAppData.mpEventTestInput; + SAL_INFO("vcl.eventtesting", "Event Limit reached, exiting" << pSVData->maAppData.mnEventTestLimit); CloseDialogsAndQuit(); } else { - Scheduler::ProcessTaskScheduling(false); - if (InjectKeyEvent(*mpEventTestInput)) - --mnEventTestLimit; - if (!mpEventTestInput->good()) + if (InjectKeyEvent(*pSVData->maAppData.mpEventTestInput)) + --pSVData->maAppData.mnEventTestLimit; + if (!pSVData->maAppData.mpEventTestInput->good()) { SAL_INFO("vcl.eventtesting", "Event Input exhausted, exit next cycle"); - mnEventTestLimit = 0; + pSVData->maAppData.mnEventTestLimit = 0; } - Scheduler::ProcessTaskScheduling(false); - mpEventTestingIdle->Start(); + Application::PostUserEvent( LINK( NULL, ImplSVAppData, ImplVclEventTestingHdl ) ); } } @@ -420,7 +437,7 @@ void Application::Execute() 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.mpEventTestingIdle->SetPriority(SchedulerPriority::MEDIUM); pSVData->maAppData.mpEventTestInput = new SvFileStream("eventtesting", StreamMode::READ); pSVData->maAppData.mpEventTestingIdle->Start(); break;
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
