Skip to content

Commit 7589e2d

Browse files
committed
Add Makefile and README.md
1 parent 3c9825e commit 7589e2d

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.PHONY: all build test test-single clean
2+
3+
all: build test
4+
5+
build:
6+
@echo "Building orchestrator binary..."
7+
mkdir -p bin
8+
cd orchestrator && go build -o ./bin/orchestrator
9+
@echo "Building go-handler binary..."
10+
cd go-handler/go-bitcoinkernel && $(MAKE) build-kernel && $(MAKE) build
11+
cd go-handler && go build -o ./bin/go-handler
12+
@echo "Building rust-handler binary..."
13+
cd rust-handler && cargo build --release
14+
@echo "Build complete!"
15+
16+
test:
17+
@echo "Running all conformance tests with go-handler..."
18+
-./orchestrator/bin/orchestrator -handler ./go-handler/bin/go-handler -testdir testdata
19+
@echo "Running all conformance tests with rust-handler..."
20+
-./orchestrator/bin/orchestrator -handler ./rust-handler/target/release/rust-handler -testdir testdata
21+
22+
test-single:
23+
@if [ -z "$(TEST)" ]; then \
24+
echo "Error: TEST variable not set. Usage: make test-single TEST=testdata/chainstate_basic.json"; \
25+
exit 1; \
26+
fi
27+
@echo "Running test with go-handler: $(TEST)"
28+
./bin/orchestrator -handler ./go-handle/bin/go-handler -testfile $(TEST)
29+
@echo "Running test with rust-handler: $(TEST)"
30+
./bin/orchestrator -handler ./rust-handler/target/release/rust-handler -testfile $(TEST)
31+
32+
clean:
33+
@echo "Cleaning build artifacts..."
34+
cd go-handler/go-bitcoinkernel && $(MAKE) clean
35+
cd orchestrator && go clean && rm -rf build
36+
cd go-handler && go clean && rm -rf build
37+
cd rust-handler && cargo clean

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Bitcoin Kernel Binding Conformance Tests
2+
3+
This directory contains a language-agnostic conformance testing framework for Bitcoin Kernel bindings.
4+
5+
## ⚠️ Work in Progress
6+
7+
## Overview
8+
9+
The framework ensures that all language bindings (Go, Python, Rust, etc.) behave identically by:
10+
- Defining a standard JSON protocol for testing
11+
- Providing shared test cases that work across all bindings
12+
- Enforcing consistent error handling and categorization
13+
14+
## Architecture
15+
16+
```
17+
┌─────────────┐ ┌──────────────────┐
18+
│ Orchestrator│────────▶│ Handler Binary │
19+
│ (Go Test │ stdin │ (Go/Rust/etc) │
20+
│ Runner) │◀────────│ │
21+
└─────────────┘ stdout └──────────────────┘
22+
│ │
23+
│ │
24+
▼ ▼
25+
┌─────────┐ ┌────────────────┐
26+
│ Test │ │ Binding API │
27+
│ Cases │ └────────────────┘
28+
│ (JSON) │
29+
└─────────┘
30+
```
31+
32+
1. [**Orchestrator**](./orchestrator): Spawns handler binary, sends test requests, validates responses
33+
2. **Handler Binary**: Implements protocol, calls binding API, returns results
34+
- [Go handler](./go-handler) for the [Go binding](https://github.com/stringintech/go-bitcoinkernel)
35+
- [Rust handler](./rust-handler) for the [Rust binding](https://github.com/TheCharlatan/rust-bitcoinkernel)
36+
3. [**Test Cases**](./testdata): JSON files defining requests and expected responses
37+
38+
## Getting Started
39+
40+
### Cloning
41+
42+
Clone the repository with submodules:
43+
44+
```bash
45+
git clone --recurse-submodules https://github.com/stringintech/kernel-bindings-spec.git
46+
```
47+
**Note:** go-handler currently depends on go-bitcoinkernel via a submodule.
48+
49+
50+
### Building
51+
52+
Use the provided Makefile to build the project:
53+
54+
```bash
55+
# Build everything!
56+
make build
57+
```
58+
59+
### Running Tests
60+
61+
```bash
62+
# Run all conformance tests with both Go and Rust handlers
63+
make test
64+
65+
# Run a specific test file with both Go and Rust handlers
66+
make test-single TEST=testdata/chainstate_basic.json
67+
```

0 commit comments

Comments
 (0)