[clang-tools-extra] [clang-doc] Add basic e2e test (PR #93928)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 7 11:10:00 PDT 2024


================
@@ -0,0 +1,361 @@
+// RUN: rm -rf %t && mkdir -p %t/build %t/include %t/src %t/docs
+// RUN: sed 's|$test_dir|%/t|g' %S/Inputs/clang-doc-project1/database_template.json > %t/build/compile_commands.json
+// RUN: cp %S/Inputs/clang-doc-project1/*.h  %t/include
+// RUN: cp %S/Inputs/clang-doc-project1/*.cpp %t/src
+// RUN: cd %t
+// RUN: clang-doc --format=html --executor=all-TUs --asset=%S/Inputs ./build/compile_commands.json
----------------
ilovepi wrote:

I'm still not convinced you need to `cp` almost anything. If the "project" folder in inputs is laid out correctly (modulo the output location for documentation) then I think you'll be good w/o the need to copy any files. The `compile_commands.json` can be used in place if a relative path works for the "directory" key. If that doesn't work, you'll likely still have to copy the `compile_commands.json` file, but you can just replace the `test_dir` w/  the expansion of `%S/Inputs` using `sed` and won't have to `cd` at all if you use the  `--output=` option and point it at `%t`.

Does that make sense? I'm trying to limit the amount of complexity in the test setup, because I don't see the copy steps as necessary or valuable. To me, it seems like if the `Inputs/basic-project` files and directories are set up the way you want them, then you don't really need to do much, other than use the right command line w/ `clang-doc`. This is typically how we want to set up tests, whenever possible.

https://github.com/llvm/llvm-project/pull/93928


More information about the cfe-commits mailing list