@@ -27,6 +27,7 @@ function parse_boolean() {
27
27
28
28
parse_boolean " $METAFIX_DISABLE_TO_DO " && disable_todo=1 || disable_todo=
29
29
parse_boolean " $METAFIX_INTEGRATION_TEST_PROFILE " && noprofile= || noprofile=no
30
+ parse_boolean " $METAFIX_KEEP_TEMP " && keep_temp=1 || keep_temp=
30
31
31
32
[ -t 1 -a -x /usr/bin/colordiff ] && colordiff=colordiff || colordiff=cat
32
33
@@ -67,6 +68,10 @@ function die() {
67
68
exit 2
68
69
}
69
70
71
+ function rm_temp() {
72
+ [ -n " $keep_temp " ] || rm -f " $@ "
73
+ }
74
+
70
75
function run_metafix() {
71
76
$gradle_command --console=plain -p " $root_directory " :metafix-runner:run --args=" $1 " -P${noprofile} profile=" ${1% .* } "
72
77
}
@@ -120,8 +125,8 @@ function get_file() {
120
125
function command_info() {
121
126
log " ${color_info}${1^} command exit status$color_reset : $2 "
122
127
123
- [ -s " $3 " ] && log " ${color_info}${1^} command output$color_reset : $3 " || rm -f " $3 "
124
- [ -s " $4 " ] && log " ${color_info}${1^} command error$color_reset : $4 " || rm -f " $4 "
128
+ [ -s " $3 " ] && log " ${color_info}${1^} command output$color_reset : $3 " || rm_temp " $3 "
129
+ [ -s " $4 " ] && log " ${color_info}${1^} command error$color_reset : $4 " || rm_temp " $4 "
125
130
126
131
log
127
132
}
@@ -166,7 +171,7 @@ function test_failed() {
166
171
log " Output: ${12} "
167
172
log " Diff: ${13} "
168
173
169
- [ -s " ${13} " ] && $colordiff < " ${13} " || rm -f " ${13} "
174
+ [ -s " ${13} " ] && $colordiff < " ${13} " || rm_temp " ${13} "
170
175
fi
171
176
172
177
command_info " $5 " " $6 " " $7 " " $8 "
@@ -222,7 +227,7 @@ function run_tests() {
222
227
if diff -u " $test_expected " " $metafix_output " > " $metafix_diff " ; then
223
228
test_passed " $test " " $test_todo " " $metafix_elapsed_time "
224
229
225
- rm -f " $metafix_diff " " $metafix_command_output " " $metafix_command_error "
230
+ rm_temp " $metafix_diff " " $metafix_command_output " " $metafix_command_error "
226
231
else
227
232
test_failed " $test " " $test_todo " " $metafix_elapsed_time " FAILED\
228
233
metafix " $metafix_exit_status " " $metafix_command_output " " $metafix_command_error " \
0 commit comments