diff --git a/.gitignore b/.gitignore index 28f4043337d84131500d1cd0b522b05ae1298048..560bf16d7a7857cceeab9099dc33028b0f0662de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ **/*.rs.bk .#* -target \ No newline at end of file +target +*.swp +tags diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..5995c8613b28f8a6d662cf47dd75b32abc5a5557 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,51 @@ +#.cargo_test_template: &cargo_test + #stage: test + #script: + #- ./run-cargo.sh + #- ls -lR + #- ./klee.sh + +#nightly:cargo: + #image: afoht/llvm4-klee-rust + #<<: *cargo_test + +stages: + - deploy + #- test + +# Setup the rust environment +#before_script: + #- pacman -Sy tree + #- apt-get update -yqq + #- apt-get install -yqq --no-install-recommends build-essential + ## Must be outside the project folder + #- cd / + #- cargo install cargo + ## Return + #- cd - + ##- rustup toolchain remove nightly + ##- rustup toolchain install nightly + #- rustup default nightly + #- rustup target add arm-unknown-linux-gnueabihf + #- rustup target add arm-unknown-linux-gnueabi + #- rustup target add armv7-unknown-linux-gnueabihf + #- rustup component add rust-src + #- rustup update + + +# Generate documentation +pages: + image: rustdocker/rust:nightly + stage: deploy + only: + - master + script: + - rm -rf public + - mkdir public + - cd cargo-klee + - cargo doc --no-deps + # The content inside the target doc folder, but index even deeper down + - cp -R target/doc/* ../public + artifacts: + paths: + - public diff --git a/klee-examples/Cargo.toml b/klee-examples/Cargo.toml index 7b3ded6e2b4c9210fa345ff6d26d827af6bf55f9..205a70953f5e544a03068afaaabebba8b9be5807 100644 --- a/klee-examples/Cargo.toml +++ b/klee-examples/Cargo.toml @@ -5,6 +5,7 @@ authors = ["Jorge Aparicio <jorge@japaric.io>"] [dependencies] klee = {path="../klee"} +testfunction = {path="../testfunction"} [profile.release] -debug = true \ No newline at end of file +debug = true diff --git a/klee-examples/examples/foos.rs b/klee-examples/examples/foos.rs new file mode 100644 index 0000000000000000000000000000000000000000..d00d2ee08c7405952fb8f3856c10b76fe6ade69b --- /dev/null +++ b/klee-examples/examples/foos.rs @@ -0,0 +1,25 @@ +#![no_std] + +#[macro_use] +extern crate klee; + +extern crate testfunction; + +use core::ptr; +use testfunction::m1::*; +use testfunction::m2::*; + +fn main() { + let u = ksymbol!("u"); + + unsafe { + ptr::read_volatile(&f2(f1(u))); + } +} + +// add 1 wrapping +//mod m1; +//mod m2; + +//use m1::*; +//use m2::*; diff --git a/testfunction/Cargo.toml b/testfunction/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..473a47309a90a6f3baa765f6ab8fb7c55f06b175 --- /dev/null +++ b/testfunction/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "testfunction" +version = "0.1.0" +authors = ["Henrik Tjäder <henrik@tjaders.com>"] + +[dependencies] diff --git a/testfunction/src/lib.rs b/testfunction/src/lib.rs new file mode 100644 index 0000000000000000000000000000000000000000..b3e545bd235ea52c256c31b40f4db256d0341f6b --- /dev/null +++ b/testfunction/src/lib.rs @@ -0,0 +1,7 @@ +#![no_std] + +pub mod m1; +pub mod m2; + +use m1::*; +use m2::*; diff --git a/testfunction/src/m1.rs b/testfunction/src/m1.rs new file mode 100644 index 0000000000000000000000000000000000000000..14e1fab2ec8bcef5f2b0a127ee79bc30fc2efe8f --- /dev/null +++ b/testfunction/src/m1.rs @@ -0,0 +1,3 @@ +pub fn f1(u: u8) -> u8 { + u.wrapping_add(1) +} diff --git a/testfunction/src/m2.rs b/testfunction/src/m2.rs new file mode 100644 index 0000000000000000000000000000000000000000..87e0c462335e68ccd8337b6446b0c0fbb3e845e3 --- /dev/null +++ b/testfunction/src/m2.rs @@ -0,0 +1,3 @@ +pub fn f2(u: u8) -> u8 { + 100 / u +}