Skip to content

Commit

Permalink
refactor: simplify compilation features and CLI argument parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianMoesl committed Mar 6, 2021
1 parent e32947d commit 14eb74a
Show file tree
Hide file tree
Showing 11 changed files with 247 additions and 273 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jobs:
os: [ubuntu-20.04, macos-10.15, windows-2019]
include:
- os: ubuntu-20.04
features: z3-solver,boolector-solver
features: z3,boolector
target: x86_64-unknown-linux-gnu
extension: ""
- os: macos-10.15
features: z3-solver,boolector-solver
features: z3,boolector
target: x86_64-apple-darwin
extension: ""
- os: windows-2019
features: z3-solver
features: z3
target: x86_64-pc-windows-msvc
extension: ".exe"
steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
experimental: [false]
include:
- os: ubuntu-20.04
features: z3-solver,boolector-solver
features: z3,boolector
- os: macos-10.15
features: z3-solver,boolector-solver
features: z3,boolector
- os: windows-2019
features: z3-solver
features: z3
- toolchain: stable
os: ubuntu-latest
experimental: true
features: z3-solver,boolector-solver
features: z3,boolector
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
116 changes: 37 additions & 79 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ version ="0.2.0"

[features]
default = []
boolector-solver = ["boolector"]
z3-solver = ["z3"]

[lib]
name = "monster"
Expand All @@ -30,7 +28,8 @@ harness = false

[dependencies]
byteorder = "~1.4.2"
clap = "3.0.0-beta.2"
clap = "~2.33.3"
strum = { version = "~0.20.0", features = ["derive"] }
riscu = "~0.5.0"
petgraph = "~0.5.1"
rand = "~0.8.3"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $ choco install git -y
```
### Build and Test from Source
Tests can be executed on all platforms, alltough one
feature is not supported on Windows: `boolector-solver`
feature is not supported on Windows: `boolector`

1. Test your toolchain setup by compiling monster:
```
Expand Down
18 changes: 9 additions & 9 deletions benches/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ use std::{
use tempfile::{tempdir, TempDir};
use utils::compile_riscu;

#[cfg(feature = "boolector-solver")]
#[cfg(feature = "boolector")]
use monster::solver::Boolector;

#[cfg(feature = "z3-solver")]
#[cfg(feature = "z3")]
use monster::solver::Z3;

const TEST_FILES: [&str; 4] = [
Expand Down Expand Up @@ -50,11 +50,11 @@ fn bench_demonstration(c: &mut Criterion) {
group.bench_function("Monster", |b| {
b.iter(|| execute_single::<MonsterSolver, &PathBuf>(&object_file))
});
#[cfg(feature = "boolector-solver")]
#[cfg(feature = "boolector")]
group.bench_function("Boolector", |b| {
b.iter(|| execute_single::<Boolector, &PathBuf>(&object_file))
});
#[cfg(feature = "z3-solver")]
#[cfg(feature = "z3")]
group.bench_function("Z3", |b| {
b.iter(|| execute_single::<Z3, &PathBuf>(&object_file))
});
Expand All @@ -69,11 +69,11 @@ fn bench_solver_avg(c: &mut Criterion) {
group.bench_function("Monster", |b| {
b.iter(|| execute_all::<MonsterSolver>(&object_files))
});
#[cfg(feature = "boolector-solver")]
#[cfg(feature = "boolector")]
group.bench_function("Boolector", |b| {
b.iter(|| execute_all::<Boolector>(&object_files))
});
#[cfg(feature = "z3-solver")]
#[cfg(feature = "z3")]
group.bench_function("Z3", |b| b.iter(|| execute_all::<Z3>(&object_files)));
}

Expand All @@ -94,7 +94,7 @@ fn bench_solver_individual(c: &mut Criterion) {
});
}

#[cfg(feature = "boolector-solver")]
#[cfg(feature = "boolector")]
{
let mut boolector_grp = c.benchmark_group("Boolector");
boolector_grp
Expand All @@ -108,7 +108,7 @@ fn bench_solver_individual(c: &mut Criterion) {
});
}

#[cfg(feature = "z3-solver")]
#[cfg(feature = "z3")]
{
let mut z3_grp = c.benchmark_group("Z3");
z3_grp.warm_up_time(Duration::from_secs(2)).sample_size(30);
Expand All @@ -126,7 +126,7 @@ fn compile_test_files() -> Vec<PathBuf> {
TEMP_DIR = Some(tmp_dir.clone());

TEST_OBJECT_FILES = Some(
compile_riscu(tmp_dir.clone(), Some(&TEST_FILES))
compile_riscu(tmp_dir, Some(&TEST_FILES))
.map(|(_source, object)| object)
.collect(),
);
Expand Down
Loading

0 comments on commit 14eb74a

Please sign in to comment.