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

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 15:07:51 PDT 2024


================
@@ -69,8 +70,15 @@
 clang_tidy_headers = os.path.join(
     config.test_source_root, "clang-tidy", "checkers", "Inputs", "Headers"
 )
+
 config.substitutions.append(("%clang_tidy_headers", clang_tidy_headers))
 
+clang_doc_install = os.path.join(
+    os.path.dirname(shutil.which("clang-doc")), "..", "share", "clang"
+)
----------------
ilovepi wrote:

so the CMAKE_INSTALL_DATADIR variable is used when you build the install target w/ `ninja install` or equivalent. The install target isn't the build of clang/llvm or even clang-doc. Instead it copies the artifacts you want to install into their final location. Essentially, imagine if you wanted to install clang to`/usr/bin/`, and all its headers to `/usr/include/`, and all its libs to `/usr/lib/`. That's basically what the install step is for, and you can point the base install directory to be anywhere. For instance I have a `$HOME/clang-install/` folder that I install the toolchain into when I need to use it in production type situations. For daily development, I just run things out of my `build` folder. The build folder is also where tests run.

This may be hidden by your IDE, but esentialy, you point CMake at the project, and tell it to build everything in some folder, usually called `build`.  After CMake runs and sets up all the build files for a build system, like `ninja` or `make`,  you can build the project by using the right build command. For clang-doc, that would be something like `ninja clang-doc` or `ninja check-clang-extra-clang-doc` to run its tests. But that won't install anything, it just builds things in the `build` directory. To install you'd run `ninja install` and then only the things that were important to ship would be installed to the location you specified, or to `/usr/local/` on Linux if you didn't specify anything.

The default style sheet (and any other fixed resources) should be easy for you to either copy to the right place, or to pass into the `clang-doc` command line, since its path relative to the source directory is fixed. @petrhosek may know of some other mechanism to force an asset to be copied into the build directory, but I'm not sure that is required in this case.

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


More information about the cfe-commits mailing list