================
@@ -0,0 +1,64 @@
+// Diagnostics for the -fdepscan-log-path driver flag during dependency
scanning:
+// an empty value is rejected, an inconsistent value across commands in one
scan
+// is rejected, and a consistent value is accepted (and aggregated).
+
+// UNSUPPORTED: system-windows
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: sed -e "s|DIR|%/t|g" %t/empty.json.template > %t/empty.json
+// RUN: sed -e "s|DIR|%/t|g" %t/inconsistent.json.template >
%t/inconsistent.json
+// RUN: sed -e "s|DIR|%/t|g" %t/consistent.json.template > %t/consistent.json
+
+// An explicitly empty value is rejected.
+// RUN: not clang-scan-deps -compilation-database %t/empty.json \
+// RUN: -format experimental-full -j 1 2>&1 | FileCheck %s
--check-prefix=EMPTY
+// EMPTY: error: '-fdepscan-log-path=' requires a non-empty file path
+
+// Different log paths across commands in one scan are rejected.
+// RUN: not clang-scan-deps -compilation-database %t/inconsistent.json \
+// RUN: -format experimental-full -j 1 2>&1 | FileCheck %s
--check-prefix=CONFLICT
+// CONFLICT: error: '-fdepscan-log-path' set inconsistently within a
dependency scan
+
+// The same log path across commands is fine; both are aggregated into one log.
+// RUN: clang-scan-deps -compilation-database %t/consistent.json \
+// RUN: -format experimental-full -j 1 -o %t/deps.json
+// RUN: FileCheck %s --check-prefix=OK --input-file %t/scan.log
+// OK: logging_start
+// OK: starting scanning command:{{.*}}tu.c
+// OK: starting scanning command:{{.*}}tu2.c
+// OK: logging_end
+
+// One command with a valid flag, the other does not have a flag in effect.
+// RUN: not clang-scan-deps -compilation-database %t/inconsistent.json \
----------------
cyndyishida wrote:
```suggestion
// RUN: not clang-scan-deps -compilation-database %t/inconsistent2.json \
```
https://github.com/llvm/llvm-project/pull/211966
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits