I'm testing a fairly small (4K LOC) interactive program and have built
an expect/perl from scratch to test it (this is for an intro software
engineeing class).
The program is compiled with all the necessary flags in g++ for
profiling and coverage statistics. When run from the command line, all
the profile output files are updated nicely as they should be (most
importantly, gmon.out, gprof's main output). However, when I spawn
this process and interact with it through my expect script, and after
it terminates normally (i.e. no crashes), the gmon.out file does not
exist.
I'm assuming that somewhere between the spawning of the process by
Expect and the end of the script, the background things that should be
happening are being "eaten" by Expect.
Is there an easy way to solve this problem? I have Exploring Expect if
someone could refer me to a page in there, too.
"The profiled program must call exit(2) or return normally for the
profiling information to be saved in the gmon.out file."
The problem occurs only when Expect closes the program itself.
Sorry for wasting anyone's time who has read this far.