Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
10d77e2
simplexup: add cargo-nextest installation
ikripaka May 12, 2026
8eabcb9
cli: migrate from `cargo test` to `cargo nextest`
ikripaka May 12, 2026
681de64
cli: add formal nextest version check
ikripaka May 14, 2026
78dc70c
cli: change dependency from `cargo nextest` to local `smplx-nextest` …
ikripaka May 18, 2026
e2a0a63
cli: edit namings in `commands/test.rs` for building `smplx-nextest` …
ikripaka May 19, 2026
5c3dddb
remove leftover semver check arguments
ikripaka May 19, 2026
4b8d1c2
cli: move forming of flags to separate function
ikripaka May 21, 2026
61175dd
simplexup: add newlines
ikripaka May 21, 2026
05add01
simplexup: simplify version retrieval for comparison
ikripaka May 21, 2026
5c61739
cli: move bin args building to one function
ikripaka May 21, 2026
146d050
simplexup: bump version from 0.0.4 to 0.0.5
ikripaka May 25, 2026
ee19246
simplexup: add version check in cargo-binstall
ikripaka May 25, 2026
ee104a4
simplexup: remove cargo-binstall
ikripaka May 25, 2026
c061e4f
cli: add nextest dsl test maker enabled by default
ikripaka May 26, 2026
e2ff677
cli: add --no-simplex flag
ikripaka May 26, 2026
174b469
cli: add alias (nocapture) for no-capture flag in tests
ikripaka May 27, 2026
e280921
Update crates/cli/src/commands/core.rs
Arvolear May 27, 2026
473a49e
cli: remove -vvv option
ikripaka May 28, 2026
2209a5b
simplexup: remove `cargo install` dependency
ikripaka May 28, 2026
8b49076
cli: add `test-threads` flag
ikripaka May 28, 2026
bf05e35
ci: add smplx-nextest binaries name to zip packing and attestation
ikripaka May 28, 2026
921b0de
ci: fix verbosity in fixtures.yml
ikripaka May 28, 2026
cbefe0a
cli: divide verbose flag into 2
ikripaka May 29, 2026
3b1ee7d
cli: add test-threads flag ignoring when no-capture set
ikripaka May 29, 2026
43d7381
cli: limit test-threads flag to non-zero values
ikripaka May 29, 2026
d147feb
cli: add drop contexts, so memory can be gracefully cleaned on normal…
ikripaka May 29, 2026
7fdea36
cli: correct show_output description
ikripaka May 29, 2026
f030606
fix lints
ikripaka May 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ rpc_password = "password"
[test]
mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean"
bitcoins = 10_000_000
verbosity = 0 # 0 - none, 1 - debug, 2 - trace
verbosity = 0 # 0 - none, 1 - debug, 2 - trace, 3 - trace + additional cargo verbose output
Comment thread
Arvolear marked this conversation as resolved.
Outdated

[test.esplora]
url = "<esplora url>"
Expand Down
89 changes: 50 additions & 39 deletions crates/cli/src/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ use std::path::PathBuf;
use std::process::Stdio;

use smplx_sdk::global::Verbosity;
use smplx_test::{SMPLX_TEST_MARKER, TestConfig};
use smplx_test::{TestConfig, smplx_test_marker};

use super::core::{TestArguments, TestFlags};
use super::error::CommandError;

/// Nextest dsl variable to filter and use only simplex tests
const SMPLX_NEXTEST_DSL_TEST_MARKER: &str = concat!("test(/", smplx_test_marker!(), "$/)");

pub struct Test {}

