diff --git a/test/fuse_integration/posix_Makefile b/test/fuse_integration/posix_Makefile index 733d28758..b919a7772 100644 --- a/test/fuse_integration/posix_Makefile +++ b/test/fuse_integration/posix_Makefile @@ -271,11 +271,35 @@ generate-html-report: @echo "$(BLUE)[REPORT] Generating HTML report...$(RESET)" @echo "" > $(REPORT_DIR)/posix_compliance_report.html @echo "SeaweedFS POSIX Compliance Report" >> $(REPORT_DIR)/posix_compliance_report.html - @echo "" >> $(REPORT_DIR)/posix_compliance_report.html + @echo "" >> $(REPORT_DIR)/posix_compliance_report.html @echo "

SeaweedFS POSIX Compliance Report

" >> $(REPORT_DIR)/posix_compliance_report.html @echo "

Generated on: $$(date)

" >> $(REPORT_DIR)/posix_compliance_report.html - @echo "

Test Results

" >> $(REPORT_DIR)/posix_compliance_report.html - @echo "

Detailed test results are available in the text and JSON reports.

" >> $(REPORT_DIR)/posix_compliance_report.html + @echo "
" >> $(REPORT_DIR)/posix_compliance_report.html + @echo "

Test Summary

" >> $(REPORT_DIR)/posix_compliance_report.html + @if [ -f "$(REPORT_DIR)/posix_basic_results.log" ]; then \ + TOTAL=$$(grep -c "RUN\|PASS\|FAIL" $(REPORT_DIR)/posix_basic_results.log 2>/dev/null || echo "0"); \ + PASSED=$$(grep -c "PASS:" $(REPORT_DIR)/posix_basic_results.log 2>/dev/null || echo "0"); \ + FAILED=$$(grep -c "FAIL:" $(REPORT_DIR)/posix_basic_results.log 2>/dev/null || echo "0"); \ + echo "

Basic Tests: $$PASSED passed, $$FAILED failed

" >> $(REPORT_DIR)/posix_compliance_report.html; \ + fi + @if [ -f "$(REPORT_DIR)/posix_critical_results.log" ]; then \ + TOTAL=$$(grep -c "RUN\|PASS\|FAIL" $(REPORT_DIR)/posix_critical_results.log 2>/dev/null || echo "0"); \ + PASSED=$$(grep -c "PASS:" $(REPORT_DIR)/posix_critical_results.log 2>/dev/null || echo "0"); \ + FAILED=$$(grep -c "FAIL:" $(REPORT_DIR)/posix_critical_results.log 2>/dev/null || echo "0"); \ + echo "

Critical Tests: $$PASSED passed, $$FAILED failed

" >> $(REPORT_DIR)/posix_compliance_report.html; \ + fi + @echo "
" >> $(REPORT_DIR)/posix_compliance_report.html + @echo "

Detailed Results

" >> $(REPORT_DIR)/posix_compliance_report.html + @for logfile in $(REPORT_DIR)/*.log; do \ + if [ -f "$$logfile" ]; then \ + basename=$$(basename "$$logfile" .log); \ + echo "
" >> $(REPORT_DIR)/posix_compliance_report.html; \ + echo "

$$basename

" >> $(REPORT_DIR)/posix_compliance_report.html; \ + echo "
" >> $(REPORT_DIR)/posix_compliance_report.html; \
+			tail -50 "$$logfile" | sed 's/&/\&/g; s//\>/g' >> $(REPORT_DIR)/posix_compliance_report.html; \
+			echo "
" >> $(REPORT_DIR)/posix_compliance_report.html; \ + fi; \ + done @echo "" >> $(REPORT_DIR)/posix_compliance_report.html @echo "$(GREEN)[OK] HTML report generated: $(REPORT_DIR)/posix_compliance_report.html$(RESET)" @@ -297,7 +321,54 @@ generate-json-report: @echo " \"timestamp\": \"$$(date -u +"%Y-%m-%dT%H:%M:%SZ")\"," >> $(REPORT_DIR)/posix_compliance_report.json @echo " \"seaweedfs_version\": \"$$($(WEED_BINARY) version 2>/dev/null | head -n1 || echo 'Unknown')\"," >> $(REPORT_DIR)/posix_compliance_report.json @echo " \"test_environment\": { \"os\": \"$$(uname -s)\", \"arch\": \"$$(uname -m)\" }," >> $(REPORT_DIR)/posix_compliance_report.json - @echo " \"test_results\": \"See individual log files for detailed results\"" >> $(REPORT_DIR)/posix_compliance_report.json + @echo " \"test_suites\": {" >> $(REPORT_DIR)/posix_compliance_report.json + @FIRST=true; \ + for logfile in $(REPORT_DIR)/*.log; do \ + if [ -f "$$logfile" ]; then \ + basename=$$(basename "$$logfile" .log); \ + if [ "$$FIRST" = "true" ]; then \ + FIRST=false; \ + else \ + echo " ," >> $(REPORT_DIR)/posix_compliance_report.json; \ + fi; \ + PASSED=$$(grep -c "PASS:" "$$logfile" 2>/dev/null || echo "0"); \ + FAILED=$$(grep -c "FAIL:" "$$logfile" 2>/dev/null || echo "0"); \ + TOTAL=$$((PASSED + FAILED)); \ + echo " \"$$basename\": {" >> $(REPORT_DIR)/posix_compliance_report.json; \ + echo " \"total_tests\": $$TOTAL," >> $(REPORT_DIR)/posix_compliance_report.json; \ + echo " \"passed\": $$PASSED," >> $(REPORT_DIR)/posix_compliance_report.json; \ + echo " \"failed\": $$FAILED," >> $(REPORT_DIR)/posix_compliance_report.json; \ + if [ $$TOTAL -gt 0 ]; then \ + SUCCESS_RATE=$$(awk "BEGIN {printf \"%.2f\", ($$PASSED/$$TOTAL)*100}"); \ + else \ + SUCCESS_RATE="0.00"; \ + fi; \ + echo " \"success_rate\": \"$$SUCCESS_RATE%\"" >> $(REPORT_DIR)/posix_compliance_report.json; \ + echo " }" >> $(REPORT_DIR)/posix_compliance_report.json; \ + fi; \ + done + @echo " }," >> $(REPORT_DIR)/posix_compliance_report.json + @TOTAL_PASSED=0; TOTAL_FAILED=0; \ + for logfile in $(REPORT_DIR)/*.log; do \ + if [ -f "$$logfile" ]; then \ + PASSED=$$(grep -c "PASS:" "$$logfile" 2>/dev/null || echo "0"); \ + FAILED=$$(grep -c "FAIL:" "$$logfile" 2>/dev/null || echo "0"); \ + TOTAL_PASSED=$$((TOTAL_PASSED + PASSED)); \ + TOTAL_FAILED=$$((TOTAL_FAILED + FAILED)); \ + fi; \ + done; \ + GRAND_TOTAL=$$((TOTAL_PASSED + TOTAL_FAILED)); \ + if [ $$GRAND_TOTAL -gt 0 ]; then \ + OVERALL_SUCCESS=$$(awk "BEGIN {printf \"%.2f\", ($$TOTAL_PASSED/$$GRAND_TOTAL)*100}"); \ + else \ + OVERALL_SUCCESS="0.00"; \ + fi; \ + echo " \"summary\": {" >> $(REPORT_DIR)/posix_compliance_report.json; \ + echo " \"total_tests\": $$GRAND_TOTAL," >> $(REPORT_DIR)/posix_compliance_report.json; \ + echo " \"total_passed\": $$TOTAL_PASSED," >> $(REPORT_DIR)/posix_compliance_report.json; \ + echo " \"total_failed\": $$TOTAL_FAILED," >> $(REPORT_DIR)/posix_compliance_report.json; \ + echo " \"overall_success_rate\": \"$$OVERALL_SUCCESS%\"" >> $(REPORT_DIR)/posix_compliance_report.json; \ + echo " }" >> $(REPORT_DIR)/posix_compliance_report.json @echo "}" >> $(REPORT_DIR)/posix_compliance_report.json @echo "$(GREEN)[OK] JSON report generated: $(REPORT_DIR)/posix_compliance_report.json$(RESET)" diff --git a/test/fuse_integration/posix_compliance_test.go b/test/fuse_integration/posix_compliance_test.go index 5cb782d26..b6068c76a 100644 --- a/test/fuse_integration/posix_compliance_test.go +++ b/test/fuse_integration/posix_compliance_test.go @@ -633,7 +633,7 @@ func (s *POSIXComplianceTestSuite) TestConcurrentAccess(t *testing.T) { } }) - t.Run("ConcurrentWrites", func(t *testing.T) { + t.Run("ConcurrentFileCreations", func(t *testing.T) { testFile := filepath.Join(mountPoint, "concurrent_write.txt") // Launch multiple concurrent writers diff --git a/test/fuse_integration/posix_external_test.go b/test/fuse_integration/posix_external_test.go index f22b65438..e1ca0b5e7 100644 --- a/test/fuse_integration/posix_external_test.go +++ b/test/fuse_integration/posix_external_test.go @@ -191,7 +191,8 @@ set -e cd "$1" ln -s link1 link2 ln -s link2 link1 -if [ -f link1 ]; then +# Try to access the file, which should fail due to too many symbolic links +if cat link1 2>/dev/null; then echo "FAIL: Symlink cycle not detected" exit 1 fi @@ -470,11 +471,13 @@ func (s *ExternalPOSIXTestSuite) testEdgeCases(t *testing.T, mountPoint string) require.NoError(t, err) defer os.RemoveAll(testDir) - t.Run("EmptyFileName", func(t *testing.T) { - // Test creating files with empty names (should fail) - emptyFile := filepath.Join(testDir, "") - err := os.WriteFile(emptyFile, []byte("test"), 0644) + t.Run("WriteToDirectoryAsFile", func(t *testing.T) { + // Test writing to a directory as if it were a file (should fail) + // Note: filepath.Join(testDir, "") returns testDir itself + err := os.WriteFile(testDir, []byte("test"), 0644) require.Error(t, err) + // Verify the error indicates we're trying to write to a directory + require.Contains(t, err.Error(), "directory", "Expected error to indicate target is a directory") }) t.Run("VeryLongFileName", func(t *testing.T) {