[llvm] r176377 - Rewrite a test to check actual output rather than intermediate implementation

Eli Bendersky eliben at google.com
Fri Mar 1 12:54:00 PST 2013


Author: eliben
Date: Fri Mar  1 14:54:00 2013
New Revision: 176377

URL: http://llvm.org/viewvc/llvm-project?rev=176377&view=rev
Log:
Rewrite a test to check actual output rather than intermediate implementation
detail.

The was this test was written, it was relying on an implementation detail
(fixups) and hence was very brittle (relying, among other things, on the
exact ordering of statistics printed by MC).

The test was rewritten to check a more observable output difference. While it
doesn't cover 100% of the things the original test covered, it's a good
practice to write regression tests this way. If we want to check that
internal details and invariants hold, such tests should be expressed as unit
tests.




Modified:
    llvm/trunk/test/MC/ELF/no-fixup.s

Modified: llvm/trunk/test/MC/ELF/no-fixup.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/no-fixup.s?rev=176377&r1=176376&r2=176377&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/no-fixup.s (original)
+++ llvm/trunk/test/MC/ELF/no-fixup.s Fri Mar  1 14:54:00 2013
@@ -1,11 +1,11 @@
-// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t -stats 2>%t.out
-// RUN: FileCheck --input-file=%t.out %s
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t
+// RUN: llvm-objdump -r %t | FileCheck %s
 
-// Test that we create no fixups for this file since "a" and "b" are in the
-// same fragment.
+// Test that we create no fixups for this file since "a" and "b"
+// are in the same fragment. If b was in a different section, a
+// fixup causing a relocation would be generated in the object file.
 
-// CHECK:      assembler - Number of emitted object file bytes
-// CHECK-NEXT: assembler - Number of fragment layouts
+// CHECK-NOT: RELOCATION RECORDS
 
 a:
   nop





More information about the llvm-commits mailing list