# SeaweedFS POSIX Compliance Testing Makefile # Configuration WEED_BINARY := $(shell which weed 2>/dev/null || echo "../../weed") GO_VERSION := 1.21 TEST_TIMEOUT := 45m COVERAGE_FILE := posix_coverage.out REPORT_DIR := reports EXTERNAL_TOOLS_DIR := external_tools # Test categories POSIX_BASIC_TESTS := posix_compliance_test.go POSIX_EXTENDED_TESTS := posix_extended_test.go POSIX_EXTERNAL_TESTS := posix_external_test.go # Colors for output RED := \033[31m GREEN := \033[32m YELLOW := \033[33m BLUE := \033[34m MAGENTA := \033[35m CYAN := \033[36m WHITE := \033[37m RESET := \033[0m .DEFAULT_GOAL := help # Prerequisites checks check-binary: @if [ ! -f "$(WEED_BINARY)" ]; then \ echo "$(RED)❌ SeaweedFS binary not found at $(WEED_BINARY)$(RESET)"; \ echo " Please run 'make' in the root directory first"; \ exit 1; \ fi @echo "$(GREEN)✅ SeaweedFS binary found at $(WEED_BINARY)$(RESET)" check-fuse: @if command -v fusermount >/dev/null 2>&1; then \ echo "$(GREEN)✅ FUSE is installed (Linux)$(RESET)"; \ elif command -v umount >/dev/null 2>&1 && [ "$$(uname)" = "Darwin" ]; then \ echo "$(GREEN)✅ FUSE is available (macOS)$(RESET)"; \ else \ echo "$(RED)❌ FUSE not found. Please install:$(RESET)"; \ echo " Ubuntu/Debian: sudo apt-get install fuse"; \ echo " CentOS/RHEL: sudo yum install fuse"; \ echo " macOS: brew install macfuse"; \ exit 1; \ fi check-go: @go version | grep -q "go1\.[2-9][0-9]" || \ go version | grep -q "go1\.2[1-9]" || \ (echo "$(RED)❌ Go $(GO_VERSION)+ required. Current: $$(go version)$(RESET)" && exit 1) @echo "$(GREEN)✅ Go version check passed$(RESET)" check-prereqs: check-go check-fuse check-binary @echo "$(GREEN)✅ All prerequisites satisfied$(RESET)" # Setup and initialization init-module: @if [ ! -f go.mod ]; then \ echo "$(BLUE)📦 Initializing Go module...$(RESET)"; \ go mod init seaweedfs-posix-tests; \ go mod tidy; \ fi setup-reports: @mkdir -p $(REPORT_DIR) @mkdir -p $(EXTERNAL_TOOLS_DIR) setup-external-tools: setup-reports @echo "$(BLUE)🛠️ Setting up external POSIX test tools...$(RESET)" @$(MAKE) setup-pjdfstest @$(MAKE) setup-nfstest @$(MAKE) setup-fio # External tools setup setup-pjdfstest: @if [ ! -d "$(EXTERNAL_TOOLS_DIR)/pjdfstest" ]; then \ echo "$(BLUE)📥 Setting up pjdfstest...$(RESET)"; \ cd $(EXTERNAL_TOOLS_DIR) && \ git clone https://github.com/pjd/pjdfstest.git && \ cd pjdfstest && \ autoreconf -ifs && \ ./configure && \ make; \ else \ echo "$(GREEN)✅ pjdfstest already setup$(RESET)"; \ fi setup-nfstest: @echo "$(BLUE)📥 Installing nfstest...$(RESET)" @pip3 install --user nfstest 2>/dev/null || \ echo "$(YELLOW)⚠️ nfstest installation failed. Install manually: pip3 install nfstest$(RESET)" setup-fio: @if ! command -v fio >/dev/null 2>&1; then \ echo "$(BLUE)📥 Installing FIO...$(RESET)"; \ if command -v apt-get >/dev/null 2>&1; then \ sudo apt-get update && sudo apt-get install -y fio; \ elif command -v yum >/dev/null 2>&1; then \ sudo yum install -y fio; \ elif command -v brew >/dev/null 2>&1; then \ brew install fio; \ else \ echo "$(YELLOW)⚠️ Please install FIO manually$(RESET)"; \ fi; \ else \ echo "$(GREEN)✅ FIO already installed$(RESET)"; \ fi # Core test execution test-posix-basic: check-prereqs init-module setup-reports @echo "$(CYAN)🧪 Running basic POSIX compliance tests...$(RESET)" @if [ -n "$(TEST_MOUNT_POINT)" ]; then \ echo "$(BLUE)Using external mount point: $(TEST_MOUNT_POINT)$(RESET)"; \ TEST_MOUNT_POINT="$(TEST_MOUNT_POINT)" TEST_SKIP_CLUSTER_SETUP="true" \ go test -v -timeout $(TEST_TIMEOUT) -run TestPOSIXCompliance $(POSIX_BASIC_TESTS) 2>&1 | \ tee $(REPORT_DIR)/posix_basic_results.log; \ else \ go test -v -timeout $(TEST_TIMEOUT) -run TestPOSIXCompliance $(POSIX_BASIC_TESTS) 2>&1 | \ tee $(REPORT_DIR)/posix_basic_results.log; \ fi test-posix-extended: check-prereqs init-module setup-reports @echo "$(CYAN)🧪 Running extended POSIX compliance tests...$(RESET)" @if [ -n "$(TEST_MOUNT_POINT)" ]; then \ echo "$(BLUE)Using external mount point: $(TEST_MOUNT_POINT)$(RESET)"; \ TEST_MOUNT_POINT="$(TEST_MOUNT_POINT)" TEST_SKIP_CLUSTER_SETUP="true" \ go test -v -timeout $(TEST_TIMEOUT) -run TestPOSIXExtended $(POSIX_EXTENDED_TESTS) 2>&1 | \ tee $(REPORT_DIR)/posix_extended_results.log; \ else \ go test -v -timeout $(TEST_TIMEOUT) -run TestPOSIXExtended $(POSIX_EXTENDED_TESTS) 2>&1 | \ tee $(REPORT_DIR)/posix_extended_results.log; \ fi test-posix-external: check-prereqs init-module setup-reports setup-external-tools @echo "$(CYAN)🧪 Running external POSIX test suite integration...$(RESET)" @if [ -n "$(TEST_MOUNT_POINT)" ]; then \ echo "$(BLUE)Using external mount point: $(TEST_MOUNT_POINT)$(RESET)"; \ TEST_MOUNT_POINT="$(TEST_MOUNT_POINT)" TEST_SKIP_CLUSTER_SETUP="true" \ go test -v -timeout $(TEST_TIMEOUT) -run TestExternalPOSIXSuites $(POSIX_EXTERNAL_TESTS) 2>&1 | \ tee $(REPORT_DIR)/posix_external_results.log; \ else \ go test -v -timeout $(TEST_TIMEOUT) -run TestExternalPOSIXSuites $(POSIX_EXTERNAL_TESTS) 2>&1 | \ tee $(REPORT_DIR)/posix_external_results.log; \ fi # Comprehensive test suites test-posix-full: test-posix-basic test-posix-extended test-posix-external @echo "$(GREEN)✅ Full POSIX compliance test suite completed$(RESET)" @$(MAKE) generate-report test-posix-critical: check-prereqs init-module setup-reports @echo "$(CYAN)🧪 Running critical POSIX compliance tests...$(RESET)" @if [ -n "$(TEST_MOUNT_POINT)" ]; then \ echo "$(BLUE)Using external mount point: $(TEST_MOUNT_POINT)$(RESET)"; \ TEST_MOUNT_POINT="$(TEST_MOUNT_POINT)" TEST_SKIP_CLUSTER_SETUP="true" \ go test -v -timeout 15m \ -run "TestPOSIXCompliance/(FileOperations|DirectoryOperations|PermissionTests|IOOperations)" \ $(POSIX_BASIC_TESTS) 2>&1 | tee $(REPORT_DIR)/posix_critical_results.log; \ else \ go test -v -timeout 15m \ -run "TestPOSIXCompliance/(FileOperations|DirectoryOperations|PermissionTests|IOOperations)" \ $(POSIX_BASIC_TESTS) 2>&1 | tee $(REPORT_DIR)/posix_critical_results.log; \ fi test-posix-stress: check-prereqs init-module setup-reports @echo "$(CYAN)🧪 Running POSIX stress tests...$(RESET)" @go test -v -timeout $(TEST_TIMEOUT) \ -run "TestExternalPOSIXSuites/CustomPOSIXTests" \ $(POSIX_EXTERNAL_TESTS) 2>&1 | tee $(REPORT_DIR)/posix_stress_results.log # Performance and benchmarks benchmark-posix: check-prereqs init-module setup-reports @echo "$(CYAN)📈 Running POSIX performance benchmarks...$(RESET)" @go test -v -timeout $(TEST_TIMEOUT) -bench=. -benchmem \ $(POSIX_BASIC_TESTS) $(POSIX_EXTENDED_TESTS) 2>&1 | \ tee $(REPORT_DIR)/posix_benchmark_results.log profile-posix: check-prereqs init-module setup-reports @echo "$(CYAN)📊 Running POSIX tests with profiling...$(RESET)" @go test -v -timeout $(TEST_TIMEOUT) -cpuprofile $(REPORT_DIR)/posix.cpu.prof \ -memprofile $(REPORT_DIR)/posix.mem.prof -run TestPOSIXCompliance $(POSIX_BASIC_TESTS) @echo "$(GREEN)📊 Profiles generated:$(RESET)" @echo " CPU: $(REPORT_DIR)/posix.cpu.prof" @echo " Memory: $(REPORT_DIR)/posix.mem.prof" @echo "$(BLUE)View with: go tool pprof $(REPORT_DIR)/posix.cpu.prof$(RESET)" # Coverage analysis coverage-posix: check-prereqs init-module setup-reports @echo "$(CYAN)📊 Running POSIX tests with coverage analysis...$(RESET)" @go test -v -timeout $(TEST_TIMEOUT) -coverprofile=$(REPORT_DIR)/$(COVERAGE_FILE) \ $(POSIX_BASIC_TESTS) $(POSIX_EXTENDED_TESTS) $(POSIX_EXTERNAL_TESTS) @go tool cover -html=$(REPORT_DIR)/$(COVERAGE_FILE) -o $(REPORT_DIR)/posix_coverage.html @echo "$(GREEN)📊 Coverage report generated: $(REPORT_DIR)/posix_coverage.html$(RESET)" # External tool tests test-pjdfstest: setup-external-tools @echo "$(CYAN)🧪 Running pjdfstest suite...$(RESET)" @if [ -d "$(EXTERNAL_TOOLS_DIR)/pjdfstest" ]; then \ cd $(EXTERNAL_TOOLS_DIR)/pjdfstest && \ prove -r tests/ 2>&1 | tee ../../$(REPORT_DIR)/pjdfstest_results.log; \ else \ echo "$(RED)❌ pjdfstest not setup$(RESET)"; \ exit 1; \ fi test-nfstest-posix: @echo "$(CYAN)🧪 Running nfstest_posix...$(RESET)" @if command -v nfstest_posix >/dev/null 2>&1; then \ mkdir -p /tmp/nfstest_mount; \ nfstest_posix --path /tmp/nfstest_mount --verbose 2>&1 | \ tee $(REPORT_DIR)/nfstest_results.log; \ else \ echo "$(YELLOW)⚠️ nfstest_posix not available$(RESET)"; \ fi # FIO-based performance tests test-fio-posix: setup-reports @echo "$(CYAN)🧪 Running FIO-based POSIX I/O tests...$(RESET)" @$(MAKE) create-fio-configs @if command -v fio >/dev/null 2>&1; then \ for config in $(REPORT_DIR)/fio_*.conf; do \ echo "$(BLUE)Running FIO config: $$config$(RESET)"; \ fio $$config --output=$(REPORT_DIR)/$$(basename $$config .conf)_results.log; \ done; \ else \ echo "$(YELLOW)⚠️ FIO not available$(RESET)"; \ fi create-fio-configs: setup-reports @echo "$(BLUE)📝 Creating FIO test configurations...$(RESET)" @cat > $(REPORT_DIR)/fio_random_rw.conf << 'EOF' [global] name=posix_random_rw ioengine=sync iodepth=1 rw=randrw bs=4k direct=0 size=100m numjobs=4 runtime=30 time_based [random_rw_test] directory=/tmp/seaweedfs_mount EOF @cat > $(REPORT_DIR)/fio_sequential.conf << 'EOF' [global] name=posix_sequential ioengine=sync iodepth=1 bs=1m direct=0 size=500m runtime=60 time_based [seq_write] rw=write directory=/tmp/seaweedfs_mount [seq_read] rw=read directory=/tmp/seaweedfs_mount EOF # Reporting and analysis generate-report: setup-reports @echo "$(BLUE)📋 Generating comprehensive POSIX compliance report...$(RESET)" @$(MAKE) generate-html-report @$(MAKE) generate-text-report @$(MAKE) generate-json-report generate-html-report: @echo "$(BLUE)📄 Generating HTML report...$(RESET)" @cat > $(REPORT_DIR)/posix_compliance_report.html << 'EOF'
Generated: $(shell date)
SeaweedFS Version: $(shell $(WEED_BINARY) version 2>/dev/null || echo "Unknown")
This report provides a comprehensive analysis of SeaweedFS FUSE mount POSIX compliance.
Category | Status | Details |
---|---|---|
Basic File Operations | See detailed results | Create, read, write, delete operations |
Directory Operations | See detailed results | Directory lifecycle management |
Extended Attributes | See detailed results | xattr support and operations |
File Locking | See detailed results | Advisory and mandatory locking |
Advanced I/O | See detailed results | readv/writev, pread/pwrite, mmap |
External Test Suites | See detailed results | pjdfstest, nfstest integration |
See individual log files for detailed test results: