[llvm] r360289 - [FileCheck, NFC] Split defines.txt in two

Thomas Preud'homme via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 14:47:36 PDT 2019


Author: thopre
Date: Wed May  8 14:47:36 2019
New Revision: 360289

URL: http://llvm.org/viewvc/llvm-project?rev=360289&view=rev
Log:
[FileCheck, NFC] Split defines.txt in two

Summary:
Split defines.txt into diagnostics test and functionality test. Also add
comments, remove the semicolon prefix and group RUN lines with their
CHECK directives.

Reviewers: jhenderson, probinson, arichardson

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D61679

Added:
    llvm/trunk/test/FileCheck/pattern-defines-diagnostics.txt
    llvm/trunk/test/FileCheck/pattern-defines.txt
Removed:
    llvm/trunk/test/FileCheck/defines.txt

Removed: llvm/trunk/test/FileCheck/defines.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FileCheck/defines.txt?rev=360288&view=auto
==============================================================================
--- llvm/trunk/test/FileCheck/defines.txt (original)
+++ llvm/trunk/test/FileCheck/defines.txt (removed)
@@ -1,48 +0,0 @@
-; RUN: FileCheck -DVALUE=10 -input-file %s %s
-; RUN: not FileCheck -DVALUE=20 -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRMSG
-; RUN: not FileCheck -DVALUE=10 -check-prefix NOT -input-file %s %s 2>&1 | FileCheck %s -check-prefix NOT-ERRMSG
-; RUN: FileCheck -DVALUE=20 -check-prefix NOT -input-file %s %s
-; RUN: not FileCheck -DVALUE10 -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIEQ1
-; RUN: not FileCheck -D -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIEQ2
-; RUN: not FileCheck -D=10 -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIVAR1
-; RUN: not FileCheck -D= -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIVAR2
-; RUN: FileCheck -DVALUE= -check-prefix EMPTY -input-file %s %s 2>&1
-
-; RUN: not FileCheck -D10VALUE=10 -input-file %s %s 2>&1 | FileCheck %s --strict-whitespace -check-prefix ERRCLIFMT
-; RUN: not FileCheck -D at VALUE=10 -input-file %s %s 2>&1 | FileCheck %s --strict-whitespace -check-prefix ERRCLIPSEUDO
-; RUN: not FileCheck -D'VALUE + 2=10' -input-file %s %s 2>&1 | FileCheck %s --strict-whitespace -check-prefix ERRCLITRAIL
-Value = 10
-; CHECK: Value = [[VALUE]]
-; NOT-NOT: Value = [[VALUE]]
-
-; ERRMSG: defines.txt:[[@LINE-3]]:10: error: CHECK: expected string not found in input
-; ERRMSG: defines.txt:1:1: note: scanning from here
-; ERRMSG: defines.txt:1:1: note: with variable "VALUE" equal to "20"
-; ERRMSG: defines.txt:[[@LINE-7]]:1: note: possible intended match here
-
-; NOT-ERRMSG: defines.txt:[[@LINE-7]]:12: error: {{NOT}}-NOT: excluded string found in input
-; NOT-ERRMSG: defines.txt:[[@LINE-10]]:1: note: found here
-; NOT-ERRMSG: defines.txt:[[@LINE-11]]:1: note: with variable "VALUE" equal to "10"
-
-; ERRCLIEQ1: Missing equal sign in command-line definition '-DVALUE10'
-
-; ERRCLIEQ2: {{F|f}}ile{{C|c}}heck{{[^:]*}}: for the -D option: requires a value!
-
-; ERRCLIVAR1: Missing pattern variable name in command-line definition '-D=10'
-
-; ERRCLIVAR2: Missing pattern variable name in command-line definition '-D='
-
-Empty value = @@
-; EMPTY: Empty value = @[[VALUE]]@
-
-; ERRCLIFMT: Global defines:1:19: error: invalid name for variable definition '10VALUE'
-; ERRCLIFMT-NEXT: Global define #1: 10VALUE=10
-; ERRCLIFMT-NEXT: {{^                  \^$}}
-
-; ERRCLIPSEUDO: Global defines:1:19: error: invalid name for variable definition '@VALUE'
-; ERRCLIPSEUDO-NEXT: Global define #1: @VALUE=10
-; ERRCLIPSEUDO-NEXT: {{^                  \^$}}
-
-; ERRCLITRAIL: Global defines:1:19: error: invalid name for variable definition 'VALUE + 2'
-; ERRCLITRAIL-NEXT: Global define #1: VALUE + 2=10
-; ERRCLITRAIL-NEXT: {{^                  \^$}}

