Files
snapd/tests/bin/tests.cleanup
Zygmunt Krynicki ef07bf737d tests: add tests.cleanup helper
Several of our tests used a trick where a "defer.sh" script was appended
to, collecting more and more commands to execute. The restore section
then used tac(1) to reverse file order and execute the result,
implementing a simple cleanup stack in shell.

This patch takes that idea and polishes the rough edges. The new
tests.cleanup tool comes with basic but sufficient functionality, tests
and documentation to complete the same task.

Using this pattern can simplify restore logic as the conditions that
lead to prepare or execute customizing something do not have to be
repeated.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
2020-07-06 22:15:14 +02:00

Symbolic link
1 line
26 B
Plaintext