Skip to content

Commit

Permalink
x86: Add an integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
chameco committed Mar 1, 2021
1 parent 67322ea commit 2caad31
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
Binary file added intTests/test_llvm_x86_07/test
Binary file not shown.
10 changes: 10 additions & 0 deletions intTests/test_llvm_x86_07/test.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
section .bss
section .text
global precondtest
precondtest:
mov rax, rdi
ret
global _start
_start:
mov rax, 60
syscall
8 changes: 8 additions & 0 deletions intTests/test_llvm_x86_07/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdint.h>
#include <stdio.h>

extern uint64_t precondtest(uint64_t x);

void test() {
precondtest(1);
};
14 changes: 14 additions & 0 deletions intTests/test_llvm_x86_07/test.saw
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
enable_experimental;

m <- llvm_load_module "test.bc";

let precondtest_setup = do {
x <- crucible_fresh_var "x" (llvm_int 64);
crucible_precond {{ x < 10 }};
llvm_execute_func [crucible_term x];
x' <- crucible_fresh_var "x'" (llvm_int 64);
crucible_return (crucible_term x');
crucible_postcond {{ x' < 10 }};
};

llvm_verify_x86 m "./test" "precondtest" [] false precondtest_setup w4;
7 changes: 7 additions & 0 deletions intTests/test_llvm_x86_07/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e

# yasm -felf64 test.S
# ld test.o -o test
clang -c -emit-llvm test.c
$SAW test.saw

0 comments on commit 2caad31

Please sign in to comment.