[LU-9474] tests: register traps in a correct order Created: 09/May/17  Updated: 05/Aug/20  Resolved: 06/Aug/18

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.12.0, Lustre 2.10.7

Type: Bug Priority: Minor
Reporter: CEA Assignee: Saurabh Tandan (Inactive)
Resolution: Fixed Votes: 0
Labels: patch

Attachments: File tests_stack_trap.bash    
Issue Links:
Related
is related to LU-9475 tests: provide utilities to stack traps Resolved
is related to LU-10461 sanity 77c failure due to variables c... Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

trap is used in many tests to set actions to perform on cleanup.

IMHO, trap should be registered in this order:

cleanup_test_XX()
{
    undo_something
}

test_XX()
{
    trap cleanup_test_XX EXIT
    do_something
    ...
}

Currently many tests do not respect this template.
Among those, some:

  • register the trap after do_something();
  • explicitly call cleanup_test_XX() at the end of the test;
  • call trap 0 at the start of cleanup_test_XX() (this one may be controversial, I believe the test harness should provide, and probably already provides, trap isolation between tests).


 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 Andreas Dilger [ 16/May/17 ]

I'm not sure why you think the "call trap 0 at start of trap function", "call trap function at end of test" is bad? That consolidates cleanup code that may be in the trap function, rather than duplicating it at the end of the test and ensures that the trap is cleared for this test. AFAIK, there is not yet a "trap 0" at the end of run_tests() though that is probably a good idea.

Comment by Quentin Bouget [ 16/May/17 ]

Ultimately, the test is launched in run_one() which itself is called inside a subshell in run_one_logged(), so traps defined inside a test function should not leak to other tests and EXIT traps are already executed at the end of tests.

Comment by Gerrit Updater [ 17/Oct/17 ]

Quentin Bouget (quentin.bouget@cea.fr) uploaded a new patch: https://review.whamcloud.com/29653
Subject: LU-9474 tests: add the stack_trap() utility function
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: ec4ea64c9cefc6dd973c3955d18d6ba0255371f7

Comment by Gerrit Updater [ 15/Nov/17 ]

Quentin Bouget (quentin.bouget@cea.fr) uploaded a new patch: https://review.whamcloud.com/30097
Subject: LU-9474 tests: rewrite copytool_setup to use stack_trap
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 85c1b03c86a6e3351e13eb5b8ca8e23e497886af

Comment by Gerrit Updater [ 15/Nov/17 ]

Quentin Bouget (quentin.bouget@cea.fr) uploaded a new patch: https://review.whamcloud.com/30098
Subject: LU-9474 tests: replace import_file with copytool import
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 400c76c39fa2157bcebc4ab3c606a3e6f0942740

Comment by Gerrit Updater [ 22/Nov/17 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/29653/
Subject: LU-9474 tests: add the stack_trap() utility function
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 1dfda720c080e39890e5a659a30c8988ca498a7c

Comment by Gerrit Updater [ 05/Dec/17 ]

James Nunez (james.a.nunez@intel.com) uploaded a new patch: https://review.whamcloud.com/30371
Subject: LU-9474 tests: add the stack_trap() utility function
Project: fs/lustre-release
Branch: b2_10
Current Patch Set: 1
Commit: d4dbfd8ef76ce280fceb5c155cae44277a4fa919

Comment by Gerrit Updater [ 12/Dec/17 ]

Quentin Bouget (quentin.bouget@cea.fr) uploaded a new patch: https://review.whamcloud.com/30490
Subject: LU-9474 tests: fix quoting in stack_trap
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 8e086c102cbaabf3cf2be6645a2891064f057e13

Comment by Gerrit Updater [ 17/Dec/17 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/30097/
Subject: LU-9474 tests: rewrite copytool_setup to use stack_trap
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 2042bcea662847c12cacdecd598b0a0d5fa4d805

Comment by Gerrit Updater [ 19/Dec/17 ]

John L. Hammond (john.hammond@intel.com) merged in patch https://review.whamcloud.com/30371/
Subject: LU-9474 tests: add the stack_trap() utility function
Project: fs/lustre-release
Branch: b2_10
Current Patch Set:
Commit: eb9c7a25c8d62e549d1c41df0bf047bc2b1d63b4

Comment by Gerrit Updater [ 09/Feb/18 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/30490/
Subject: LU-9474 tests: fix quoting in stack_trap
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 99420a1830b89a8aba6350b095065d65107f7c0f

Comment by Gerrit Updater [ 27/Feb/18 ]

Quentin Bouget (quentin.bouget@cea.fr) uploaded a new patch: https://review.whamcloud.com/31429
Subject: LU-9474 tests: remove unneeded hsm_set_param for raolu tests
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 93e92575b03e1982e52734369b9cde3cb92dd786

Comment by Gerrit Updater [ 21/May/18 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/31429/
Subject: LU-9474 tests: remove unneeded hsm_set_param for raolu tests
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 804739be1f3bdd28e47d2e71b8ca78923549db25

Comment by Gerrit Updater [ 06/Aug/18 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/30098/
Subject: LU-9474 tests: replace import_file with copytool import
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 61089d59a672e0e3760e52cc1e6fc7f10caaf00e

Comment by Peter Jones [ 06/Aug/18 ]

Looks like this work has all landed now

Comment by Gerrit Updater [ 01/Feb/19 ]

Jian Yu (yujian@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/34158
Subject: LU-9474 tests: fix quoting in stack_trap
Project: fs/lustre-release
Branch: b2_10
Current Patch Set: 1
Commit: d7f6102a1ee47ba01f202c66a80d5a3f213501f5

Comment by Gerrit Updater [ 15/Feb/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/34158/
Subject: LU-9474 tests: fix quoting in stack_trap
Project: fs/lustre-release
Branch: b2_10
Current Patch Set:
Commit: 4c33ed79380017abfb9a1e34b99bc957257f4d55

Generated at Sat Feb 10 02:26:30 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.