From 02df9912b616cac7cec800d6795d3292c510bcb2 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 19 Nov 2025 10:20:16 -0800 Subject: [PATCH 1/7] [bfops/more-flexible-smoketests]: Smoketests are flexible to target directory overrides --- smoketests/__init__.py | 7 ++++++- smoketests/__main__.py | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/smoketests/__init__.py b/smoketests/__init__.py index 66d33a175d5..73071eec2fd 100644 --- a/smoketests/__init__.py +++ b/smoketests/__init__.py @@ -20,10 +20,15 @@ TEST_DIR = Path(__file__).parent STDB_DIR = TEST_DIR.parent exe_suffix = ".exe" if sys.platform == "win32" else "" -SPACETIME_BIN = STDB_DIR / ("target/debug/spacetime" + exe_suffix) +BUILD_DIR = STDB_DIR / "target" +SPACETIME_BIN = '' TEMPLATE_TARGET_DIR = STDB_DIR / "target/_stdbsmoketests" BASE_STDB_CONFIG_PATH = TEST_DIR / "config.toml" +def update_spacetime_bin_path(): + SPACETIME_BIN = BUILD_DIR / "debug/spacetime" + exe_suffix +update_spacetime_bin_path() + # the contents of files for the base smoketest project template TEMPLATE_LIB_RS = open(STDB_DIR / "crates/cli/templates/basic-rust/server/src/lib.rs").read() TEMPLATE_CARGO_TOML = open(STDB_DIR / "crates/cli/templates/basic-rust/server/Cargo.toml").read() diff --git a/smoketests/__main__.py b/smoketests/__main__.py index 6161dc5a7aa..8fc17b576b7 100644 --- a/smoketests/__main__.py +++ b/smoketests/__main__.py @@ -7,7 +7,7 @@ import re import fnmatch import json -from . import TEST_DIR, SPACETIME_BIN, BASE_STDB_CONFIG_PATH, exe_suffix, build_template_target +from . import TEST_DIR, BUILD_DIR, SPACETIME_BIN, BASE_STDB_CONFIG_PATH, exe_suffix, build_template_target, update_spacetime_bin_path import smoketests import sys import logging @@ -82,6 +82,10 @@ def main(): if not args.no_build_cli: logging.info("Compiling spacetime cli...") smoketests.run_cmd("cargo", "build", cwd=TEST_DIR.parent, capture_stderr=False) + build_metadata = smoketests.run_cmd("cargo", "metadata", "--format-version", "1", "--no-deps", cwd=TEST_DIR.parent, capture_stderr=False) + parsed = json.loads(build_metadata) + BUILD_DIR = parsed['target_directory'] + update_spacetime_bin_path() update_bin_name = "spacetimedb-update" + exe_suffix try: From 8ddd9cfe156547d45fb914efbf81b44143aca241 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 19 Nov 2025 11:00:30 -0800 Subject: [PATCH 2/7] [bfops/more-flexible-smoketests]: tiny refactor --- smoketests/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smoketests/__init__.py b/smoketests/__init__.py index 73071eec2fd..d2b6dfcfa70 100644 --- a/smoketests/__init__.py +++ b/smoketests/__init__.py @@ -20,11 +20,11 @@ TEST_DIR = Path(__file__).parent STDB_DIR = TEST_DIR.parent exe_suffix = ".exe" if sys.platform == "win32" else "" -BUILD_DIR = STDB_DIR / "target" -SPACETIME_BIN = '' TEMPLATE_TARGET_DIR = STDB_DIR / "target/_stdbsmoketests" BASE_STDB_CONFIG_PATH = TEST_DIR / "config.toml" +BUILD_DIR = STDB_DIR / "target" +SPACETIME_BIN = None def update_spacetime_bin_path(): SPACETIME_BIN = BUILD_DIR / "debug/spacetime" + exe_suffix update_spacetime_bin_path() From 04179c4f9b3826bb6baa190ef79a46ebd8797a70 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 19 Nov 2025 11:02:52 -0800 Subject: [PATCH 3/7] [bfops/more-flexible-smoketests]: fix --- smoketests/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoketests/__init__.py b/smoketests/__init__.py index d2b6dfcfa70..6d9b03de2d7 100644 --- a/smoketests/__init__.py +++ b/smoketests/__init__.py @@ -26,7 +26,7 @@ BUILD_DIR = STDB_DIR / "target" SPACETIME_BIN = None def update_spacetime_bin_path(): - SPACETIME_BIN = BUILD_DIR / "debug/spacetime" + exe_suffix + SPACETIME_BIN = BUILD_DIR / ("debug/spacetime" + exe_suffix) update_spacetime_bin_path() # the contents of files for the base smoketest project template From 8e6bde5739cf0099983d39b6d3c515b48212416f Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 19 Nov 2025 11:03:47 -0800 Subject: [PATCH 4/7] [bfops/more-flexible-smoketests]: review --- smoketests/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/smoketests/__init__.py b/smoketests/__init__.py index 6d9b03de2d7..ae7c4a0aecf 100644 --- a/smoketests/__init__.py +++ b/smoketests/__init__.py @@ -23,11 +23,10 @@ TEMPLATE_TARGET_DIR = STDB_DIR / "target/_stdbsmoketests" BASE_STDB_CONFIG_PATH = TEST_DIR / "config.toml" -BUILD_DIR = STDB_DIR / "target" SPACETIME_BIN = None -def update_spacetime_bin_path(): - SPACETIME_BIN = BUILD_DIR / ("debug/spacetime" + exe_suffix) -update_spacetime_bin_path() +def update_spacetime_bin_path(build_dir): + SPACETIME_BIN = build_dir / ("debug/spacetime" + exe_suffix) +update_spacetime_bin_path(STDB_DIR / "target") # the contents of files for the base smoketest project template TEMPLATE_LIB_RS = open(STDB_DIR / "crates/cli/templates/basic-rust/server/src/lib.rs").read() From bb3f615f62c85c917fd4ec380da5ef2db14142dd Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 19 Nov 2025 11:04:12 -0800 Subject: [PATCH 5/7] [bfops/more-flexible-smoketests]: fix --- smoketests/__main__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/smoketests/__main__.py b/smoketests/__main__.py index 8fc17b576b7..da170715817 100644 --- a/smoketests/__main__.py +++ b/smoketests/__main__.py @@ -7,7 +7,7 @@ import re import fnmatch import json -from . import TEST_DIR, BUILD_DIR, SPACETIME_BIN, BASE_STDB_CONFIG_PATH, exe_suffix, build_template_target, update_spacetime_bin_path +from . import TEST_DIR, SPACETIME_BIN, BASE_STDB_CONFIG_PATH, exe_suffix, build_template_target, update_spacetime_bin_path import smoketests import sys import logging @@ -84,8 +84,7 @@ def main(): smoketests.run_cmd("cargo", "build", cwd=TEST_DIR.parent, capture_stderr=False) build_metadata = smoketests.run_cmd("cargo", "metadata", "--format-version", "1", "--no-deps", cwd=TEST_DIR.parent, capture_stderr=False) parsed = json.loads(build_metadata) - BUILD_DIR = parsed['target_directory'] - update_spacetime_bin_path() + update_spacetime_bin_path(parsed['target_directory']) update_bin_name = "spacetimedb-update" + exe_suffix try: From 598dd0844eb80da9a6df89f64eff25b52ca9aced Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 19 Nov 2025 12:12:40 -0800 Subject: [PATCH 6/7] [bfops/more-flexible-smoketests]: fix --- smoketests/__init__.py | 4 ++-- smoketests/__main__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/smoketests/__init__.py b/smoketests/__init__.py index ae7c4a0aecf..f5d144610bf 100644 --- a/smoketests/__init__.py +++ b/smoketests/__init__.py @@ -146,7 +146,7 @@ def log_cmd(args): logging.debug(f"$ {' '.join(str(arg) for arg in args)}") -def run_cmd(*args, capture_stderr=True, check=True, full_output=False, cmd_name=None, log=True, **kwargs): +def run_cmd(*args, capture_stdout=True, capture_stderr=True, check=True, full_output=False, cmd_name=None, log=True, **kwargs): if log: log_cmd(args if cmd_name is None else [cmd_name, *args[1:]]) @@ -166,7 +166,7 @@ def run_cmd(*args, capture_stderr=True, check=True, full_output=False, cmd_name= if capture_stderr and output.stderr.strip() != "": logging.debug(f"--- stderr ---\n{output.stderr.strip()}") needs_close = True - if output.stdout.strip() != "": + if capture_stdout and output.stdout.strip() != "": logging.debug(f"--- stdout ---\n{output.stdout.strip()}") needs_close = True if needs_close: diff --git a/smoketests/__main__.py b/smoketests/__main__.py index da170715817..e1c92bb5332 100644 --- a/smoketests/__main__.py +++ b/smoketests/__main__.py @@ -82,9 +82,9 @@ def main(): if not args.no_build_cli: logging.info("Compiling spacetime cli...") smoketests.run_cmd("cargo", "build", cwd=TEST_DIR.parent, capture_stderr=False) - build_metadata = smoketests.run_cmd("cargo", "metadata", "--format-version", "1", "--no-deps", cwd=TEST_DIR.parent, capture_stderr=False) + build_metadata = smoketests.run_cmd("cargo", "metadata", "--format-version", "1", "--no-deps", cwd=TEST_DIR.parent, capture_stdout=False) parsed = json.loads(build_metadata) - update_spacetime_bin_path(parsed['target_directory']) + update_spacetime_bin_path(Path(parsed['target_directory'])) update_bin_name = "spacetimedb-update" + exe_suffix try: From a58af2dae248307d6f480325357aec7e37e33270 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Wed, 19 Nov 2025 12:26:46 -0800 Subject: [PATCH 7/7] [bfops/more-flexible-smoketests]: fix --- smoketests/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/smoketests/__init__.py b/smoketests/__init__.py index f5d144610bf..d9f724db6a9 100644 --- a/smoketests/__init__.py +++ b/smoketests/__init__.py @@ -25,6 +25,7 @@ SPACETIME_BIN = None def update_spacetime_bin_path(build_dir): + global SPACETIME_BIN SPACETIME_BIN = build_dir / ("debug/spacetime" + exe_suffix) update_spacetime_bin_path(STDB_DIR / "target")