Page MenuHomePhabricator

[Reproducers] Add tests for functionality
ClosedPublic

Authored by JDevlieghere on Dec 12 2018, 3:44 PM.

Details

Summary

This patch adds test that check that functionality in lldb continues to work when replaying a reproducer.

Currently the patch checks that:

  • Entries in image list are identical.
  • That stepping behaves the same.
  • That the data formatters behave the same.

Diff Detail

Event Timeline

JDevlieghere created this revision.Dec 12 2018, 3:44 PM
aprantl added inline comments.Dec 12 2018, 4:07 PM
lit/Reproducer/Functionalities/Inputs/stepping.c
8 ↗(On Diff #177958)

Why does only this file have a header?

9 ↗(On Diff #177958)

If we don't need stdio then removing it will speed up compile time. You can still fwd-declare puts or printf.

lit/Reproducer/Functionalities/TestStepping.test
39 ↗(On Diff #177958)

perhaps copy the commands in here so it is easier to understand what is being checked for?

39 ↗(On Diff #177958)

You could even generate the input file using grep -v CHECK %s... ?

JDevlieghere marked an inline comment as done.

Address Adrian's feedback

JDevlieghere marked 4 inline comments as done.Dec 13 2018, 8:52 AM
JDevlieghere added inline comments.
lit/Reproducer/Functionalities/Inputs/stepping.c
8 ↗(On Diff #177958)

I initially copied the file from the dotest suite before modifying it :-)

aprantl requested changes to this revision.Mar 6 2019, 2:56 PM
aprantl added inline comments.
lit/Reproducer/Functionalities/Inputs/foo.cpp
3 ↗(On Diff #178075)

clang-format?

lit/Reproducer/Functionalities/TestImagineList.test
8 ↗(On Diff #178075)

You're not supposed to use %T since it;'s not unique. Instead do

# RUN: rm -rf %t && mkdir %t
# RUN: rm -rf %t/imagelist
17 ↗(On Diff #178075)

really? ;-)

This revision now requires changes to proceed.Mar 6 2019, 2:56 PM
aprantl added inline comments.Mar 6 2019, 2:56 PM
lit/Reproducer/Functionalities/TestDataFormatter.test
5 ↗(On Diff #178075)

same here

lit/Reproducer/Functionalities/TestStepping.test
10 ↗(On Diff #178075)

and here

JDevlieghere marked 8 inline comments as done.

Feedback Adrian

aprantl added inline comments.Mar 6 2019, 3:37 PM
lldb/lit/Reproducer/Functionalities/TestImagineList.test
9

There's still a %T

Remove spurious RUN command.

JDevlieghere marked an inline comment as done.Mar 6 2019, 4:06 PM
JDevlieghere added inline comments.
lit/Reproducer/Functionalities/TestImagineList.test
17 ↗(On Diff #178075)

🤔🤔🤔

aprantl accepted this revision.Mar 6 2019, 4:19 PM
aprantl added inline comments.
lldb/lit/Reproducer/Functionalities/TestDataFormatter.test
6

The -x c++ should be redundant with the .cpp extension.

This revision is now accepted and ready to land.Mar 6 2019, 4:19 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2019, 4:24 PM

There is also failing TestImagineList on my Fedora buildbot:

++ : 'RUN: at line 19'
++ cat /home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/lit/Reproducer/Functionalities/Output/TestImagineList.test.tmp.txt
++ /home/jkratoch/redhat/llvm-monorepo-clangassert/bin/FileCheck /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Functionalities/TestImagineList.test
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Functionalities/TestImagineList.test:24:10: error: CHECK: expected string not found in input
# CHECK: [ 1] [[ONE:.*]]
         ^
<stdin>:11:1: note: scanning from here
(lldb) reproducer generate
^
<stdin>:16:22: note: possible intended match here
(lldb) # LLDB init file for the LIT tests.
                     ^

The output is missing [ 1], unaware why it should be required and what is there probably on OSX:

CAPTURE
(lldb) command source -s 0 '/quad/home/jkratoch/redhat/llvm-monorepo/lldb/lit/lit-lldb-init'
Executing commands in '/quad/home/jkratoch/redhat/llvm-monorepo/lldb/lit/lit-lldb-init'.
(lldb) # LLDB init file for the LIT tests.
(lldb) settings set symbols.enable-external-lookup false
(lldb) settings set interpreter.echo-comment-commands false
(lldb) target create "/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/lit/Reproducer/Functionalities/Output/TestImagineList.test.tmp.out"
Current executable set to '/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/lit/Reproducer/Functionalities/Output/TestImagineList.test.tmp.out' (x86_64).
(lldb) image list
[  0] 39FC470D 0x0000000000400000 /home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/lit/Reproducer/Functionalities/Output/TestImagineList.test.tmp.out 
(lldb) reproducer generate
Reproducer written to '/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/lit/Reproducer/Functionalities/Output/TestImagineList.test.tmp.repro'
REPLAY
(lldb) command source -s 0 '/quad/home/jkratoch/redhat/llvm-monorepo/lldb/lit/lit-lldb-init'
Executing commands in '/quad/home/jkratoch/redhat/llvm-monorepo/lldb/lit/lit-lldb-init'.
(lldb) # LLDB init file for the LIT tests.
(lldb) settings set symbols.enable-external-lookup false
(lldb) settings set interpreter.echo-comment-commands false
(lldb) target create "/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/lit/Reproducer/Functionalities/Output/TestImagineList.test.tmp.out"
Current executable set to '/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/lit/Reproducer/Functionalities/Output/TestImagineList.test.tmp.out' (x86_64).
(lldb) image list
[  0] 39FC470D 0x0000000000400000 /home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/lit/Reproducer/Functionalities/Output/TestImagineList.test.tmp.out 
(lldb) reproducer generate