[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ctrl-C on Win32
Re: Ctrl-C on Win32
Mon, 23 Apr 2001 17:14:46 -0500 (CDT)
On Mon, 23 Apr 2001, Johan Holmberg wrote:
> On Mon, 23 Apr 2001, Steven Knight wrote:
> > > I have tested my ideas with 5.6 and it seem to work as expected,
> > > but I don't know how to write a testcase for it (especially the
> > > timing-dependent part).
> > This is a fun one for building a test case... Here's an outline of how
> > I'd do it:
> > [detailed decription removed]
> Wow, that was even more complicated than I imagined, with lots of
> potentially platform-dependent functionality (fork/
> background process/kill/sleep ....).
Yes. It would actually be good to pull that functionality into the
Test::Cmd::Cons module (or maybe the Test::Cmd module itself). But
it'll be more effective to prototype it first in a few real tests
to see exactly what functionality is needed, and whether it can be
> > [...] The script should build the target
> > file, but also sleep(), say for three seconds. This will be when you'll
> > interrupt Cons (avoiding timing issues).
> The case I thought about as most tricky to test was to send the
> signal (Ctrl-C) while Cons was *not* running another command (via
> system), ie. when Cons was running its own code.
Good point. That is rather a different case.
> When I tested this manually I added a "busy-wait" loop to the Cons
> source, but I guess it has to be done another way to be usable as a
> real testcase. Can a [perl] rule be used, or isn't that realistic
> enough ???
That seems like a good starting point. Since Cons evals the [perl]
code, you genuinely will send the signal while Perl is running.
If it looks like we need to, I don't see anything wrong with considering
adding a small hook or two for testability. If that's a "busy-wait"
mode that can be unobtrusively enabled, that might be worth considering.
But see if [perl] will do the trick first.