diff --git a/.github/ci-windows-cross.py b/.github/ci-windows-cross.py index 6453cb9eac0..bf13f81ac75 100755 --- a/.github/ci-windows-cross.py +++ b/.github/ci-windows-cross.py @@ -96,7 +96,7 @@ def run_functional_tests(): "--jobs", num_procs, "--quiet", - f"--tmpdirprefix={workspace}", + f"--tmpdirprefix={workspace / '_ _'}", "--combinedlogslen=99999999", *shlex.split(os.environ.get("TEST_RUNNER_EXTRA", "").strip()), # feature_unsupported_utxo_db.py fails on Windows because of emojis in the test data directory. diff --git a/.github/ci-windows.py b/.github/ci-windows.py index 964558a2e20..00acf715ec5 100755 --- a/.github/ci-windows.py +++ b/.github/ci-windows.py @@ -198,7 +198,7 @@ def run_tests(ci_type): "--jobs", num_procs, "--quiet", - f"--tmpdirprefix={workspace}", + f"--tmpdirprefix={workspace / '_ _'}", "--combinedlogslen=99999999", *shlex.split(os.environ.get("TEST_RUNNER_EXTRA", "").strip()), ] diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh index 8d9a16ab784..4ca660a5d69 100755 --- a/ci/test/00_setup_env.sh +++ b/ci/test/00_setup_env.sh @@ -6,7 +6,7 @@ export LC_ALL=C.UTF-8 -set -o errexit -o pipefail -o xtrace +set -o errexit -o nounset -o pipefail -o xtrace # The source root dir, usually from git, usually read-only. # The ci system copies this folder. @@ -20,15 +20,14 @@ export BASE_ROOT_DIR="${BASE_ROOT_DIR:-/ci_container_base}" # This folder exists only on the ci guest, and on the ci host as a volume. export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends} # A folder for the ci system to put temporary files (build result, datadirs for tests, ...) +# The name contains a space and a non-ASCII symbol to confirm the build and +# tests handle word-splitting and UTF8 correctly. # This folder only exists on the ci guest. -export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch} +export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch_ ₿🧪_} echo "Setting specific values in env" -if [ -n "${FILE_ENV}" ]; then - set -o errexit; - # shellcheck disable=SC1090 - source "${FILE_ENV}" -fi +# shellcheck disable=SC1090 +source "${FILE_ENV}" echo "Fallback to default values in env (if not yet set)" # The number of parallel jobs to pass down to make and test_runner.py diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh index 7834415ba5e..6914a5af18a 100755 --- a/ci/test/03_test_script.sh +++ b/ci/test/03_test_script.sh @@ -109,7 +109,7 @@ ccache --zero-stats # Folder where the build is done. BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_SCRATCH_DIR/build-$HOST} -BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_INSTALL_PREFIX=$BASE_OUTDIR -Werror=dev" +BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL '-DCMAKE_INSTALL_PREFIX=$BASE_OUTDIR' -Werror=dev" if [[ "${RUN_IWYU}" == true || "${RUN_TIDY}" == true ]]; then BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" diff --git a/test/functional/feature_logging.py b/test/functional/feature_logging.py index 07420733e00..fd3b80972ed 100755 --- a/test/functional/feature_logging.py +++ b/test/functional/feature_logging.py @@ -37,8 +37,8 @@ class LoggingTest(BitcoinTestFramework): invdir = self.relative_log_path("foo") invalidname = os.path.join("foo", "foo.log") self.stop_node(0) - exp_stderr = r"Error: Could not open debug log file \S+$" - self.nodes[0].assert_start_raises_init_error([f"-debuglogfile={invalidname}"], exp_stderr, match=ErrorMatch.FULL_REGEX) + exp_stderr = "Error: Could not open debug log file " + self.nodes[0].assert_start_raises_init_error([f"-debuglogfile={invalidname}"], exp_stderr, match=ErrorMatch.PARTIAL_REGEX) assert not os.path.isfile(os.path.join(invdir, "foo.log")) # check that invalid log (relative) works after path exists @@ -51,7 +51,7 @@ class LoggingTest(BitcoinTestFramework): self.stop_node(0) invdir = os.path.join(self.options.tmpdir, "foo") invalidname = os.path.join(invdir, "foo.log") - self.nodes[0].assert_start_raises_init_error([f"-debuglogfile={invalidname}"], exp_stderr, match=ErrorMatch.FULL_REGEX) + self.nodes[0].assert_start_raises_init_error([f"-debuglogfile={invalidname}"], exp_stderr, match=ErrorMatch.PARTIAL_REGEX) assert not os.path.isfile(os.path.join(invdir, "foo.log")) # check that invalid log (absolute) works after path exists diff --git a/test/functional/feature_notifications.py b/test/functional/feature_notifications.py index 71500cc6598..9c409b321f6 100755 --- a/test/functional/feature_notifications.py +++ b/test/functional/feature_notifications.py @@ -31,6 +31,10 @@ LARGE_WORK_INVALID_CHAIN_WARNING = ( def notify_outputname(walletname, txid): return txid if platform.system() == 'Windows' else f'{walletname}_{txid}' +def shell_escape_posix(arg): + # Identical to ShellEscape() in the C++ code + return "'" + arg.replace("'", "'\"'\"'") + "'" + class NotificationsTest(BitcoinTestFramework): def set_test_params(self): @@ -51,13 +55,18 @@ class NotificationsTest(BitcoinTestFramework): os.mkdir(self.walletnotify_dir) os.mkdir(self.shutdownnotify_dir) + if platform.system() == 'Windows': + walletnotify_path = f"\"{os.path.join(self.walletnotify_dir, notify_outputname('%w', '%s'))}\"" + else: + walletnotify_path = f"{shell_escape_posix(os.path.join(self.walletnotify_dir, ''))}{notify_outputname('%w', '%s')}" + # -alertnotify and -blocknotify on node0, walletnotify on node1 self.extra_args = [[ - f"-alertnotify=echo %s >> {self.alertnotify_file}", - f"-blocknotify=echo > {os.path.join(self.blocknotify_dir, '%s')}", - f"-shutdownnotify=echo > {self.shutdownnotify_file}", + f"-alertnotify=echo %s >> \"{self.alertnotify_file}\"", + f"-blocknotify=echo > \"{os.path.join(self.blocknotify_dir, '%s')}\"", + f"-shutdownnotify=echo > \"{self.shutdownnotify_file}\"", ], [ - f"-walletnotify=echo %h_%b > {os.path.join(self.walletnotify_dir, notify_outputname('%w', '%s'))}", + f"-walletnotify=echo %h_%b > {walletnotify_path}", ]] self.wallet_names = [self.default_wallet_name, self.wallet] super().setup_network()