[LU-9475] tests: provide utilities to stack traps Created: 09/May/17 Updated: 05/Aug/20 Resolved: 10/Apr/18 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | CEA | Assignee: | Saurabh Tandan (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Severity: | 3 | ||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||
| Description |
|
Some tests (for example test_12q and test_24d of sanity-hsm) perform several actions that require cleanup. Unfortunately, trap does not provide any option to stack traps on top of one another. cleanup_something()
{
undo_something
}
cleanup_test_XX()
{
undo_something else
cleanup_something
}
test_XX()
{
trap clean_something() EXIT
do_something
trap cleanup_test_XX EXIT
do_something else
}
This method, while valid in most cases[1], requires developers to check whether or not, any utility function they use in their test(s) might set up a trap on its own. [1] in sanity-hsm, copytool_setup() sets up a trap itself; this means that it has to be called before setting another trap such as cleanup_test_XX() (otherwise, cleanup_test_XX() would be overwritten) which is not always correct. |
| Comments |
| Comment by James Nunez (Inactive) [ 09/May/17 ] |
|
Saurabh - Quentin started work on this issue with https://review.whamcloud.com/#/c/26734/. Would you please work with him to make sure that this work lands to master? Thanks, James |
| Comment by James Nunez (Inactive) [ 09/Apr/18 ] |
|
Quentin - Is this work being tracked under Thanks |
| Comment by Quentin Bouget [ 10/Apr/18 ] |
|
Hi James, Yes, this ticket can be closed =] |
| Comment by Peter Jones [ 10/Apr/18 ] |
|
ok - thanks |