Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cargo-klee
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Lindgren
cargo-klee
Commits
21fe254a
Commit
21fe254a
authored
2 years ago
by
Per Lindgren
Browse files
Options
Downloads
Patches
Plain Diff
move to clap 4, wip3
parent
436f05fe
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cargo-klee/Cargo.toml
+3
-0
3 additions, 0 deletions
cargo-klee/Cargo.toml
cargo-klee/src/lib.rs
+1
-0
1 addition, 0 deletions
cargo-klee/src/lib.rs
cargo-klee/src/main.rs
+35
-14
35 additions, 14 deletions
cargo-klee/src/main.rs
with
39 additions
and
14 deletions
cargo-klee/Cargo.toml
+
3
−
0
View file @
21fe254a
...
...
@@ -15,3 +15,6 @@ either = "1.6.1"
clap
=
{
version
=
"4.0.6"
,
features
=
[
"derive"
,
"color"
]
}
rustc_version
=
"0.4.0"
anyhow
=
"1.0.65"
# cargo_metadata = "0.15.0"
regex
=
"1.6.0"
# colored = "2.0.0"
This diff is collapsed.
Click to expand it.
cargo-klee/src/lib.rs
+
1
−
0
View file @
21fe254a
pub
mod
cargo_out
;
pub
mod
cli
;
This diff is collapsed.
Click to expand it.
cargo-klee/src/main.rs
+
35
−
14
View file @
21fe254a
use
anyhow
::
Error
;
use
anyhow
::
{
anyhow
,
Error
}
;
// use std::error::Error;
use
cargo_klee
::
cli
::
Cli
;
use
clap
::
Parser
;
use
std
::
str
::
Split
;
// extern crate libc;
use
std
::{
env
,
fs
,
path
::
PathBuf
,
process
::{
self
,
Command
},
process
::{
self
,
Command
,
ExitStatus
,
Stdio
},
time
::
SystemTime
,
};
...
...
@@ -67,12 +68,9 @@ fn main() -> Result<(), Error> {
let
mut
cargo
=
Command
::
new
(
"cargo"
);
cargo
// compile using rustc
.arg
(
"rustc"
);
.arg
(
"rustc"
)
// verbose output for debugging purposes
if
args
.verbose
{
cargo
.arg
(
"-v"
);
}
.arg
(
"-v"
);
// set features, always including `klee-analysis`
if
args
.all_features
{
...
...
@@ -128,13 +126,36 @@ fn main() -> Result<(), Error> {
eprintln!
(
"
\n
{:?}
\n
"
,
cargo
);
}
// execute the command and unwrap the result into status
let
status
=
cargo
.status
()
?
;
// // execute the command and unwrap the result into status
// let status = cargo.status()?;
// if !status.success() {
// // TODO! correctly handle exit status
// panic!("{:?}", status);
// // return Err(status.code().unwrap_or(1).into());
// }
println!
(
"project name {:?}"
,
project
.name
());
println!
(
"project target {:?}"
,
project
.target
());
println!
(
"project toml {:?}"
,
project
.toml
());
println!
(
"project target_dir {:?}"
,
project
.target_dir
());
let
output
=
cargo
.stdout
(
Stdio
::
piped
())
.output
()
?
;
let
stderr
=
String
::
from_utf8
(
output
.stderr
)
?
;
// We enforce color, assumes standard utf-8 coding for Green
let
comp
=
"
\u{1b}
[32m Compiling"
;
let
s
:
Split
<&
str
>
=
stderr
.split
(
comp
);
let
last
=
s
.last
()
.unwrap
();
if
args
.verbose
{
println!
(
"{}"
,
stderr
);
}
else
{
println!
(
"{}{}"
,
comp
,
last
);
}
if
!
status
.success
()
{
// TODO! correctly handle exit status
panic!
(
"{:?}"
,
status
);
// return Err(status.code().unwrap_or(1).into());
if
!
output
.status
.success
()
{
return
Err
(
anyhow!
(
"Compilation failed, exiting cargo-klee"
));
}
Ok
(())
...
...
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