Instrument the error recovery testsuite with .store- and .compare- State.

Add a special lit substitution giving us the executed test folder, so that
before next run we could cleanup.
This commit is contained in:
Jerome Beclin 2013-08-21 12:36:48 +02:00 committed by sftnight
parent ead0f8d091
commit 162101dd9d
9 changed files with 75 additions and 18 deletions

View File

@ -1,4 +1,5 @@
// RUN: cat %s | %cling -Xclang -verify
// RUN: rm -f %testexecdir/ErrorRecovery/*.tmp
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
// Actually test clang::DeclContext::removeDecl(). This function in clang is
// the main method that is used for the error recovery. This means when there
@ -13,13 +14,17 @@
// The current test checks if that codepath in removeDecl still exists because
// it is important for the stable error recovery in cling
.storeState "testMyClass"
class MyClass {
struct {
int a;
error_here; // expected-error {{C++ requires a type specifier for all declarations}}
};
};
.compareState "testMyClass"
// CHECK-NOT: File with AST differencies stored in: testMyClassAST.diff
.storeState "testStructX"
struct X {
union {
float f3;
@ -50,5 +55,10 @@ struct X {
double c2;
};
};
.compareState "testStructX"
// CHECK-NOT: File with AST differencies stored in: testStructXAST.diff
// Make FileCheck happy with having at least one positive rule:
int a = 5
// CHECK: (int) 5
.q

View File

@ -1,5 +1,15 @@
// RUN: cat %s | %cling -I%p | FileCheck %s
// RUN: rm -f %testexecdir/ErrorRecovery/*.tmp
// RUN: cat %s | %cling -I%p 2>&1 | FileCheck %s
// XFAIL: *
.storeState "testCurrentFailures"
#include "Overloads.h"
error_here;
error_here;
.compareState "testCurrentFailures"
// CHECK-NOT: File with AST differencies stored in: testCurrentFailuresAST.diff
// Make FileCheck happy with having at least one positive rule:
int a = 5
// CHECK: (int) 5
.q

View File

@ -1,11 +1,19 @@
// RUN: cat %s | %cling -Xclang -verify -I%p
// RUN: rm -f %testexecdir/ErrorRecovery/*.tmp
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
#define BEGIN_NAMESPACE namespace test_namespace {
#define END_NAMESPACE }
.rawInput 1
.storeState "testMacroExpansion"
.rawInput 1
BEGIN_NAMESPACE int j; END_NAMESPACE
BEGIN_NAMESPACE int j; END_NAMESPACE // expected-error {{redefinition of 'j'}} expected-note {{previous definition is here}}
.rawInput 0
.compareState "testMacroExpansion"
// CHECK-NOT: File with AST differencies stored in: testMacroExpansionAST.diff
// Make FileCheck happy with having at least one positive rule:
int a = 5
// CHECK: (int) 5
.q

View File

@ -1,7 +1,11 @@
// RUN: cat %s | %cling -Xclang -verify -I%p 2>&1 | %FileCheck %s
// RUN: rm %testexecdir/ErrorRecovery/*.tmp
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
// XFAIL: *
// The main issue is that expected - error is not propagated to the source file and
// the expected diagnostics get misplaced.
.storeState "testMetaProcessor"
.x CannotDotX.h() // expected-error@2 {{use of undeclared identifier 'CannotDotX'}}
// CHECK: Error in cling::MetaProcessor: execute file failed.
.x CannotDotX.h()
@ -16,4 +20,6 @@
.L CannotDotX.h
// CHECK: Error in cling::MetaProcessor: load file failed.
.compareState "testMetaProcessor"
// CHECK-NOT: File with AST differencies stored in: testMetaProcessorAST.diff
.q

View File

@ -1,8 +1,12 @@
// RUN: cat %s | %cling -Xclang -verify -I%p | FileCheck %s
// RUN: rm -f %testexecdir/ErrorRecovery/*.tmp
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
// Tests the removal of nested decls
.storeState "testNestedDecls1"
struct Outer { struct Inner { enum E{i = 1}; }; };error_here; // expected-error {{error: use of undeclared identifier 'error_here'}}
.compareState "testNestedDecls1"
// CHECK-NOT: File with AST differencies stored in: testNestedDeclsAST1.diff
.rawInput
namespace Outer { struct Inner { enum E{i = 2}; }; };
@ -12,7 +16,11 @@ Outer::Inner::i
// CHECK: (Outer::Inner::E::i) : (int) 2
enum A{a}; //
.storeState "testNestedDecls2"
enum A{a}; // expected-error {{redefinition of 'A'}} expected-note {{previous definition is here}}
a // expected-error {{use of undeclared identifier 'a'}}
.compareState "testNestedDecls2"
// CHECK-NOT: File with AST differencies stored in: testNestedDeclsAST2.diff
.q

View File

@ -1,4 +1,5 @@
// RUN: cat %s | %cling -Xclang -verify -I%p | FileCheck %s
// RUN: rm -f %testexecdir/ErrorRecovery/*.tmp
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
// Test the removal of decls from the redeclaration chain, which are marked as
// redeclarables.
@ -8,7 +9,10 @@ extern int my_int;
int my_funct();
.rawInput 0
.storeState "testRedeclarables"
#include "Redeclarables.h"
.compareState "testRedeclarables"
// CHECK-NOT: File with AST differencies stored in: testRedeclarablesAST.diff
.rawInput 1
int my_funct() {

View File

@ -1,6 +1,7 @@
// RUN: cat %s | %cling -Xclang -verify -I%p | FileCheck %s
// Test the removal of decls which are stored in vector of redeclarables
// RUN: rm -f %testexecdir/ErrorRecovery/*.tmp
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
// Test the removal of decls which are stored in vector of redeclarables
.rawInput 1
extern int __my_i;
template<typename T> T TemplatedF(T t);
@ -10,18 +11,21 @@ double OverloadedF(double d){ return d + 10.11f; };
namespace test { int y = 0; }
.rawInput 0
.storeState "testSubsequentDecls"
#include "SubsequentDecls.h"
.compareState "testSubsequentDecls"
// CHECK-NOT: File with AST differencies stored in: testSubsequentDeclsAST.diff
.rawInput 1
template<> int TemplatedF(int i) { return i + 100; }
int OverloadedF(int i) { return i + 100;}
.rawInput 0
int __my_i = 10
// CHECK: (int) 10
OverloadedF(__my_i)
int __my_i = 10
// CHECK: (int) 10
OverloadedF(__my_i)
// CHECK: (int) 110
TemplatedF(__my_i)
TemplatedF(__my_i)
// CHECK: (int) 110
.q

View File

@ -1,10 +1,13 @@
// RUN: cat %s | %cling -Xclang -verify -I%p | FileCheck %s
// RUN: rm -f %testexecdir/ErrorRecovery/*.tmp
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
// XFAIL: *
// Test the ability of including a wrong file see diagnostics and remove the
// cached files so that all the changes are going to be seen next time it gets
// included.
.storeState "testUncacheFile"
#include <iostream>
#include <fstream>
@ -37,3 +40,6 @@ MyClass my;
my.gimme12()
// CHECK: (int const) 12
.compareState "testUncacheFile"
// CHECK-NOT: File with AST differencies stored in: testUncacheFileAST.diff
.q

View File

@ -144,6 +144,7 @@ site_exp = {}
## site_exp[sub].replace('-fno-exceptions', '')))
## else:
## config.substitutions.append(('%' + sub, site_exp[sub]))
config.substitutions.append(('%testexecdir', config.test_exec_root))
config.substitutions.append(('%shlibext', config.shlibext))
# For each occurrence of an llvm tool name as its own word, replace it