1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0031038: Draw - adaptations for running tests with CLang address sanitizer

New optional environment variable CSF_CPULIMIT_FACTOR is introduced, allowing scaling the argument given to DRAW command cpulimit by specified factor.

Command testgrid is extended by two new options:
- -skipped: to re-run tests skipped in specified log
- -skip: to skip specified number of tests in the beginning of test sequence

Temporary Tcl scripts generated by test system are now removed from the test log directories immediately after the test execution, to save disk space.

Advises on use of CLang sanitizers are added in guide "Debugging hints and tips".
This commit is contained in:
abv
2019-10-06 09:33:53 +03:00
committed by bugmaster
parent e9d05765c2
commit f979709590
4 changed files with 126 additions and 22 deletions

View File

@@ -144,7 +144,9 @@ help testgrid {
-xml filename: write XML report for Jenkins (in JUnit-like format)
-beep: play sound signal at the end of the tests
-regress dirname: re-run only a set of tests that have been detected as regressions on some previous run.
-skipped dirname: re-run only a set of tests that have been skipped on some previous run.
Here "dirname" is path to directory containing results of previous run.
-skip N: skip first N tests (useful to restart after abort)
Groups, grids, and test cases to be executed can be specified by list of file
masks, separated by spaces or comma; default is all (*).
}
@@ -172,7 +174,10 @@ proc testgrid {args} {
set exc_grid 0
set exc_case 0
set regress 0
set prev_logdir ""
set skipped 0
set logdir_regr ""
set logdir_skip ""
set nbskip 0
for {set narg 0} {$narg < [llength $args]} {incr narg} {
set arg [lindex $args $narg]
@@ -234,13 +239,29 @@ proc testgrid {args} {
}
# re-run only a set of tests that have been detected as regressions on some previous run
if { $arg == "-regress" } {
if { $arg == "-regress" || $arg == "-skipped" } {
incr narg
if { $narg < [llength $args] && ! [regexp {^-} [lindex $args $narg]] } {
set prev_logdir [lindex $args $narg]
set regress 1
if { $arg == "-regress" } {
set logdir_regr [file normalize [string trim [lindex $args $narg]]]
set regress 1
} else {
set logdir_skip [file normalize [string trim [lindex $args $narg]]]
set skipped 1
}
} else {
error "Option -regress requires argument"
error "Option $arg requires argument"
}
continue
}
# skip N first tests
if { $arg == "-skip" } {
incr narg
if { $narg < [llength $args] && [string is integer [lindex $args $narg]] } {
set nbskip [lindex $args $narg]
} else {
error "Option -skip requires integer argument"
}
continue
}
@@ -303,7 +324,6 @@ proc testgrid {args} {
# check that target log directory is empty or does not exist
set logdir [file normalize [string trim $logdir]]
set prev_logdir [file normalize [string trim $prev_logdir]]
if { $logdir == "" } {
# if specified logdir is empty string, generate unique name like
# results/<branch>_<timestamp>
@@ -332,7 +352,7 @@ proc testgrid {args} {
# if option "regress" is given
set rerun_group_grid_case {}
if { ${regress} > 0 } {
if { ${regress} > 0 || ${skipped} > 0 } {
if { "${groupmask}" != "*"} {
lappend rerun_group_grid_case [list $groupmask $gridmask $casemask]
}
@@ -341,8 +361,8 @@ proc testgrid {args} {
}
if { ${regress} > 0 } {
if { [file exists ${prev_logdir}/tests.log] } {
set fd [open ${prev_logdir}/tests.log]
if { [file exists ${logdir_regr}/tests.log] } {
set fd [open ${logdir_regr}/tests.log]
while { [gets $fd line] >= 0 } {
if {[regexp {CASE ([^\s]+) ([^\s]+) ([^\s]+): FAILED} $line dump group grid casename] ||
[regexp {CASE ([^\s]+) ([^\s]+) ([^\s]+): IMPROVEMENT} $line dump group grid casename]} {
@@ -351,7 +371,20 @@ proc testgrid {args} {
}
close $fd
} else {
error "Error: file ${prev_logdir}/tests.log is not found, check your input arguments!"
error "Error: file ${logdir_regr}/tests.log is not found, check your input arguments!"
}
}
if { ${skipped} > 0 } {
if { [file exists ${logdir_skip}/tests.log] } {
set fd [open ${logdir_skip}/tests.log]
while { [gets $fd line] >= 0 } {
if {[regexp {CASE ([^\s]+) ([^\s]+) ([^\s]+): SKIPPED} $line dump group grid casename] } {
lappend rerun_group_grid_case [list $group $grid $casename]
}
}
close $fd
} else {
error "Error: file ${logdir_skip}/tests.log is not found, check your input arguments!"
}
}
@@ -501,7 +534,11 @@ proc testgrid {args} {
continue
}
lappend tests_list [list $dir $group $grid $casename $casefile]
if { $nbskip > 0 } {
incr nbskip -1
} else {
lappend tests_list [list $dir $group $grid $casename $casefile]
}
}
}
}
@@ -571,7 +608,8 @@ proc testgrid {args} {
if { $logdir != "" } { set imgdir_cmd "set imagedir $logdir/$group/$grid" }
# prepare command file for running test case in separate instance of DRAW
set fd_cmd [open $logdir/$group/$grid/${casename}.tcl w]
set file_cmd "$logdir/$group/$grid/${casename}.tcl"
set fd_cmd [open $file_cmd w]
puts $fd_cmd "$imgdir_cmd"
puts $fd_cmd "set test_image $casename"
puts $fd_cmd "_run_test $dir $group $grid $casefile t"
@@ -594,7 +632,7 @@ proc testgrid {args} {
# commant to run DRAW with a command file;
# note that empty string is passed as standard input to avoid possible
# hang-ups due to waiting for stdin of the launching process
set command "exec <<{} DRAWEXE -f $logdir/$group/$grid/${casename}.tcl"
set command "exec <<{} DRAWEXE -f $file_cmd"
# alternative method to run without temporary file; disabled as it needs too many backslashes
# else {
@@ -1558,6 +1596,7 @@ proc _log_and_puts {logvar message} {
proc _log_test_case {output logdir dir group grid casename logvar} {
upvar $logvar log
set show_errors 0
# check result and make HTML log
_check_log $dir $group $grid $casename $show_errors $output summary html_log
lappend log $summary
@@ -1567,6 +1606,11 @@ proc _log_test_case {output logdir dir group grid casename logvar} {
_log_html $logdir/$group/$grid/$casename.html $html_log "Test $group $grid $casename"
_log_save $logdir/$group/$grid/$casename.log "$output\n$summary" "Test $group $grid $casename"
}
# remove intermediate command file used to run test
if { [file exists $logdir/$group/$grid/${casename}.tcl] } {
file delete $logdir/$group/$grid/${casename}.tcl
}
}
# Auxiliary procedure to save log to file
@@ -1710,8 +1754,8 @@ proc _log_html_summary {logdir log totals regressions improvements skipped total
puts $fd "</table>"
# time stamp and elapsed time info
puts $fd "<p>Generated on [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}] on [info hostname]\n<p>"
if { $total_time != "" } {
puts $fd "<p>Generated on [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}] on [info hostname]\n<p>"
puts $fd [join [split $total_time "\n"] "<p>"]
} else {
puts $fd "<p>NOTE: This is intermediate summary; the tests are still running! This page will refresh automatically until tests are finished."