[LU-10234] tests: sanity-hsm: tests 34,35,36 are not using wait correctly Created: 13/Nov/17  Updated: 05/Aug/20  Resolved: 22/Nov/17

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.11.0, Lustre 2.10.2

Type: Bug Priority: Minor
Reporter: CEA Assignee: Quentin Bouget
Resolution: Fixed Votes: 0
Labels: patch

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

All those tests launch a command in the background and want to check whether or not the command completes, they do so like this:

test_3*()
{
    ...
    md5sum $f > /dev/null &
    local pid=$!
    ...
    local rc=$(wait $pid)
    [[ $rc -eq 0 ]] || error "..."
}

Putting aside the fact that launching wait in a subshell like this will not work (pid 12345 is not a child of this shell), local rc=$(command) is not the way to check a return code in bash.

This code should be replaced with:

test_3*()
{
    ...
    md5sum $f > /dev/null &
    local pid=$!
    ...
    wait $pid || error "..."
}


 Comments   
Comment by Peter Jones [ 13/Nov/17 ]

Quentin

Will you be pushing a patch to correct this?

Peter

Comment by Quentin Bouget [ 13/Nov/17 ]

Yes =)

Quentin

Comment by Gerrit Updater [ 15/Nov/17 ]

Quentin Bouget (quentin.bouget@cea.fr) uploaded a new patch: https://review.whamcloud.com/30102
Subject: LU-10234 tests: use wait correctly in sanity-hsm test_3[4-6]
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 52b79ef846dcdf8740a0c15669f63ce514176a71

Comment by Gerrit Updater [ 22/Nov/17 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/30102/
Subject: LU-10234 tests: use wait correctly in sanity-hsm test_3[4-6]
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: eec4b8985f5eaacd13f0e0db7328dcdd610655bc

Comment by Peter Jones [ 22/Nov/17 ]

Landed for 2.11

Comment by Gerrit Updater [ 22/Nov/17 ]

James Nunez (james.a.nunez@intel.com) uploaded a new patch: https://review.whamcloud.com/30208
Subject: LU-10234 tests: use wait correctly in sanity-hsm test_3[4-6]
Project: fs/lustre-release
Branch: b2_10
Current Patch Set: 1
Commit: edb1c83170db6bc699c33b6bd8be9771483b8987

Comment by Gerrit Updater [ 27/Nov/17 ]

John L. Hammond (john.hammond@intel.com) merged in patch https://review.whamcloud.com/30208/
Subject: LU-10234 tests: use wait correctly in sanity-hsm test_3[4-6]
Project: fs/lustre-release
Branch: b2_10
Current Patch Set:
Commit: ef3252dc74e962dd7c81e09ca6b4b49273275b59

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