Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmurph32 committed Feb 11, 2025
1 parent 38f97a0 commit dccba31
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test-wasm-web:
# WASI testing requires the WASI SDK https://github.com/WebAssembly/wasi-sdk installed in /opt,
# wasmtime, and the target wasm32-wasip2 on the nightly toolchain
test-wasi:
CC=/opt/wasi-sdk/bin/clang CARGO_TARGET_WASM32_WASIP2_RUNNER="wasmtime -S common --dir ." cargo +nightly test --target wasm32-wasip2 -p c2pa -p c2pa-crypto
CC=/opt/wasi-sdk/bin/clang CARGO_TARGET_WASM32_WASIP2_RUNNER="wasmtime -S cli -S http --dir ." cargo +nightly test --target wasm32-wasip2 -p c2pa -p c2pa-crypto --all-features

# Full local validation, build and test all features including wasm
# Run this before pushing a PR to pre-validate
Expand Down
12 changes: 9 additions & 3 deletions sdk/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3300,9 +3300,15 @@ impl Store {
resp.subscribe().block();
let response = resp
.get()
.expect("HTTP request response missing")
.expect("HTTP request response requested more than once")
.expect("HTTP request failed");
.ok_or(Error::RemoteManifestFetch(
"HTTP request response missing".to_string(),
))?
.map_err(|_| {
Error::RemoteManifestFetch(
"HTTP request response requested more than once".to_string(),
)
})?
.map_err(|_| Error::RemoteManifestFetch("HTTP request failed".to_string()))?;
if response.status() == 200 {
let content_length: usize = response
.headers()
Expand Down
1 change: 0 additions & 1 deletion sdk/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

/// Complete functional integration test with parent and ingredients.
// Isolate from wasm by wrapping in module.

#[cfg(feature = "file_io")]
mod integration_1 {
use std::{io, path::PathBuf};
Expand Down
2 changes: 1 addition & 1 deletion sdk/tests/test_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod common;
use common::{compare_stream_to_known_good, fixtures_path, test_signer};

#[test]
#[ignore] // TODO: Test does not pass in WASI or native
#[cfg(all(feature = "add_thumbnails", feature = "file_io"))]
fn test_builder_ca_jpg() -> Result<()> {
let manifest_def = std::fs::read_to_string(fixtures_path("simple_manifest.json"))?;
let mut builder = Builder::from_json(&manifest_def)?;
Expand Down
11 changes: 7 additions & 4 deletions sdk/tests/v2_api_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,13 @@ mod integration_v2 {
dest
};

// write dest to file for debugging
let debug_path = format!("{}/../target/v2_test.jpg", env!("CARGO_MANIFEST_DIR"));
std::fs::write(debug_path, dest.get_ref())?;
dest.rewind()?;
#[cfg(not(target_os = "wasi"))]
{
// write dest to file for debugging
let debug_path = format!("{}/../target/v2_test.jpg", env!("CARGO_MANIFEST_DIR"));
std::fs::write(debug_path, dest.get_ref())?;
dest.rewind()?;
}

let reader = Reader::from_stream(format, &mut dest)?;

Expand Down

0 comments on commit dccba31

Please sign in to comment.