[Lldb-commits] [lldb] r129935 - in /lldb/trunk: source/API/SBInstruction.cpp source/Core/Disassembler.cpp test/arm_emulation/TestEmulations.py
Johnny Chen
johnny.chen at apple.com
Thu Apr 21 13:27:45 PDT 2011
Author: johnny
Date: Thu Apr 21 15:27:45 2011
New Revision: 129935
URL: http://llvm.org/viewvc/llvm-project?rev=129935&view=rev
Log:
Use self.TraceOn() API to decide whether to print debug output.
Modified:
lldb/trunk/source/API/SBInstruction.cpp
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/test/arm_emulation/TestEmulations.py
Modified: lldb/trunk/source/API/SBInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstruction.cpp?rev=129935&r1=129934&r2=129935&view=diff
==============================================================================
--- lldb/trunk/source/API/SBInstruction.cpp (original)
+++ lldb/trunk/source/API/SBInstruction.cpp Thu Apr 21 15:27:45 2011
@@ -155,8 +155,5 @@
if (!m_opaque_sp.get())
m_opaque_sp.reset (new PseudoInstruction());
- bool success = m_opaque_sp->TestEmulation (output_stream.get(), test_file);
- if (output_stream.GetSize() > 0)
- fprintf (stdout, "%s", output_stream.GetData());
- return success;
-}
\ No newline at end of file
+ return m_opaque_sp->TestEmulation (output_stream.get(), test_file);
+}
Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=129935&r1=129934&r2=129935&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Thu Apr 21 15:27:45 2011
@@ -510,14 +510,14 @@
if (!file_name)
{
- out_stream->Printf ("Instruction::TestEmulation: Missing file_name.\n");
+ out_stream->Printf ("Instruction::TestEmulation: Missing file_name.");
return false;
}
FILE *test_file = fopen (file_name, "r");
if (!test_file)
{
- out_stream->Printf ("Instruction::TestEmulation: Attempt to open test file failed.\n");
+ out_stream->Printf ("Instruction::TestEmulation: Attempt to open test file failed.");
return false;
}
@@ -525,7 +525,7 @@
char buffer[256];
if (!fgets (buffer,255, test_file)) // Read/skip first line of file, which should be a comment line (description).
{
- out_stream->Printf ("Instruction::TestEmulation: Read comment line failed.\n");
+ out_stream->Printf ("Instruction::TestEmulation: Read comment line failed.");
fclose (test_file);
return false;
}
@@ -533,7 +533,7 @@
if (fscanf (test_file, "%s", buffer) != 1) // Read the arch or arch-triple from the file
{
- out_stream->Printf ("Instruction::TestEmulation: Read arch failed.\n");
+ out_stream->Printf ("Instruction::TestEmulation: Read arch failed.");
fclose (test_file);
return false;
}
@@ -549,9 +549,9 @@
fclose (test_file);
if (success)
- out_stream->Printf ("Emulation test succeeded.\n");
+ out_stream->Printf ("Emulation test succeeded.");
else
- out_stream->Printf ("Emulation test failed.\n");
+ out_stream->Printf ("Emulation test failed.");
return success;
}
Modified: lldb/trunk/test/arm_emulation/TestEmulations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/arm_emulation/TestEmulations.py?rev=129935&r1=129934&r2=129935&view=diff
==============================================================================
--- lldb/trunk/test/arm_emulation/TestEmulations.py (original)
+++ lldb/trunk/test/arm_emulation/TestEmulations.py Thu Apr 21 15:27:45 2011
@@ -22,7 +22,6 @@
for f in thumb_files:
test_file = os.path.join (test_dir, f)
- print '\nRunning test ' + f
self.run_a_single_test (test_file)
@@ -37,7 +36,6 @@
for f in arm_files:
test_file = os.path.join (test_dir, f)
- print '\nRunning test ' + f
self.run_a_single_test (test_file)
def run_a_single_test (self, filename):
@@ -45,11 +43,11 @@
stream = lldb.SBStream ();
success = insn.TestEmulation (stream, filename);
output = stream.GetData();
- if not success:
+ if self.TraceOn():
+ print '\nRunning test ' + os.path.basename(filename)
print output
- self.assertTrue ('Emulation test succeeded.' in output)
- self.assertTrue (success == True)
+ self.assertTrue (success, 'Emulation test succeeded.')
if __name__ == '__main__':
import atexit
More information about the lldb-commits
mailing list