[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Wed May 28 23:20:05 PDT 2025


================
@@ -0,0 +1,4 @@
+// RUN: not clang-doc %S/Inputs/basic-project/src/Circle.cpp -output=/root/docs 2>&1 | FileCheck %s
----------------
ilovepi wrote:

Well, I had forgotten that `create_directories()` works differently than `create_directory()`,  in that its basically `mkdir -p`. 

However, in general, you cannot rely on `/root` failing. Imagine if this ran in a docker container which often runs as the root user. That operation would succeed.  Many of our bots in CI run this way.  Using `/dev/null` may work, since I think we may do some kind of remapping for that in the internal shell used on Windows. However, I don't recall precisely, and I seldom build on Windows. Failing that, we'd need to use %t and change permissions on it. I'd rather avoid trying to modify permission in a test  though.

Looking through the tree, https://github.com/llvm/llvm-project/blob/main/llvm/test/tools/llvm-ifs/fail-file-write.test and the windows test next to it may be the best examples to follow, if we have to use permission modifications in the test.

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


More information about the cfe-commits mailing list