119 if Options.options.valgrind and not force_no_valgrind: |
119 if Options.options.valgrind and not force_no_valgrind: |
120 if Options.options.command_template: |
120 if Options.options.command_template: |
121 raise Utils.WafError("Options --command-template and --valgrind are conflicting") |
121 raise Utils.WafError("Options --command-template and --valgrind are conflicting") |
122 if not env['VALGRIND']: |
122 if not env['VALGRIND']: |
123 raise Utils.WafError("valgrind is not installed") |
123 raise Utils.WafError("valgrind is not installed") |
124 argv = [env['VALGRIND'], "--leak-check=full", "--error-exitcode=1"] + argv |
124 argv = [env['VALGRIND'], "--leak-check=full", "--show-reachable=yes", "--error-exitcode=1"] + argv |
125 proc = subprocess.Popen(argv, env=proc_env, cwd=cwd, stderr=subprocess.PIPE) |
125 proc = subprocess.Popen(argv, env=proc_env, cwd=cwd, stderr=subprocess.PIPE) |
126 reg = re.compile ('definitely lost: ([^ ]+) bytes') |
|
127 error = False |
126 error = False |
128 for line in proc.stderr: |
127 for line in proc.stderr: |
129 sys.stderr.write(line) |
128 sys.stderr.write(line) |
130 result = reg.search(line) |
129 if "== LEAK SUMMARY" in line: |
131 if result is None: |
|
132 continue |
|
133 if result.group(1) != "0": |
|
134 error = True |
130 error = True |
135 retval = proc.wait() |
131 retval = proc.wait() |
136 if retval == 0 and error: |
132 if retval == 0 and error: |
137 retval = 1 |
133 retval = 1 |
138 else: |
134 else: |