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

tests: sanity-hsm: tests 34,35,36 are not using wait correctly

    XMLWordPrintable

Details

    • 3
    • 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 "..."
      }
      

      Attachments

        Activity

          People

            bougetq Quentin Bouget (Inactive)
            cealustre CEA
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: