HoppeRx - the cure for your ailing device

A community site dedicated to the support of device problems found by Hopper

The Cat Parade

The Cat Parade

  • Comments 34

It has been said that trying to keep Hopper focused on a single application is like trying to get cats to walk in a parade (very difficult). The problem is Hopper is designed from its foundation to stress the entire system and never stay in one place too long – its job is to move around. Generally this is a good thing, but if you are trying to isolate a problem or your intent is to stress a particular application (if you are an ISV), it can be frustrating to watch Hopper navigate away from your application and find bugs that are not of interest of you. Hopper does have a built-in option (/a) to help with this, but it can be awkward and sometimes frustrating. 

 

I have coded a sample alternative below that simply sits in a tight loop, re-executing the application you want to keep Hopper banging on. The code loops and continually re-launches the application you want to test (this sample focuses on Media Player) and sleeps for a specified period. Using the below, it is possible Hopper will navigate away from your application but once the time duration expires, your application will be switched to front and again receive the brunt of Hopper's fury. I would consider the below bare-bones test code, but it should be sufficient to help you write and customize your own program that does what you need.

 

#include <windows.h>

 

#define ONE_SECOND      1000

#define TEN_SECONDS     (10 * ONE_SECOND)

#define TWENTY_SECONDS  (2 * TEN_SECONDS)

#define ONE_MINUTE      (3 * TWENTY_SECONDS)

#define FIVE_MINUTES    (5 * ONE_MINUTE)

#define FIFTEEN_MINUTES (3 * FIVE_MINUTES)

 

// Adjust the following to suit your needs

#define SLEEP_TIMEOUT TWENTY_SECONDS

TCHAR *g_pszAppName = TEXT("\\windows\\wmPlayer.exe");

 

//------------------------------------------------------------------------------

int WINAPI

WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,

    LPWSTR lpCmdLine, int iCmdShow)

{

    TCHAR tszTmp[MAX_PATH];

    PROCESS_INFORMATION piProcInfo;

 

    while(TRUE)

    {

        wsprintf(tszTmp, TEXT(" ... Relaunching: %s"), g_pszAppName);

        OutputDebugString(tszTmp);

        if(! CreateProcess(g_pszAppName, NULL, NULL, NULL, FALSE, 0, NULL,

                NULL, NULL, &piProcInfo))

        {

            goto Error;

        }

 

        // Adjust this value to suit your needs above

        Sleep(SLEEP_TIMEOUT);

    }

Error:

    // Error condition - should never get here.

    wsprintf(tszTmp, TEXT("ERROR: could not launch %s, last error: %d"),

        g_pszAppName, GetLastError());

    OutputDebugString(tszTmp);

    return(TRUE);

}

 

 

To use this test application, you will need to copy the above to a .cpp file and add a sources and makefile. Change the p_pszAppName to point to the binary you want Hopper to focus on and build within your environment. Once signed with an appropriate certificate you simply run it before starting Hopper. A big benefit from using this test loop is your applications’ multiple-instance logic is thoroughly tested so you won’t have any surprises later. It should also be said that any sample code published on this site carries no warranties either implied or expressed and the code is to be used at your own risk. Enjoy!

Comments
  • Good Tricks!

    This time my question is:
    Is the Hopper.exe for the Smartphone same as the one for the Pocker PC(phone edition)?

    The hopper.exe on my PPC board always run 33mins with the result "Start Menu no respond". and I follow the instructions on Doc: running hopper with KITL,when the first time the "Start menu no responding loop 1..." appears in the output panel, I break it, and Load NKdebug.dll,run "Allthreads sleeplist runlist" commands and so on. I got a lot of "PID/TID/Callstacks" but I don't know how to use these infomation to find the causation.
    How to analyse it?
    Where can I find the documents(or Hands-on-labs) about this topic?

    I am a newbie. Thanks!
  • Great tool ! Works with smartphone too.

    Brings the targetted app (POutlook ->Tasks) in my case every so often even though Hopper is running wild.

    Thanks Steve !!!

  • What is a “Cat Parade”?

    My apologies for anyone who does not recognize the reference – I try to make my titles memorable so they can easily be remembered. A “Cat Parade” refers to trying to make cats (the animals) try to walk in a straight line, or try to get them to do anything they don’t want to do – impossible!

    It’s the same way with trying to get Hopper to stay in a single place – its almost impossible because it was designed to do just the opposite. Hopper wants to traverse the entire system looking for bugs – the Cat Parade will allow you to reign in Hopper so it stays (mostly) in a single place.
  • Good tool!!

    But why not update Hopper and check application name after each key press? If the application name changed, back to the application you want to test again.
  • Ah! Good question and I am glad you brought it up. I have been thinking of how useful an “exclusive mode” could be and I keep coming back to the fact that I want to know the device can switch still to another app. I fear that having an exclusive mode would allow certain app hangs to go unchecked – and I want to know when I can’t dismiss the foreground window. I also like the way the focusApp above hammers on the instance checking – there is no way to run the above without rock-solid instance checking.

    However, that is just one opinion and should not indicate your suggestion is any less valuable – it is up to the OEM and ISV to best determine how to test their products. Off the top of my head, there are two ways to do exclusive mode:

    1. Easy way: I would take the above focusApp sample and I would replace the timer with logic to monitor the foreground window. You would need to populate some list that contains the names of all your windows and whenever the foreground window does not match this list, re-launch your app. This would not be exclusive, but could get you close with +/- 20 minutes of work.
    2. less-easy way: Use the above method, but instead of using Hopper find my blog entry “Roll your own Hopper in 200 lines of code – sample included!” and build your own input stress tool to test your application. While this would take more time, you could guarantee exclusivity since you would have more (complete) control over the test application. Also, you could add intelligence to the tool to do real things with your application and stress it in ways that Hopper couldn’t – you could actually do stuff.

    The bottom line is using any focus method on your app will allow you to increase your stability and not affect the platform during Hopper testing.
  • (housekeeping comment)
    It appears that some porn-bot has this URL. I have been trying to delete them as they arrive, but I apologize in advance if off-topic content is visible.
  • http://www.bloggen.be/rosarybracelets <a href="http://www.bloggen.be/rosarybracelets">rosary bracelets</a> rosary bracelets
  • http://www.bloggen.be/zend/ <a href="http://www.bloggen.be/zend/">replica watches</a> replica watches
  • Hello, nice site look this:
    http://sato.awardspace.com/gucci-replica-sun-glasses.htm
    <a href="http://sato.awardspace.com/chanel-replica-sun-glasses.htm">chanel replica sun glasses</a>
    <a href="http://sato.awardspace.com/designer-replica-sun-glasses.htm">designer replica sun glasses</a>
    <a href="http://sato.awardspace.com/chanel-replica-sun-glasses.htm">chanel replica sun glasses</a>
    <a href="http://sato.awardspace.com/chanel-replica-sun-glasses.htm">chanel replica sun glasses</a>
  • http://xoomer.alice.it/replicas/replica-rolex.html <a href="http://xoomer.alice.it/replicas/replica-rolex.html">replica rolex</a>  replica rolex
  • http://blogshot.nl/halloween <a href="http://blogshot.nl/halloween">Halloween costume</a> Halloween costume

  • http://qurl.com/rzbyc <a href="http://qurl.com/rzbyc">replica watches</a> replica watches

  • http://pb2.forenshop.net/cgi-bin/forenserver/foren/F_2359/cutecast.pl  <a href="http://pb2.forenshop.net/cgi-bin/forenserver/foren/F_2359/cutecast.pl">Christmas gifts</a> Christmas gifts

  • The focusapp described in a previous blog entry The Cat Parade is a great way for ISVs to get additional

  • http://rw.da.cx  <a href="http://rw.da.cx">replica watches</a> replica watches

Page 1 of 3 (34 items) 123
Leave a Comment
  • Please add 4 and 4 and type the answer here:
  • Post