[Lldb-commits] [lldb] 0274c79 - [lldb/Utils] Serialize exit code in lldb-repro.py
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue May 5 16:06:30 PDT 2020
Author: Jonas Devlieghere
Date: 2020-05-05T16:05:49-07:00
New Revision: 0274c797c65a720010aee7f40cff621cd993ba15
URL: https://github.com/llvm/llvm-project/commit/0274c797c65a720010aee7f40cff621cd993ba15
DIFF: https://github.com/llvm/llvm-project/commit/0274c797c65a720010aee7f40cff621cd993ba15.diff
LOG: [lldb/Utils] Serialize exit code in lldb-repro.py
After 61d5b0e66394 more shell test are expected to exit with a non-zero
status code. Because the exit status is computed in the driver and not
behind the SB API layer, reproducers don't know about it and always
return 0 unless replay failed.
This discrepancy means that these tests don't work with lldb-repro.py
and skipping them for this reason would be a pity. To solve this
problem, the script now serializes the exit code during capture and
returns that during replay.
These is an assert that ensures that replay exits with a zero exit
status to prevent replay failures from being silently ignored.
Added:
Modified:
lldb/utils/lldb-repro/lldb-repro.py
Removed:
################################################################################
diff --git a/lldb/utils/lldb-repro/lldb-repro.py b/lldb/utils/lldb-repro/lldb-repro.py
index fddd65ee093c..2244e97a0ff1 100755
--- a/lldb/utils/lldb-repro/lldb-repro.py
+++ b/lldb/utils/lldb-repro/lldb-repro.py
@@ -44,10 +44,8 @@ def main():
# Create a new lldb invocation with capture or replay enabled.
lldb = os.path.join(os.path.dirname(sys.argv[0]), 'lldb')
new_args = [lldb]
- cleanup = False
if sys.argv[1] == "replay":
new_args.extend(['--replay', reproducer_path])
- cleanup = True
elif sys.argv[1] == "capture":
new_args.extend([
'--capture', '--capture-path', reproducer_path,
@@ -59,8 +57,19 @@ def main():
return 1
exit_code = subprocess.call(new_args)
- if cleanup:
+
+ # The driver always exists with a zero exit code during replay. Store the
+ # exit code and return that for tests that expect a non-zero exit code.
+ exit_code_path = os.path.join(reproducer_path, 'exit_code.txt')
+ if sys.argv[1] == "replay":
+ with open(exit_code_path, 'r') as f:
+ assert exit_code == 0
+ exit_code = int(f.read())
shutil.rmtree(reproducer_path, True)
+ elif sys.argv[1] == "capture":
+ with open(exit_code_path, 'w') as f:
+ f.write('%d' % exit_code)
+
return exit_code
More information about the lldb-commits
mailing list