; RUN: %ProtectFileCheckOutput FileCheck -dump-input=help \
; RUN: | FileCheck %s -check-prefix=HELP
-HELP-NOT: {{.}}
-HELP: The following description was requested by -dump-input=help
-HELP: try{{.*}}-color
-HELP-NOT: {{.}}
-
;--------------------------------------------------
; Check -dump-input=never.
;
; Include the case without -v, which isn't covered elsewhere.
;--------------------------------------------------
+; FileCheck success, no -v => no dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=never 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
+; FileCheck fail, no -v => no dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=never 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,NODUMP
+; FileCheck success, -v => no dump, trace.
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=never -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,NODUMP
+; FileCheck fail, -v => no dump, trace.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=never -v 2>&1 \
; Check no -dump-input, which defaults to never.
;--------------------------------------------------
+; FileCheck success, -v => no dump, trace.
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,NODUMP
+; FileCheck fail, -v => no dump, trace.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -v 2>&1 \
; Include the case without -v, which isn't covered elsewhere.
;--------------------------------------------------
+; FileCheck success, no -v => no dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=fail 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
+; FileCheck fail, no -v => dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=fail 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,DUMP-ERR
+; FileCheck success, -v => no dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
+; FileCheck fail, -v => dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
; Check -dump-input-on-failure.
;--------------------------------------------------
+; Command-line option.
+
+; FileCheck success, -v => no dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input-on-failure -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
+; FileCheck fail, -v => dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input-on-failure -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines \
; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
+; FILECHECK_DUMP_INPUT_ON_FAILURE=1.
+
+; FileCheck success, -v => no dump, no trace.
; RUN: %ProtectFileCheckOutput FILECHECK_DUMP_INPUT_ON_FAILURE=1 \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
+; FileCheck fail, -v => dump, no trace.
; RUN: %ProtectFileCheckOutput FILECHECK_DUMP_INPUT_ON_FAILURE=1 \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -v 2>&1 \
; Check -dump-input=always.
;--------------------------------------------------
+; FileCheck success, -v => dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=always -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
+; FileCheck fail, -v => dump, no trace.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=always -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines \
; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
+;--------------------------------------------------
+; Check multiple -dump-input options.
+;
+; This ocurrs most commonly when a test author specifies -dump-input on a
+; specific FileCheck call while a test runner specifies -dump-input in
+; FILECHECK_OPTS, but check the behavior generally.
+;
+; "help" has precedence, and then the most verbose value wins. The most
+; common combinations involve "fail" and "always", so test those the most.
+;--------------------------------------------------
+
+;- - - - - - - - - - - - - - - - - - - - - - - - -
+; Check duplicate.
+;- - - - - - - - - - - - - - - - - - - - - - - - -
+
+; fail, fail => fail (FileCheck fail => dump)
+; RUN: %ProtectFileCheckOutput \
+; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
+; RUN: -match-full-lines -dump-input=fail -dump-input=fail -v \
+; RUN: 2>&1 \
+; RUN: | FileCheck %s -match-full-lines \
+; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
+
+;- - - - - - - - - - - - - - - - - - - - - - - - -
+; Check precedence.
+;- - - - - - - - - - - - - - - - - - - - - - - - -
+
+; help, always => help
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -input-file %t.err -color %t.check \
+; RUN: -dump-input=help -dump-input=always \
+; RUN: | FileCheck %s -check-prefix=HELP
+
+; always, fail => always (FileCheck success => dump)
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
+; RUN: -match-full-lines -dump-input=always -dump-input=fail \
+; RUN: -v 2>&1 \
+; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
+
+; fail, never => fail (FileCheck fail => dump)
+; RUN: %ProtectFileCheckOutput \
+; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
+; RUN: -match-full-lines -dump-input=fail -dump-input=never -v \
+; RUN: 2>&1 \
+; RUN: | FileCheck %s -match-full-lines \
+; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
+
+;- - - - - - - - - - - - - - - - - - - - - - - - -
+; Check that order doesn't matter.
+;- - - - - - - - - - - - - - - - - - - - - - - - -
+
+; fail, always => always (FileCheck success => dump)
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
+; RUN: -match-full-lines -dump-input=fail -dump-input=always \
+; RUN: -v 2>&1 \
+; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
+
+;- - - - - - - - - - - - - - - - - - - - - - - - -
+; Check that FILECHECK_OPTS isn't handled differently.
+;- - - - - - - - - - - - - - - - - - - - - - - - -
+
+; always, fail => always (FileCheck success => dump)
+; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input=always \
+; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
+; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
+; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
+
+; fail, always => always (FileCheck success => dump)
+; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input=fail \
+; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
+; RUN: -match-full-lines -dump-input=always -v 2>&1 \
+; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
+
; END.
;--------------------------------------------------
-; Check the output for all cases that actually process directives.
+; Check the output.
;--------------------------------------------------
+; HELP-NOT: {{.}}
+; HELP: The following description was requested by -dump-input=help
+; HELP: try{{.*}}-color
+; HELP-NOT: {{.}}
+
; Trace is sometimes suppressed.
; TRACE: {{.*}}remark:{{.*}}
; NOTRACE-NOT: remark: