Files
ToastyFS/scripts
Claudeandcozis cc758a5d3a Add web server to cluster demo and fix port bug
- Add web server integration to cluster_demo.sh script
  - Configure web server port (8090)
  - Update build_if_needed() to check for toastyfs_web binary
  - Add get_web_binary() function
  - Start web server after chunk servers
  - Update status display to show web server
  - Update help text to show HTTP interface

- Fix bug in web/main.c where --local-port incorrectly set
  upstream_port instead of local_port

The cluster demo now starts a full cluster with:
- Metadata server on port 8080 (ToastyFS protocol)
- N chunk servers starting from port 8081
- Web server on port 8090 (HTTP interface)
2025-11-23 09:03:13 +01:00
..
2025-11-16 02:10:59 +01:00

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

# 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:

sudo apt-get install lcov

Usage

Quick text summary (5 second simulation)

make coverage-report

HTML report with branch details (5 second simulation)

make coverage-html

Custom duration

./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