Skip to content

test(spec): move spec test runners to test folder #699

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

Merged
merged 3 commits into from
Jan 30, 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ $(VECTORS_DIR)/%: $(SPECTEST_ROOTDIR)/%_${SPECTEST_VERSION}.tar.gz
-rm -rf $@
tar -xzmf "$<" -C $(SPECTEST_ROOTDIR)

$(SPECTEST_GENERATED_ROOTDIR): $(VECTORS_DIR)/mainnet $(VECTORS_DIR)/minimal $(VECTORS_DIR)/general lib/spec/runners/*.ex lib/mix/tasks/generate_spec_tests.ex
$(SPECTEST_GENERATED_ROOTDIR): $(VECTORS_DIR)/mainnet $(VECTORS_DIR)/minimal $(VECTORS_DIR)/general test/spec/runners/*.ex test/spec/tasks/*.ex
mix generate_spec_tests

#⬇️ download-vectors: @ Download the spec test vectors files.
Expand Down
1 change: 0 additions & 1 deletion lib/lambda_ethereum_consensus/p2p/block_downloader.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ defmodule LambdaEthereumConsensus.P2P.BlockDownloader do
{:ok, chunks} <- parse_response(response_chunk),
{:ok, blocks} <- decode_chunks(chunks),
:ok <- verify_batch(blocks, slot, count) do
# TODO: handle cases where slot is empty
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unrelated, but this comment doesn't apply anymore.

tags = %{result: "success", type: "by_slot", reason: "success"}
:telemetry.execute([:network, :request], %{blocks: count}, tags)
{:ok, blocks}
Expand Down
7 changes: 5 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ defmodule LambdaEthereumConsensus.MixProject do
elixirc_paths: compiler_paths(Mix.env()),
warn_test_pattern: "_remove_warning.exs",
preferred_cli_env: [
dialyzer: :test
dialyzer: :test,
generate_spec_tests: :test
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is the main change, running the task in :test env so that the runners are included as part of the compilation.

]
]
end
Expand Down Expand Up @@ -69,6 +70,8 @@ defmodule LambdaEthereumConsensus.MixProject do
]
end

defp compiler_paths(:test), do: ["test/spec", "test/fixtures"] ++ compiler_paths(:prod)
defp compiler_paths(:test),
do: ["test/spec", "test/fixtures"] ++ compiler_paths(:prod)

defp compiler_paths(_), do: ["lib", "proto"]
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule Mix.Tasks.GenerateSpecTests do
@shortdoc "Generates tests for spec test files"
@impl Mix.Task
def run(_args) do
{:ok, file_names} = File.ls(Path.join(["lib", "spec", "runners"]))
{:ok, file_names} = File.ls(Path.join(["test", "spec", "runners"]))
runners = Enum.map(file_names, &Path.basename(&1, ".ex"))

# Generate all tests for Capella fork
Expand Down
File renamed without changes.
File renamed without changes.