Added: llvm/trunk/test/FileCheck/pattern-defines-diagnostics.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FileCheck/pattern-defines-diagnostics.txt?rev=360289&view=auto
==============================================================================
--- llvm/trunk/test/FileCheck/pattern-defines-diagnostics.txt (added)
+++ llvm/trunk/test/FileCheck/pattern-defines-diagnostics.txt Wed May  8 14:47:36 2019
@@ -0,0 +1,49 @@
+; Test incorrect syntax for -D option is correctly diagnosed.
+
+; Missing equal sign.
+RUN: not FileCheck -DVALUE10 --input-file %s %s 2>&1 \
+RUN:   | FileCheck %s --check-prefix ERRCLIEQ1
+
+ERRCLIEQ1: Missing equal sign in command-line definition '-DVALUE10'
+
+; Missing definition expression (variable name, equal sign and value).
+RUN: not FileCheck -D --input-file %s %s 2>&1 \
+RUN:   | FileCheck %s --check-prefix ERRCLIEQ2
+
+ERRCLIEQ2: {{F|f}}ile{{C|c}}heck{{[^:]*}}: for the -D option: requires a value!
+
+; Missing variable name.
+RUN: not FileCheck -D=10 --input-file %s %s 2>&1 \
+RUN:   | FileCheck %s --check-prefix ERRCLIVAR1
+
+ERRCLIVAR1: Missing pattern variable name in command-line definition '-D=10'
+
+; Missing variable name.
+RUN: not FileCheck -D= --input-file %s %s 2>&1 \
+RUN:   | FileCheck %s --check-prefix ERRCLIVAR2
+
+ERRCLIVAR2: Missing pattern variable name in command-line definition '-D='
+
+; Invalid variable name: starts with a digit.
+RUN: not FileCheck -D10VALUE=10 --input-file %s %s 2>&1 \
+RUN:   | FileCheck %s --strict-whitespace --check-prefix ERRCLIFMT
+
+ERRCLIFMT: Global defines:1:19: error: invalid name for variable definition '10VALUE'
+ERRCLIFMT-NEXT: Global define #1: 10VALUE=10
+ERRCLIFMT-NEXT: {{^                  \^$}}
+
+; Invalid definition of pseudo variable.
+RUN: not FileCheck -D at VALUE=10 --input-file %s %s 2>&1 \
+RUN:   | FileCheck %s --strict-whitespace --check-prefix ERRCLIPSEUDO
+
+ERRCLIPSEUDO: Global defines:1:19: error: invalid name for variable definition '@VALUE'
+ERRCLIPSEUDO-NEXT: Global define #1: @VALUE=10
+ERRCLIPSEUDO-NEXT: {{^                  \^$}}
+
+; Invalid definition of an expression.
+RUN: not FileCheck -D'VALUE + 2=10' --input-file %s %s 2>&1 \
+RUN:   | FileCheck %s --strict-whitespace --check-prefix ERRCLITRAIL
+
+ERRCLITRAIL: Global defines:1:19: error: invalid name for variable definition 'VALUE + 2'
+ERRCLITRAIL-NEXT: Global define #1: VALUE + 2=10
+ERRCLITRAIL-NEXT: {{^                  \^$}}

Added: llvm/trunk/test/FileCheck/pattern-defines.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FileCheck/pattern-defines.txt?rev=360289&view=auto
==============================================================================
--- llvm/trunk/test/FileCheck/pattern-defines.txt (added)
+++ llvm/trunk/test/FileCheck/pattern-defines.txt Wed May  8 14:47:36 2019
@@ -0,0 +1,29 @@
+; Test functionality of -D option: pattern variables are defined to the right
+; value and CHECK directives using them match as expected given the value set.
+
+; Pattern variable correctly defined to a non-empty string.
+RUN: FileCheck -DVALUE=10 --input-file %s %s
+RUN: not FileCheck -DVALUE=20 --input-file %s %s 2>&1 \
+RUN:   | FileCheck %s --check-prefix ERRMSG
+RUN: not FileCheck -DVALUE=10 --check-prefix NOT --input-file %s %s 2>&1 \
+RUN:   | FileCheck %s --check-prefix NOT-ERRMSG
+RUN: FileCheck -DVALUE=20 --check-prefix NOT --input-file %s %s
+
+Value = 10
+CHECK: Value = [[VALUE]]
+NOT-NOT: Value = [[VALUE]]
+
+ERRMSG: defines.txt:[[@LINE-3]]:8: error: CHECK: expected string not found in input
+ERRMSG: defines.txt:1:1: note: scanning from here
+ERRMSG: defines.txt:1:1: note: with variable "VALUE" equal to "20"
+ERRMSG: defines.txt:[[@LINE-7]]:1: note: possible intended match here
+
+NOT-ERRMSG: defines.txt:[[@LINE-7]]:10: error: {{NOT}}-NOT: excluded string found in input
+NOT-ERRMSG: defines.txt:[[@LINE-10]]:1: note: found here
+NOT-ERRMSG: defines.txt:[[@LINE-11]]:1: note: with variable "VALUE" equal to "10"
+
+; Definition of pattern variable to an empty string.
+RUN: FileCheck -DVALUE= --check-prefix EMPTY --input-file %s %s 2>&1
+
+Empty value = @@
+EMPTY: Empty value = @[[VALUE]]@




More information about the llvm-commits mailing list