Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-11673

Correct shell issues/mistakes in Lustre test suites

Details

    • 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.

      Attachments

        Issue Links

          Activity

            [LU-11673] Correct shell issues/mistakes in Lustre test suites

            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

            gerrit Gerrit Updater added a comment - 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

            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

            gerrit Gerrit Updater added a comment - 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

            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

            gerrit Gerrit Updater added a comment - 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

            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

            gerrit Gerrit Updater added a comment - 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

            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

            gerrit Gerrit Updater added a comment - 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

            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

            gerrit Gerrit Updater added a comment - 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

            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

            gerrit Gerrit Updater added a comment - 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

            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

            gerrit Gerrit Updater added a comment - 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
            pjones Peter Jones added a comment -

            All open patches seem to have landed for 2.13

            pjones Peter Jones added a comment - All open patches seem to have landed for 2.13

            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

            gerrit Gerrit Updater added a comment - 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

            People

              jamesanunez James Nunez (Inactive)
              jamesanunez James Nunez (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: