diff options
| author | chrislu <chris.lu@gmail.com> | 2025-08-31 12:04:39 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-08-31 12:04:39 -0700 |
| commit | fd1149e5b26c6a762980f2e36c44a19ab081ee8e (patch) | |
| tree | 6549d4487cf197dc016b5faf74af0ba98ab8360b | |
| parent | 591ca3f2c5af90a6e64c5ca90d91b47ef2c211ae (diff) | |
| download | seaweedfs-fd1149e5b26c6a762980f2e36c44a19ab081ee8e.tar.xz seaweedfs-fd1149e5b26c6a762980f2e36c44a19ab081ee8e.zip | |
fix
| -rw-r--r-- | test/fuse_integration/posix_Makefile | 79 | ||||
| -rw-r--r-- | test/fuse_integration/posix_compliance_test.go | 2 | ||||
| -rw-r--r-- | test/fuse_integration/posix_external_test.go | 13 |
3 files changed, 84 insertions, 10 deletions
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 "<!DOCTYPE html>" > $(REPORT_DIR)/posix_compliance_report.html @echo "<html><head><title>SeaweedFS POSIX Compliance Report</title>" >> $(REPORT_DIR)/posix_compliance_report.html - @echo "<style>body{font-family:Arial;margin:20px}.pass{color:green}.fail{color:red}</style>" >> $(REPORT_DIR)/posix_compliance_report.html + @echo "<style>body{font-family:Arial;margin:20px}.pass{color:green}.fail{color:red}.summary{background:#f5f5f5;padding:10px;margin:10px 0}.test-section{margin:20px 0;border-left:3px solid #ddd;padding-left:15px}</style>" >> $(REPORT_DIR)/posix_compliance_report.html @echo "</head><body><h1>SeaweedFS POSIX Compliance Report</h1>" >> $(REPORT_DIR)/posix_compliance_report.html @echo "<p>Generated on: $$(date)</p>" >> $(REPORT_DIR)/posix_compliance_report.html - @echo "<h2>Test Results</h2>" >> $(REPORT_DIR)/posix_compliance_report.html - @echo "<p>Detailed test results are available in the text and JSON reports.</p>" >> $(REPORT_DIR)/posix_compliance_report.html + @echo "<div class='summary'>" >> $(REPORT_DIR)/posix_compliance_report.html + @echo "<h2>Test Summary</h2>" >> $(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 "<p>Basic Tests: <span class='pass'>$$PASSED passed</span>, <span class='fail'>$$FAILED failed</span></p>" >> $(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 "<p>Critical Tests: <span class='pass'>$$PASSED passed</span>, <span class='fail'>$$FAILED failed</span></p>" >> $(REPORT_DIR)/posix_compliance_report.html; \ + fi + @echo "</div>" >> $(REPORT_DIR)/posix_compliance_report.html + @echo "<h2>Detailed Results</h2>" >> $(REPORT_DIR)/posix_compliance_report.html + @for logfile in $(REPORT_DIR)/*.log; do \ + if [ -f "$$logfile" ]; then \ + basename=$$(basename "$$logfile" .log); \ + echo "<div class='test-section'>" >> $(REPORT_DIR)/posix_compliance_report.html; \ + echo "<h3>$$basename</h3>" >> $(REPORT_DIR)/posix_compliance_report.html; \ + echo "<pre>" >> $(REPORT_DIR)/posix_compliance_report.html; \ + tail -50 "$$logfile" | sed 's/&/\&/g; s/</\</g; s/>/\>/g' >> $(REPORT_DIR)/posix_compliance_report.html; \ + echo "</pre></div>" >> $(REPORT_DIR)/posix_compliance_report.html; \ + fi; \ + done @echo "</body></html>" >> $(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) { |
