Re: [PATCH 3/3] perf tests: Improve temp file cleanup in test_arm_coresight.sh

From: Leo Yan
Date: Wed Sep 22 2021 - 21:18:16 EST


On Wed, Sep 22, 2021 at 05:49:55PM +0100, James Clark wrote:

[...]

> > So below change should be sufficient?
> >
> > cleanup_files()
> > {
> > rm -f ${perfdata}
> > rm -f ${file}
> > + rm -f "${perfdata}.old"
> > + exit $glb_err
> > }
> >
> > Sorry if I miss anything at here and cause noise.
>
> The problem with not re-sending the sigint is that if you want to run the
> script in a bash while loop like:
>
> while ! tests/shell/test_arm_coresight.sh; do echo loop; done
>
> Then it's impossible to exit with Ctrl-C and delete the temp files at the
> same time. It exits if we don't trap sigint like it is at the moment, but
> then it leaves the temporary files. This change is so we can have both
> behaviours of Ctrl-C in a loop and keep the cleanup working.

Okay, I cannot think out better idea to handle this test case;
so current patch is fine for me. Thanks for explanation.

Thanks,
Leo