Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testutils bug(s) #4489

Merged
merged 4 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ include $(srcdir)/src.mk

noinst_HEADERS = $(SRC_H_FILES)

if BUILD_TESTS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to remove this block?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was accidental duplication while editing.

stellar_core_SOURCES = main/StellarCoreVersion.cpp main/XDRFilesSha256.cpp $(SRC_CXX_FILES) $(SRC_TEST_CXX_FILES)
else # !BUILD_TESTS
stellar_core_SOURCES = main/StellarCoreVersion.cpp main/XDRFilesSha256.cpp $(SRC_CXX_FILES)
endif # !BUILD_TESTS

if USE_TRACY
CARGO_FEATURE_TRACY = --features tracy
else
Expand Down Expand Up @@ -187,13 +181,13 @@ $(SOROBAN_LIBS_STAMP): $(wildcard rust/soroban/p*/Cargo.lock) Makefile $(RUST_DE
FEATURE_FLAGS="" ; \
case "$$proto" in \
p21) \
FEATURE_FLAGS="$(CARGO_FEATURE_TESTUTILS)" \
FEATURE_FLAGS="" \
;; \
$(SOROBAN_MAX_PROTOCOL)) \
FEATURE_FLAGS="$(CARGO_FEATURE_TRACY) $(CARGO_FEATURE_NEXT) $(CARGO_FEATURE_TESTUTILS)" \
FEATURE_FLAGS="$(CARGO_FEATURE_TRACY) $(CARGO_FEATURE_NEXT)" \
;; \
*) \
FEATURE_FLAGS="$(CARGO_FEATURE_TRACY) $(CARGO_FEATURE_TESTUTILS)" \
FEATURE_FLAGS="$(CARGO_FEATURE_TRACY)" \
;; \
esac ; \
cd $(abspath $(RUST_BUILD_DIR))/soroban/$$proto && \
Expand Down Expand Up @@ -226,7 +220,7 @@ $(LIBRUST_STELLAR_CORE): $(RUST_HOST_DEPFILES) $(SRC_RUST_FILES) Makefile $(SORO
--$(RUST_PROFILE) \
--locked \
--target-dir $(abspath $(RUST_TARGET_DIR)) \
$(CARGO_FEATURE_TRACY) $(CARGO_FEATURE_NEXT) \
$(CARGO_FEATURE_TRACY) $(CARGO_FEATURE_NEXT) $(CARGO_FEATURE_TESTUTILS) \
-- \
$(ALL_SOROBAN_EXTERN_ARGS) \
$(ALL_SOROBAN_DEPEND_ARGS)
Expand Down
13 changes: 6 additions & 7 deletions src/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,9 @@ use log::partition::TX;

// We have multiple copies of soroban linked into stellar-core here. This is
// accomplished using an adaptor module -- contract.rs -- mounted multiple times
// into the same outer crate, inside different modules soroban_p21, soroban_p22,
// etc. each with its own local binding for the external crate soroban_env_host.
// The contract.rs module imports soroban_env_host from `super` which means each
// into the same outer crate, inside different modules p21, p22, etc. each with
// its own local binding for the external crate soroban_env_host. The
// contract.rs module imports soroban_env_host from `super` which means each
// instance of it sees a different soroban. This is a bit of a hack and only
// works when the soroban versions all have a compatible _enough_ interface to
// all be called from "the same" contract.rs.
Expand Down Expand Up @@ -774,6 +774,7 @@ mod test_extra_protocol {

use super::*;
use std::hash::Hasher;
use std::str::FromStr;

pub(super) fn maybe_invoke_host_function_again_and_compare_outputs(
res1: &Result<InvokeHostFunctionOutput, Box<dyn std::error::Error>>,
Expand Down Expand Up @@ -845,9 +846,7 @@ mod test_extra_protocol {
) -> Result<(), Box<dyn std::error::Error>> {
match new_protocol {
22 => {
use soroban_p22::contract::{
inplace_modify_cxxbuf_encoded_type, xdr::SorobanResources,
};
use p22::contract::{inplace_modify_cxxbuf_encoded_type, xdr::SorobanResources};
if let Ok(extra) = std::env::var("SOROBAN_TEST_CPU_BUDGET_FACTOR") {
if let Ok(factor) = u32::from_str(&extra) {
inplace_modify_cxxbuf_encoded_type::<SorobanResources>(
Expand Down Expand Up @@ -884,7 +883,7 @@ mod test_extra_protocol {

match new_protocol {
22 => {
use soroban_p22::contract::{
use p22::contract::{
inplace_modify_cxxbuf_encoded_type, xdr::ContractCostParams,
xdr::ContractCostType as CT,
};
Expand Down
Loading