impl Test {
Expand All @@ -28,9 +31,9 @@ impl Test {

config.to_file(&cache_path)?;

let mut cargo_test_command = Self::build_cargo_test_command(&cache_path, args, flags);
let mut cargo_nextest_command = Self::build_cargo_nextest_command(&cache_path, args, flags);

let output = cargo_test_command.output()?;
let output = cargo_nextest_command.output()?;

match output.status.code() {
Some(code) => {
Expand All @@ -48,75 +51,83 @@ impl Test {
Ok(())
}

fn build_cargo_test_command(
fn build_cargo_nextest_command(
cache_path: &PathBuf,
args: &TestArguments,
flags: &TestFlags,
) -> std::process::Command {
let mut cargo_test_command = std::process::Command::new("cargo");
cargo_test_command.arg("test");
let mut cargo_nextest_command = std::process::Command::new("smplx-nextest");
cargo_nextest_command.arg("nextest");
cargo_nextest_command.arg("run");

cargo_test_command.args(Self::build_cargo_test_args(args, flags));
cargo_test_command.args(Self::build_test_bin_args(args, flags));
cargo_nextest_command.args(Self::build_cargo_nextest_args(args, flags));
cargo_nextest_command.args(Self::build_test_bin_args(args, flags));

cargo_test_command
cargo_nextest_command
.env(smplx_test::TEST_ENV_NAME, cache_path)
.stdin(Stdio::inherit())
.stderr(Stdio::inherit())
.stdout(Stdio::inherit());

cargo_test_command
cargo_nextest_command
}

fn build_cargo_test_args(args: &TestArguments, flags: &TestFlags) -> Vec<String> {
let mut cargo_test_args = Vec::new();
fn build_cargo_nextest_args(args: &TestArguments, flags: &TestFlags) -> Vec<String> {
Comment thread
Arvolear marked this conversation as resolved.
let mut cargo_nextest_args = Vec::new();

if args.filters.is_empty() {
cargo_nextest_args.push("--filterset".into());

if let Some(target) = &args.target {
cargo_test_args.push("--test".into());
cargo_test_args.push(target.clone());
if let Some(target) = &args.target {
cargo_nextest_args.push(format!("binary({target}) and {SMPLX_NEXTEST_DSL_TEST_MARKER}"));
} else {
cargo_nextest_args.push(SMPLX_NEXTEST_DSL_TEST_MARKER.into());
}
} else {
cargo_nextest_args.extend(args.filters.iter().cloned());
Comment thread
Arvolear marked this conversation as resolved.
Outdated
}

if flags.no_fail_fast {
Comment thread
Arvolear marked this conversation as resolved.
cargo_test_args.push("--no-fail-fast".into());
cargo_nextest_args.push("--no-fail-fast".into());
}
if flags.nocapture {
cargo_nextest_args.push("--nocapture".into());
}
if flags.quiet {
cargo_nextest_args.push("--cargo-quiet".into());
}
if flags.verbose != 0 {
cargo_nextest_args.push("--verbose".into());
cargo_nextest_args.push("--cargo-verbose".into());

// `-vvv` verbosity level
if flags.verbose == Verbosity::MAX_VERBOSITY_LEVEL {
cargo_nextest_args.push("--cargo-verbose".into());
}
}

cargo_test_args
cargo_nextest_args
}

fn build_test_bin_args(args: &TestArguments, flags: &TestFlags) -> Vec<String> {
fn build_test_bin_args(_args: &TestArguments, flags: &TestFlags) -> Vec<String> {
Comment thread
Arvolear marked this conversation as resolved.
Outdated
let mut test_bin_args = Vec::new();

test_bin_args.push("--".into());

// TODO: custom filters may run non-simplex tests due to cargo limitations. Figure out how to fix this
if args.filters.is_empty() {
test_bin_args.push(SMPLX_TEST_MARKER.to_string());
} else {
test_bin_args.extend(args.filters.iter().cloned());
}

test_bin_args.extend(Self::build_test_bin_flags(flags));
if !test_bin_args.is_empty() {
test_bin_args.insert(0, "--".into());
}

test_bin_args
}

fn build_test_bin_flags(flags: &TestFlags) -> Vec<String> {
let mut test_bin_args = Vec::new();
let mut test_bin_flags = Vec::new();

if flags.nocapture {
test_bin_args.push("--nocapture".into());
}
if flags.show_output {
test_bin_args.push("--show-output".into());
}
if flags.ignored {
test_bin_args.push("--ignored".into());
}
if flags.quiet {
test_bin_args.push("--quiet".into());
test_bin_flags.push("--ignored".into());
}

test_bin_args
test_bin_flags
}

fn get_test_config_cache_name() -> Result<PathBuf, CommandError> {
Expand Down
2 changes: 1 addition & 1 deletion crates/sdk/src/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub enum Verbosity {

impl Verbosity {
/// The maximum allowed verbosity level.
pub const MAX_VERBOSITY_LEVEL: u8 = 2;
pub const MAX_VERBOSITY_LEVEL: u8 = 3;

/// Creates a `Verbosity` instance from the number of verbosity flags provided (e.g., -v, -vv).
#[must_use]
Expand Down
9 changes: 8 additions & 1 deletion crates/test/src/macros/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ use syn::parse::Parser;

use crate::TEST_ENV_NAME;

pub const SMPLX_TEST_MARKER: &str = "_smplx_test";
#[macro_export]
macro_rules! smplx_test_marker {
() => {
"_smplx_test"
};
}

pub const SMPLX_TEST_MARKER: &str = smplx_test_marker!();

type AttributeArgs = syn::punctuated::Punctuated<syn::Meta, syn::Token![,]>;

Expand Down
55 changes: 52 additions & 3 deletions simplexup/simplexup
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -eo pipefail
# NOTE: if you make modifications to this script, please increment the version number.
# WARNING: the SemVer pattern: major.minor.patch must be followed as we use it to determine if the script is up to date.
SIMPLEXUP_INSTALLER_VERSION="0.0.4"
NEXTEST_VERSION="0.9.133"
BINSTALL_VERSION="1.19.1"

BASE_DIR=${XDG_CONFIG_HOME:-$HOME}
SIMPLEX_DIR=${SIMPLEX_DIR:-"$BASE_DIR/.simplex"}
Expand All @@ -14,14 +16,17 @@ SIMPLEX_BIN_PATH="$SIMPLEX_BIN_DIR/simplexup"
SIMPLEXUP_IGNORE_VERIFICATION=false
DEFAULT_SIMPLEX_REPO="BlockstreamResearch/smplx"

SMPLX_NEXTEST_NAME="smplx-nextest"
SMPLX_BIN_NAME="simplex"
DEP_BINS=(elementsd electrs)
BINS=(simplex "${DEP_BINS[@]}")
BINS=("${SMPLX_BIN_NAME}" "${SMPLX_NEXTEST_NAME}" "${DEP_BINS[@]}")
HASH_NAMES=()
HASH_VALUES=()

main() {
need_cmd git
need_cmd curl
need_cmd cargo
Comment thread
Arvolear marked this conversation as resolved.
Outdated

while [[ -n $1 ]]; do
case $1 in
Expand Down Expand Up @@ -82,7 +87,12 @@ main() {
version_dir="${SIMPLEX_VERSIONS_DIR}/${SIMPLEX_VERSION}"
ensure mkdir -p "$version_dir"

local BINS_TO_DOWNLOAD=("${BINS[@]}")
# Install `cargo-binstall` for installing various binaries from the internet
install_binstall_version "$BINSTALL_VERSION"
# Install default version of `nextest` for simplex
install_nextest_binary "$NEXTEST_VERSION" "$version_dir"

local BINS_TO_DOWNLOAD=("${SMPLX_BIN_NAME}" "${DEP_BINS[@]}")

if [[ -n "$SIMPLEX_COMMIT" ]]; then
local author="$(echo "${SIMPLEX_REPO}" | cut -d'/' -f1 -)"
Expand Down Expand Up @@ -595,12 +605,51 @@ install_simplex_from_commit() {
say "Installing Simplex version $simplex_version"

ensure cargo build --release --manifest-path "${tmp_dir}/Cargo.toml"
ensure mv "${tmp_dir}/target/release/simplex" "${out_dir}/simplex"
ensure mv "${tmp_dir}/target/release/${SMPLX_BIN_NAME}" "${out_dir}/${SMPLX_BIN_NAME}"

say "Removing temporary directory..."
rm -rf "${tmp_dir}"
}

install_nextest_binary() {
local nextest_version=$1
local install_dir=$2

# Check if smplx-nextest is already installed and matches the required version
say "Checking ${SMPLX_NEXTEST_NAME} version..."
local smplx_nextest_bin_full_path="${install_dir}/${SMPLX_NEXTEST_NAME}"
if check_cmd "${smplx_nextest_bin_full_path}" nextest; then
local current_version
current_version=$(${SMPLX_NEXTEST_NAME} nextest show-config version | head -n 1 | awk '{print $4}')
Comment thread
Arvolear marked this conversation as resolved.
Outdated
Comment thread
Arvolear marked this conversation as resolved.
Outdated

if [[ "$current_version" == "$nextest_version" ]]; then
say "${SMPLX_NEXTEST_NAME} $nextest_version is already installed, skipping installation."
return 0
fi
fi


say "Installing ${SMPLX_NEXTEST_NAME} version ${nextest_version} into ${install_dir}..."
ensure cargo binstall cargo-nextest@"${nextest_version}" --only-signed --install-path "${install_dir}" --no-track --force --min-tls-version 1.3 -y
mv "${install_dir}/cargo-nextest" "${smplx_nextest_bin_full_path}"
return 0
Comment thread
Arvolear marked this conversation as resolved.
Outdated
}

install_binstall_version() {
local binstall_version=$1

# Check if cargo-binstall is already installed
say "Checking cargo-binstall version..."
if check_cmd cargo-binstall; then
say "cargo-binstall $binstall_version is already installed, skipping installation."
return 0
fi

say "Installing cargo-binstall version $binstall_version..."
ensure cargo install cargo-binstall --version "$binstall_version" --locked --force
return 0
Comment thread
Arvolear marked this conversation as resolved.
Outdated
}

# Form a comma separated list with 'and' for user experience
form_str_list() {
local STR_LIST=("$@")
Expand Down
Loading