Skip to content

Latest commit

 

History

History
81 lines (76 loc) · 3.2 KB

DEV_ENVIRONMENT.md

File metadata and controls

81 lines (76 loc) · 3.2 KB

Setting up the dev environment for Komodo DeFi Framework to run full tests suite

Running native tests

  1. Install Docker or Podman.
  2. Install libudev-dev (dpkg) or libudev-devel (rpm) package.
  3. Install protobuf compiler, so protoc is available in your PATH.
  4. Download ZCash params files: Windows, Unix/Linux
  5. Create .env.client file with the following content
    ALICE_PASSPHRASE=spice describe gravity federal blast come thank unfair canal monkey style afraid
    
  6. Create .env.seed file with the following content
    BOB_PASSPHRASE=also shoot benefit prefer juice shell elder veteran woman mimic image kidney
    
  7. MacOS specific: run script (required after each reboot)
    #!/bin/bash
    for ((i=2;i<256;i++))
    do
        sudo ifconfig lo0 alias 127.0.0.$i up
    done
    sudo ifconfig lo0 inet6 -alias ::1
    sudo ifconfig lo0 inet6 -alias fe80::1%lo0
    Please note that you have to run it again after each reboot
  8. Linux specific:
    • for Docker users:
      sudo groupadd docker
      sudo usermod -aG docker $USER
      
    • for Podman users:
      sudo ln -s $(which podman) /usr/bin/docker
      
  9. Try cargo test --all --features run-docker-tests -- --test-threads=16.

Running WASM tests

  1. Set up WASM Build Environment
  2. Install Firefox.
  3. Download Gecko driver for your OS
  4. Set environment variables required to run WASM tests
    # wasm-bindgen specific variables
    export WASM_BINDGEN_TEST_TIMEOUT=180
    export GECKODRIVER=PATH_TO_GECKO_DRIVER_BIN
    # MarketMaker specific variables
    export BOB_PASSPHRASE="also shoot benefit prefer juice shell elder veteran woman mimic image kidney"
    export ALICE_PASSPHRASE="spice describe gravity federal blast come thank unfair canal monkey style afraid"
  5. Run WASM tests
    • for Linux users:
    wasm-pack test --firefox --headless mm2src/mm2_main
    
    • for OSX users (Intel):
    CC=/usr/local/opt/llvm/bin/clang AR=/usr/local/opt/llvm/bin/llvm-ar wasm-pack test --firefox --headless mm2src/mm2_main
    
    • for OSX users (Apple Silicon):
    CC=/opt/homebrew/opt/llvm/bin/clang AR=/opt/homebrew/opt/llvm/bin/llvm-ar wasm-pack test --firefox --headless mm2src/mm2_main
    
    Please note CC and AR must be specified in the same line as wasm-pack test mm2src/mm2_main.

Running specific WASM tests with Cargo

  • Install wasm-bindgen-cli:
    Make sure you have wasm-bindgen-cli installed with a version that matches the one specified in your Cargo.toml file. You can install it using Cargo with the following command:
    cargo install -f wasm-bindgen-cli --version <wasm-bindgen-version>
    
  • Run
    cargo test --target wasm32-unknown-unknown --package coins --lib utxo::utxo_block_header_storage::wasm::indexeddb_block_header_storage
    

PS If you notice that this guide is outdated, please submit a PR.