How do I write test cases for interactive commands?

Alexander Richardson arichardson at freebsd.org
Mon Apr 19 13:04:45 UTC 2021


On Sat, 17 Apr 2021 at 17:14, Enji Cooper <yaneurabeya at gmail.com> wrote:
>
>
> > On Apr 14, 2021, at 10:40 PM, Gleb Popov <arrowd at freebsd.org> wrote:
>
>>
> > Take a look at LLVM testing infrastructure and specifically the llvm-lit
> > tool.
>
> Does their test infrastructure leverage GoogleTest? If so, then the bulk majority of the work would just be integrating it into Kyua.
> Cheers,
> -Enji
>

If you are interested in writing tests for llvm/clang/lldb those
should be submitted upstream and not be part of the FreeBSD source
tree. Therefore, Kyua is almost certainly not the right solution.
https://www.llvm.org/docs/TestingGuide.html explains how to write
tests for LLVM, however, it is quite stale. I would suggest looking at
existing tests inside LLVM and adjusting those to match what you want
to test.

The FreeBSD src contrib/ import does not include the extensive LLVM
testsuite, so you could start by looking at
https://github.com/llvm/llvm-project/tree/main/clang/test for clang
and https://github.com/llvm/llvm-project/tree/main/lldb/test for LLDB.
I have never looked at the LLDB tests, but as far as I know there are
tests that use python to drive the interaction.

Alex


More information about the freebsd-hackers mailing list