[llvm-bugs] [Bug 32941] New: FileCheck failure for a C-based unit test case

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 5 12:55:13 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=32941

            Bug ID: 32941
           Summary: FileCheck failure for a C-based unit test case
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ys114321 at gmail.com
                CC: llvm-bugs at lists.llvm.org

I tried to write a C-based unit test case for BPF source debugging.
But it failed as follows.

[~/work/llvm/test/CodeGen/BPF] clang -O2 -target bpf -g -c debug_source.c &&
llvm-objdump -S debug_source.o                                                  

debug_source.o: file format ELF64-BPF

Disassembly of section .text:
test:
; int test(int *p) {
       0:       b7 02 00 00 02 00 00 00         r2 = 2
; *p = 2;
       1:       63 21 00 00 00 00 00 00         *(u32 *)(r1 + 0) = r2
; return 1;
       2:       b7 00 00 00 01 00 00 00         r0 = 1
       3:       95 00 00 00 00 00 00 00         exit
[~/work/llvm/test/CodeGen/BPF] ~/work/llvm/build/bin/llvm-lit -v debug_source.c
-- Testing: 1 tests, 1 threads --
FAIL: LLVM :: CodeGen/BPF/debug_source.c (1 of 1)
******************** TEST 'LLVM :: CodeGen/BPF/debug_source.c' FAILED
********************
Script:
--
clang -g -target bpfel -O2 -c -x c -o
/home/yhs/work/llvm/build/test/CodeGen/BPF/Output/debug_source.c.tmp - <
/home/yhs/work/llvm/test/CodeGen/BPF/debug_source.c
/home/yhs/work/llvm/build/./bin/llvm-objdump -S
/home/yhs/work/llvm/build/test/CodeGen/BPF/Output/debug_source.c.tmp |
/home/yhs/work/llvm/build/./bin/FileCheck /home/yhs/work/llvm
/test/CodeGen/BPF/debug_source.c
clang -g -target bpfeb -O2 -c -x c -o
/home/yhs/work/llvm/build/test/CodeGen/BPF/Output/debug_source.c.tmp - <
/home/yhs/work/llvm/test/CodeGen/BPF/debug_source.c
/home/yhs/work/llvm/build/./bin/llvm-objdump -S
/home/yhs/work/llvm/build/test/CodeGen/BPF/Output/debug_source.c.tmp |
/home/yhs/work/llvm/build/./bin/FileCheck /home/yhs/work/llvm
/test/CodeGen/BPF/debug_source.c
--
Exit Code: 1

Command Output (stderr):
--
/home/yhs/work/llvm/test/CodeGen/BPF/debug_source.c:6:11: error: expected
string not found in input
// CHECK: file format ELF64-BPF
          ^
<stdin>:2:1: note: scanning from here
/home/yhs/work/llvm/build/test/CodeGen/BPF/Output/debug_source.c.tmp: file
format ELF64-BPF
^
<stdin>:2:22: note: possible intended match here
/home/yhs/work/llvm/build/test/CodeGen/BPF/Output/debug_source.c.tmp: file
format ELF64-BPF
                     ^
/home/yhs/work/llvm/test/CodeGen/BPF/debug_source.c:8:11: error: expected
string not found in input
// CHECK: int test(int *p) {
          ^
<stdin>:2:31: note: scanning from here
/home/yhs/work/llvm/build/test/CodeGen/BPF/Output/debug_source.c.tmp: file
format ELF64-BPF
                              ^
<stdin>:4:11: note: possible intended match here
Disassembly of section .text:
          ^

--

********************
Testing Time: 0.12s
********************
Failing Tests (1):
    LLVM :: CodeGen/BPF/debug_source.c

  Unexpected Failures: 1
[~/work/llvm/test/CodeGen/BPF] cat debug_source.c
// RUN: clang -g -target bpfel -O2 -c -x c -o %t - < %s
// RUN: llvm-objdump -S %t | FileCheck %s
// RUN: clang -g -target bpfeb -O2 -c -x c -o %t - < %s
// RUN: llvm-objdump -S %t | FileCheck %s

// CHECK: file format ELF64-BPF
// CHECK-LABEL: test
// CHECK: int test(int *p) {
int test(int *p) {
// CHECK: *p = 2;
  *p = 2;
// CHECK: return 1;
  return 1;
}
[~/work/llvm/test/CodeGen/BPF]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170505/b72289df/attachment.html>


More information about the llvm-bugs mailing list