-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (83 loc) · 2.5 KB
/
Makefile
File metadata and controls
96 lines (83 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
.PHONY: test install clean example help
# Default target
help:
@echo "Available targets:"
@echo " test - Run test script"
@echo " test-modes - Run comprehensive mode tests"
@echo " test-fixes - Run fix tests for problematic log formats"
@echo " test-encoding - Test encoding handling"
@echo " test-incomplete - Test incomplete log handling"
@echo " test-all - Run all tests"
@echo " example - Run example script"
@echo " test-data - Test with original test data (transaction mode)"
@echo " test-line-mode - Test line mode functionality"
@echo " install - Install the package"
@echo " clean - Clean up generated files"
@echo " help - Show this help message"
# Run tests
test:
python test_parser.py
# Run comprehensive mode tests
test-modes:
python test_modes.py
# Run fix tests for problematic log formats
test-fixes:
python test_fixes.py
# Test encoding handling
test-encoding:
python test_encoding.py
# Test incomplete log handling
test-incomplete:
python test_incomplete_logs.py
# Run all tests
test-all:
@echo "Running all tests..."
@echo "1. Basic tests:"
python test_parser.py
@echo ""
@echo "2. Mode tests:"
python test_modes.py
@echo ""
@echo "3. Fix tests:"
python test_fixes.py
@echo ""
@echo "4. Encoding tests:"
python test_encoding.py
@echo ""
@echo "5. Incomplete log tests:"
python test_incomplete_logs.py
@echo ""
@echo "All tests completed!"
# Run example
example:
python example.py
# Test with original test data
test-data:
@echo "Testing with original syslog format (transaction mode):"
head -20 test/test.log | python postfix_log_parser.py
@echo ""
@echo "Testing with ISO8601 format (transaction mode):"
head -20 test/test-iso8601.log | python postfix_log_parser.py
# Test line mode
test-line-mode:
@echo "Testing line mode with individual log entries:"
head -10 test/test.log | python postfix_log_parser.py --line-mode
@echo ""
@echo "Testing single line:"
echo "Oct 10 04:02:08 mail postfix/smtp[123]: ABC: to=<test@example.com>, status=sent" | python postfix_log_parser.py --line-mode
# Install package
install:
pip install -e .
# Clean up
clean:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
find . -name "*.pyc" -delete
find . -name "__pycache__" -delete
# Compare output with original Go implementation (if available)
compare:
@echo "Python implementation output:"
head -20 test/test.log | python postfix_log_parser.py | jq .
@echo ""
@echo "Note: Install original Go implementation to compare outputs"