Skip to content

Commit 2caad31

Browse files
committed
x86: Add an integration test
1 parent 67322ea commit 2caad31

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

intTests/test_llvm_x86_07/test

4.59 KB
Binary file not shown.

intTests/test_llvm_x86_07/test.S

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
section .bss
2+
section .text
3+
global precondtest
4+
precondtest:
5+
mov rax, rdi
6+
ret
7+
global _start
8+
_start:
9+
mov rax, 60
10+
syscall

intTests/test_llvm_x86_07/test.c

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <stdint.h>
2+
#include <stdio.h>
3+
4+
extern uint64_t precondtest(uint64_t x);
5+
6+
void test() {
7+
precondtest(1);
8+
};

intTests/test_llvm_x86_07/test.saw

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
enable_experimental;
2+
3+
m <- llvm_load_module "test.bc";
4+
5+
let precondtest_setup = do {
6+
x <- crucible_fresh_var "x" (llvm_int 64);
7+
crucible_precond {{ x < 10 }};
8+
llvm_execute_func [crucible_term x];
9+
x' <- crucible_fresh_var "x'" (llvm_int 64);
10+
crucible_return (crucible_term x');
11+
crucible_postcond {{ x' < 10 }};
12+
};
13+
14+
llvm_verify_x86 m "./test" "precondtest" [] false precondtest_setup w4;

intTests/test_llvm_x86_07/test.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# yasm -felf64 test.S
5+
# ld test.o -o test
6+
clang -c -emit-llvm test.c
7+
$SAW test.saw

0 commit comments

Comments
 (0)