tests: Replace ON_EXIT m4 macro by on_exit() shell function.