[LU-11673] Correct shell issues/mistakes in Lustre test suites Created: 15/Nov/18  Updated: 04/Mar/22  Resolved: 15/Aug/19

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

Type: Improvement Priority: Minor
Reporter: James Nunez (Inactive) Assignee: James Nunez (Inactive)
Resolution: Fixed Votes: 0
Labels: test_script_improvements, tests

Issue Links:
Related
is related to LU-15617 Add shellcheck to prepare-commit-msg Resolved
Rank (Obsolete): 9223372036854775807

 Description   

Running the Lustre test suites with shellcheck (https://github.com/koalaman/shellcheck), used in CodeFactor (https://www.codefactor.io/), has brought out a few issues. We need to correct any valid issues that these utilities bring out.

As an example, shellcheck pointed out the following issue in sanity test 405

18918 test_405() {
18919         [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.92) -o \
18920         [ $(lustre_version_code client) -lt $(version_code 2.6.99) ] &&
18921                 skip "Layout swap lock is not supported"

although in not the most straight forward way

$ shellcheck myscript
 
Line 18918:
 test_405() {
            ^-- SC1009: The mentioned syntax error was in this brace group.
 
Line 18919:
         [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.92) -o \
         ^-- SC1073: Couldn't parse this test expression. Fix to allow more checks.
 
Line 18920:
         [ $(lustre_version_code client) -lt $(version_code 2.6.99) ] &&
         ^-- SC1026: If grouping expressions inside [..], use \( ..\).
           ^-- SC1072: Expected test to end here (don't wrap commands in []/[[]]). Fix any mentioned problems and try again.

In addition, the OpenGroup, has marked the use of some functionality as obsolete and “functionality described may be removed in a future version of this volume of POSIX.1-2017. Strictly Conforming POSIX Applications and Strictly Conforming XSI Applications shall not use obsolescent features.” In particular, under the test ([) page at http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html , use of the following are marked as obsolete:

expression1 -a  expression2
    [OB XSI] 
    True if both expression1 and expression2 are true; otherwise, false. The -a binary primary is left associative. It has a higher precedence than -o. 
expression1 -o  expression2
    [OB XSI] 
    True if either expression1 or expression2 is true; otherwise, false. The -o binary primary is left associative. 

For a better explanation, see https://github.com/koalaman/shellcheck/wiki/SC2166.



 Comments   
Comment by Gerrit Updater [ 15/Nov/18 ]

James Nunez (jnunez@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/33670
Subject: LU-11673 tests: correct extra call to test in sanity
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 3bf482f243af4d8bac094d05f12e6981d128a182

Comment by Gerrit Updater [ 30/Apr/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/33670/
Subject: LU-11673 tests: replace obsolete '-o' to '||'
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 6d277f126df7605d402255333180b0ca03991613

Comment by Peter Jones [ 30/Apr/19 ]

Landed for 2.13

Comment by James Nunez (Inactive) [ 30/Apr/19 ]

Reopening this ticket because there are a few more test script issues that should be cleaned up under this ticket.

Comment by Gerrit Updater [ 06/Jun/19 ]

James Nunez (jnunez@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35079
Subject: LU-11673 tests: add space before ']' in test-framework
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: e82eb59b21d8f441144dd0d93ba95dc1155a740c

Comment by Gerrit Updater [ 06/Jun/19 ]

James Nunez (jnunez@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35080
Subject: LU-11673 tests: quote argument of –n
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: fa9556ae99c61f1ef7224d750d1b73c1e43e9be6

Comment by Gerrit Updater [ 12/Jun/19 ]

James Nunez (jnunez@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35210
Subject: LU-11673 testing: testing quote argument of -n
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 5226fc26d6249cb4018c9769698b7e46cd2de683

Comment by Gerrit Updater [ 27/Jun/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35079/
Subject: LU-11673 tests: add space before ']' in test-framework
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 54e011a729fd656ae8568192763afe12425cd05e

Comment by Gerrit Updater [ 01/Aug/19 ]

James Nunez (jnunez@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35669
Subject: LU-11673 tests: quote argument of -n conf-sanity
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 873f34d5056c3682fce69d1b89d74543742dde08

Comment by Gerrit Updater [ 15/Aug/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35080/
Subject: LU-11673 tests: quote argument of -n and test fix
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 7e0cba246a7f2408c8266574a657e4459f691570

Comment by Gerrit Updater [ 15/Aug/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35669/
Subject: LU-11673 tests: quote argument of -n conf-sanity
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 443cc6e51f0202b9bc40c256259c4fc14ae3f7af

Comment by Peter Jones [ 15/Aug/19 ]

All open patches seem to have landed for 2.13

Comment by Gerrit Updater [ 05/Dec/19 ]

James Nunez (jnunez@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36926
Subject: LU-11673 tests: add space before ']' in test-framework
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: 918bc9c3657a4950c4d055961bfaecbd660a3140

Comment by Gerrit Updater [ 05/Dec/19 ]

James Nunez (jnunez@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36927
Subject: LU-11673 tests: quote argument of -n and test fix
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: 92fe5ff5d54e80be5ebd1d81997930d014765381

Comment by Gerrit Updater [ 05/Dec/19 ]

James Nunez (jnunez@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36928
Subject: LU-11673 tests: quote argument of -n conf-sanity
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: 3511f674a4e93db74e0ef7fe1d21fbacc76cf5ad

Comment by Gerrit Updater [ 05/Dec/19 ]

James Nunez (jnunez@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36929
Subject: LU-11673 tests: replace obsolete '-o' to '||'
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: c0ad282157bda61d2e10e7507ef6b04d14d5fc1a

Comment by Gerrit Updater [ 12/Dec/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36926/
Subject: LU-11673 tests: add space before ']' in test-framework
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: 93efabdb0db798037f377206f50502e6510b4604

Comment by Gerrit Updater [ 20/Dec/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36927/
Subject: LU-11673 tests: quote argument of -n and test fix
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: 1727bce01ffe49ce5dbf44af3d1cf4dd8f1db15d

Comment by Gerrit Updater [ 20/Dec/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36928/
Subject: LU-11673 tests: quote argument of -n conf-sanity
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: c207b3cb9b49e3c8026e63173a92ee6231f8eb5f

Comment by Gerrit Updater [ 03/Jan/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36929/
Subject: LU-11673 tests: replace obsolete '-o' to '||'
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: 4cf34cbf68eed1fd201f0eb4bd9f3155e805cef9

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