2018-04-13 10:46:03 +00:00
|
|
|
$testRoot = ".\"
|
|
|
|
|
2020-08-26 08:01:51 +00:00
|
|
|
Get-ChildItem -Path $testRoot -Attribute Directory |
|
2018-04-13 10:46:03 +00:00
|
|
|
Foreach-Object {
|
2020-08-26 08:01:51 +00:00
|
|
|
|
|
|
|
$dirName = (Get-Item $testRoot$_).Name
|
2020-08-31 02:21:32 +00:00
|
|
|
$langName = $dirName
|
2020-08-26 08:01:51 +00:00
|
|
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
2020-10-11 00:24:15 +00:00
|
|
|
$result = & ".\unitTest.ps1" $dirName $langName
|
2020-08-26 08:01:51 +00:00
|
|
|
$sw.Stop()
|
|
|
|
"Test: " + $sw.Elapsed.TotalMilliseconds + " ms"
|
|
|
|
|
2020-08-31 02:21:32 +00:00
|
|
|
|
2020-08-26 08:01:51 +00:00
|
|
|
if ($result -eq 0)
|
2020-08-31 02:21:32 +00:00
|
|
|
{
|
|
|
|
"$dirName ... OK"
|
|
|
|
}
|
2020-08-26 08:01:51 +00:00
|
|
|
elseif ($result -eq 1)
|
2020-08-31 02:21:32 +00:00
|
|
|
{
|
2020-08-26 08:01:51 +00:00
|
|
|
"$dirName ... unitTest file not found. Test skipped."
|
2020-08-31 02:21:32 +00:00
|
|
|
}
|
2020-10-11 00:24:15 +00:00
|
|
|
elseif ($result -eq -1)
|
2020-08-26 08:01:51 +00:00
|
|
|
{
|
2020-08-31 02:21:32 +00:00
|
|
|
"$dirName ... KO"
|
2020-10-11 00:24:15 +00:00
|
|
|
"result = $result"
|
|
|
|
"There are some problems in your $dirName.xml"
|
|
|
|
exit -1
|
|
|
|
}
|
|
|
|
elseif ($result -eq -2)
|
|
|
|
{
|
|
|
|
"Exception!"
|
|
|
|
exit -1
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
"It should not happen - check your script."
|
2020-08-26 08:01:51 +00:00
|
|
|
exit -1
|
|
|
|
}
|
2020-08-31 02:21:32 +00:00
|
|
|
|
|
|
|
# Check all Sub-directories for other unit-tests
|
2020-08-26 08:01:51 +00:00
|
|
|
Get-ChildItem -Path $testRoot\$dirName -Attribute Directory |
|
2020-08-31 02:21:32 +00:00
|
|
|
Foreach-Object {
|
2020-08-26 08:01:51 +00:00
|
|
|
|
2020-08-31 02:21:32 +00:00
|
|
|
$subDirName = (Get-Item $testRoot$dirName\$_).Name
|
2020-08-26 08:01:51 +00:00
|
|
|
$sw = [Diagnostics.Stopwatch]::StartNew()
|
2020-08-31 02:21:32 +00:00
|
|
|
$subResult = &.\unitTest.ps1 $langName\$subDirName $langName
|
2020-08-26 08:01:51 +00:00
|
|
|
$sw.Stop()
|
|
|
|
"Test:" + $sw.Elapsed.TotalMilliseconds + " ms"
|
2020-08-31 02:21:32 +00:00
|
|
|
if ($subResult -eq 0)
|
|
|
|
{
|
|
|
|
"$dirName-$subDirName ... OK"
|
|
|
|
}
|
|
|
|
elseif ($subResult -eq 1)
|
|
|
|
{
|
2020-08-26 08:01:51 +00:00
|
|
|
"$dirName-$subDirName ... unitTest file not found. Test skipped."
|
2020-08-31 02:21:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
"$dirName-$subDirName ... KO"
|
|
|
|
""
|
2020-10-11 00:24:15 +00:00
|
|
|
"There are some problems in your $dirName.xml"
|
2020-08-31 02:21:32 +00:00
|
|
|
exit -1
|
|
|
|
}
|
|
|
|
}
|
2018-04-13 10:46:03 +00:00
|
|
|
}
|
2020-08-25 00:21:51 +00:00
|
|
|
""
|
|
|
|
"All tests are passed."
|
2018-12-29 17:58:00 +00:00
|
|
|
exit 0
|