Skip to content

Commit

Permalink
Merge pull request fermyon#2217 from fermyon/generalize-runtime-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rylev authored Jan 10, 2024
2 parents d752e9f + 5ff3489 commit 61c8036
Show file tree
Hide file tree
Showing 35 changed files with 1,251 additions and 1,105 deletions.
25 changes: 18 additions & 7 deletions Cargo.lock

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

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ sha2 = "0.10.1"
which = "4.2.5"
e2e-testing = { path = "crates/e2e-testing" }
http-body-util = { workspace = true }
testing-framework = { path = "tests/testing-framework" }
runtime-tests = { path = "tests/runtime-tests" }
test-components = { path = "tests/test-components" }
test-codegen-macro = { path = "crates/test-codegen-macro" }
Expand All @@ -114,7 +115,13 @@ llm-metal = ["llm", "spin-trigger-http/llm-metal"]
llm-cublas = ["llm", "spin-trigger-http/llm-cublas"]

[workspace]
members = ["crates/*", "sdk/rust", "sdk/rust/macro", "tests/runtime-tests"]
members = [
"crates/*",
"sdk/rust",
"sdk/rust/macro",
"tests/runtime-tests",
"tests/testing-framework",
]

[workspace.dependencies]
anyhow = "1.0.75"
Expand Down
2 changes: 0 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::{

use cargo_target_dep::build_target_dep;

const RUST_HTTP_INTEGRATION_TEST: &str = "tests/http/simple-spin-rust";
const RUST_HTTP_VAULT_VARIABLES_TEST: &str = "tests/http/vault-variables-test";
const TIMER_TRIGGER_INTEGRATION_TEST: &str = "examples/spin-timer/app-example";
const WASI_HTTP_INTEGRATION_TEST: &str = "examples/wasi-http-rust-streaming-outgoing-body";
Expand Down Expand Up @@ -86,7 +85,6 @@ error: the `wasm32-wasi` target is not installed
);
build_wasm_test_program("timer_app_example.wasm", "examples/spin-timer/app-example");

cargo_build(RUST_HTTP_INTEGRATION_TEST);
cargo_build(RUST_HTTP_VAULT_VARIABLES_TEST);
cargo_build(TIMER_TRIGGER_INTEGRATION_TEST);
cargo_build(WASI_HTTP_INTEGRATION_TEST);
Expand Down
8 changes: 6 additions & 2 deletions crates/test-codegen-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ use std::{env, path::PathBuf};

/// This macro generates the `#[test]` functions for the runtime tests.
#[proc_macro]
pub fn codegen_tests(_input: TokenStream) -> TokenStream {
pub fn codegen_runtime_tests(_input: TokenStream) -> TokenStream {
let mut tests = Vec::new();
let tests_path =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../tests/runtime-tests/tests");
let tests_path_string = tests_path
.to_str()
.expect("CARGO_MANIFEST_DIR is not valid utf8")
.to_owned();
for entry in std::fs::read_dir(tests_path).expect("failed to read tests directory") {
let entry = entry.expect("error reading test directory entry");
let test = entry.path();
Expand All @@ -33,7 +37,7 @@ pub fn codegen_tests(_input: TokenStream) -> TokenStream {
#[test]
#feature_attribute
fn #ident() {
run(#name)
run(::std::path::PathBuf::from(#tests_path_string).join(#name))
}
});
}
Expand Down
2 changes: 0 additions & 2 deletions tests/http/simple-spin-rust/.cargo/config.toml

This file was deleted.

Loading

0 comments on commit 61c8036

Please sign in to comment.