From 193733044666af86e295c1f9957dbd21caa5612b Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sun, 12 Jan 2014 18:38:02 +0000 Subject: Removed use of deprecated Tcl parser for tests. This allows llvm-lit from LLVM3.3 to actually run KLEE's testsuite. Things still seem to be broken though. --- test/lit.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/lit.cfg b/test/lit.cfg index 39aaa824..c2144d43 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -8,7 +8,7 @@ import os config.name = 'KLEE' # testFormat: The test format to use to interpret tests. -config.test_format = lit.formats.TclTest() +config.test_format = lit.formats.ShTest(execute_external=False) # suffixes: A list of file extensions to treat as test files, this is actually # set by on_clone(). -- cgit 1.4.1 From 9555ad14b188f66eff900df79840d8995af13ff2 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sun, 12 Jan 2014 19:00:08 +0000 Subject: Fixed Expr/Parser/ConstantFolding.pc test for llvm-lit (this probably breaks DejaGNU tests). The issue is that in Tcl the quote needs escaping but for llvm-lit we don't need to do this. We should move to using the LLVM FileCheck tool instead of grep! --- test/Expr/Parser/ConstantFolding.pc | 172 ++++++++++++++++++------------------ 1 file changed, 86 insertions(+), 86 deletions(-) (limited to 'test') diff --git a/test/Expr/Parser/ConstantFolding.pc b/test/Expr/Parser/ConstantFolding.pc index 2c8a4c52..a02920db 100644 --- a/test/Expr/Parser/ConstantFolding.pc +++ b/test/Expr/Parser/ConstantFolding.pc @@ -2,196 +2,196 @@ array a[64] : w32 -> w8 = symbolic -# RUN: grep -A 2 \"# Query 1$\" %t > %t2 -# RUN: grep \"(query .. false)\" %t2 +# RUN: grep -A 2 "# Query 1$" %t > %t2 +# RUN: grep "(query .. false)" %t2 (query [] (Not (Ult (w32 0) (w32 1)))) # Check -- 0 + X ==> X -# RUN: grep -A 2 \"# Query 2$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).)\" %t2 +# RUN: grep -A 2 "# Query 2$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a).)" %t2 (query [] false [(Add w8 0 (Read w8 0 a))]) -# RUN: grep -A 2 \"# Query 3$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).)\" %t2 +# RUN: grep -A 2 "# Query 3$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a).)" %t2 (query [] false [(Add w8 (Read w8 0 a) 0)]) # Check -- C_0 + (C_1 + X) ==> (C_0 + C_1) + X -# RUN: grep -A 2 \"# Query 4$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 30 (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 4$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 30 (Read w8 0 a)).)" %t2 (query [] false [(Add w8 10 (Add w8 20 (Read w8 0 a)))]) # Check -- C_0 + (X + C_1) ==> (C_0 + C_1) + X -# RUN: grep -A 2 \"# Query 5$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 30 (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 5$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 30 (Read w8 0 a)).)" %t2 (query [] false [(Add w8 10 (Add w8 (Read w8 0 a) 20))]) # Check -- C_0 + (C_1 - X) ==> (C_0 + C_1) - X -# RUN: grep -A 2 \"# Query 6$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 30 (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 6$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 30 (Read w8 0 a)).)" %t2 (query [] false [(Add w8 10 (Sub w8 20 (Read w8 0 a)))]) # Check -- C_0 + (X - C_1) ==> (C_0 - C_1) + X -# RUN: grep -A 2 \"# Query 7$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246 (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 7$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246 (Read w8 0 a)).)" %t2 (query [] false [(Add w8 10 (Sub w8 (Read w8 0 a) 20))]) # Check -- (X + Y) + Z ==> X + (Y + Z) -# RUN: grep -A 3 \"# Query 8$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 (Read w8 0 a)\" %t2 -# RUN: grep \"(Add w8 (Read w8 1 a) (Read w8 2 a)\" %t2 +# RUN: grep -A 3 "# Query 8$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 (Read w8 0 a)" %t2 +# RUN: grep "(Add w8 (Read w8 1 a) (Read w8 2 a)" %t2 (query [] false [(Add w8 (Add w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))]) # Check -- (X - Y) + Z ==> X + (Z - Y) -# RUN: grep -A 3 \"# Query 9$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 (Read w8 0 a)\" %t2 -# RUN: grep \"(Sub w8 (Read w8 2 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 9$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 (Read w8 0 a)" %t2 +# RUN: grep "(Sub w8 (Read w8 2 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Sub w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))]) # Check -- X + (C + Y) ==> C + (X + Y) -# RUN: grep -A 3 \"# Query 10$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10\" %t2 -# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 10$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10" %t2 +# RUN: grep "(Add w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Read w8 0 a) (Add w8 10 (Read w8 1 a)))]) # Check -- X + (Y + C) ==> C + (X + Y) -# RUN: grep -A 3 \"# Query 11$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10\" %t2 -# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 11$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10" %t2 +# RUN: grep "(Add w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Read w8 0 a) (Add w8 (Read w8 1 a) 10))]) # Check -- X + (C - Y) ==> C + (X - Y) -# RUN: grep -A 3 \"# Query 12$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10\" %t2 -# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 12$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10" %t2 +# RUN: grep "(Sub w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Read w8 0 a) (Sub w8 10 (Read w8 1 a)))]) # Check -- X + (Y - C) ==> -C + (X + Y) -# RUN: grep -A 3 \"# Query 13$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246\" %t2 -# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 13$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246" %t2 +# RUN: grep "(Add w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Read w8 0 a) (Sub w8 (Read w8 1 a) 10))]) # Check -- C_0 - (C_1 + X) ==> (C_0 - C1) - X -# RUN: grep -A 2 \"# Query 14$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 10 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 14$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 10 (Read w8 0 a))" %t2 (query [] false [(Sub w8 20 (Add w8 10 (Read w8 0 a)))]) # Check -- C_0 - (X + C_1) ==> (C_0 + C1) + X -# RUN: grep -A 2 \"# Query 15$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 10 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 15$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 10 (Read w8 0 a))" %t2 (query [] false [(Sub w8 20 (Add w8 (Read w8 0 a) 10))]) # Check -- C_0 - (C_1 - X) ==> (C_0 - C1) + X -# RUN: grep -A 2 \"# Query 16$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 16$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10 (Read w8 0 a))" %t2 (query [] false [(Sub w8 20 (Sub w8 10 (Read w8 0 a)))]) # Check -- C_0 - (X - C_1) ==> (C_0 + C1) - X -# RUN: grep -A 2 \"# Query 17$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 30 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 17$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 30 (Read w8 0 a))" %t2 (query [] false [(Sub w8 20 (Sub w8 (Read w8 0 a) 10))]) # Check -- (C_0 + X) - C_1 ==> (C_0 - C1) + X -# RUN: grep -A 2 \"# Query 18$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 18$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246 (Read w8 0 a))" %t2 (query [] false [(Sub w8 (Add w8 10 (Read w8 0 a)) 20)]) # Check -- (X + C_0) - C_1 ==> (C_0 - C1) + X -# RUN: grep -A 2 \"# Query 19$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 19$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246 (Read w8 0 a))" %t2 (query [] false [(Sub w8 (Add w8 (Read w8 0 a) 10) 20)]) # Check -- (C_0 - X) - C_1 ==> (C_0 - C1) - X -# RUN: grep -A 2 \"# Query 20$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 246 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 20$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 246 (Read w8 0 a))" %t2 (query [] false [(Sub w8 (Sub w8 10 (Read w8 0 a)) 20)]) # Check -- (X - C_0) - C_1 ==> -(C_0 + C1) + X -# RUN: grep -A 2 \"# Query 21$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 226 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 21$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 226 (Read w8 0 a))" %t2 (query [] false [(Sub w8 (Sub w8 (Read w8 0 a) 10) 20)]) # Check -- (X + Y) - Z ==> X + (Y - Z) -# RUN: grep -A 3 \"# Query 22$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 (Read w8 0 a)\" %t2 -# RUN: grep \"(Sub w8 (Read w8 1 a) (Read w8 2 a)\" %t2 +# RUN: grep -A 3 "# Query 22$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 (Read w8 0 a)" %t2 +# RUN: grep "(Sub w8 (Read w8 1 a) (Read w8 2 a)" %t2 (query [] false [(Sub w8 (Add w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))]) # Check -- (X - Y) - Z ==> X - (Y + Z) -# RUN: grep -A 3 \"# Query 23$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 (Read w8 0 a)\" %t2 -# RUN: grep \"(Add w8 (Read w8 1 a) (Read w8 2 a)\" %t2 +# RUN: grep -A 3 "# Query 23$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 (Read w8 0 a)" %t2 +# RUN: grep "(Add w8 (Read w8 1 a) (Read w8 2 a)" %t2 (query [] false [(Sub w8 (Sub w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))]) # Check -- X - (C + Y) ==> -C + (X - Y) -# RUN: grep -A 3 \"# Query 24$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246\" %t2 -# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 24$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246" %t2 +# RUN: grep "(Sub w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Sub w8 (Read w8 0 a) (Add w8 10 (Read w8 1 a)))]) # Check -- X - (Y + C) ==> -C + (X - Y) -# RUN: grep -A 3 \"# Query 25$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246\" %t2 -# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 25$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246" %t2 +# RUN: grep "(Sub w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Sub w8 (Read w8 0 a) (Add w8 (Read w8 1 a) 10))]) # Check -- X - (C - Y) ==> -C + (X + Y) -# RUN: grep -A 3 \"# Query 26$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246\" %t2 -# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 26$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246" %t2 +# RUN: grep "(Add w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Sub w8 (Read w8 0 a) (Sub w8 10 (Read w8 1 a)))]) # Check -- X - (Y - C) ==> C + (X - Y) -# RUN: grep -A 3 \"# Query 27$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10\" %t2 -# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 27$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10" %t2 +# RUN: grep "(Sub w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Sub w8 (Read w8 0 a) (Sub w8 (Read w8 1 a) 10))]) # Check -- X * 0 ==> 0 -# RUN: grep -A 2 \"# Query 28$\" %t > %t2 -# RUN: grep \"(query .. false .(w8 0).\" %t2 +# RUN: grep -A 2 "# Query 28$" %t > %t2 +# RUN: grep "(query .. false .(w8 0)." %t2 (query [] false [(Mul w8 0 (Read w8 0 a))]) # Check -- X * 1 ==> X -# RUN: grep -A 2 \"# Query 29$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).\" %t2 +# RUN: grep -A 2 "# Query 29$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a)." %t2 (query [] false [(Mul w8 1 (Read w8 0 a))]) # Check -- X & 0 ==> 0 -# RUN: grep -A 2 \"# Query 30$\" %t > %t2 -# RUN: grep \"(query .. false .(w8 0).\" %t2 +# RUN: grep -A 2 "# Query 30$" %t > %t2 +# RUN: grep "(query .. false .(w8 0)." %t2 (query [] false [(And w8 0 (Read w8 0 a))]) # Check -- X & 0b1...1 ==> X -# RUN: grep -A 2 \"# Query 31$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).\" %t2 +# RUN: grep -A 2 "# Query 31$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a)." %t2 (query [] false [(And w8 255 (Read w8 0 a))]) # Check -- X | 0 ==> X -# RUN: grep -A 2 \"# Query 32$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).\" %t2 +# RUN: grep -A 2 "# Query 32$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a)." %t2 (query [] false [(Or w8 0 (Read w8 0 a))]) # Check -- X | 0b1...1 ==> X -# RUN: grep -A 2 \"# Query 33$\" %t > %t2 -# RUN: grep \"(query .. false .(w8 255).\" %t2 +# RUN: grep -A 2 "# Query 33$" %t > %t2 +# RUN: grep "(query .. false .(w8 255)." %t2 (query [] false [(Or w8 255 (Read w8 0 a))]) # Check -- X ^ 0b1...1 ==> X -# RUN: grep -A 2 \"# Query 34$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).\" %t2 +# RUN: grep -A 2 "# Query 34$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a)." %t2 (query [] false [(Xor w8 0 (Read w8 0 a))]) # Check -- true == X ==> X -# RUN: grep -A 2 \"# Query 35$\" %t > %t2 -# RUN: grep \"(query .. false .(Eq 0 (Read w8 0 a)).\" %t2 +# RUN: grep -A 2 "# Query 35$" %t > %t2 +# RUN: grep "(query .. false .(Eq 0 (Read w8 0 a))." %t2 (query [] false [(Eq true (Eq 0 (Read w8 0 a)))]) # Check -- !!X ==> X -# RUN: grep -A 2 \"# Query 36$\" %t > %t2 -# RUN: grep \"(query .. false .(Eq 0 (Read w8 0 a)).\" %t2 +# RUN: grep -A 2 "# Query 36$" %t > %t2 +# RUN: grep "(query .. false .(Eq 0 (Read w8 0 a))." %t2 (query [] false [(Not (Not (Eq 0 (Read w8 0 a))))]) # Check -- !Const -# RUN: grep -A 2 \"# Query 37$\" %t > %t2 -# RUN: grep \"(query .. false .true.\" %t2 +# RUN: grep -A 2 "# Query 37$" %t > %t2 +# RUN: grep "(query .. false .true." %t2 (query [] false [(Eq (Not w32 0xdeadbeef) 0x21524110)]) -- cgit 1.4.1 From a24c8a8b57eb355f28ec2890847a33c77143a1ef Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sun, 12 Jan 2014 19:03:19 +0000 Subject: Fixed Expr/Parser/MultiByteReads.pc test. --- test/Expr/Parser/MultiByteReads.pc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/Expr/Parser/MultiByteReads.pc b/test/Expr/Parser/MultiByteReads.pc index ea2e7a5d..71f0288f 100644 --- a/test/Expr/Parser/MultiByteReads.pc +++ b/test/Expr/Parser/MultiByteReads.pc @@ -1,6 +1,6 @@ -# RUN: %kleaver -print-ast -pc-multibyte-reads=true %s >log -# RUN: grep -q "(ReadLSB w32 4 arr1)" log -# RUN: grep -q "(ReadMSB w32 2 arr2)" log +# RUN: %kleaver -print-ast -pc-multibyte-reads=true %s > %t.log +# RUN: grep -q "(ReadLSB w32 4 arr1)" %t.log +# RUN: grep -q "(ReadMSB w32 2 arr2)" %t.log array arr1[8] : w32 -> w8 = symbolic array arr2[8] : w32 -> w8 = symbolic -- cgit 1.4.1 From 32b0d6bac1a00afb948d64eb0e6390a31f7d8d92 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sun, 12 Jan 2014 19:05:27 +0000 Subject: Fixed Expr/Parser/Simplify.pc test for llvm-lit. Escaped quote issue. --- test/Expr/Parser/Simplify.pc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/Expr/Parser/Simplify.pc b/test/Expr/Parser/Simplify.pc index 1a853b16..6d817b6f 100644 --- a/test/Expr/Parser/Simplify.pc +++ b/test/Expr/Parser/Simplify.pc @@ -3,38 +3,38 @@ array a[64] : w32 -> w8 = symbolic # Check -- X u> Y ==> Y u< X -# RUN: grep -A 2 \"# Query 1\" %t > %t2 -# RUN: grep \"(query .. false .(Ult (Read w8 1 a) (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 1" %t > %t2 +# RUN: grep "(query .. false .(Ult (Read w8 1 a) (Read w8 0 a)).)" %t2 (query [] false [(Ugt (Read w8 0 a) (Read w8 1 a))]) # Check -- X u>= Y ==> Y u<= X -# RUN: grep -A 2 \"# Query 2\" %t > %t2 -# RUN: grep \"(query .. false .(Ule (Read w8 1 a) (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 2" %t > %t2 +# RUN: grep "(query .. false .(Ule (Read w8 1 a) (Read w8 0 a)).)" %t2 (query [] false [(Uge (Read w8 0 a) (Read w8 1 a))]) # Check -- X u> Y ==> Y u< X -# RUN: grep -A 2 \"# Query 3\" %t > %t2 -# RUN: grep \"(query .. false .(Slt (Read w8 1 a) (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 3" %t > %t2 +# RUN: grep "(query .. false .(Slt (Read w8 1 a) (Read w8 0 a)).)" %t2 (query [] false [(Sgt (Read w8 0 a) (Read w8 1 a))]) # Check -- X u>= Y ==> Y u<= X -# RUN: grep -A 2 \"# Query 4\" %t > %t2 -# RUN: grep \"(query .. false .(Sle (Read w8 1 a) (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 4" %t > %t2 +# RUN: grep "(query .. false .(Sle (Read w8 1 a) (Read w8 0 a)).)" %t2 (query [] false [(Sge (Read w8 0 a) (Read w8 1 a))]) # Check -- X != Y ==> !(X == Y) -# RUN: grep -A 2 \"# Query 5\" %t > %t2 -# RUN: grep \"(query .. false .(Not (Eq (Read w8 0 a) (Read w8 1 a))).)\" %t2 +# RUN: grep -A 2 "# Query 5" %t > %t2 +# RUN: grep "(query .. false .(Not (Eq (Read w8 0 a) (Read w8 1 a))).)" %t2 (query [] false [(Ne (Read w8 0 a) (Read w8 1 a))]) # Check -- !(X or Y) ==> !X and !Y -# RUN: grep -A 3 \"# Query 6$\" %t > %t2 -# RUN: grep \"(query .. false .(And (Not (Eq 0 (Read w8 0 a)))\" %t2 -# RUN: grep \"(Not (Eq 1 (Read w8 1 a))))\" %t2 +# RUN: grep -A 3 "# Query 6$" %t > %t2 +# RUN: grep "(query .. false .(And (Not (Eq 0 (Read w8 0 a)))" %t2 +# RUN: grep "(Not (Eq 1 (Read w8 1 a))))" %t2 (query [] false [(Not (Or (Eq 0 (Read w8 0 a)) (Eq 1 (Read w8 1 a))))]) # Check -- false == X ==> !X -# RUN: grep -A 2 \"# Query 7\" %t > %t2 -# RUN: grep \"(query .. false .(Not (Extract 1 (Read w8 0 a))).)\" %t2 +# RUN: grep -A 2 "# Query 7" %t > %t2 +# RUN: grep "(query .. false .(Not (Extract 1 (Read w8 0 a))).)" %t2 (query [] false [(Eq (Extract w1 1 (Read w8 0 a)) false)]) -- cgit 1.4.1 From 2cfdfe0ddc88c8ec9619c37fd207778dcf2824e2 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sun, 12 Jan 2014 19:47:12 +0000 Subject: Add LLVM tool directory to PATH when running tests with llvm-lit. This is needed because the helper tool 'not' is used by some tests --- test/Makefile | 1 + test/lit.cfg | 9 ++++++++- test/lit.site.cfg.in | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index 75e05dda..b2cc0210 100644 --- a/test/Makefile +++ b/test/Makefile @@ -114,4 +114,5 @@ lit.site.cfg: site.exp @sed -e "s#@KLEE_SOURCE_DIR@#$(PROJ_SRC_ROOT)#g" \ -e "s#@KLEE_BINARY_DIR@#$(PROJ_OBJ_ROOT)#g" \ -e "s#@KLEE_TOOLS_DIR@#$(ToolDir)#g" \ + -e "s#@LLVM_TOOLS_DIR@#$(LLVMToolDir)#g" \ $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ diff --git a/test/lit.cfg b/test/lit.cfg index c2144d43..e8dca065 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -22,12 +22,19 @@ klee_obj_root = getattr(config, 'klee_obj_root', None) if klee_obj_root is not None: config.test_exec_root = os.path.join(klee_obj_root, 'test') + # Tweak the PATH to include the tool dir. if klee_obj_root is not None: klee_tools_dir = getattr(config, 'klee_tools_dir', None) if not klee_tools_dir: lit.fatal('No KLEE tools dir set!') - path = os.path.pathsep.join((klee_tools_dir, config.environment['PATH'])) + + # Check LLVM tool directory + llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) + if not llvm_tools_dir: + lit.fatal('No LLVM tool directory set!') + + path = os.path.pathsep.join((klee_tools_dir, config.environment['PATH'], llvm_tools_dir)) config.environment['PATH'] = path # Propogate 'HOME' through the environment. diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index ec92b32d..f47d63b8 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -3,6 +3,7 @@ config.klee_src_root = "@KLEE_SOURCE_DIR@" config.klee_obj_root = "@KLEE_BINARY_DIR@" config.klee_tools_dir = "@KLEE_TOOLS_DIR@" +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" # Let the main config do the real work. lit.load_config(config, "@KLEE_SOURCE_DIR@/test/lit.cfg") -- cgit 1.4.1 From f5afeb84a847e3876122211913b7117fd3ad1862 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sun, 12 Jan 2014 19:55:48 +0000 Subject: Put llvm tools directory at beginning of PATH list so that the LLVM version that KLEE and llvm-as use is the same. --- test/lit.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/lit.cfg b/test/lit.cfg index e8dca065..191461b6 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -34,7 +34,7 @@ if klee_obj_root is not None: if not llvm_tools_dir: lit.fatal('No LLVM tool directory set!') - path = os.path.pathsep.join((klee_tools_dir, config.environment['PATH'], llvm_tools_dir)) + path = os.path.pathsep.join((llvm_tools_dir, klee_tools_dir, config.environment['PATH'] )) config.environment['PATH'] = path # Propogate 'HOME' through the environment. -- cgit 1.4.1 From 313390c68fc808d5fe7cf746a7a65b1e018362dc Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 02:18:37 +0000 Subject: Allow llvm-lit from 2.9 to work by hacking %T substitution variable. --- test/Makefile | 1 + test/lit.cfg | 4 ++++ test/lit.site.cfg.in | 1 + 3 files changed, 6 insertions(+) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index b2cc0210..4bc63b66 100644 --- a/test/Makefile +++ b/test/Makefile @@ -115,4 +115,5 @@ lit.site.cfg: site.exp -e "s#@KLEE_BINARY_DIR@#$(PROJ_OBJ_ROOT)#g" \ -e "s#@KLEE_TOOLS_DIR@#$(ToolDir)#g" \ -e "s#@LLVM_TOOLS_DIR@#$(LLVMToolDir)#g" \ + -e "s#@LLVM_VERSION_MAJOR@#$(LLVM_VERSION_MAJOR)#g" \ $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ diff --git a/test/lit.cfg b/test/lit.cfg index 191461b6..f81576f9 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -77,6 +77,10 @@ for sub in ['llvmgcc', 'llvmgxx']: config.substitutions.append(('%kleaver', 'kleaver')) config.substitutions.append(('%klee', 'klee')) +# LLVM < 3.0 doesn't Support %T directive +if int(config.llvm_version_major) == 2: + config.substitutions.append(('%T','Output')) + def klee_supports_posix_runtime(): return int(site_exp['ENABLE_POSIX_RUNTIME']) diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index f47d63b8..2b239f56 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -4,6 +4,7 @@ config.klee_src_root = "@KLEE_SOURCE_DIR@" config.klee_obj_root = "@KLEE_BINARY_DIR@" config.klee_tools_dir = "@KLEE_TOOLS_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.llvm_version_major = "@LLVM_VERSION_MAJOR@" # Let the main config do the real work. lit.load_config(config, "@KLEE_SOURCE_DIR@/test/lit.cfg") -- cgit 1.4.1 From 38a084fb50cfb38570d0194bb076805e4f752c99 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sun, 12 Jan 2014 21:34:59 +0000 Subject: Fixed many tests that make use of the file tool to check a file created by KLEE exists. A big difference between DejaGNU and llvm-lit is that in DejaGNU the working directory is the test output directory (e.g. test/Feature/Output) but in llvm-lit the working directory is the test directory (e.g. test/Feature ) To fix this I have used the %T substitution variable for llvm-lit. I have also improved some tests by using LLVM's FileCheck tool and removing of hard coded constants for data type size in some places. This commit inevitably breaks running the tests under DejaGNU. Although it is possible to hack by introducing the %T substitution variable some tests would still be broken because the use of shell pipes in DejaGNU doesn't seem to work properly. I could work around this but it's really not worth the effort. --- test/Feature/CallToUndefinedExternal.cpp | 5 +++-- test/Feature/DanglingConcreteReadExpr.c | 2 +- test/Feature/DoubleFree.c | 5 +++-- test/Feature/DumpStatesOnHalt.c | 5 +++-- test/Feature/ExprLogging.c | 8 ++++---- test/Feature/InAndOutOfBounds.c | 14 ++++++++------ test/Feature/IntrinsicTrap.ll | 8 +++++--- test/Feature/KleeReportError.c | 9 ++++++--- test/Feature/LowerSwitch.c | 4 ++-- test/Feature/MakeConcreteSymbolic.c | 4 ++-- test/Feature/MultipleFreeResolution.c | 13 +++++++++---- test/Feature/MultipleReallocResolution.c | 4 ++-- test/Feature/OneFreeError.c | 8 +++++--- test/Feature/OneOutOfBounds.c | 10 ++++++---- test/Feature/OverlappedError.c | 4 ++-- test/Feature/PreferCex.c | 3 ++- test/Feature/Realloc.c | 4 ++-- test/Feature/ReplayPath.c | 2 +- test/Feature/Vararg.c | 2 +- test/Feature/WriteCov.c | 4 ++-- test/Runtime/POSIX/FD_Fail2.c | 14 +++++++------- test/Runtime/POSIX/FilePerm.c | 6 +++--- test/Runtime/POSIX/FreeArgv.c | 14 +++++++++----- test/Runtime/POSIX/Isatty.c | 13 +++++++++---- test/Runtime/POSIX/Openat.c | 2 +- test/Runtime/POSIX/PrgName.c | 4 ++-- test/Runtime/POSIX/SeedAndFail.c | 8 ++++---- test/Solver/LargeIntegers.pc | 12 ++++++------ test/regression/2007-10-11-free-of-alloca.c | 7 ++++--- .../2007-10-11-illegal-access-after-free-and-branch.c | 7 +++++-- test/regression/2008-03-04-free-of-global.c | 7 ++++--- 31 files changed, 123 insertions(+), 89 deletions(-) (limited to 'test') diff --git a/test/Feature/CallToUndefinedExternal.cpp b/test/Feature/CallToUndefinedExternal.cpp index 84b5a3b4..26e8fc55 100644 --- a/test/Feature/CallToUndefinedExternal.cpp +++ b/test/Feature/CallToUndefinedExternal.cpp @@ -1,10 +1,11 @@ // RUN: %llvmgxx %s -emit-llvm -g -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.external.err +// RUN: %klee %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.external.err extern "C" void poof(void); int main() { + // CHECK: failed external call: poof poof(); return 0; diff --git a/test/Feature/DanglingConcreteReadExpr.c b/test/Feature/DanglingConcreteReadExpr.c index 1bf44c3f..204187a2 100644 --- a/test/Feature/DanglingConcreteReadExpr.c +++ b/test/Feature/DanglingConcreteReadExpr.c @@ -1,6 +1,6 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc -// RUN: grep "total queries = 2" klee-last/info +// RUN: grep "total queries = 2" %T/klee-last/info #include diff --git a/test/Feature/DoubleFree.c b/test/Feature/DoubleFree.c index 3727ef2b..d97e0c08 100644 --- a/test/Feature/DoubleFree.c +++ b/test/Feature/DoubleFree.c @@ -1,10 +1,11 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ptr.err +// RUN: %klee %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.ptr.err int main() { int *x = malloc(4); free(x); + // CHECK: memory error: invalid pointer: free free(x); return 0; } diff --git a/test/Feature/DumpStatesOnHalt.c b/test/Feature/DumpStatesOnHalt.c index d86b786b..c65d5568 100644 --- a/test/Feature/DumpStatesOnHalt.c +++ b/test/Feature/DumpStatesOnHalt.c @@ -1,8 +1,9 @@ // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee --stop-after-n-instructions=1 --dump-states-on-halt=true %t1.bc -// RUN: test -f klee-last/test000001.ktest +// RUN: %klee --stop-after-n-instructions=1 --dump-states-on-halt=true %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.ktest int main() { int x = 10; return x; } +// CHECK: halting execution, dumping remaining states diff --git a/test/Feature/ExprLogging.c b/test/Feature/ExprLogging.c index 9e9df87a..abab8031 100644 --- a/test/Feature/ExprLogging.c +++ b/test/Feature/ExprLogging.c @@ -1,14 +1,14 @@ // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t1.bc // We disable the cex-cache to eliminate nondeterminism across different solvers, in particular when counting the number of queries in the last two commands // RUN: %klee --use-cex-cache=false --use-query-log=all:pc,all:smt2,solver:pc,solver:smt2 --write-pcs --write-cvcs --write-smt2s %t1.bc 2> %t2.log -// RUN: %kleaver -print-ast klee-last/all-queries.pc > %t3.log +// RUN: %kleaver -print-ast %T/klee-last/all-queries.pc > %t3.log // RUN: %kleaver -print-ast %t3.log > %t4.log // RUN: diff %t3.log %t4.log -// RUN: %kleaver -print-ast klee-last/solver-queries.pc > %t3.log +// RUN: %kleaver -print-ast %T/klee-last/solver-queries.pc > %t3.log // RUN: %kleaver -print-ast %t3.log > %t4.log // RUN: diff %t3.log %t4.log -// RUN: grep "^; Query" klee-last/all-queries.smt2 | wc -l | grep -q 17 -// RUN: grep "^; Query" klee-last/solver-queries.smt2 | wc -l | grep -q 17 +// RUN: grep "^; Query" %T/klee-last/all-queries.smt2 | wc -l | grep -q 17 +// RUN: grep "^; Query" %T/klee-last/solver-queries.smt2 | wc -l | grep -q 17 #include diff --git a/test/Feature/InAndOutOfBounds.c b/test/Feature/InAndOutOfBounds.c index ba655b83..3a559075 100644 --- a/test/Feature/InAndOutOfBounds.c +++ b/test/Feature/InAndOutOfBounds.c @@ -1,8 +1,8 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ptr.err -o -f klee-last/test000002.ptr.err -// RUN: test ! -f klee-last/test000001.ptr.err -o ! -f klee-last/test000002.ptr.err -// RUN: test ! -f klee-last/test000003.ktest +// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc +// RUN: %klee %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.ptr.err -o -f %T/klee-last/test000002.ptr.err +// RUN: test ! -f %T/klee-last/test000001.ptr.err -o ! -f %T/klee-last/test000002.ptr.err +// RUN: test ! -f %T/klee-last/test000003.ktest unsigned klee_urange(unsigned start, unsigned end) { unsigned x; @@ -12,7 +12,9 @@ unsigned klee_urange(unsigned start, unsigned end) { } int main() { - int *x = malloc(4); + int *x = malloc(sizeof(int)); + // FIXME: Use newer FileCheck syntax to support relative line numbers + // CHECK: InAndOutOfBounds.c:18: memory error: out of bound pointer x[klee_urange(0,2)] = 1; free(x); return 0; diff --git a/test/Feature/IntrinsicTrap.ll b/test/Feature/IntrinsicTrap.ll index 5af46225..13b93e4d 100644 --- a/test/Feature/IntrinsicTrap.ll +++ b/test/Feature/IntrinsicTrap.ll @@ -1,8 +1,6 @@ ; RUN: llvm-as %s -f -o %t1.bc ; RUN: %klee -disable-opt %t1.bc -; RUN: grep abort() klee-last/assembly.ll | wc -l | grep -q 2 -; RUN: echo "llvm.trap()" > %t2.ll -; RUN: grep llvm.trap() klee-last/assembly.ll %t2.ll | wc -l | grep -q 1 +; RUN: FileCheck %s --input-file=%T/klee-last/assembly.ll target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-f128:128:128-n8:16:32:64" target triple = "x86_64-unknown-linux-gnu" @@ -15,6 +13,8 @@ entry: br i1 %c, label %btrue, label %bfalse btrue: + ; CHECK-NOT: call void @llvm.trap() + ; CHECK: call void @abort() call void @llvm.trap() noreturn nounwind unreachable @@ -25,4 +25,6 @@ return: ret i32 0 } +; CHECK-NOT: call void @llvm.trap() +; CHECK: declare void @abort() declare void @llvm.trap() noreturn nounwind diff --git a/test/Feature/KleeReportError.c b/test/Feature/KleeReportError.c index dda72fd0..37c07ed1 100644 --- a/test/Feature/KleeReportError.c +++ b/test/Feature/KleeReportError.c @@ -1,6 +1,6 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc -// RUN: %klee --emit-all-errors %t2.bc > %t3.log -// RUN: ls klee-last/ | grep .my.err | wc -l | grep 2 +// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t2.bc +// RUN: %klee --emit-all-errors %t2.bc 2>&1 | FileCheck %s +// RUN: ls %T/klee-last/ | grep .my.err | wc -l | grep 2 #include #include @@ -16,6 +16,9 @@ int main(int argc, char** argv) { if (y) { fprintf(stderr, "My error\n"); + // CHECK: KleeReportError.c:22: My error + // CHECK: KleeReportError.c:22: My error + // FIXME: Use FileCheck's relative line number syntax klee_report_error(__FILE__, __LINE__, "My error", "my.err"); } diff --git a/test/Feature/LowerSwitch.c b/test/Feature/LowerSwitch.c index 1b92e398..49cad076 100644 --- a/test/Feature/LowerSwitch.c +++ b/test/Feature/LowerSwitch.c @@ -1,8 +1,8 @@ // RUN: %llvmgcc %s -emit-llvm -g -c -o %t.bc // RUN: %klee --exit-on-error --allow-external-sym-calls --switch-type=internal %t.bc -// RUN: not test -f klee-last/test000010.ktest +// RUN: not test -f %T/klee-last/test000010.ktest // RUN: %klee --exit-on-error --allow-external-sym-calls --switch-type=simple %t.bc -// RUN: test -f klee-last/test000010.ktest +// RUN: test -f %T/klee-last/test000010.ktest #include diff --git a/test/Feature/MakeConcreteSymbolic.c b/test/Feature/MakeConcreteSymbolic.c index 29b43a04..bfbb807d 100644 --- a/test/Feature/MakeConcreteSymbolic.c +++ b/test/Feature/MakeConcreteSymbolic.c @@ -1,8 +1,8 @@ // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc // RUN: %klee --exit-on-error %t1.bc -// RUN: grep "done: total queries = 0" klee-last/info +// RUN: grep "done: total queries = 0" %T/klee-last/info // RUN: %klee --make-concrete-symbolic=1 --exit-on-error %t1.bc -// RUN: grep "done: total queries = 2" klee-last/info +// RUN: grep "done: total queries = 2" %T/klee-last/info #include diff --git a/test/Feature/MultipleFreeResolution.c b/test/Feature/MultipleFreeResolution.c index 8a36f459..cd8a383b 100644 --- a/test/Feature/MultipleFreeResolution.c +++ b/test/Feature/MultipleFreeResolution.c @@ -1,7 +1,7 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee --emit-all-errors %t1.bc -// RUN: ls klee-last/ | grep .ktest | wc -l | grep 4 -// RUN: ls klee-last/ | grep .err | wc -l | grep 3 +// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc +// RUN: %klee --emit-all-errors %t1.bc 2>&1 | FileCheck %s +// RUN: ls %T/klee-last/ | grep .ktest | wc -l | grep 4 +// RUN: ls %T/klee-last/ | grep .err | wc -l | grep 3 #include #include @@ -31,9 +31,14 @@ int main() { free(buf[s]); + // CHECK: MultipleFreeResolution.c:39: memory error: out of bound pointer + // CHECK: MultipleFreeResolution.c:39: memory error: out of bound pointer + // CHECK: MultipleFreeResolution.c:39: memory error: out of bound pointer + // FIXME: Use FileCheck's relative line numbers for (i=0; i<3; i++) { printf("*buf[%d] = %d\n", i, *buf[i]); } return 0; } +// CHECK: KLEE: done: generated tests = 4 diff --git a/test/Feature/MultipleReallocResolution.c b/test/Feature/MultipleReallocResolution.c index b1a14ace..1f77485f 100644 --- a/test/Feature/MultipleReallocResolution.c +++ b/test/Feature/MultipleReallocResolution.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc -// RUN: ls klee-last/ | grep .err | wc -l | grep 2 -// RUN: ls klee-last/ | grep .ptr.err | wc -l | grep 2 +// RUN: ls %T/klee-last/ | grep .err | wc -l | grep 2 +// RUN: ls %T/klee-last/ | grep .ptr.err | wc -l | grep 2 #include #include diff --git a/test/Feature/OneFreeError.c b/test/Feature/OneFreeError.c index 8eb13298..e83b535a 100644 --- a/test/Feature/OneFreeError.c +++ b/test/Feature/OneFreeError.c @@ -1,10 +1,12 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ptr.err +// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc +// RUN: %klee %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.ptr.err int main() { int *x = malloc(4); free(x); + // CHECK: OneFreeError.c:10: memory error: out of bound pointer + // FIXME: Use FileCheck's relative line numbers x[0] = 1; return 0; } diff --git a/test/Feature/OneOutOfBounds.c b/test/Feature/OneOutOfBounds.c index 11a9eecb..72d36b70 100644 --- a/test/Feature/OneOutOfBounds.c +++ b/test/Feature/OneOutOfBounds.c @@ -1,9 +1,11 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ptr.err +// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc +// RUN: %klee %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.ptr.err int main() { - int *x = malloc(4); + int *x = malloc(sizeof(int)); + // CHECK: OneOutOfBounds.c:9: memory error: out of bound pointer + // FIXME: Use FileCheck's relative line numbers x[1] = 1; free(x); return 0; diff --git a/test/Feature/OverlappedError.c b/test/Feature/OverlappedError.c index aa220ed9..886c7ec8 100644 --- a/test/Feature/OverlappedError.c +++ b/test/Feature/OverlappedError.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc -// RUN: ls klee-last/ | grep .ktest | wc -l | grep 4 -// RUN: ls klee-last/ | grep .ptr.err | wc -l | grep 2 +// RUN: ls %T/klee-last/ | grep .ktest | wc -l | grep 4 +// RUN: ls %T/klee-last/ | grep .ptr.err | wc -l | grep 2 #include diff --git a/test/Feature/PreferCex.c b/test/Feature/PreferCex.c index 97ce5101..6cdb8446 100644 --- a/test/Feature/PreferCex.c +++ b/test/Feature/PreferCex.c @@ -1,6 +1,6 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee --exit-on-error %t1.bc -// RUN: ktest-tool klee-last/test000001.ktest | grep -F 'Hi\x00\x00' +// RUN: ktest-tool %T/klee-last/test000001.ktest | FileCheck %s #include #include @@ -10,6 +10,7 @@ int main() { char buf[4]; klee_make_symbolic(buf, sizeof buf); + // CHECK: Hi\x00\x00 klee_prefer_cex(buf, buf[0]=='H'); klee_prefer_cex(buf, buf[1]=='i'); klee_prefer_cex(buf, buf[2]=='\0'); diff --git a/test/Feature/Realloc.c b/test/Feature/Realloc.c index a47adad6..62aa170b 100644 --- a/test/Feature/Realloc.c +++ b/test/Feature/Realloc.c @@ -1,6 +1,5 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee --exit-on-error %t1.bc -// RUN: grep "KLEE: WARNING ONCE: Large alloc" klee-last/warnings.txt +// RUN: %klee --exit-on-error %t1.bc 2>&1 | FileCheck %s #include #include @@ -11,6 +10,7 @@ int main() { assert(p); p[1] = 52; + // CHECK: KLEE: WARNING ONCE: Large alloc int *p2 = realloc(p, 1<<30); assert(p2[1] == 52); diff --git a/test/Feature/ReplayPath.c b/test/Feature/ReplayPath.c index f88ad6dc..ccf59657 100644 --- a/test/Feature/ReplayPath.c +++ b/test/Feature/ReplayPath.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -DCOND_EXIT -c -o %t1.bc // RUN: klee --write-paths %t1.bc > %t3.good // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc -// RUN: %klee --replay-path klee-last/test000001.path %t2.bc >%t3.log +// RUN: %klee --replay-path %T/klee-last/test000001.path %t2.bc > %t3.log // RUN: diff %t3.log %t3.good #include diff --git a/test/Feature/Vararg.c b/test/Feature/Vararg.c index 9f6643bc..31eee235 100644 --- a/test/Feature/Vararg.c +++ b/test/Feature/Vararg.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc > %t2.out // RUN: grep "types: (52, 37, 2.00, (9,12,15))" %t2.out -// RUN: test -f klee-last/test000001.ptr.err +// RUN: test -f %T/klee-last/test000001.ptr.err #include #include diff --git a/test/Feature/WriteCov.c b/test/Feature/WriteCov.c index bb2d64e8..45e7bc43 100644 --- a/test/Feature/WriteCov.c +++ b/test/Feature/WriteCov.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -emit-llvm -g -c -o %t2.bc // RUN: %klee --exit-on-error --write-cov %t2.bc -// RUN: grep -c WriteCov.c:15 klee-last/test000001.cov klee-last/test000002.cov >%t3.txt -// RUN: grep -c WriteCov.c:17 klee-last/test000001.cov klee-last/test000002.cov >>%t3.txt +// RUN: grep -c WriteCov.c:15 %T/klee-last/test000001.cov %T/klee-last/test000002.cov >%t3.txt +// RUN: grep -c WriteCov.c:17 %T/klee-last/test000001.cov %T/klee-last/test000002.cov >>%t3.txt // RUN: grep klee-last/test000001.cov:0 %t3.txt // RUN: grep klee-last/test000001.cov:1 %t3.txt // RUN: grep klee-last/test000002.cov:0 %t3.txt diff --git a/test/Runtime/POSIX/FD_Fail2.c b/test/Runtime/POSIX/FD_Fail2.c index b42e03bf..624329fc 100644 --- a/test/Runtime/POSIX/FD_Fail2.c +++ b/test/Runtime/POSIX/FD_Fail2.c @@ -1,12 +1,12 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee --libc=uclibc --posix-runtime --search=dfs %t1.bc --sym-files 1 10 --max-fail 1 -// RUN: test -f klee-last/test000001.ktest -// RUN: test -f klee-last/test000002.ktest -// RUN: test -f klee-last/test000003.ktest -// RUN: test -f klee-last/test000004.ktest -// RUN: test -f klee-last/test000005.ktest -// RUN: test -f klee-last/test000006.ktest -// RUN: test -f klee-last/test000007.ktest +// RUN: test -f %T/klee-last/test000001.ktest +// RUN: test -f %T/klee-last/test000002.ktest +// RUN: test -f %T/klee-last/test000003.ktest +// RUN: test -f %T/klee-last/test000004.ktest +// RUN: test -f %T/klee-last/test000005.ktest +// RUN: test -f %T/klee-last/test000006.ktest +// RUN: test -f %T/klee-last/test000007.ktest #include #include diff --git a/test/Runtime/POSIX/FilePerm.c b/test/Runtime/POSIX/FilePerm.c index d387c2a9..1346c09a 100644 --- a/test/Runtime/POSIX/FilePerm.c +++ b/test/Runtime/POSIX/FilePerm.c @@ -1,8 +1,8 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc // RUN: %klee --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log -// RUN: test -f klee-last/test000001.ktest -// RUN: test -f klee-last/test000002.ktest -// RUN: test -f klee-last/test000003.ktest +// RUN: test -f %T/klee-last/test000001.ktest +// RUN: test -f %T/klee-last/test000002.ktest +// RUN: test -f %T/klee-last/test000003.ktest #include #include diff --git a/test/Runtime/POSIX/FreeArgv.c b/test/Runtime/POSIX/FreeArgv.c index ceec4de2..4d2e5b75 100644 --- a/test/Runtime/POSIX/FreeArgv.c +++ b/test/Runtime/POSIX/FreeArgv.c @@ -1,18 +1,22 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc -// RUN: %klee --posix-runtime %t.bc --sym-args 1 1 1 -// RUN: test -f klee-last/test000001.free.err -// RUN: test -f klee-last/test000002.free.err -// RUN: test -f klee-last/test000003.free.err +// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t.bc +// RUN: %klee --posix-runtime %t.bc --sym-args 1 1 1 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.free.err +// RUN: test -f %T/klee-last/test000002.free.err +// RUN: test -f %T/klee-last/test000003.free.err int main(int argc, char **argv) { + // FIXME: Use FileCheck's CHECK-DAG to check source locations switch(klee_range(0, 3, "range")) { case 0: + // CHECK: free of global free(argv); break; case 1: + // CHECK: free of global free(argv[0]); break; case 2: + // CHECK: free of global free(argv[1]); break; } diff --git a/test/Runtime/POSIX/Isatty.c b/test/Runtime/POSIX/Isatty.c index 293ee653..bd514d48 100644 --- a/test/Runtime/POSIX/Isatty.c +++ b/test/Runtime/POSIX/Isatty.c @@ -1,9 +1,9 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc // RUN: %klee --libc=uclibc --posix-runtime %t.bc --sym-files 0 10 --sym-stdout 2>%t.log -// RUN: test -f klee-last/test000001.ktest -// RUN: test -f klee-last/test000002.ktest -// RUN: test -f klee-last/test000003.ktest -// RUN: test -f klee-last/test000004.ktest +// RUN: test -f %T/klee-last/test000001.ktest +// RUN: test -f %T/klee-last/test000002.ktest +// RUN: test -f %T/klee-last/test000003.ktest +// RUN: test -f %T/klee-last/test000004.ktest // RUN: grep -q "stdin is a tty" %t.log // RUN: grep -q "stdin is NOT a tty" %t.log // RUN: grep -q "stdout is a tty" %t.log @@ -15,16 +15,21 @@ #include #include +// FIXME: Use new FileCheck to check klee's output int main(int argc, char** argv) { int fd0 = 0; // stdin int fd1 = 1; // stdout int r = isatty(fd0); + // CHECK-DAG: stdin is a tty + // CHECK-DAG: stdin is NOT a tty if (r) fprintf(stderr, "stdin is a tty\n"); else fprintf(stderr, "stdin is NOT a tty\n"); r = isatty(fd1); + // CHECK-DAG: stdout is a tty + // CHECK-DAG: stdout is NOT a tty if (r) fprintf(stderr, "stdout is a tty\n"); else fprintf(stderr, "stdout is NOT a tty\n"); diff --git a/test/Runtime/POSIX/Openat.c b/test/Runtime/POSIX/Openat.c index d417ee47..3c17f976 100644 --- a/test/Runtime/POSIX/Openat.c +++ b/test/Runtime/POSIX/Openat.c @@ -1,6 +1,6 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc // RUN: %klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10 -// RUN: test -f klee-last/test000001.ktest +// RUN: test -f %T/klee-last/test000001.ktest #include #include diff --git a/test/Runtime/POSIX/PrgName.c b/test/Runtime/POSIX/PrgName.c index dc6a4b8c..6bc682ca 100644 --- a/test/Runtime/POSIX/PrgName.c +++ b/test/Runtime/POSIX/PrgName.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc // RUN: %klee --posix-runtime --exit-on-error %t2.bc --sym-arg 10 >%t.log -// RUN: test -f klee-last/test000001.ktest -// RUN: test -f klee-last/test000002.ktest +// RUN: test -f %T/klee-last/test000001.ktest +// RUN: test -f %T/klee-last/test000002.ktest // RUN: grep -q "No" %t.log // RUN: grep -qv "Yes" %t.log diff --git a/test/Runtime/POSIX/SeedAndFail.c b/test/Runtime/POSIX/SeedAndFail.c index 740db664..d9bd7f8d 100644 --- a/test/Runtime/POSIX/SeedAndFail.c +++ b/test/Runtime/POSIX/SeedAndFail.c @@ -1,8 +1,8 @@ // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc -// RUN: rm -rf tmp-123 -// RUN: %klee --libc=uclibc --output-dir=tmp-123 --posix-runtime %t.bc --sym-files 1 10 2>%t.log -// RUN: %klee --seed-out-dir=tmp-123 --zero-seed-extension --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --max-fail 1 -// RUN: ls klee-last | grep -c assert | grep 4 +// RUN: rm -rf %T/tmp-123 +// RUN: %klee --libc=uclibc --output-dir=%T/tmp-123 --posix-runtime %t.bc --sym-files 1 10 2>%t.log +// RUN: %klee --seed-out-dir=%T/tmp-123 --zero-seed-extension --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --max-fail 1 +// RUN: ls %T/klee-last | grep -c assert | grep 4 #include #include diff --git a/test/Solver/LargeIntegers.pc b/test/Solver/LargeIntegers.pc index 53ff3a51..e0921393 100644 --- a/test/Solver/LargeIntegers.pc +++ b/test/Solver/LargeIntegers.pc @@ -2,16 +2,16 @@ array a[64] : w32 -> w8 = symbolic -# RUN: grep -A 1 \"Query 0\" %t > %t2 -# RUN: grep \"Expr 0:\t18446744073709551618\" %t2 +# RUN: grep -A 1 "Query 0" %t > %t2 +# RUN: grep "Expr 0: 18446744073709551618" %t2 (query [] false [(Concat w128 (w64 1) (w64 2))]) -# RUN: grep -A 1 \"Query 1\" %t > %t2 -# RUN: grep \"Expr 0:\t16\" %t2 +# RUN: grep -A 1 "Query 1" %t > %t2 +# RUN: grep "Expr 0: 16" %t2 (query [] false [(Extract w5 60 (Concat w128 (w64 1) (w64 2)))]) -# RUN: grep -A 1 \"Query 2\" %t > %t2 -# RUN: grep \"Array 0:\ta.16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1\" %t2 +# RUN: grep -A 1 "Query 2" %t > %t2 +# RUN: grep "Array 0: a.16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1" %t2 (query [(Eq 0x0102030405060708090A0B0C0D0E0F10 (ReadLSB w128 0 a))] false [] [a]) diff --git a/test/regression/2007-10-11-free-of-alloca.c b/test/regression/2007-10-11-free-of-alloca.c index 71a16f6b..44a9ed4e 100644 --- a/test/regression/2007-10-11-free-of-alloca.c +++ b/test/regression/2007-10-11-free-of-alloca.c @@ -1,9 +1,10 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.free.err +// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc +// RUN: %klee %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.free.err int main() { int buf[4]; + // CHECK: 2007-10-11-free-of-alloca.c:8: free of alloca free(buf); // this should give runtime error, not crash return 0; } diff --git a/test/regression/2007-10-11-illegal-access-after-free-and-branch.c b/test/regression/2007-10-11-illegal-access-after-free-and-branch.c index fbbb99c3..73b3ed3f 100644 --- a/test/regression/2007-10-11-illegal-access-after-free-and-branch.c +++ b/test/regression/2007-10-11-illegal-access-after-free-and-branch.c @@ -1,6 +1,6 @@ // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc -// RUN: %klee --optimize %t1.bc -// RUN: test -f klee-last/test000001.ptr.err +// RUN: %klee --optimize %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.ptr.err #include #include @@ -13,7 +13,10 @@ int main(int argc, char **argv) { unsigned char x = buf[1]; free(buf); if (x) + { + // CHECK: 2007-10-11-illegal-access-after-free-and-branch.c:18: memory error: out of bound pointer return buf[2]; + } klee_silent_exit(0); return 0; } diff --git a/test/regression/2008-03-04-free-of-global.c b/test/regression/2008-03-04-free-of-global.c index 7821398d..5351128d 100644 --- a/test/regression/2008-03-04-free-of-global.c +++ b/test/regression/2008-03-04-free-of-global.c @@ -1,10 +1,11 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.free.err +// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc +// RUN: %klee %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.free.err int buf[4]; int main() { + // CHECK: 2008-03-04-free-of-global.c:9: free of global free(buf); // this should give runtime error, not crash return 0; } -- cgit 1.4.1 From ad8b548626ba5b797f948200cff2d80d579a12c2 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 20 Jan 2014 14:45:50 +0000 Subject: Fixed Feature/LongDouble.cpp test for llvm-lit by removed use of { } quotes. I also add FileCheck lines but I've not added running FileCheck because only new versions of FileCheck support the CHECK-DAG: syntax. --- test/Feature/LongDouble.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/Feature/LongDouble.cpp b/test/Feature/LongDouble.cpp index ecee43b4..6e6baf6a 100644 --- a/test/Feature/LongDouble.cpp +++ b/test/Feature/LongDouble.cpp @@ -1,11 +1,11 @@ // RUN: %llvmgxx -I../../../include -g -fno-exceptions -emit-llvm -O0 -c -o %t.bc %s // RUN: %klee --libc=klee --no-output --exit-on-error %t.bc > %t.log -// RUN: grep -q {powl\(-11\\.0,0\)=1\\.0\\+} %t.log -// RUN: grep -q {powl\(-11\\.0,1\)=-11\\.0\\+} %t.log -// RUN: grep -q {powl\(-11\\.0,2\)=121\\.0\\+} %t.log -// RUN: grep -q {1/0=inf} %t.log -// RUN: grep -q {1/-1=-1\\.0\\+} %t.log -// RUN: grep -q {1/-2=-0\\.50\\+} %t.log +// RUN: grep -q powl\(-11\\.0,0\)=1\\.0\\+ %t.log +// RUN: grep -q powl\(-11\\.0,1\)=-11\\.0\\+ %t.log +// RUN: grep -q powl\(-11\\.0,2\)=121\\.0\\+ %t.log +// RUN: grep -q 1/0=inf %t.log +// RUN: grep -q 1/-1=-1\\.0\\+ %t.log +// RUN: grep -q 1/-2=-0\\.50\\+ %t.log #include #include @@ -44,10 +44,17 @@ int main(int argc, char ** argv) // test 80-bit external dispatch long double d = powl((long double)-11.0, (long double)a); + // FIXME: Use CHECK-DAG: with FileCheck tool + // CHECK-DAG: powl(-11.0,0)=1.0 + // CHECK-DAG: powl(-11.0,1)=-11.0 + // CHECK-DAG: powl(-11.0,2)=121.0 printf("powl(-11.0,%d)=%Lf\n", a, d); // test 80-bit fdiv long double e = (long double) 1 / (long double) b; + // CHECK-DAG: 1/0=inf + // CHECK-DAG: 1/1-1=-1.0 + // CHECK-DAG: 1/-2=-0.50 printf("1/%d=%Lf\n", b, e); return 0; -- cgit 1.4.1 From 3be371b38bba7facc74490f713659d99d621830d Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 02:30:49 +0000 Subject: Fix Feature/Envp.c test for llvm-lit by providing the PWD environmental variable in test environment. --- test/lit.cfg | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/lit.cfg b/test/lit.cfg index f81576f9..3bda57df 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -39,6 +39,7 @@ if klee_obj_root is not None: # Propogate 'HOME' through the environment. config.environment['HOME'] = os.environ['HOME'] +config.environment['PWD'] = os.environ['PWD'] ### -- cgit 1.4.1 From fba6feb650c74ac9def2a38be137b1d62e68cc84 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 02:23:10 +0000 Subject: Force python2 to be used when running llvm-lit. This needs to be fixed properly at configure time at some point. --- test/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index 4bc63b66..6a0184e2 100644 --- a/test/Makefile +++ b/test/Makefile @@ -51,12 +51,14 @@ check-local:: site.exp endif check-local-lit:: lit.site.cfg + # FIXME: Detect python at configure time ( $(ULIMIT) \ - $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) + python2 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) check-local-all:: lit.site.cfg + # FIXME: Detect python at configure time ( $(ULIMIT) \ - $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) + python2 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) ifdef TESTONE CLEANED_TESTONE := $(patsubst %/,%,$(TESTONE)) -- cgit 1.4.1 From 70d6a3341a70f9daf0c3653a041b925e53ebafa2 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 02:46:40 +0000 Subject: Fixed Feature/InAndOutOfBounds.c so it did not make use of ! which seemed to causing problems for llvm-lit's parser. --- test/Feature/InAndOutOfBounds.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/Feature/InAndOutOfBounds.c b/test/Feature/InAndOutOfBounds.c index 3a559075..729d6b78 100644 --- a/test/Feature/InAndOutOfBounds.c +++ b/test/Feature/InAndOutOfBounds.c @@ -1,8 +1,8 @@ // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc 2>&1 | FileCheck %s -// RUN: test -f %T/klee-last/test000001.ptr.err -o -f %T/klee-last/test000002.ptr.err -// RUN: test ! -f %T/klee-last/test000001.ptr.err -o ! -f %T/klee-last/test000002.ptr.err -// RUN: test ! -f %T/klee-last/test000003.ktest +// RUN: test -f %T/klee-last/test000001.ptr.err -o -f %T/klee-last/test000002.ptr.err +// RUN: not test -f %T/klee-last/test000001.ptr.err -a -f %T/klee-last/test000002.ptr.err +// RUN: not test -f %T/klee-last/test000003.ktest unsigned klee_urange(unsigned start, unsigned end) { unsigned x; -- cgit 1.4.1 From 9b45ab8822ec3336e137b68003103125c5a4f9ab Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 17:14:55 +0000 Subject: Removed all of llvm-lit's dependence on DejaGNU. A few things are now broken and will be fixed shortly. --- test/Makefile | 7 +++- test/lit.cfg | 106 ++++++--------------------------------------------- test/lit.site.cfg.in | 14 +++++++ 3 files changed, 32 insertions(+), 95 deletions(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index 6a0184e2..ea6624d0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -111,11 +111,16 @@ site.exp: Makefile $(LEVEL)/Makefile.config @test ! -f site.exp || mv site.exp site.bak @mv site.tmp site.exp -lit.site.cfg: site.exp +lit.site.cfg: lit.site.cfg.in @echo "Making KLEE 'lit.site.cfg' file..." @sed -e "s#@KLEE_SOURCE_DIR@#$(PROJ_SRC_ROOT)#g" \ -e "s#@KLEE_BINARY_DIR@#$(PROJ_OBJ_ROOT)#g" \ -e "s#@KLEE_TOOLS_DIR@#$(ToolDir)#g" \ -e "s#@LLVM_TOOLS_DIR@#$(LLVMToolDir)#g" \ -e "s#@LLVM_VERSION_MAJOR@#$(LLVM_VERSION_MAJOR)#g" \ + -e "s#@LLVMCC@#$(KLEE_BITCODE_C_COMPILER) -I$(PROJ_SRC_ROOT)/include#g" \ + -e "s#@LLVMCXX@#$(KLEE_BITCODE_CXX_COMPILER) -I$(PROJ_SRC_ROOT)/include#g" \ + -e "s#@ENABLE_UCLIBC@#$(ENABLE_UCLIBC)#g" \ + -e "s#@ENABLE_POSIX_RUNTIME@#$(ENABLE_POSIX_RUNTIME)#g" \ + -e "s#@TARGET_TRIPLE@#$(TARGET_TRIPLE)#g" \ $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ diff --git a/test/lit.cfg b/test/lit.cfg index 3bda57df..9344cae8 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -10,9 +10,9 @@ config.name = 'KLEE' # testFormat: The test format to use to interpret tests. config.test_format = lit.formats.ShTest(execute_external=False) -# suffixes: A list of file extensions to treat as test files, this is actually -# set by on_clone(). -config.suffixes = [] +# suffixes: A list of file extensions to treat as test files +# Note this can be overridden by lit.local.cfg files +config.suffixes = ['.ll', '.c', '.cpp', '.pc'] # test_source_root: The root path where tests are located. config.test_source_root = os.path.dirname(__file__) @@ -22,7 +22,6 @@ klee_obj_root = getattr(config, 'klee_obj_root', None) if klee_obj_root is not None: config.test_exec_root = os.path.join(klee_obj_root, 'test') - # Tweak the PATH to include the tool dir. if klee_obj_root is not None: klee_tools_dir = getattr(config, 'klee_tools_dir', None) @@ -41,38 +40,18 @@ if klee_obj_root is not None: config.environment['HOME'] = os.environ['HOME'] config.environment['PWD'] = os.environ['PWD'] -### - -import os - # Check that the object root is known. if config.test_exec_root is None: lit.fatal('test execution root not set!') -### - -# Load site data from DejaGNU's site.exp. -import re -site_exp = {} -# FIXME: Implement lit.site.cfg. -for line in open(os.path.join(config.klee_obj_root, 'test', 'site.exp')): - m = re.match('set ([^ ]+) "([^"]*)"', line) - if m: - site_exp[m.group(1)] = m.group(2) - -# Add substitutions. -config.substitutions.append(('%llvmgcc_only', site_exp['llvmgcc'])) -for sub in ['llvmgcc', 'llvmgxx']: - if sub in ('llvmgcc', 'llvmgxx'): - config.substitutions.append(('%' + sub, - site_exp[sub] + ' -emit-llvm -w')) - # FIXME: This is a hack to avoid LLVMC tests failing due to a clang driver - # warning when passing in "-fexceptions -fno-exceptions". - elif sub == 'compile_cxx': - config.substitutions.append(('%' + sub, - site_exp[sub].replace('-fno-exceptions', ''))) - else: - config.substitutions.append(('%' + sub, site_exp[sub])) + +# Add substitutions from lit.site.cfg +subs = [ 'llvmgcc', 'llvmgxx'] +for name in subs: + value = getattr(config, name, None) + if value == None: + lit.fatal('{0} is not set'.format(name)) + config.substitutions.append( ('%' + name, value)) # FIXME: Give these proper paths. config.substitutions.append(('%kleaver', 'kleaver')) @@ -80,66 +59,5 @@ config.substitutions.append(('%klee', 'klee')) # LLVM < 3.0 doesn't Support %T directive if int(config.llvm_version_major) == 2: + # This is a hack config.substitutions.append(('%T','Output')) - -def klee_supports_posix_runtime(): - return int(site_exp['ENABLE_POSIX_RUNTIME']) - -def klee_supports_uclibc(): - return int(site_exp['ENABLE_UCLIBC']) - -excludes = [] - -# Provide target_triple for use in XFAIL and XTARGET. -config.target_triple = site_exp['target_triplet'] - -# Provide on_clone hook for reading 'dg.exp'. -import os -simpleLibData = re.compile(r"""load_lib llvm.exp - -RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\]""", - re.MULTILINE) -conditionalLibData = re.compile(r"""load_lib llvm.exp - -if.*\[?(klee[^ ]*)\].*{ - *RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\] -\}""", re.MULTILINE) -def on_clone(parent, cfg, for_path): - def addSuffixes(match): - if match[0] == '{' and match[-1] == '}': - cfg.suffixes = ['.' + s for s in match[1:-1].split(',')] - else: - cfg.suffixes = ['.' + match] - - libPath = os.path.join(os.path.dirname(for_path), - 'dg.exp') - if not os.path.exists(libPath): - cfg.unsupported = True - return - - # Reset unsupported, in case we inherited it. - cfg.unsupported = False - lib = open(libPath).read().strip() - - # Check for a simple library. - m = simpleLibData.match(lib) - if m: - addSuffixes(m.group(1)) - return - - # Check for a conditional test set. - m = conditionalLibData.match(lib) - if m: - funcname,match = m.groups() - addSuffixes(match) - - func = globals().get(funcname) - if not func: - lit.error('unsupported predicate %r' % funcname) - elif not func(): - cfg.unsupported = True - return - # Otherwise, give up. - lit.error('unable to understand %r:\n%s' % (libPath, lib)) - -config.on_clone = on_clone diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 2b239f56..11159415 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -4,7 +4,21 @@ config.klee_src_root = "@KLEE_SOURCE_DIR@" config.klee_obj_root = "@KLEE_BINARY_DIR@" config.klee_tools_dir = "@KLEE_TOOLS_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" + +# Needed to check if a hack needs to be applied config.llvm_version_major = "@LLVM_VERSION_MAJOR@" +# Compilers +# FIXME: use llvmcc not llvmgcc +config.llvmgcc = "@LLVMCC@" +config.llvmgxx = "@LLVMCXX@" + +# Features +config.enable_uclibc = True if @ENABLE_UCLIBC@ == 1 else False +config.enable_posix_runtime = True if @ENABLE_POSIX_RUNTIME@ == 1 else False + +# Current target +config.target_triple = "@TARGET_TRIPLE@" + # Let the main config do the real work. lit.load_config(config, "@KLEE_SOURCE_DIR@/test/lit.cfg") -- cgit 1.4.1 From 025c906dd27d00f1cf4e930d138283d711483034 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 17:27:10 +0000 Subject: Add lit.local.cfg file for test/Concrete so no tests are executed in this directory. I don't know why these tests are here, they weren't executed before by DejaGNU. --- test/Concrete/lit.local.cfg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 test/Concrete/lit.local.cfg (limited to 'test') diff --git a/test/Concrete/lit.local.cfg b/test/Concrete/lit.local.cfg new file mode 100644 index 00000000..b882827d --- /dev/null +++ b/test/Concrete/lit.local.cfg @@ -0,0 +1,3 @@ +# FIXME: Why are these here +# Disable all tests in this directory +config.suffixes = [ ] -- cgit 1.4.1 From 6285c45683eacccf79ab7cffba75570cdb642570 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 17:38:08 +0000 Subject: Fixed tests where llvm-gcc was called without the -emit-llvm flag. DejaGNU testing used to have this flag in its substitution variable but for llvm-lit this has not been done. I could replicate what DejaGNU did but by forcing developers to be explicit when creating LLVM bitcode * Remove test suite inconsistentcies. Some tests explictly use -emit-llvm * Allows for tests to be written in the future that invoke the compiler as a native compiler --- test/Feature/AsmAddresses.c | 4 ++-- test/Feature/CheckMemoryAccess.c | 2 +- test/Feature/DefineFixedObject.c | 2 +- test/Feature/Float.c | 2 +- test/Feature/GetValue.c | 2 +- test/Feature/MemoryLimit.c | 4 ++-- test/Feature/NamedSeedMatching.c | 2 +- test/Feature/SetForking.c | 2 +- test/regression/2008-05-23-gep-with-global-const.c | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/Feature/AsmAddresses.c b/test/Feature/AsmAddresses.c index a58fc059..d0b89ef1 100644 --- a/test/Feature/AsmAddresses.c +++ b/test/Feature/AsmAddresses.c @@ -1,6 +1,6 @@ -// RUN: %llvmgcc -g -c -o %t.bc %s +// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s // RUN: %klee --exit-on-error --use-asm-addresses %t.bc -// RUN: %llvmgcc -DOVERLAP -g -c -o %t.bc %s +// RUN: %llvmgcc -emit-llvm -DOVERLAP -g -c -o %t.bc %s // RUN: not %klee --exit-on-error --use-asm-addresses %t.bc #include diff --git a/test/Feature/CheckMemoryAccess.c b/test/Feature/CheckMemoryAccess.c index dd6e8745..30590f88 100644 --- a/test/Feature/CheckMemoryAccess.c +++ b/test/Feature/CheckMemoryAccess.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -g -c %s -o %t.bc +// RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc // RUN: %klee %t.bc > %t.log // RUN: grep -q "good" %t.log // RUN: not grep -q "bad" %t.log diff --git a/test/Feature/DefineFixedObject.c b/test/Feature/DefineFixedObject.c index 36822434..9f71f89b 100644 --- a/test/Feature/DefineFixedObject.c +++ b/test/Feature/DefineFixedObject.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -c -o %t1.bc %s +// RUN: %llvmgcc -emit-llvm -c -o %t1.bc %s // RUN: %klee --exit-on-error %t1.bc #include diff --git a/test/Feature/Float.c b/test/Feature/Float.c index a1f54fd8..f7e4dde0 100644 --- a/test/Feature/Float.c +++ b/test/Feature/Float.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -g -c %s -o %t.bc +// RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc // RUN: %klee %t.bc > %t.log // RUN: grep "3.30* -1.10* 2.420*" %t.log diff --git a/test/Feature/GetValue.c b/test/Feature/GetValue.c index dfd40d69..5023c51c 100644 --- a/test/Feature/GetValue.c +++ b/test/Feature/GetValue.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -c -o %t1.bc %s +// RUN: %llvmgcc -emit-llvm -c -o %t1.bc %s // RUN: %klee --exit-on-error %t1.bc #include diff --git a/test/Feature/MemoryLimit.c b/test/Feature/MemoryLimit.c index d959c3de..a3c1250e 100644 --- a/test/Feature/MemoryLimit.c +++ b/test/Feature/MemoryLimit.c @@ -1,5 +1,5 @@ -// RUN: %llvmgcc -DLITTLE_ALLOC -g -c %s -o %t.little.bc -// RUN: %llvmgcc -g -c %s -o %t.big.bc +// RUN: %llvmgcc -emit-llvm -DLITTLE_ALLOC -g -c %s -o %t.little.bc +// RUN: %llvmgcc -emit-llvm -g -c %s -o %t.big.bc // RUN: %klee --max-memory=20 %t.little.bc > %t.little.log // RUN: %klee --max-memory=20 %t.big.bc > %t.big.log // RUN: not grep -q "MALLOC FAILED" %t.little.log diff --git a/test/Feature/NamedSeedMatching.c b/test/Feature/NamedSeedMatching.c index bb7f6097..16da3117 100644 --- a/test/Feature/NamedSeedMatching.c +++ b/test/Feature/NamedSeedMatching.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -c -g %s -o %t.bc +// RUN: %llvmgcc -emit-llvm -c -g %s -o %t.bc // RUN: rm -rf %t.out // RUN: %klee --output-dir=%t.out %t.bc "initial" // RUN: test -f %t.out/test000001.ktest diff --git a/test/Feature/SetForking.c b/test/Feature/SetForking.c index 8620110d..cbae33c0 100644 --- a/test/Feature/SetForking.c +++ b/test/Feature/SetForking.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -g -c %s -o %t.bc +// RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc // RUN: %klee %t.bc > %t.log // RUN: sort %t.log | uniq -c > %t.uniq.log // RUN: grep "1 A" %t.uniq.log diff --git a/test/regression/2008-05-23-gep-with-global-const.c b/test/regression/2008-05-23-gep-with-global-const.c index 5e03ec1d..3ad9b24e 100644 --- a/test/regression/2008-05-23-gep-with-global-const.c +++ b/test/regression/2008-05-23-gep-with-global-const.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -O0 -c -o %t.bc %s +// RUN: %llvmgcc -emit-llvm -O0 -c -o %t.bc %s // RUN: %klee --exit-on-error %t.bc #include -- cgit 1.4.1 From 2914a43e42184efe46a7b28caccfbb54c781e795 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 17:50:27 +0000 Subject: Added Runtime/POSIX/lit.local.cfg file that prevents the POSIX tests from being executed if not enabled at configure time. --- test/Runtime/POSIX/lit.local.cfg | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test/Runtime/POSIX/lit.local.cfg (limited to 'test') diff --git a/test/Runtime/POSIX/lit.local.cfg b/test/Runtime/POSIX/lit.local.cfg new file mode 100644 index 00000000..680351b7 --- /dev/null +++ b/test/Runtime/POSIX/lit.local.cfg @@ -0,0 +1,7 @@ +def getRoot(config): + if not config.parent: + return config + return getRoot(config.parent) + +if not getRoot(config).enable_posix_runtime: + config.unsupported = True -- cgit 1.4.1 From 48ce6b94f4fe5131242ba87485cd79e081a991ed Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 18:04:52 +0000 Subject: Only run SELinux test if support for SELinux was detected at configure time. --- test/Makefile | 1 + test/Runtime/POSIX/SELinux.c | 30 ------------------------------ test/Runtime/POSIX/SELinux/SELinux.c | 30 ++++++++++++++++++++++++++++++ test/Runtime/POSIX/SELinux/lit.local.cfg | 7 +++++++ test/lit.site.cfg.in | 1 + 5 files changed, 39 insertions(+), 30 deletions(-) delete mode 100644 test/Runtime/POSIX/SELinux.c create mode 100644 test/Runtime/POSIX/SELinux/SELinux.c create mode 100644 test/Runtime/POSIX/SELinux/lit.local.cfg (limited to 'test') diff --git a/test/Makefile b/test/Makefile index ea6624d0..23c891e4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -123,4 +123,5 @@ lit.site.cfg: lit.site.cfg.in -e "s#@ENABLE_UCLIBC@#$(ENABLE_UCLIBC)#g" \ -e "s#@ENABLE_POSIX_RUNTIME@#$(ENABLE_POSIX_RUNTIME)#g" \ -e "s#@TARGET_TRIPLE@#$(TARGET_TRIPLE)#g" \ + -e "s#@HAVE_SELINUX@#$(HAVE_SELINUX)#g" \ $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ diff --git a/test/Runtime/POSIX/SELinux.c b/test/Runtime/POSIX/SELinux.c deleted file mode 100644 index 65dd1a7f..00000000 --- a/test/Runtime/POSIX/SELinux.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Very basic test, as right now SELinux support is extremely basic */ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee --posix-runtime --exit-on-error %t1.bc --sym-arg 2 > %t.log -// XFAIL: no-selinux - -#include -#include -#include - -int main(int argc, char** argv) { - - security_context_t con; - - assert(argc == 2); - - int selinux = is_selinux_enabled(); - printf("selinux enabled = %d\n", selinux); - - if (setfscreatecon(argv[1]) < 0) - printf("Error: set\n"); - else printf("Success: set\n"); - - if (getfscreatecon(&con) < 0) - printf("Error: get\n"); - else printf("Success: get\n"); - - printf("create_con = %s\n", con); - - return 0; -} diff --git a/test/Runtime/POSIX/SELinux/SELinux.c b/test/Runtime/POSIX/SELinux/SELinux.c new file mode 100644 index 00000000..65dd1a7f --- /dev/null +++ b/test/Runtime/POSIX/SELinux/SELinux.c @@ -0,0 +1,30 @@ +/* Very basic test, as right now SELinux support is extremely basic */ +// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc +// RUN: %klee --posix-runtime --exit-on-error %t1.bc --sym-arg 2 > %t.log +// XFAIL: no-selinux + +#include +#include +#include + +int main(int argc, char** argv) { + + security_context_t con; + + assert(argc == 2); + + int selinux = is_selinux_enabled(); + printf("selinux enabled = %d\n", selinux); + + if (setfscreatecon(argv[1]) < 0) + printf("Error: set\n"); + else printf("Success: set\n"); + + if (getfscreatecon(&con) < 0) + printf("Error: get\n"); + else printf("Success: get\n"); + + printf("create_con = %s\n", con); + + return 0; +} diff --git a/test/Runtime/POSIX/SELinux/lit.local.cfg b/test/Runtime/POSIX/SELinux/lit.local.cfg new file mode 100644 index 00000000..2046d4d0 --- /dev/null +++ b/test/Runtime/POSIX/SELinux/lit.local.cfg @@ -0,0 +1,7 @@ +def getRoot(config): + if not config.parent: + return config + return getRoot(config.parent) + +if not getRoot(config).have_selinux: + config.unsupported = True diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 11159415..6fc3d49c 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -16,6 +16,7 @@ config.llvmgxx = "@LLVMCXX@" # Features config.enable_uclibc = True if @ENABLE_UCLIBC@ == 1 else False config.enable_posix_runtime = True if @ENABLE_POSIX_RUNTIME@ == 1 else False +config.have_selinux = True if @HAVE_SELINUX@ == 1 else False # Current target config.target_triple = "@TARGET_TRIPLE@" -- cgit 1.4.1 From aa9d6e30f6581f8b1a803e1e459a2ef3f3dbb697 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 18:10:54 +0000 Subject: Give absolute paths to KLEE's tools in lit.cfg . This fixes a long standing FIXME: --- test/lit.cfg | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/lit.cfg b/test/lit.cfg index 9344cae8..36a79b42 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -53,9 +53,11 @@ for name in subs: lit.fatal('{0} is not set'.format(name)) config.substitutions.append( ('%' + name, value)) -# FIXME: Give these proper paths. -config.substitutions.append(('%kleaver', 'kleaver')) -config.substitutions.append(('%klee', 'klee')) +# Set absolute paths for KLEE's tools +subs = [ ('%kleaver', 'kleaver'), ('%klee','klee') ] +for s,basename in subs: + config.substitutions.append( (s, os.path.join(klee_tools_dir, basename) ) ) + # LLVM < 3.0 doesn't Support %T directive if int(config.llvm_version_major) == 2: -- cgit 1.4.1 From 8a460a94c6a442e22187e8b5b3560bed34460f4b Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 18:30:12 +0000 Subject: Remove the last remnants (I think) of DejaGNU. Goodbye! Say hello to our new friend, llvm-lit :) --- autoconf/configure.ac | 5 -- autoconf/m4/path_tclsh.m4 | 39 --------- configure | 132 ------------------------------ test/CXX/dg.exp | 3 - test/Coverage/dg.exp | 3 - test/Dogfood/dg.exp | 3 - test/Expr/Lexer/dg.exp | 3 - test/Expr/Parser/dg.exp | 3 - test/Expr/dg.exp | 3 - test/Feature/dg.exp | 3 - test/Makefile | 66 ++------------- test/Programs/dg.exp | 3 - test/Runtime/POSIX/dg.exp | 5 -- test/Runtime/Uclibc/dg.exp | 5 -- test/Solver/dg.exp | 3 - test/TestRunner.sh | 37 +-------- test/lib/llvm.exp | 199 --------------------------------------------- test/regression/dg.exp | 3 - 18 files changed, 10 insertions(+), 508 deletions(-) delete mode 100644 autoconf/m4/path_tclsh.m4 delete mode 100644 test/CXX/dg.exp delete mode 100644 test/Coverage/dg.exp delete mode 100644 test/Dogfood/dg.exp delete mode 100644 test/Expr/Lexer/dg.exp delete mode 100644 test/Expr/Parser/dg.exp delete mode 100644 test/Expr/dg.exp delete mode 100644 test/Feature/dg.exp delete mode 100644 test/Programs/dg.exp delete mode 100644 test/Runtime/POSIX/dg.exp delete mode 100644 test/Runtime/Uclibc/dg.exp delete mode 100644 test/Solver/dg.exp delete mode 100644 test/lib/llvm.exp delete mode 100644 test/regression/dg.exp (limited to 'test') diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 5a47e924..af5affc0 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -564,11 +564,6 @@ else AC_SUBST(REQUIRES_RTTI,[[1]]) fi -dnl ************************************************************************** -dnl * Check for dejagnu -dnl ************************************************************************** -AC_PATH_PROG(RUNTEST, [runtest]) -DJ_AC_PATH_TCLSH dnl ************************************************************************** dnl * Create the output files diff --git a/autoconf/m4/path_tclsh.m4 b/autoconf/m4/path_tclsh.m4 deleted file mode 100644 index 85433de7..00000000 --- a/autoconf/m4/path_tclsh.m4 +++ /dev/null @@ -1,39 +0,0 @@ -dnl This macro checks for tclsh which is required to run dejagnu. On some -dnl platforms (notably FreeBSD), tclsh is named tclshX.Y - this handles -dnl that for us so we can get the latest installed tclsh version. -dnl -AC_DEFUN([DJ_AC_PATH_TCLSH], [ -no_itcl=true -AC_MSG_CHECKING(for the tclsh program in tclinclude directory) -AC_ARG_WITH(tclinclude, - AS_HELP_STRING([--with-tclinclude], - [directory where tcl headers are]), - [with_tclinclude=${withval}],[with_tclinclude='']) -AC_CACHE_VAL(ac_cv_path_tclsh,[ -dnl first check to see if --with-itclinclude was specified -if test x"${with_tclinclude}" != x ; then - if test -f ${with_tclinclude}/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}; pwd)` - elif test -f ${with_tclinclude}/src/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}/src; pwd)` - else - AC_MSG_ERROR([${with_tclinclude} directory doesn't contain tclsh]) - fi -fi]) - -dnl see if one is installed -if test x"${ac_cv_path_tclsh}" = x ; then - AC_MSG_RESULT(none) - AC_PATH_PROGS([TCLSH],[tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh]) - if test x"${TCLSH}" = x ; then - ac_cv_path_tclsh=''; - else - ac_cv_path_tclsh="${TCLSH}"; - fi -else - AC_MSG_RESULT(${ac_cv_path_tclsh}) - TCLSH="${ac_cv_path_tclsh}" - AC_SUBST(TCLSH) -fi -]) - diff --git a/configure b/configure index 85e7fec2..d343ac69 100755 --- a/configure +++ b/configure @@ -624,8 +624,6 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS -TCLSH -RUNTEST METASMT_ROOT ENABLE_METASMT STP_ROOT @@ -728,7 +726,6 @@ enable_posix_runtime with_runtime with_stp with_metasmt -with_tclinclude ' ac_precious_vars='build_alias host_alias @@ -1379,7 +1376,6 @@ Optional Packages: (default [Release+Asserts]) --with-stp Location of STP installation directory --with-metasmt Location of metaSMT installation directory - --with-tclinclude directory where tcl headers are Some influential environment variables: CC C compiler command @@ -4994,134 +4990,6 @@ $as_echo "#define SUPPORT_METASMT 1" >>confdefs.h fi -# Extract the first word of "runtest", so it can be a program name with args. -set dummy runtest; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_RUNTEST+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $RUNTEST in - [\\/]* | ?:[\\/]*) - ac_cv_path_RUNTEST="$RUNTEST" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_RUNTEST="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -RUNTEST=$ac_cv_path_RUNTEST -if test -n "$RUNTEST"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUNTEST" >&5 -$as_echo "$RUNTEST" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - -no_itcl=true -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the tclsh program in tclinclude directory" >&5 -$as_echo_n "checking for the tclsh program in tclinclude directory... " >&6; } - -# Check whether --with-tclinclude was given. -if test "${with_tclinclude+set}" = set; then : - withval=$with_tclinclude; with_tclinclude=${withval} -else - with_tclinclude='' -fi - -if ${ac_cv_path_tclsh+:} false; then : - $as_echo_n "(cached) " >&6 -else - -if test x"${with_tclinclude}" != x ; then - if test -f ${with_tclinclude}/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}; pwd)` - elif test -f ${with_tclinclude}/src/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}/src; pwd)` - else - as_fn_error $? "${with_tclinclude} directory doesn't contain tclsh" "$LINENO" 5 - fi -fi -fi - - -if test x"${ac_cv_path_tclsh}" = x ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } - for ac_prog in tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_TCLSH+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $TCLSH in - [\\/]* | ?:[\\/]*) - ac_cv_path_TCLSH="$TCLSH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_TCLSH="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -TCLSH=$ac_cv_path_TCLSH -if test -n "$TCLSH"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH" >&5 -$as_echo "$TCLSH" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$TCLSH" && break -done - - if test x"${TCLSH}" = x ; then - ac_cv_path_tclsh=''; - else - ac_cv_path_tclsh="${TCLSH}"; - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_path_tclsh}" >&5 -$as_echo "${ac_cv_path_tclsh}" >&6; } - TCLSH="${ac_cv_path_tclsh}" - -fi - ac_config_commands="$ac_config_commands Makefile" diff --git a/test/CXX/dg.exp b/test/CXX/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/CXX/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Coverage/dg.exp b/test/Coverage/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/Coverage/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Dogfood/dg.exp b/test/Dogfood/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/Dogfood/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Expr/Lexer/dg.exp b/test/Expr/Lexer/dg.exp deleted file mode 100644 index 94fc4df8..00000000 --- a/test/Expr/Lexer/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{pc}]] diff --git a/test/Expr/Parser/dg.exp b/test/Expr/Parser/dg.exp deleted file mode 100644 index 94fc4df8..00000000 --- a/test/Expr/Parser/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{pc}]] diff --git a/test/Expr/dg.exp b/test/Expr/dg.exp deleted file mode 100644 index 94fc4df8..00000000 --- a/test/Expr/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{pc}]] diff --git a/test/Feature/dg.exp b/test/Feature/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/Feature/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Makefile b/test/Makefile index 23c891e4..c27ffad3 100644 --- a/test/Makefile +++ b/test/Makefile @@ -11,7 +11,7 @@ LEVEL = .. DIRS = # -# Make Dejagnu the default for testing +# Make llvm-lit the default for testing # all:: check-local @@ -19,12 +19,12 @@ all:: check-local include Makefile.tests #===------------------------------------------------------------------------===# -# DejaGNU testing support +# llvm-lit testing support #===------------------------------------------------------------------------===# +ULIMIT = ulimit -t 600 ; ulimit -d 512000 ; # FIXME: Fix test suite so we can run lit in parallel. ifdef VERBOSE -RUNTESTFLAGS := $(VERBOSE) LIT_ARGS := -j1 -v else LIT_ARGS := -j1 -s -v @@ -32,25 +32,14 @@ endif ifdef TESTSUITE LIT_TESTSUITE := $(TESTSUITE) -CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE)) -CLEANED_TESTSUITE := $(patsubst test/%,%,$(CLEANED_TESTSUITE)) -RUNTESTFLAGS := --tool $(CLEANED_TESTSUITE) else LIT_TESTSUITE := . endif -ifneq ($(RUNTEST),) -check-local:: site.exp - ( ulimit -t 600 ; ulimit -d 512000 ; \ - PATH="$(ToolDir):$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \ - $(RUNTEST) $(RUNTESTFLAGS) ; \ - ! grep FAIL testrun.log; ! grep -q ^FAIL testrun.log; ) -else -check-local:: site.exp - @echo "*** dejagnu not found. Make sure runtest is in your PATH, then reconfigure llvm." -endif +# Potential support in the future for multiple test suites +LIT_ALL_TESTSUITES := $(LIT_TESTSUITE) -check-local-lit:: lit.site.cfg +check-local:: lit.site.cfg # FIXME: Detect python at configure time ( $(ULIMIT) \ python2 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) @@ -58,26 +47,7 @@ check-local-lit:: lit.site.cfg check-local-all:: lit.site.cfg # FIXME: Detect python at configure time ( $(ULIMIT) \ - python2 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) - -ifdef TESTONE -CLEANED_TESTONE := $(patsubst %/,%,$(TESTONE)) -CLEANED_TESTONE := $(patsubst test/%,%,$(CLEANED_TESTONE)) -SUBDIR := $(shell dirname $(CLEANED_TESTONE)) -TESTPATH := $(PROJ_SRC_ROOT)/test/$(CLEANED_TESTONE) -check-one: site.exp $(TCLSH) - $(Verb)( echo "source $(PROJ_OBJ_ROOT)/test/site.exp" ; \ - echo "set subdir $(SUBDIR)" ; \ - echo "proc pass { msg } { puts \"PASS: \$$msg\" } "; \ - echo "proc fail { msg } { puts \"FAIL: \$$msg\" }" ; \ - echo "proc xfail { msg } { puts \"XFAIL: \$$msg\" }" ; \ - echo "proc xpass { msg } { puts \"XPASS: \$$msg\" }" ; \ - echo "source $(PROJ_SRC_ROOT)/test/lib/llvm.exp" ; \ - echo "RunLLVMTests $(TESTPATH)" ) | \ - ( ulimit -t 600 ; ulimit -d 512000 ; \ - PATH="$(ToolDir):$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \ - $(TCLSH) ) -endif + python2 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) ) clean:: $(RM) -rf `find $(PROJ_OBJ_ROOT)/test -name Output -type d -print` @@ -89,28 +59,6 @@ clean:: $(RM) -rf `find $(PROJ_OBJ_ROOT)/test -name test.log` rm -f site.exp -site.exp: Makefile $(LEVEL)/Makefile.config - @echo 'Making a new site.exp file...' - @echo '## these variables are automatically generated by make ##' >site.tmp - @echo '# Do not edit here. If you wish to override these values' >>site.tmp - @echo '# edit the last section' >>site.tmp - @echo 'set target_triplet "$(TARGET_TRIPLE)"' >> site.tmp - @echo 'set ENABLE_UCLIBC "$(ENABLE_UCLIBC)"' >> site.tmp - @echo 'set ENABLE_POSIX_RUNTIME "$(ENABLE_POSIX_RUNTIME)"' >> site.tmp - @echo 'set TEST_FEATURE_LIST "$(TEST_FEATURE_LIST)"' >> site.tmp - @echo 'set srcroot "$(PROJ_SRC_ROOT)"' >>site.tmp - @echo 'set objroot "$(PROJ_OBJ_ROOT)"' >>site.tmp - @echo 'set srcdir "$(PROJ_SRC_ROOT)/test"' >>site.tmp - @echo 'set objdir "$(PROJ_OBJ_ROOT)/test"' >>site.tmp - @echo 'set llvmgcc "$(LLVMCC) -I$(PROJ_SRC_ROOT)/include"' >> site.tmp - @echo 'set llvmgxx "$(LLVMCXX) -I$(PROJ_SRC_ROOT)/include"' >> site.tmp - @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp - @test ! -f site.exp || \ - sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp - @-rm -f site.bak - @test ! -f site.exp || mv site.exp site.bak - @mv site.tmp site.exp - lit.site.cfg: lit.site.cfg.in @echo "Making KLEE 'lit.site.cfg' file..." @sed -e "s#@KLEE_SOURCE_DIR@#$(PROJ_SRC_ROOT)#g" \ diff --git a/test/Programs/dg.exp b/test/Programs/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/Programs/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Runtime/POSIX/dg.exp b/test/Runtime/POSIX/dg.exp deleted file mode 100644 index 88406208..00000000 --- a/test/Runtime/POSIX/dg.exp +++ /dev/null @@ -1,5 +0,0 @@ -load_lib llvm.exp - -if { [klee_supports_posix_runtime] } { - RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] -} diff --git a/test/Runtime/Uclibc/dg.exp b/test/Runtime/Uclibc/dg.exp deleted file mode 100644 index 9c1663c3..00000000 --- a/test/Runtime/Uclibc/dg.exp +++ /dev/null @@ -1,5 +0,0 @@ -load_lib llvm.exp - -if { [klee_supports_uclibc] } { - RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] -} diff --git a/test/Solver/dg.exp b/test/Solver/dg.exp deleted file mode 100644 index 94fc4df8..00000000 --- a/test/Solver/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{pc}]] diff --git a/test/TestRunner.sh b/test/TestRunner.sh index 3e2cace4..ab50856a 100755 --- a/test/TestRunner.sh +++ b/test/TestRunner.sh @@ -1,36 +1,5 @@ #!/bin/sh -# -# TestRunner.sh - This script is used to run the deja-gnu tests exactly like -# deja-gnu does, by executing the Tcl script specified in the test case's -# RUN: lines. This is made possible by a simple make target supported by the -# test/Makefile. All this script does is invoke that make target. -# -# Usage: -# TestRunner.sh {script_names} -# -# This script is typically used by cd'ing to a test directory and then -# running TestRunner.sh with a list of test file names you want to run. -# -TESTPATH=`pwd` -SUBDIR="" -if test `dirname $1` = "." ; then - while test `basename $TESTPATH` != "test" -a ! -z "$TESTPATH" ; do - tmp=`basename $TESTPATH` - SUBDIR="$tmp/$SUBDIR" - TESTPATH=`dirname $TESTPATH` - done -fi +# Deprecated, use 'llvm-lit'. -for TESTFILE in "$@" ; do - if test `dirname $TESTFILE` = . ; then - if test -d "$TESTPATH" ; then - cd $TESTPATH - make check-one TESTONE="$SUBDIR$TESTFILE" - cd $PWD - else - echo "Can't find klee/test directory in " `pwd` - fi - else - make check-one TESTONE=$TESTFILE - fi -done +echo "warning: '$0' is deprecated, use 'llvm-lit' instead." +exec llvm-lit "$@" diff --git a/test/lib/llvm.exp b/test/lib/llvm.exp deleted file mode 100644 index ce52c4b5..00000000 --- a/test/lib/llvm.exp +++ /dev/null @@ -1,199 +0,0 @@ -# This procedure executes one line of a test case's execution script. -proc execOneLine { test PRS outcome lineno line } { - set status 0 - set resultmsg "" - set retval [ catch { eval exec -keepnewline -- $line } errmsg ] - if { $retval != 0 } { - set code [lindex $::errorCode 0] - set lineno [expr $lineno + 1] - if { $PRS != ""} { - set PRS " for $PRS" - } - set errmsg " at line $lineno\nwhile running: $line\n$errmsg" - switch "$code" { - CHILDSTATUS { - set status [lindex $::errorCode 2] - if { $status != 0 } { - set resultmsg "$test$PRS\nFailed with exit($status)$errmsg" - } - } - CHILDKILLED { - set signal [lindex $::errorCode 2] - set resultmsg "$test$PRS\nFailed with signal($signal)$errmsg" - } - CHILDSUSP { - set signal [lindex $::errorCode 2] - set resultmsg "$test$PRS\nFailed with suspend($signal)$errmsg" - } - POSIX { - set posixNum [lindex $::errorCode 1] - set posixMsg [lindex $::errorCode 2] - set resultmsg "$test$PRS\nFailed with posix($posixNum,$posixMsg)$errmsg" - } - NONE { - } - default { - } - } - } - return $resultmsg -} - -# This procedure performs variable substitutions on the RUN: lines of a test -# cases. -proc substitute { line test tmpFile } { - global srcroot objroot srcdir objdir subdir target_triplet - global llvmgcc llvmgxx llvmgcc_version - set path [file join $srcdir $subdir] - - # Substitute all Tcl variables. - set new_line [subst $line ] - - #replace %llvmgcc with actual path to llvmgcc - regsub -all {%llvmgcc} $new_line "$llvmgcc -emit-llvm" new_line - #replace %llvmgxx with actual path to llvmg++ - regsub -all {%llvmgxx} $new_line "$llvmgxx -emit-llvm" new_line - #replace %klee with klee binary - regsub -all {%klee} $new_line "klee" new_line - #replace %kleaver with kleaver binary - regsub -all {%kleaver} $new_line "kleaver" new_line - #replace %p with path to source, - regsub -all {%p} $new_line [file join $srcdir $subdir] new_line - #replace %s with filename - regsub -all {%s} $new_line $test new_line - #replace %t with temp filenames - regsub -all {%t} $new_line $tmpFile new_line - #replace %% with % - regsub -all {%%} $new_line % new_line - return $new_line -} - -# This procedure runs the set of tests for the test_source_files array. -proc RunLLVMTests { test_source_files } { - global srcroot objroot srcdir objdir subdir TEST_FEATURE_LIST target_triplet - set timeout 60 - - set path [file join $objdir $subdir] - - #Make Output Directory if it does not exist already - if { [file exists path] } { - cd $path - } else { - file mkdir $path - cd $path - } - - file mkdir Output - cd Output - - foreach test $test_source_files { - #Should figure out best way to set the timeout - #set timeout 40 - - set filename [file tail $test] - set outcome PASS - set tmpFile "$filename.tmp" - - #set hasRunline bool to check if testcase has a runline - set numLines 0 - - # Open the test file and start reading lines - set testFileId [ open $test r] - set runline "" - set PRNUMS "" - foreach line [split [read $testFileId] \n] { - - # if its the END. line then stop parsing (optimization for big files) - if {[regexp {END.[ *]$} $line match endofscript]} { - break - - # if the line is continued, concatenate and continue the loop - } elseif {[regexp {RUN: *(.+)(\\)$} $line match oneline suffix]} { - set runline "$runline$oneline " - - # if its a terminating RUN: line then do substitution on the whole line - # and then save the line. - } elseif {[regexp {RUN: *([^&]+)(&&)?} $line match oneline suffix]} { - set runline "$runline$oneline" - set runline [ substitute $runline $test $tmpFile ] - set lines($numLines) $runline - set numLines [expr $numLines + 1] - set runline "" - - # if its an PR line, save the problem report number - } elseif {[regexp {PR([0-9]+)} $line match prnum]} { - if {$PRNUMS == ""} { - set PRNUMS "PR$prnum" - } else { - set PRNUMS "$PRNUMS,$prnum" - } - # if its an XFAIL line, see if we should be XFAILing or not. - } elseif {[regexp {XFAIL:[ *](.+)} $line match features]} { - set features - - foreach feature [split $features ,] { - if { [regexp {\*} $feature match] } { - set outcome XFAIL - } elseif { [regexp $feature $target_triplet match] } { - set outcome XFAIL - } elseif { [regexp $feature $TEST_FEATURE_LIST match] } { - set outcome XFAIL - } - } - } - } - - # Done reading the script - close $testFileId - - - if { $numLines == 0 } { - fail "$test: \nDoes not have a RUN line\n" - } else { - set failed 0 - for { set i 0 } { $i < $numLines } { set i [ expr $i + 1 ] } { - regsub ^.*RUN:(.*) $lines($i) \1 theLine - set resultmsg [execOneLine $test $PRNUMS $outcome $i $theLine ] - if { $resultmsg != "" } { - if { $outcome == "XFAIL" } { - xfail "$resultmsg" - } else { - fail "$resultmsg" - } - set failed 1 - break - } - } - if { $failed } { - continue - } else { - if { $PRNUMS != "" } { - set PRNUMS " for $PRNUMS" - } - if { $outcome == "XFAIL" } { - xpass "$test$PRNUMS" - } else { - pass "$test$PRNUMS" - } - } - } - } -} - -# Check if klee was configured with POSIX runtime support. -proc klee_supports_posix_runtime { } { - global ENABLE_POSIX_RUNTIME - if { $ENABLE_POSIX_RUNTIME == "1" } { - return 1 - } - return 0 -} - -# Check if klee was configured with uclibc support. -proc klee_supports_uclibc { } { - global ENABLE_UCLIBC - if { $ENABLE_UCLIBC == "1" } { - return 1 - } - return 0 -} diff --git a/test/regression/dg.exp b/test/regression/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/regression/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] -- cgit 1.4.1 From b58f5e78a9f3c161f7c8589bf5430a36ee33baf6 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 18:53:06 +0000 Subject: Partially fix python detection for running llvm-lit. The problem is newer LLVM versions (e.g. 3.3) detect python at their configure time whereas older versions don't (i.e. 2.9). So I don't want to add python detection to KLEE's configure if LLVM already does the work for us. We need to move off llvm 2.9 anyway. --- test/Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index c27ffad3..a60c82cb 100644 --- a/test/Makefile +++ b/test/Makefile @@ -36,18 +36,23 @@ else LIT_TESTSUITE := . endif +# Older LLVM versions don't detect python at configure time +# so guess the location +ifndef PYTHON + # llvm-lit doesn't work with python3 so force python2 + PYTHON := python2 +endif + # Potential support in the future for multiple test suites LIT_ALL_TESTSUITES := $(LIT_TESTSUITE) check-local:: lit.site.cfg - # FIXME: Detect python at configure time ( $(ULIMIT) \ - python2 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) + $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) check-local-all:: lit.site.cfg - # FIXME: Detect python at configure time ( $(ULIMIT) \ - python2 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) ) + $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) ) clean:: $(RM) -rf `find $(PROJ_OBJ_ROOT)/test -name Output -type d -print` -- cgit 1.4.1 From e2f56b6bbb4bee1d1384b2b23930e108449d30b2 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 18:58:14 +0000 Subject: Only run klee-uclibc tests if KLEE was configured with klee-uclibc support. --- test/Runtime/Uclibc/lit.local.cfg | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test/Runtime/Uclibc/lit.local.cfg (limited to 'test') diff --git a/test/Runtime/Uclibc/lit.local.cfg b/test/Runtime/Uclibc/lit.local.cfg new file mode 100644 index 00000000..c9944834 --- /dev/null +++ b/test/Runtime/Uclibc/lit.local.cfg @@ -0,0 +1,7 @@ +def getRoot(config): + if not config.parent: + return config + return getRoot(config.parent) + +if not getRoot(config).enable_uclibc: + config.unsupported = True -- cgit 1.4.1 From 54b5b1d8fc99376fccbbcb471825012dfa1e4017 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 14 Jan 2014 18:06:52 +0000 Subject: Fixed test cases that fail if using an in-source build --- test/Coverage/ReadArgs.c | 6 +++--- test/regression/2007-08-01-bool-zext-in-call.ll | 11 +++++++++-- test/regression/2007-10-12-failed-make-symbolic-after-copy.c | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/Coverage/ReadArgs.c b/test/Coverage/ReadArgs.c index 7ebf056e..ddfb1747 100644 --- a/test/Coverage/ReadArgs.c +++ b/test/Coverage/ReadArgs.c @@ -1,8 +1,8 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: rm -rf xxx -// RUN: echo " --output-dir=xxx " > %t1.args +// RUN: rm -rf %T/xxx +// RUN: echo " --output-dir=%T/xxx " > %t1.args // RUN: %klee --read-args %t1.args %t1.bc -// RUN: test -d xxx +// RUN: test -d %T/xxx int main() { return 0; diff --git a/test/regression/2007-08-01-bool-zext-in-call.ll b/test/regression/2007-08-01-bool-zext-in-call.ll index d10a41ef..fc77785d 100644 --- a/test/regression/2007-08-01-bool-zext-in-call.ll +++ b/test/regression/2007-08-01-bool-zext-in-call.ll @@ -1,5 +1,12 @@ -; RUN: llvm-as -f %s -o - | %klee 2> %t1.log -; RUN: not test -f klee-last/test0001.abort.err +; RUN: rm -rf %T/xxx +; +; The output directory must be explicitly set so that it ends up in the Output/ +; directory which is not scanned for .ll files by llvm-lit, otherwise running +; test suite a second time will cause problems because assembly.ll generated by +; executing this test case the first time will be detected as a test case. +; +; RUN: llvm-as -f %s -o - | %klee --output-dir=%T/xxx +; RUN: not test -f %T/xxx/klee-last/test0001.abort.err declare void @klee_abort() diff --git a/test/regression/2007-10-12-failed-make-symbolic-after-copy.c b/test/regression/2007-10-12-failed-make-symbolic-after-copy.c index e9a280c3..bfe61f2c 100644 --- a/test/regression/2007-10-12-failed-make-symbolic-after-copy.c +++ b/test/regression/2007-10-12-failed-make-symbolic-after-copy.c @@ -1,6 +1,6 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ktest +// RUN: test -f %T/klee-last/test000001.ktest int main() { unsigned x, y[4]; -- cgit 1.4.1 From c2a8ad5bacc783be5d64e07a3e4b327e18cc09be Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 14 Jan 2014 18:10:21 +0000 Subject: Explicitly use only one thread when invoking llvm-lit in TestRunner.sh We need to fix the test suite so we can run it in parallel. --- test/TestRunner.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/TestRunner.sh b/test/TestRunner.sh index ab50856a..3a69604b 100755 --- a/test/TestRunner.sh +++ b/test/TestRunner.sh @@ -2,4 +2,5 @@ # Deprecated, use 'llvm-lit'. echo "warning: '$0' is deprecated, use 'llvm-lit' instead." -exec llvm-lit "$@" +# FIXME: Make test suite work in parallel. +exec llvm-lit --threads=1 "$@" -- cgit 1.4.1 From ebc387f1181ca39cd72fe8ef27a535cd0c674bcf Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 20 Jan 2014 18:25:35 +0000 Subject: Hide make check command unless using VERBOSE make variable. e.g. $ make check VERBOSE=1 # Shows command and shows more detail $ make check # Does not show command and shows summary --- test/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index a60c82cb..61a91800 100644 --- a/test/Makefile +++ b/test/Makefile @@ -47,12 +47,12 @@ endif LIT_ALL_TESTSUITES := $(LIT_TESTSUITE) check-local:: lit.site.cfg - ( $(ULIMIT) \ - $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) + $(Verb) ( $(ULIMIT) \ + $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) check-local-all:: lit.site.cfg - ( $(ULIMIT) \ - $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) ) + $(Verb) ( $(ULIMIT) \ + $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) ) clean:: $(RM) -rf `find $(PROJ_OBJ_ROOT)/test -name Output -type d -print` -- cgit 1.4.1