[clang] [llvm] [Utils] add --update-tests flag to llvm-lit (PR #97369)

Henrik G. Olsson via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 10 13:48:12 PDT 2024


================
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -verify %s
+// RUN: diff %s %s.expected
----------------
hnrklssn wrote:

The files in the `Inputs` directory are not discovered by lit, so this doesn't actually run the RUN lines. Instead a copy is made, and a new lit instance is launched to test the run lines.

This is in `duplicate-diag.test`, the RUN lines of `duplicate-diag.c` are not executed at all for this case because it tests the `update-verify-tests.py` script:
```
# RUN: cp %S/Inputs/duplicate-diag.c %t.c && not %clang_cc1 -verify %t.c 2>&1 | %update-verify-tests
# RUN: diff -u %S/Inputs/duplicate-diag.c.expected %t.c
# RUN: %clang_cc1 -verify %t.c
```

This is in `lit-plugin.test`, which copies the files to a separate directory and launches llvm-lit there to test the lit integration:
```
# RUN: cp %S/Inputs/*.c %S/LitTests
# RUN: cp %S/Inputs/*.c.expected %S/LitTests
# RUN: not %{lit} %S/LitTests
# RUN: not %{lit} %S/LitTests --update-tests
# RUN: %{lit} %S/LitTests
```

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


More information about the cfe-commits mailing list