-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmvn-test-no-boilerplate.sh
More file actions
executable file
·71 lines (61 loc) · 1.98 KB
/
Copy pathmvn-test-no-boilerplate.sh
File metadata and controls
executable file
·71 lines (61 loc) · 1.98 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
#!/bin/bash
# Strip Maven test boilerplate - show compile errors and test results only
# Usage: ./mvn-test-no-boilerplate.sh [maven test arguments]
#
# Examples:
# ./mvn-test-no-boilerplate.sh -Dtest=RefactorTests
# ./mvn-test-no-boilerplate.sh -Dtest=RefactorTests#testList -Djava.util.logging.ConsoleHandler.level=INFO
# ./mvn-test-no-boilerplate.sh -Dtest=RefactorTests#testList -Djava.util.logging.ConsoleHandler.level=FINER
#
# For running tests in a specific module:
# ./mvn-test-no-boilerplate.sh -pl json-java21-api-tracker -Dtest=CompilerApiLearningTest
#
# The script automatically detects if mvnd is available, otherwise falls back to mvn
# Detect if mvnd is available, otherwise use mvn
if command -v mvnd &> /dev/null; then
MVN_CMD="mvnd"
else
MVN_CMD="mvn"
fi
timeout 120 $MVN_CMD test "$@" 2>&1 | awk '
BEGIN {
scanning_started = 0
compilation_section = 0
test_section = 0
}
# Skip all WARNING lines before project scanning starts
/INFO.*Scanning for projects/ {
scanning_started = 1
print
next
}
# Before scanning starts, skip WARNING lines
!scanning_started && /^WARNING:/ { next }
# Show compilation errors
/COMPILATION ERROR/ { compilation_section = 1 }
/BUILD FAILURE/ && compilation_section { compilation_section = 0 }
# Show test section
/INFO.*T E S T S/ {
test_section = 1
print "-------------------------------------------------------"
print " T E S T S"
print "-------------------------------------------------------"
next
}
# In compilation error section, show everything
compilation_section { print }
# In test section, show everything - let user control logging with -D arguments
test_section {
print
}
# Before test section starts, show important lines only
!test_section && scanning_started {
if (/INFO.*Scanning|INFO.*Building|INFO.*resources|INFO.*compiler|INFO.*surefire|ERROR|FAILURE/) {
print
}
# Show compilation warnings/errors
if (/WARNING.*COMPILATION|ERROR.*/) {
print
}
}
'