This script provides a convenient way to spawn and manage a ToastyFS cluster for demo and testing purposes. Features include: - Start a cluster with configurable number of chunk servers - Automatic building if binary is not present - Process management with PID tracking - Status checking for all cluster nodes - Easy cleanup of all cluster processes - Separate log files for each server component - Colorized output for better readability Usage: ./scripts/cluster_demo.sh start [num_servers] - Start cluster ./scripts/cluster_demo.sh stop - Stop cluster ./scripts/cluster_demo.sh status - Show status ./scripts/cluster_demo.sh clean - Clean data/logs
86 lines
2.0 KiB
Markdown
86 lines
2.0 KiB
Markdown
# Scripts
|
|
|
|
This directory contains utility scripts for ToastyFS development and testing.
|
|
|
|
## Cluster Demo Script
|
|
|
|
The `cluster_demo.sh` script allows you to easily spawn and manage a ToastyFS cluster for demo and testing purposes.
|
|
|
|
### Usage
|
|
|
|
```bash
|
|
# Start a cluster with 3 chunk servers (default)
|
|
./scripts/cluster_demo.sh start
|
|
|
|
# Start a cluster with a custom number of chunk servers
|
|
./scripts/cluster_demo.sh start 5
|
|
|
|
# Check cluster status
|
|
./scripts/cluster_demo.sh status
|
|
|
|
# Stop the cluster
|
|
./scripts/cluster_demo.sh stop
|
|
|
|
# Clean all cluster data and logs
|
|
./scripts/cluster_demo.sh clean
|
|
```
|
|
|
|
### What it does
|
|
|
|
The script:
|
|
- Builds ToastyFS if needed
|
|
- Starts one metadata server (leader) on port 8080
|
|
- Starts the specified number of chunk servers on ports 8081, 8082, etc.
|
|
- Stores all process IDs for easy management
|
|
- Captures logs to `cluster_logs/` directory
|
|
- Stores data in `cluster_data/` directory
|
|
|
|
All servers run in the background, making it easy to test the cluster with client applications.
|
|
|
|
## Branch Coverage Measurement
|
|
|
|
### Prerequisites
|
|
|
|
The HTML report generation requires `lcov`:
|
|
|
|
```bash
|
|
sudo apt-get install lcov
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Quick text summary (5 second simulation)
|
|
```bash
|
|
make coverage-report
|
|
```
|
|
|
|
### HTML report with branch details (5 second simulation)
|
|
```bash
|
|
make coverage-html
|
|
```
|
|
|
|
### Custom duration
|
|
```bash
|
|
./scripts/measure_coverage.sh 10 # 10 second run, text output
|
|
./scripts/measure_coverage.sh 10 --html # 10 second run, HTML output
|
|
```
|
|
|
|
## What gets measured
|
|
|
|
The coverage tool:
|
|
- Builds the test binary with coverage instrumentation (`--coverage` flag)
|
|
- Runs the random simulation for the specified duration
|
|
- Generates reports showing which branches were executed
|
|
|
|
## Output
|
|
|
|
**Text report**: Shows per-file and total branch coverage percentages
|
|
|
|
**HTML report**: Interactive report generated by lcov/genhtml showing:
|
|
- Overall coverage summary
|
|
- Per-file coverage breakdown
|
|
- Source code with execution counts
|
|
- Branch coverage details
|
|
|
|
The HTML report is generated in `coverage_report/index.html`
|