Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
klee-examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Samuel Karlsson
klee-examples
Commits
4e61acde
Commit
4e61acde
authored
5 years ago
by
Per
Browse files
Options
Downloads
Patches
Plain Diff
examples
parent
f6a7dad8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/klee_hybrid_test.rs
+3
-1
3 additions, 1 deletion
examples/klee_hybrid_test.rs
examples/register_test.rs
+13
-13
13 additions, 13 deletions
examples/register_test.rs
examples/vcell_test.rs
+1
-15
1 addition, 15 deletions
examples/vcell_test.rs
with
17 additions
and
29 deletions
examples/klee_hybrid_test.rs
+
3
−
1
View file @
4e61acde
...
...
@@ -24,10 +24,12 @@ use klee_sys::{klee_abort, klee_assert, klee_assert_eq, klee_make_symbolic};
fn
main
()
{
let
mut
a
=
0
;
klee_make_symbolic!
(
&
mut
a
,
"a"
);
// Rust panic on a == 200;
let
_
=
100
/
(
a
-
200
);
match
a
{
0
=>
klee_abort!
(),
1
=>
klee_abort!
(),
2
=>
panic
!
(),
2
=>
klee_abort
!
(),
3
=>
panic!
(
"3"
),
// just one instance of panic! will be spotted
4
=>
klee_assert!
(
false
),
5
=>
klee_assert_eq!
(
false
,
true
),
...
...
This diff is collapsed.
Click to expand it.
examples/register_test.rs
+
13
−
13
View file @
4e61acde
...
...
@@ -7,7 +7,7 @@
// will still be treated as a new symbol. That might be overly pessimistic
// but is a safe approximation for the worst case behavior of the hardware.
//
// > cargo klee --
bin
register --release
// > cargo klee --
example
register
_test
--release
// ...
// KLEE: ERROR: /home/pln/.cargo/registry/src/github.com-1ecc6299db9ec823/panic-abort-0.3.2/src/lib.rs:49: abort failure
// KLEE: NOTE: now ignoring this error at this location
...
...
@@ -16,17 +16,17 @@
// KLEE: done: completed paths = 3
// KLEE: done: generated tests = 3
//
// > ls target/release/
dep
s/klee-last/
// > ls target/release/
example
s/klee-last/
// assembly.ll info messages.txt run.istats run.stats test000001.ktest test000002.ktest test000003.abort.err test000003.kquery test000003.ktest warnings.txt
//
// We see that KLEE spoted the test3 hits unreachable (and thus panics)
// We see that KLEE spot
t
ed the test3 hits unreachable (and thus panics)
//
// Let's look at the test cases separately:
//
// test1 passed:
// ktest-tool target/release/
dep
s/klee-last/test000001.ktest
// ktest file : 'target/release/
dep
s/klee-last/test000001.ktest'
// args : ['
/home/pln/rust/cargo-klee/klee-examples/target/release/deps/register-16afa0ec4812d3e4.ll
']
// ktest-tool target/release/
example
s/klee-last/test000001.ktest
// ktest file : 'target/release/
example
s/klee-last/test000001.ktest'
// args : ['
...
']
// num objects: 1
// object 0: name: 'vcell'
// object 0: size: 4
...
...
@@ -38,9 +38,9 @@
// If the first read of the register is not 1 then we are ok.
//
// The second test also passed.
// ktest-tool target/release/
dep
s/klee-last/test000002.ktest
// ktest file : 'target/release/
dep
s/klee-last/test000002.ktest'
// args : ['
/home/pln/rust/cargo-klee/klee-examples/target/release/deps/register-16afa0ec4812d3e4.ll
']
// ktest-tool target/release/
example
s/klee-last/test000002.ktest
// ktest file : 'target/release/
example
s/klee-last/test000002.ktest'
// args : ['
...
']
// num objects: 2
// object 0: name: 'vcell'
// object 0: size: 4
...
...
@@ -60,9 +60,9 @@
// returning 2.
//
// The third test gives the error.
// ktest-tool target/release/
dep
s/klee-last/test000003.ktest
// ktest file : 'target/release/
dep
s/klee-last/test000003.ktest'
// args : ['
/home/pln/rust/cargo-klee/klee-examples/target/release/deps/register-16afa0ec4812d3e4.ll
']
// ktest-tool target/release/
example
s/klee-last/test000003.ktest
// ktest file : 'target/release/
example
s/klee-last/test000003.ktest'
// args : ['
...
']
// num objects: 2
// object 0: name: 'vcell'
// object 0: size: 4
...
...
@@ -85,7 +85,6 @@
#![no_main]
use
panic_klee
as
_
;
use
volatile_register
::
RW
;
#[no_mangle]
...
...
@@ -99,6 +98,7 @@ fn main() {
unsafe
{
rw
.write
(
0
)
};
// this read is still treated as a new symbolic value of type u32
if
rw
.read
()
==
2
{
// will generate a panic!() if reached.
unreachable!
();
}
}
...
...
This diff is collapsed.
Click to expand it.
examples/vcell_test.rs
+
1
−
15
View file @
4e61acde
#![no_std]
#![no_main]
#[cfg(feature
=
"klee-analysis"
)]
use
klee_sys
::{
klee_abort
,
klee_assert
,
klee_assert_eq
,
klee_make_symbolic
};
#[cfg(feature
=
"klee-analysis"
)]
use
panic_klee
as
_
;
#[cfg(not(feature
=
"klee-analysis"
))]
use
panic_halt
as
_
;
#[cfg(not(feature
=
"klee-analysis"
))]
#[no_mangle]
fn
main
()
{
let
mut
a
=
0
;
panic!
();
}
use
vcell
;
#[cfg(feature
=
"klee-analysis"
)]
#[no_mangle]
fn
main
()
{
let
mut
vc
=
vcell
::
VolatileCell
::
new
(
0u32
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment