From f8bc1e4b277dc85a89f93738d7de4d324a093fb4 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Tue, 15 Dec 2009 07:21:14 +0000 Subject: [PATCH] Convert llvmc tests to FileCheck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91420 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/LLVMC/AppendCmdHook.td | 2 +- test/LLVMC/ExternOptions.td | 4 +++- test/LLVMC/ForwardAs.td | 3 ++- test/LLVMC/ForwardTransformedValue.td | 8 ++++++-- test/LLVMC/ForwardValue.td | 5 +++-- test/LLVMC/HookWithArguments.td | 10 ++++++---- test/LLVMC/HookWithInFile.td | 3 ++- test/LLVMC/Init.td | 5 +++-- test/LLVMC/MultiValuedOption.td | 3 ++- test/LLVMC/NoActions.td | 3 ++- test/LLVMC/OneOrMore.td | 5 +++-- test/LLVMC/OptionPreprocessor.td | 12 +++++++----- test/LLVMC/OutputSuffixHook.td | 2 +- utils/TableGen/LLVMCConfigurationEmitter.cpp | 2 +- 14 files changed, 42 insertions(+), 25 deletions(-) diff --git a/test/LLVMC/AppendCmdHook.td b/test/LLVMC/AppendCmdHook.td index 888d6869999..4a9d39121a4 100644 --- a/test/LLVMC/AppendCmdHook.td +++ b/test/LLVMC/AppendCmdHook.td @@ -1,6 +1,6 @@ // Check that hooks can be invoked from 'append_cmd'. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: FileCheck -input-file=%t %s +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" diff --git a/test/LLVMC/ExternOptions.td b/test/LLVMC/ExternOptions.td index 4694b106e2b..a05f2ca15b6 100644 --- a/test/LLVMC/ExternOptions.td +++ b/test/LLVMC/ExternOptions.td @@ -1,11 +1,13 @@ // Check that extern options work. // The dummy tool and graph are required to silence warnings. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep {extern .* AutoGeneratedSwitch_Wall} %t +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" +// CHECK: extern cl::opt AutoGeneratedSwitch_Wall + def OptList : OptionList<[(switch_option "Wall", (extern)), (parameter_option "std", (extern)), (prefix_list_option "L", (extern))]>; diff --git a/test/LLVMC/ForwardAs.td b/test/LLVMC/ForwardAs.td index 54fc050a981..ce6fbb06ef5 100644 --- a/test/LLVMC/ForwardAs.td +++ b/test/LLVMC/ForwardAs.td @@ -1,7 +1,7 @@ // Check the fix for PR4159. // http://llvm.org/bugs/show_bug.cgi?id=4159 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep unique_name %t +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" @@ -13,6 +13,7 @@ def dummy_tool : Tool<[ (in_language "dummy"), (out_language "dummy"), (actions (case + // CHECK: vec.push_back("unique_name") (not_empty "dummy"), (forward_as "dummy", "unique_name"))) ]>; diff --git a/test/LLVMC/ForwardTransformedValue.td b/test/LLVMC/ForwardTransformedValue.td index 0cda1bf1a5b..e26345362c0 100644 --- a/test/LLVMC/ForwardTransformedValue.td +++ b/test/LLVMC/ForwardTransformedValue.td @@ -1,8 +1,7 @@ // Check that forward_transformed_value works. // The dummy tool and graph are required to silence warnings. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep HookA %t | count 2 -// RUN: grep HookB %t | count 2 +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" @@ -10,12 +9,17 @@ include "llvm/CompilerDriver/Common.td" def OptList : OptionList<[(parameter_option "a", (extern)), (prefix_list_option "b", (extern))]>; +// CHECK: std::string HookA +// CHECK: std::string HookB + def dummy_tool : Tool<[ (cmd_line "dummy_cmd $INFILE"), (in_language "dummy"), (out_language "dummy"), (actions (case + // CHECK: HookA(AutoGeneratedParameter_a (not_empty "a"), (forward_transformed_value "a", "HookA"), + // CHECK: HookB(AutoGeneratedList_b (not_empty "b"), (forward_transformed_value "b", "HookB"))) ]>; diff --git a/test/LLVMC/ForwardValue.td b/test/LLVMC/ForwardValue.td index 29f61a4c0cf..31e395e6d0b 100644 --- a/test/LLVMC/ForwardValue.td +++ b/test/LLVMC/ForwardValue.td @@ -1,8 +1,7 @@ // Check that forward_value works. // The dummy tool and graph are required to silence warnings. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep {vec.push_back\(AutoGeneratedParameter_a\)} %t -// RUN: grep {std::copy\(AutoGeneratedList_b.begin\(\)} %t +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" @@ -15,7 +14,9 @@ def dummy_tool : Tool<[ (in_language "dummy"), (out_language "dummy"), (actions (case + // CHECK: vec.push_back(AutoGeneratedParameter_a) (not_empty "a"), (forward_value "a"), + // CHECK: std::copy(AutoGeneratedList_b.begin() (not_empty "b"), (forward_value "b"))) ]>; diff --git a/test/LLVMC/HookWithArguments.td b/test/LLVMC/HookWithArguments.td index 909dc8bf9b4..ba0bbe10d37 100644 --- a/test/LLVMC/HookWithArguments.td +++ b/test/LLVMC/HookWithArguments.td @@ -1,13 +1,15 @@ // Check that hooks with arguments work. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep {Hook(const char\\* Arg0, const char\\* Arg1, const char\\* Arg2);} %t | count 1 -// RUN: grep "/path" %t | count 1 -// RUN: grep "VARIABLE" %t | count 1 -// RUN: grep "/2path" %t | count 1 +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" +// CHECK: Hook(const char* Arg0, const char* Arg1, const char* Arg2); +// CHECK: std::getenv("VARIABLE") +// CHECK: "/2path" +// CHECK: "/path" + def dummy_tool : Tool<[ (cmd_line "$CALL(Hook, 'Arg1', 'Arg2', 'Arg3 Arg3Cont')/path arg1 $ENV(VARIABLE)/2path arg2 $INFILE"), (in_language "dummy"), diff --git a/test/LLVMC/HookWithInFile.td b/test/LLVMC/HookWithInFile.td index 7fb3df1c9a6..e15e43cdf04 100644 --- a/test/LLVMC/HookWithInFile.td +++ b/test/LLVMC/HookWithInFile.td @@ -1,11 +1,12 @@ // Check that a hook can be given $INFILE as an argument. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep Hook\\(inFile.c_str\\(\\)\\) %t | count 1 +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" def dummy_tool : Tool<[ +// CHECK: Hook(inFile.c_str()) (cmd_line "$CALL(Hook, '$INFILE')/path $INFILE"), (in_language "dummy"), (out_language "dummy") diff --git a/test/LLVMC/Init.td b/test/LLVMC/Init.td index 3d68d050ee9..355d83ff95a 100644 --- a/test/LLVMC/Init.td +++ b/test/LLVMC/Init.td @@ -1,13 +1,14 @@ // Check that (init true/false) and (init "str") work. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep cl::init(\\"some-string\\") %t | count 1 -// RUN: grep cl::init(true) %t | count 1 +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" def OptList : OptionList<[ +// CHECK: cl::init(true) (switch_option "dummy1", (help "none"), (init true)), +// CHECK: cl::init("some-string") (parameter_option "dummy2", (help "none"), (init "some-string")) ]>; diff --git a/test/LLVMC/MultiValuedOption.td b/test/LLVMC/MultiValuedOption.td index 108eb86dbeb..8cb18782700 100644 --- a/test/LLVMC/MultiValuedOption.td +++ b/test/LLVMC/MultiValuedOption.td @@ -1,12 +1,13 @@ // Check that multivalued options work. // The dummy tool and graph are required to silence warnings. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep cl::multi_val(2) %t | count 1 +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" def OptList : OptionList<[ + // CHECK: cl::multi_val(2) (prefix_list_option "foo", (multi_val 2)), (parameter_list_option "baz", (multi_val 2), (extern))]>; diff --git a/test/LLVMC/NoActions.td b/test/LLVMC/NoActions.td index 7b8e721397a..9c2d45a810f 100644 --- a/test/LLVMC/NoActions.td +++ b/test/LLVMC/NoActions.td @@ -1,10 +1,11 @@ // Check that tools without associated actions are accepted. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep dummy_tool %t +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" +// CHECK: class dummy_tool : public Tool { def dummy_tool : Tool<[ (cmd_line "dummy_cmd $INFILE"), (in_language "dummy"), diff --git a/test/LLVMC/OneOrMore.td b/test/LLVMC/OneOrMore.td index 08be7cfe8a7..ddf7cd1143a 100644 --- a/test/LLVMC/OneOrMore.td +++ b/test/LLVMC/OneOrMore.td @@ -1,14 +1,15 @@ // Check that (one_or_more) and (zero_or_one) properties work. // The dummy tool and graph are required to silence warnings. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep cl::Optional %t | count 1 -// RUN: grep cl::OneOrMore %t | count 1 +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" def OptList : OptionList<[ + // CHECK: cl::OneOrMore (prefix_list_option "foo", (one_or_more)), + // CHECK: cl::Optional (parameter_list_option "baz", (optional))]>; def dummy_tool : Tool<[ diff --git a/test/LLVMC/OptionPreprocessor.td b/test/LLVMC/OptionPreprocessor.td index 2f5e68bfe51..5661db865d7 100644 --- a/test/LLVMC/OptionPreprocessor.td +++ b/test/LLVMC/OptionPreprocessor.td @@ -1,8 +1,6 @@ // Test for the OptionPreprocessor and any*. -// RUN: ignore tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: grep W1 %t -// RUN: grep W2 %t -// RUN: grep W3 %t +// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t include "llvm/CompilerDriver/Common.td" @@ -17,10 +15,14 @@ def OptList : OptionList<[ ]>; def Preprocess : OptionPreprocessor< -(case (and (switch_on "foo"), (any_switch_on ["bar", "baz"])), +(case + // CHECK: W1 + (and (switch_on "foo"), (any_switch_on ["bar", "baz"])), (warning "W1"), + // CHECK: W2 (and (switch_on ["foo", "bar"]), (any_empty ["foo_p", "bar_p"])), (warning "W2"), + // CHECK: W3 (and (empty ["foo_p", "bar_p"]), (any_not_empty ["baz_p"])), (warning "W3")) >; diff --git a/test/LLVMC/OutputSuffixHook.td b/test/LLVMC/OutputSuffixHook.td index d1f9999b15c..4ecad2360ba 100644 --- a/test/LLVMC/OutputSuffixHook.td +++ b/test/LLVMC/OutputSuffixHook.td @@ -1,6 +1,6 @@ // Check that hooks can be invoked from 'output_suffix'. // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t -// RUN: FileCheck -input-file=%t %s +// RUN: FileCheck -input-file %t %s // RUN: %compile_cxx -fexceptions -x c++ %t // XFAIL: * diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp index 6217f5c1d34..5be9ab71ef1 100644 --- a/utils/TableGen/LLVMCConfigurationEmitter.cpp +++ b/utils/TableGen/LLVMCConfigurationEmitter.cpp @@ -2169,7 +2169,7 @@ void EmitToolClassDefinition (const ToolDescription& D, else O << "Tool"; - O << "{\nprivate:\n"; + O << " {\nprivate:\n"; O.indent(Indent1) << "static const char* InputLanguages_[];\n\n"; O << "public:\n"; -- 2.34.1