Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Crux-llvm testing #618

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crux-llvm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/test-data/golden/*.print_out
results
2 changes: 1 addition & 1 deletion crux-llvm/crux-llvm.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ test-suite crux-llvm-test
QuickCheck,
tasty >= 0.10,
tasty-hunit >= 0.10,
tasty-golden >= 2.3,
tasty-sugar > 1.0.1.0,
text,
what4

Expand Down
Empty file.
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions crux-llvm/test-data/golden/funnel.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] user error (STP is not configured to produce UNSAT cores)
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funnel.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
23 changes: 23 additions & 0 deletions crux-llvm/test-data/golden/funptr-array.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* See https://github.com/GaloisInc/crucible/issues/10 */

#include <crucible.h>

typedef int int_function(int);

int succ(int x) { return x+1; }
int pred(int x) { return x-1; }

int mytestfunction(int i, int j) {
int_function *funs[] = { succ, pred };
return funs[i](j);
}

int main() {
int arg = __VERIFIER_nondet_int();
int v = __VERIFIER_nondet_int();
int r;
assuming(arg >= 0 && arg <= 1);
r = mytestfunction(arg, v);
check (r == v + 1);
return 0;
}
36 changes: 36 additions & 0 deletions crux-llvm/test-data/golden/funptr-array.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[Crux] Counter example for /home/kquick/work/crux-sugar/crux-llvm/test-data/golden/funptr-array.c:12:12: error: in mytestfunction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be part of the file, given it has paths from your env in it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I'm working on that right now. The input is a relative path, but somewhere it's getting the fully-rooted path, which isn't good for several reasons. Thanks for catching this!

Failed to load function handle
Details:
Cannot resolve a symbolic pointer to a function handle: (ite (eq 0x0:[64] (bvSum (bvMul 0x8:[64] (bvSext 64 cX@9:bv)))) 6 7, 0x0:[64])
[Crux] Found counterexample for verification goal
/home/kquick/work/crux-sugar/crux-llvm/test-data/golden/funptr-array.c:12:12: error: in mytestfunction
Failed to load function handle
Details:
Cannot resolve a symbolic pointer to a function handle: (ite (eq 0x0:[64] (bvSum (bvMul 0x8:[64] (bvSext 64 cX@9:bv)))) 6 7, 0x0:[64])
The given pointer could not be resolved to a callable function
Cannot resolve a symbolic pointer to a function handle: (ite (eq 0x0:[64] (bvSum (bvMul 0x8:[64] (bvSext 64 cX@9:bv)))) 6 7, 0x0:[64])
Attempting to load callable function with type: i32(i32)
Via pointer: (6, 0x0:[64])
In memory state:
Stack frame mytestfunction
No writes or allocations
Stack frame main
No writes or allocations
Base memory
Allocations:
GlobalAlloc 11 0x20:[64] Immutable 1-byte-aligned [global variable ] .str
GlobalAlloc 10 0x10:[64] Immutable 16-byte-aligned [global variable ] __const.mytestfunction.funs
GlobalAlloc 9 0x0:[64] Immutable 1-byte-aligned [defined function ] main
GlobalAlloc 8 0x0:[64] Immutable 1-byte-aligned [defined function ] mytestfunction
GlobalAlloc 7 0x0:[64] Immutable 1-byte-aligned [defined function ] pred
GlobalAlloc 6 0x0:[64] Immutable 1-byte-aligned [defined function ] succ
GlobalAlloc 5 0x0:[64] Immutable 1-byte-aligned [external function] crucible_assert
GlobalAlloc 4 0x0:[64] Immutable 1-byte-aligned [external function] crucible_assume
GlobalAlloc 3 0x0:[64] Immutable 1-byte-aligned [external function] __VERIFIER_nondet_int
GlobalAlloc 2 0x0:[64] Immutable 1-byte-aligned [external function] llvm.dbg.declare
GlobalAlloc 1 0x0:[64] Immutable 1-byte-aligned [external function] llvm.dbg.value
Writes:
Indexed chunk:
10 |-> *(10, 0x0:[64]) := [(6, 0x0:[64]),(7, 0x0:[64])]
11 |-> *(11, 0x0:[64]) := "test-data/golden/funptr-array.c\NUL"
[Crux] Overall status: Invalid.
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr-array.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with non-zero result: "1"
2 changes: 2 additions & 0 deletions crux-llvm/test-data/golden/funptr-array.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] user error (STP is not configured to produce UNSAT cores)
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr-array.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
22 changes: 22 additions & 0 deletions crux-llvm/test-data/golden/funptr-fiddle.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <crucible.h>

int f(void) {
return 42;
}

unsigned long int g(void) {
return 99;
}

unsigned long int sel(int a) {
if (a < 10)
return (unsigned long int)(&f) + 1;
return (unsigned long int)(&g) + 0;
}

int main() {
int arg = 3;
int (*fptr)(void) = sel(arg);
check (fptr() == 42);
return 0;
}
16 changes: 16 additions & 0 deletions crux-llvm/test-data/golden/funptr-fiddle.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Crux] Counter example for /home/kquick/work/crux-sugar/crux-llvm/test-data/golden/funptr-fiddle.c:0:0: error: in sel
Undefined behavior encountered
Details:
Addition of an offset to a pointer resulted in a pointer to an address outside of the allocation
[Crux] Found counterexample for verification goal
/home/kquick/work/crux-sugar/crux-llvm/test-data/golden/funptr-fiddle.c:0:0: error: in sel
Undefined behavior encountered
Details:
Addition of an offset to a pointer resulted in a pointer to an address outside of the allocation
Pointer: (3, 0x0:[64])
Offset: 0x1:[64]
Reference:
The C language standard, version C11
§6.5.6 Additive operators, ¶8
Document URL: http://www.iso-9899.info/n1570.html
[Crux] Overall status: Invalid.
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr-fiddle.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with non-zero result: "1"
2 changes: 2 additions & 0 deletions crux-llvm/test-data/golden/funptr-fiddle.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] user error (STP is not configured to produce UNSAT cores)
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr-fiddle.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
22 changes: 22 additions & 0 deletions crux-llvm/test-data/golden/funptr-fiddle2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <crucible.h>

int f(void) {
return 42;
}

unsigned long int g(void) {
return 99;
}

unsigned long int sel(int a) {
if (a < 10)
return (unsigned long int)(&f) + 1 - 1;
return (unsigned long int)(&g) + 0;
}

int main() {
int arg = 3;
int (*fptr)(void) = sel(arg);
check ((fptr)() == 42);
return 0;
}
11 changes: 11 additions & 0 deletions crux-llvm/test-data/golden/funptr-fiddle2.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Crux] Counter example for /home/kquick/work/crux-sugar/crux-llvm/test-data/golden/funptr-fiddle2.c:0:0: error: in sel
Error translating constant
Illegal operation applied to pointer argument

[Crux] Found counterexample for verification goal
/home/kquick/work/crux-sugar/crux-llvm/test-data/golden/funptr-fiddle2.c:0:0: error: in sel
Error translating constant
Illegal operation applied to pointer argument


[Crux] Overall status: Invalid.
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr-fiddle2.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with non-zero result: "1"
2 changes: 2 additions & 0 deletions crux-llvm/test-data/golden/funptr-fiddle2.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] user error (STP is not configured to produce UNSAT cores)
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr-fiddle2.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
22 changes: 22 additions & 0 deletions crux-llvm/test-data/golden/funptr-fiddle3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <crucible.h>

int f(void) {
return 42;
}

unsigned long int g(void) {
return 99;
}

unsigned long int sel(int a) {
if (a < 10)
return (unsigned long int)(&f) + 0;
return (unsigned long int)(&g) + 0;
}

int main() {
int arg = 3;
int (*fptr)(void) = sel(arg);
check ((fptr)() == 42);
return 0;
}
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr-fiddle3.good
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Crux] Overall status: Valid.
Empty file.
2 changes: 2 additions & 0 deletions crux-llvm/test-data/golden/funptr-fiddle3.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] user error (STP is not configured to produce UNSAT cores)
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr-fiddle3.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
22 changes: 22 additions & 0 deletions crux-llvm/test-data/golden/funptr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <crucible.h>

int f(void) {
return 42;
}

int g(void) {
return 99;
}

unsigned long int sel(int a) {
if (a < 10)
return (unsigned long int)(&f);
return (unsigned long int)(&g);
}

