Fix code to generate the test signatues.
- ctx needs to be destroyed before it is regenerated.
- emit the name of the signature to be replaced.
- cleanup memory before asserting so post longjump doesn't detect a memory leak.
- comment code.
(cherry picked from commit 3a8c8a2a)