Unverified Commit bddfdf67 authored by Michael Müller's avatar Michael Müller Committed by GitHub

Fix master (#226)

parent afc190bd
Pipeline #129326 passed with stages
in 3 minutes and 46 seconds
......@@ -317,9 +317,9 @@ fn do_optimization(
let codegen_config = binaryen::CodegenConfig {
// Number of optimization passes (spends potentially a lot of time optimizing)
optimization_level: optimization_level.to_passes(),
// the default
// The default
shrink_level: optimization_level.to_shrink(),
// the default
// The default
debug_info: false,
};
let mut module = binaryen::Module::read(&dest_wasm_file_content)
......@@ -478,7 +478,8 @@ pub(crate) fn execute_with_crate_metadata(
#[cfg(test)]
mod tests_ci_only {
use crate::{
cmd, util::tests::with_tmp_dir, BuildArtifacts, ManifestPath, UnstableFlags, Verbosity,
cmd, util::tests::with_tmp_dir, BuildArtifacts, ManifestPath, OptimizationPasses,
UnstableFlags, Verbosity,
};
#[test]
......@@ -487,14 +488,13 @@ mod tests_ci_only {
cmd::new::execute("new_project", Some(path)).expect("new project creation failed");
let manifest_path =
ManifestPath::new(&path.join("new_project").join("Cargo.toml")).unwrap();
let optimization_passes = 3;
let res = super::execute(
&manifest_path,
Verbosity::Default,
true,
BuildArtifacts::All,
UnstableFlags::default(),
optimization_passes,
OptimizationPasses::default(),
)
.expect("build failed");
......@@ -523,7 +523,6 @@ mod tests_ci_only {
cmd::new::execute("new_project", Some(path)).expect("new project creation failed");
let project_dir = path.join("new_project");
let manifest_path = ManifestPath::new(&project_dir.join("Cargo.toml")).unwrap();
let optimization_passes = 3;
// when
super::execute(
......@@ -532,7 +531,7 @@ mod tests_ci_only {
true,
BuildArtifacts::CheckOnly,
UnstableFlags::default(),
optimization_passes,
OptimizationPasses::default(),
)
.expect("build failed");
......
......@@ -287,7 +287,7 @@ mod tests {
use crate::cmd::metadata::blake2_hash;
use crate::{
cmd, crate_metadata::CrateMetadata, util::tests::with_tmp_dir, BuildArtifacts,
ManifestPath, UnstableFlags, Verbosity,
ManifestPath, OptimizationPasses, UnstableFlags, Verbosity,
};
use contract_metadata::*;
use serde_json::{Map, Value};
......@@ -386,6 +386,7 @@ mod tests {
Verbosity::Default,
BuildArtifacts::All,
UnstableFlags::default(),
OptimizationPasses::default(),
)?
.dest_bundle
.expect("bundle file not found");
......
......@@ -95,7 +95,7 @@ impl ExtrinsicOpts {
#[derive(Clone, Debug, StructOpt)]
pub struct OptimizationFlags {
/// number of optimization passes, passed as an argument to wasm-opt
/// Number of optimization passes, passed as an argument to wasm-opt.
///
/// - `0`: execute no optimization passes
///
......@@ -128,6 +128,12 @@ pub enum OptimizationPasses {
Z,
}
impl Default for OptimizationPasses {
fn default() -> OptimizationPasses {
OptimizationPasses::Three
}
}
impl TryFrom<&OptimizationFlags> for OptimizationPasses {
type Error = Error;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment