I’ve been using an extension I created for automated testing. It works by writing a queue of tests to run into a file, then restarting the game using this phrase:
To restart immediately:
(- @restart; -).
Each test is deleted from the queue when it is run, so the next test will run after restarting.
If I fill the queue with multiple instances of the same test, it runs noticeably slower each time. If I recompile while a test is running, it continues advancing through the queue, but it’s fast again.
My guess is that there’s a memory leak in the interpreter that the IDE uses. But I have no idea how to isolate the problem. Can anyone help? Thanks!
I hope I’m not the only one curious, and I hope this doesn’t derail a thread…
But
is this available on windows too?
I tried the following code, and it just restarted without executing going south…is there any way to (quickly) integrate restarting immediately into a regular testing script, while you’re polishing your extension?
"simple-test" by Andrew Schultz
room 1 is a room.
To restart immediately:
(- @restart; -).
test rs with "n/rs/s"
chapter rsing
rsing is an action out of world.
understand the command "rs" as something new.
understand "rs" as rsing.
carry out rsing:
restart immediately;
[code]Include Text Capture by Eric Eve.
Use maximum capture buffer length of at least 16384.
room 1 is a room.
To restart immediately:
(- @restart; -).
chapter rsing
rsing is an action out of world.
understand the command “rs” as something new.
understand “rs” as rsing.
carry out rsing:
restart immediately;
Before reading a command:
repeat with i running from 1 to 10000:
start capturing text;
stop capturing text.[/code]
The first time I enter “rs,” it takes about 5 seconds to get to a prompt. The second time, about 10 seconds - and 5 seconds more each time.
Sorry, I meant the number of repeats in the loop, not the number of times you ran the test manually. Try changing the number from 10000 to 100000, for example. Three attempts should be enough if you can time the first one on a stopwatch.
Oops on my part–I wasn’t testing the right thing. I was testing under the z-machine, but when I changed to glulx (as indicated by your glk_ code,) things were less instantaneous.
But I did not see an increase in time taken. It was pretty consistently around 5 seconds for the 10 iterations I tried.