Not needed in my opinion. Acid can also helps.
If we decide that function marked for unit testing with a known regexp such as ending by _Test ...

defn utest()
{
    sl = symbols;
    while sl do {
        s = head sl;
        if (regexp(".*_Test", s[0])) then {
            call(s[2]);
        }
        sl = tail sl;
    }
}

This would call every function whose name is ending with _Test.

Phil;


On 7/17/2010 7:23 PM, Skip Tavakkolian wrote:
nice.  i'll give it a try later.

thinking outloud here; it seems that one could extend the capability
of ?c for generating acid code to include creating call wrapper
for any function that is marked for unit testing (perhaps another
#pragma?)

This one sounds like to work (except it does not save registers) ...

defn call(addr)
{
        local pco;

        // we need stack space, and thus process stopped.
        if status(pid) != "Stopped" then {
                print("Waiting...\n");
                stop(pid);
        }

        // Backup orginal instruction
        pco = fmt(*PC, bpfmt);

        // Put a temporary breakpoint
        **PC = bpinst;
        
        // update stack pointer
        *SP = *SP - 4;

        // make called function returning to this point
        **SP = *PC;

        // set PC to function to call
        *PC = addr;

        // do the call
        startstop(pid);

        // restore original instruction
        *PC = pco;
}

Phil;




Reply via email to