From: Reid Spencer Date: Tue, 17 Jul 2007 06:20:38 +0000 (+0000) Subject: For PR1558: X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=cb5da4a8b63696acda016a829257e6c68d938324;p=oota-llvm.git For PR1558: Move tests that have C/C++ sources into the appropriate directory. This allows them to be selected for testing based on whether llvm-gcc is present or not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39963 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/C++Frontend/2006-11-06-StackTrace.cpp b/test/C++Frontend/2006-11-06-StackTrace.cpp new file mode 100644 index 00000000000..621a301eb28 --- /dev/null +++ b/test/C++Frontend/2006-11-06-StackTrace.cpp @@ -0,0 +1,36 @@ +// This is a regression test on debug info to make sure that we can get a +// meaningful stack trace from a C++ program. +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o %t.s -f +// RUN: as %t.s -o %t.o +// RUN: %link %t.o -o %t.exe +// RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in +// RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \ +// RUN: grep {#0 DeepStack::deepest.*(this=.*,.*x=33)} +// RUN: gdb -q -batch -n -x %t.in %t.exe | \ +// RUN: grep {#7 0x.* in main.*(argc=\[12\],.*argv=.*)} + +// Only works on ppc. Should generalize? +// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64|amd64 + +#include + +class DeepStack { + int seedVal; +public: + DeepStack(int seed) : seedVal(seed) {} + + int shallowest( int x ) { return shallower(x + 1); } + int shallower ( int x ) { return shallow(x + 2); } + int shallow ( int x ) { return deep(x + 3); } + int deep ( int x ) { return deeper(x + 4); } + int deeper ( int x ) { return deepest(x + 6); } + int deepest ( int x ) { return x + 7; } + + int runit() { return shallowest(seedVal); } +}; + +int main ( int argc, char** argv) { + + DeepStack DS9( (argc > 1 ? atoi(argv[1]) : 0) ); + return DS9.runit(); +} diff --git a/test/C++Frontend/2006-11-20-GlobalSymbols.cpp b/test/C++Frontend/2006-11-20-GlobalSymbols.cpp new file mode 100644 index 00000000000..fc896b330a4 --- /dev/null +++ b/test/C++Frontend/2006-11-20-GlobalSymbols.cpp @@ -0,0 +1,10 @@ +// PR1013 +// Check to make sure debug symbols use the correct name for globals and +// functions. Will not assemble if it fails to. +// RUN: %llvmgcc -O0 -g -c %s + +int foo __asm__("f\001oo"); + +int bar() { + return foo; +} diff --git a/test/C++Frontend/2006-11-30-NoCompileUnit.cpp b/test/C++Frontend/2006-11-30-NoCompileUnit.cpp new file mode 100644 index 00000000000..993ceb484c7 --- /dev/null +++ b/test/C++Frontend/2006-11-30-NoCompileUnit.cpp @@ -0,0 +1,58 @@ +// This is a regression test on debug info to make sure we don't hit a compile +// unit size issue with gdb. +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ +// RUN: llc --disable-fp-elim -o Output/NoCompileUnit.s -f +// RUN: as Output/NoCompileUnit.s -o Output/NoCompileUnit.o +// RUN: g++ Output/NoCompileUnit.o -o Output/NoCompileUnit.exe +// RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2 +// RUN: gdb -q -batch -n -x %t2 Output/NoCompileUnit.exe | \ +// RUN: tee Output/NoCompileUnit.out | not grep {"low == high"} +// XFAIL: alpha|ia64|arm + + +class MamaDebugTest { +private: + int N; + +protected: + MamaDebugTest(int n) : N(n) {} + + int getN() const { return N; } + +}; + +class BabyDebugTest : public MamaDebugTest { +private: + +public: + BabyDebugTest(int n) : MamaDebugTest(n) {} + + static int doh; + + int doit() { + int N = getN(); + int Table[N]; + + int sum = 0; + + for (int i = 0; i < N; ++i) { + int j = i; + Table[i] = j; + } + for (int i = 0; i < N; ++i) { + int j = Table[i]; + sum += j; + } + + return sum; + } + +}; + +int BabyDebugTest::doh; + + +int main(int argc, const char *argv[]) { + BabyDebugTest BDT(20); + return BDT.doit(); +} diff --git a/test/C++Frontend/2006-11-30-Pubnames.cpp b/test/C++Frontend/2006-11-30-Pubnames.cpp new file mode 100644 index 00000000000..698f30bc052 --- /dev/null +++ b/test/C++Frontend/2006-11-30-Pubnames.cpp @@ -0,0 +1,20 @@ +// This is a regression test on debug info to make sure that we can access +// qualified global names. +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ +// RUN: llc --disable-fp-elim -o %t.s -f +// RUN: as %t.s -o %t.o +// RUN: %link %t.o -o %t.exe +// RUN: echo {break main\nrun\np Pubnames::pubname} > %t.in +// RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | grep {\$1 = 10} +// XFAIL: alpha|ia64|arm + +struct Pubnames { + static int pubname; +}; + +int Pubnames::pubname = 10; + +int main (int argc, char** argv) { + Pubnames p; + return 0; +} diff --git a/test/C++Frontend/2007-01-02-UnboundedArray.cpp b/test/C++Frontend/2007-01-02-UnboundedArray.cpp new file mode 100644 index 00000000000..648d19be62b --- /dev/null +++ b/test/C++Frontend/2007-01-02-UnboundedArray.cpp @@ -0,0 +1,14 @@ +// Make sure unbounded arrays compile with debug information. +// +// RUN: %llvmgcc -O0 -c -g %s + +// PR1068 + +struct Object { + char buffer[]; +}; + +int main(int argc, char** argv) { + new Object; + return 0; +} diff --git a/test/CFrontend/BasicInstrs.c b/test/CFrontend/BasicInstrs.c new file mode 100644 index 00000000000..812b49db28d --- /dev/null +++ b/test/CFrontend/BasicInstrs.c @@ -0,0 +1,26 @@ +// This file can be used to see what a native C compiler is generating for a +// variety of interesting operations. +// +// RUN: %llvmgcc -S %s -o - | llvm-as | llc + +unsigned int udiv(unsigned int X, unsigned int Y) { + return X/Y; +} +int sdiv(int X, int Y) { + return X/Y; +} +unsigned int urem(unsigned int X, unsigned int Y) { + return X%Y; +} +int srem(int X, int Y) { + return X%Y; +} + +_Bool setlt(int X, int Y) { + return X < Y; +} + +_Bool setgt(int X, int Y) { + return X > Y; +} + diff --git a/test/CFrontend/funccall.c b/test/CFrontend/funccall.c new file mode 100644 index 00000000000..9735e347057 --- /dev/null +++ b/test/CFrontend/funccall.c @@ -0,0 +1,17 @@ + +static int q; + +void foo() { + int t = q; + q = t + 1; +} +int main() { + q = 0; + foo(); + q = q - 1; + + return q; +} + +// This is the source that corresponds to funccall.ll +// RUN: echo foo diff --git a/test/CodeGen/Generic/BasicInstrs.c b/test/CodeGen/Generic/BasicInstrs.c deleted file mode 100644 index 812b49db28d..00000000000 --- a/test/CodeGen/Generic/BasicInstrs.c +++ /dev/null @@ -1,26 +0,0 @@ -// This file can be used to see what a native C compiler is generating for a -// variety of interesting operations. -// -// RUN: %llvmgcc -S %s -o - | llvm-as | llc - -unsigned int udiv(unsigned int X, unsigned int Y) { - return X/Y; -} -int sdiv(int X, int Y) { - return X/Y; -} -unsigned int urem(unsigned int X, unsigned int Y) { - return X%Y; -} -int srem(int X, int Y) { - return X%Y; -} - -_Bool setlt(int X, int Y) { - return X < Y; -} - -_Bool setgt(int X, int Y) { - return X > Y; -} - diff --git a/test/DebugInfo/2006-11-06-StackTrace.cpp b/test/DebugInfo/2006-11-06-StackTrace.cpp deleted file mode 100644 index 621a301eb28..00000000000 --- a/test/DebugInfo/2006-11-06-StackTrace.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// This is a regression test on debug info to make sure that we can get a -// meaningful stack trace from a C++ program. -// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o %t.s -f -// RUN: as %t.s -o %t.o -// RUN: %link %t.o -o %t.exe -// RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in -// RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \ -// RUN: grep {#0 DeepStack::deepest.*(this=.*,.*x=33)} -// RUN: gdb -q -batch -n -x %t.in %t.exe | \ -// RUN: grep {#7 0x.* in main.*(argc=\[12\],.*argv=.*)} - -// Only works on ppc. Should generalize? -// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64|amd64 - -#include - -class DeepStack { - int seedVal; -public: - DeepStack(int seed) : seedVal(seed) {} - - int shallowest( int x ) { return shallower(x + 1); } - int shallower ( int x ) { return shallow(x + 2); } - int shallow ( int x ) { return deep(x + 3); } - int deep ( int x ) { return deeper(x + 4); } - int deeper ( int x ) { return deepest(x + 6); } - int deepest ( int x ) { return x + 7; } - - int runit() { return shallowest(seedVal); } -}; - -int main ( int argc, char** argv) { - - DeepStack DS9( (argc > 1 ? atoi(argv[1]) : 0) ); - return DS9.runit(); -} diff --git a/test/DebugInfo/2006-11-20-GlobalSymbols.cpp b/test/DebugInfo/2006-11-20-GlobalSymbols.cpp deleted file mode 100644 index fc896b330a4..00000000000 --- a/test/DebugInfo/2006-11-20-GlobalSymbols.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// PR1013 -// Check to make sure debug symbols use the correct name for globals and -// functions. Will not assemble if it fails to. -// RUN: %llvmgcc -O0 -g -c %s - -int foo __asm__("f\001oo"); - -int bar() { - return foo; -} diff --git a/test/DebugInfo/2006-11-30-NoCompileUnit.cpp b/test/DebugInfo/2006-11-30-NoCompileUnit.cpp deleted file mode 100644 index 993ceb484c7..00000000000 --- a/test/DebugInfo/2006-11-30-NoCompileUnit.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// This is a regression test on debug info to make sure we don't hit a compile -// unit size issue with gdb. -// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ -// RUN: llc --disable-fp-elim -o Output/NoCompileUnit.s -f -// RUN: as Output/NoCompileUnit.s -o Output/NoCompileUnit.o -// RUN: g++ Output/NoCompileUnit.o -o Output/NoCompileUnit.exe -// RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2 -// RUN: gdb -q -batch -n -x %t2 Output/NoCompileUnit.exe | \ -// RUN: tee Output/NoCompileUnit.out | not grep {"low == high"} -// XFAIL: alpha|ia64|arm - - -class MamaDebugTest { -private: - int N; - -protected: - MamaDebugTest(int n) : N(n) {} - - int getN() const { return N; } - -}; - -class BabyDebugTest : public MamaDebugTest { -private: - -public: - BabyDebugTest(int n) : MamaDebugTest(n) {} - - static int doh; - - int doit() { - int N = getN(); - int Table[N]; - - int sum = 0; - - for (int i = 0; i < N; ++i) { - int j = i; - Table[i] = j; - } - for (int i = 0; i < N; ++i) { - int j = Table[i]; - sum += j; - } - - return sum; - } - -}; - -int BabyDebugTest::doh; - - -int main(int argc, const char *argv[]) { - BabyDebugTest BDT(20); - return BDT.doit(); -} diff --git a/test/DebugInfo/2006-11-30-Pubnames.cpp b/test/DebugInfo/2006-11-30-Pubnames.cpp deleted file mode 100644 index 698f30bc052..00000000000 --- a/test/DebugInfo/2006-11-30-Pubnames.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// This is a regression test on debug info to make sure that we can access -// qualified global names. -// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ -// RUN: llc --disable-fp-elim -o %t.s -f -// RUN: as %t.s -o %t.o -// RUN: %link %t.o -o %t.exe -// RUN: echo {break main\nrun\np Pubnames::pubname} > %t.in -// RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | grep {\$1 = 10} -// XFAIL: alpha|ia64|arm - -struct Pubnames { - static int pubname; -}; - -int Pubnames::pubname = 10; - -int main (int argc, char** argv) { - Pubnames p; - return 0; -} diff --git a/test/DebugInfo/2007-01-02-UnboundedArray.cpp b/test/DebugInfo/2007-01-02-UnboundedArray.cpp deleted file mode 100644 index 648d19be62b..00000000000 --- a/test/DebugInfo/2007-01-02-UnboundedArray.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// Make sure unbounded arrays compile with debug information. -// -// RUN: %llvmgcc -O0 -c -g %s - -// PR1068 - -struct Object { - char buffer[]; -}; - -int main(int argc, char** argv) { - new Object; - return 0; -} diff --git a/test/DebugInfo/funccall.c b/test/DebugInfo/funccall.c deleted file mode 100644 index 9735e347057..00000000000 --- a/test/DebugInfo/funccall.c +++ /dev/null @@ -1,17 +0,0 @@ - -static int q; - -void foo() { - int t = q; - q = t + 1; -} -int main() { - q = 0; - foo(); - q = q - 1; - - return q; -} - -// This is the source that corresponds to funccall.ll -// RUN: echo foo