parameters: (shell, query, count=1, supp_file=None)
return_statement: return summary
docstring: Run valgrind using the shell and a query, parse leak reports.
docstring_summary: Run valgrind using the shell and a query, parse leak reports.
docstring_tokens: Run valgrind using the shell and a query parse leak reports .
function: def check_leaks_linux(shell, query, count=1, supp_file=None):
      """Run valgrind using the shell and a query, parse leak reports."""
      suppressions = "" if supp_file is None else "--suppressions=%s" % supp_file
      cmd = [
          "valgrind",
          "--tool=memcheck",
          suppressions,
          shell,
          "--profile",
          "%d" % count,
          query,
          "--disable_extensions",
      ]
      proc = subprocess.Popen(
          cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
      )
      _, stderr = proc.communicate()
      summary = {
          "definitely": None,
          "indirectly": None,
          "possibly": None,
      }
      if args.verbose:
          print(stderr)
      for line in stderr.split("\n"):
          for key in summary:
              if line.find(key) >= 0:
                  summary[key] = line.split(":")[1].strip()
      if summary["definitely"] is None:
          raise Exception("Could not execute valgrind correctly")
      return summary
function_tokens: def check_leaks_linux ( shell , query , count = 1 , supp_file = None ) : suppressions = "" if supp_file is None else "--suppressions=%s" % supp_file cmd = [ "valgrind" , "--tool=memcheck" , suppressions , shell , "--profile" , "%d" % count , query , "--disable_extensions" , ] proc = subprocess . Popen ( cmd , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) _ , stderr = proc . communicate ( ) summary = { "definitely" : None , "indirectly" : None , "possibly" : None , } if args . verbose : print ( stderr ) for line in stderr . split ( "\n" ) : for key in summary : if line . find ( key ) >= 0 : summary [ key ] = line . split ( ":" ) [ 1 ] . strip ( ) if summary [ "definitely" ] is None : raise Exception ( "Could not execute valgrind correctly" ) return summary