int main() {
int arg = 3;
int (*fptr)(void) = sel(arg);
check (fptr() == 42);
return 0;
}
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr.good
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Crux] Overall status: Valid.
Empty file.
2 changes: 2 additions & 0 deletions crux-llvm/test-data/golden/funptr.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] user error (STP is not configured to produce UNSAT cores)
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/funptr.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
3 changes: 3 additions & 0 deletions crux-llvm/test-data/golden/gcd-test.boolector.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Crux] user error (Invalid solver configuration:
boolector is not a valid online solver (expected yices, cvc4, z3, or stp)
)
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/gcd-test.boolector.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
Empty file.
16 changes: 16 additions & 0 deletions crux-llvm/test-data/golden/gcd-test.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Crux] Goal timeout requested but not supported by STP
depth = 0
depth = 1
depth = 2
depth = 3
depth = 4
depth = 5
depth = 6
depth = 7
depth = 8
depth = 9
depth = 10
depth = 11
depth = 12
????
[Crux] user error (STP is not configured to produce UNSAT cores)
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/gcd-test.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
Empty file.
3 changes: 3 additions & 0 deletions crux-llvm/test-data/golden/hello.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Crux] Goal timeout requested but not supported by STP
Hello, world
[Crux] Overall status: Valid.
Empty file.
3 changes: 3 additions & 0 deletions crux-llvm/test-data/golden/hello2.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Crux] Goal timeout requested but not supported by STP
Hello again, world
[Crux] Overall status: Valid.
Empty file.
7 changes: 7 additions & 0 deletions crux-llvm/test-data/golden/printing.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Crux] Goal timeout requested but not supported by STP
44
4294967252
2c
2C
--------------------------
[Crux] Overall status: Valid.
Empty file.
4 changes: 4 additions & 0 deletions crux-llvm/test-data/golden/string.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] SMTLIB backend does not support function types as first class.
CallStack (from HasCallStack):
error, called at src/What4/Protocol/SMTLib2.hs:369:3 in what4-1.0.0.0.99-inplace:What4.Protocol.SMTLib2
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/string.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
Empty file.
4 changes: 4 additions & 0 deletions crux-llvm/test-data/golden/string2.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] SMTLIB backend does not support function types as first class.
CallStack (from HasCallStack):
error, called at src/What4/Protocol/SMTLib2.hs:369:3 in what4-1.0.0.0.99-inplace:What4.Protocol.SMTLib2
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/string2.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
Empty file.
2 changes: 2 additions & 0 deletions crux-llvm/test-data/golden/strlen_test.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] user error (STP is not configured to produce UNSAT cores)
1 change: 1 addition & 0 deletions crux-llvm/test-data/golden/strlen_test.stp.print
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*** Crux failed with exception: "ExitFailure 1"
29 changes: 29 additions & 0 deletions crux-llvm/test-data/golden/strlen_test2.cvc4.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
i = 0
string[(length - i) - 1] = ????
i = 1
string[(length - i) - 1] = ????
i = 2
string[(length - i) - 1] = ????
i = 3
string[(length - i) - 1] = ????
i = 4
string[(length - i) - 1] = ????
i = 5
string[(length - i) - 1] = ????
i = 6
string[(length - i) - 1] = ????
i = 7
string[(length - i) - 1] = ????
i = 8
string[(length - i) - 1] = ????
i = 9
string[(length - i) - 1] = ????
i = 10
string[(length - i) - 1] = ????
i = 11
string[(length - i) - 1] = ????
i = 12
string[(length - i) - 1] = ????
i = 13
string[(length - i) - 1] = ????
[Crux] Overall status: Valid.
Empty file.
29 changes: 29 additions & 0 deletions crux-llvm/test-data/golden/strlen_test2.z3.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
i = 0
string[(length - i) - 1] = ????
i = 1
string[(length - i) - 1] = ????
i = 2
string[(length - i) - 1] = ????
i = 3
string[(length - i) - 1] = ????
i = 4
string[(length - i) - 1] = ????
i = 5
string[(length - i) - 1] = ????
i = 6
string[(length - i) - 1] = ????
i = 7
string[(length - i) - 1] = ????
i = 8
string[(length - i) - 1] = ????
i = 9
string[(length - i) - 1] = ????
i = 10
string[(length - i) - 1] = ????
i = 11
string[(length - i) - 1] = ????
i = 12
string[(length - i) - 1] = ????
i = 13
string[(length - i) - 1] = ????
[Crux] Overall status: Valid.
Empty file.
6 changes: 6 additions & 0 deletions crux-llvm/test-data/golden/uint-cast.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Crux] Goal timeout requested but not supported by STP
bvZext 32 (bvSelect 0 8 cX@3:bv)
bvZext 32 (bvSelect 8 8 cX@3:bv)
bvZext 32 (bvSelect 16 8 cX@3:bv)
bvZext 32 (bvSelect 24 8 cX@3:bv)
[Crux] Overall status: Valid.
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions crux-llvm/test-data/golden/vector-gep.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Crux] Goal timeout requested but not supported by STP
[Crux] Overall status: Valid.
Empty file.
3 changes: 3 additions & 0 deletions crux-llvm/test-data/golden/vector-select.stp.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Crux] Goal timeout requested but not supported by STP
0x1:[32]
[Crux] Overall status: Valid.
Loading