Skip to content

Commit

Permalink
Merge pull request #73 from firedancer-io:list-harnesses
Browse files Browse the repository at this point in the history
list_harness command
  • Loading branch information
ravyu-jump authored Aug 22, 2024
2 parents 52b3a73 + 7edd10f commit c54888a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
17 changes: 16 additions & 1 deletion commands.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `solana-test-suite`

Validate instruction effects from clients using instruction context Protobuf messages.
Validate effects from clients using InstrContext Protobuf messages.

**Usage**:

Expand All @@ -21,6 +21,7 @@ $ solana-test-suite [OPTIONS] COMMAND [ARGS]...
* `decode-protobuf`: Convert InstrContext messages to...
* `exec-instr`: Execute InstrContext message(s) and print...
* `instr-from-fixtures`: Extract InstrContext messages from fixtures.
* `list-harness-types`: List harness types available for use.
* `run-tests`: Run tests on a set of targets with a...

## `solana-test-suite create-fixtures`
Expand Down Expand Up @@ -114,6 +115,20 @@ $ solana-test-suite instr-from-fixtures [OPTIONS]
* `-p, --num-processes INTEGER`: Number of processes to use [default: 4]
* `--help`: Show this message and exit.

## `solana-test-suite list-harness-types`

List harness types available for use.

**Usage**:

```console
$ solana-test-suite list-harness-types [OPTIONS]
```

**Options**:

* `--help`: Show this message and exit.

## `solana-test-suite run-tests`

Run tests on a set of targets with a directory of InstrContext
Expand Down
2 changes: 2 additions & 0 deletions src/test_suite/fuzz_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@
diff_effect_fn=txn_diff.txn_diff_effects,
consensus_diff_effect_fn=txn_diff.consensus_txn_diff_effects,
)

HARNESS_LIST = [name for name, obj in globals().items() if isinstance(obj, HarnessCtx)]
15 changes: 14 additions & 1 deletion src/test_suite/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
globals.harness_ctx = eval(harness_type)
else:
globals.harness_ctx = InstrHarness
harness_type = "InstrHarness"

app = typer.Typer(
help="Validate instruction effects from clients using instruction context Protobuf messages."
help=f"Validate effects from clients using {globals.harness_ctx.context_type.__name__} Protobuf messages."
)


Expand Down Expand Up @@ -492,5 +493,17 @@ def decode_protobuf(
print(f"{sum(write_results)} files successfully written")


@app.command(help=f"List harness types available for use.")
def list_harness_types():
# pretty print harness types
print(f"Currently set harness type: {harness_type}\n")

print("Available harness types:")
for name in HARNESS_LIST:
print(f"- {name}")
print("\nTo use, export the harness type to HARNESS_TYPE env var. Example:")
print(f"export HARNESS_TYPE={HARNESS_LIST[0]}")


if __name__ == "__main__":
app()

0 comments on commit c54888a

Please sign in to comment.