| Line 1... |
Line 1... |
#!/usr/bin/expect -f
|
#!/usr/bin/expect -f
|
|
|
|
load_lib test_utils.exp
|
|
|
###############################################################################
|
###############################################################################
|
# Command to test a single case with multiple sources
|
# Command to test a single case with multiple sources
|
# We assume:
|
# We assume:
|
# there is an shell script indicating how to testing the case
|
# there is an shell script indicating how to testing the case
|
| Line 24... |
Line 25... |
}
|
}
|
}
|
}
|
|
|
namespace eval C_CLASS {
|
namespace eval C_CLASS {
|
|
|
proc TestMakefile { case caseexe case_out_dir log_out_dir summary checker } {
|
proc TestMakefile { case caseexe case_out_dir summary checker } {
|
global cc cxx fc cflags cxxflags fflags sim #Flags
|
global cc cxx fc cflags cxxflags fflags sim #Flags
|
global curdir
|
global curdir
|
global err_compile err_link err_build pass_build #Counters
|
global C_CLASS::err_compile C_CLASS::err_link C_CLASS::err_build C_CLASS::pass_build #Counters
|
global err_runexit err_runout err_run pass_run #Counters
|
global C_CLASS::err_runexit C_CLASS::err_runout C_CLASS::err_run C_CLASS::pass_run #Counters
|
|
|
system mkdir -p $case_out_dir
|
system mkdir -p $case_out_dir
|
system mkdir -p $log_out_dir
|
|
system cp -rf $case/* $case_out_dir
|
system cp -rf $case/* $case_out_dir
|
|
|
#Parse and generate Makefile
|
#Parse and generate Makefile
|
set makefileout [open $case_out_dir/Makefile w]
|
set makefileout [open $case_out_dir/Makefile w]
|
set makefilein [open $case/Makefile r]
|
set makefilein [open $case/Makefile r]
|
| Line 71... |
Line 71... |
}
|
}
|
puts $makefileout $line
|
puts $makefileout $line
|
} elseif {[string equal [string index $line end] "\\"] || [string equal $targetfile ""]} {
|
} elseif {[string equal [string index $line end] "\\"] || [string equal $targetfile ""]} {
|
puts $makefileout $line
|
puts $makefileout $line
|
} else {
|
} else {
|
puts $makefileout "$line >& $log_out_dir/$targetfile.ci || (echo \"!!!Message:$errormsg (Makefile:$lineno) !!!\" && exit 1)"
|
puts $makefileout "$line >& $case_out_dir/$targetfile.ci || (echo \"!!!Message:$errormsg (Makefile:$lineno) !!!\" && exit 1)"
|
}
|
}
|
} else { #Parsing headers
|
} else { #Parsing headers
|
set colonpos [string first ":" $line]
|
set colonpos [string first ":" $line]
|
if { [expr $colonpos >= 0] } {
|
if { [expr $colonpos >= 0] } {
|
set targetfile [string range $line 0 [expr $colonpos - 1]]
|
set targetfile [string range $line 0 [expr $colonpos - 1]]
|
| Line 112... |
Line 112... |
set buildres -1
|
set buildres -1
|
} else {
|
} else {
|
set mpos2 [string first "!!!" $makeresult 11]
|
set mpos2 [string first "!!!" $makeresult 11]
|
set makeresult [string range $makeresult 11 [expr $mpos2 - 1]]
|
set makeresult [string range $makeresult 11 [expr $mpos2 - 1]]
|
set mpos3 [string first "]" $makeresult]
|
set mpos3 [string first "]" $makeresult]
|
catch {exec cat $log_out_dir/[string range $makeresult 1 [expr $mpos3 - 1]].ci} cioutput
|
|
set buildres -1
|
set buildres -1
|
}
|
}
|
} else {
|
} else {
|
incr pass_build
|
incr pass_build
|
if { $execute == 1 } {
|
if { $execute == 1 } {
|
set rc [catch {exec ./$caseexe > $log_out_dir/$caseexe.run}]
|
set rc [catch {exec ./$caseexe > $case_out_dir/$caseexe.run}]
|
set runresult ""
|
set runresult ""
|
if { $rc } {
|
if { $rc } {
|
set runres -1
|
set runres -1
|
incr err_run
|
incr err_run
|
} else {
|
} else {
|
catch {exec cat $log_out_dir/$caseexe.run} runresult
|
catch {exec cat $case_out_dir/$caseexe.run} runresult
|
if { [expr [$checker $runresult] == 1]} {
|
if { [expr [$checker $runresult] == 1]} {
|
incr pass_run
|
incr pass_run
|
} else {
|
} else {
|
set cmpres 1
|
set cmpres 1
|
incr err_run
|
incr err_run
|
}
|
}
|
}
|
}
|
PrintLines $runresult
|
|
}
|
}
|
}
|
}
|
|
|
Report_TestCase_Result $case $buildres $runres $cmpres
|
Report_TestCase_Result $case $buildres $runres $cmpres
|
cd $curdir
|
cd $curdir
|