Skip to content

Fix spacetimedb-update cargo test on Windows platforms #3420

@rekhoff

Description

@rekhoff

Running cargo test -p spacetimedb-update on a Windows platform (either PowerShell or Git Bash) fails with:

cargo test -p spacetimedb-update --bin spacetimedb-update

    Finished `test` profile [optimized + debuginfo] target(s) in 1.29s
     Running unittests src\main.rs (target\debug\deps\spacetimedb_update-f0e23902f0ebae1c.exe)

running 1 test
test cli::self_install::tests::ensure_script_help_is_up_to_date ... FAILED

failures:

---- cli::self_install::tests::ensure_script_help_is_up_to_date stdout ----

thread 'cli::self_install::tests::ensure_script_help_is_up_to_date' panicked at crates\update\src\cli\self_install.rs:118:14:
couldn't find usage function
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    cli::self_install::tests::ensure_script_help_is_up_to_date

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

error: test failed, to rerun pass `-p spacetimedb-update --bin spacetimedb-update`

The code that is failing is near:

let script = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/spacetime-install.sh")).unwrap();

Possibly related to Windows not reading the return line characters correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions