Skip to content

Commit

Permalink
Policheck run on VSTS for ODL-master (#919)
Browse files Browse the repository at this point in the history
* Policheck fixes

* Add the cmd to run policheck

* remove the RunPoliCheck.cmd

* Adding the exclusion config for termId 211972

* create a Policheck subdir for each branch.

* Add script to run policheck.

* move policheck exclusion config out of tools (to images dir)
  • Loading branch information
biaol-odata authored Aug 1, 2017
1 parent 6532d04 commit f80e6ee
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 7 deletions.
Binary file not shown.
4 changes: 2 additions & 2 deletions src/CodeGen/ODataT4CodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6813,8 +6813,8 @@ internal override void WriteCastToMethods(string baseTypeName, string derivedTyp
this.Write(this.ToStringHelper.ToStringWithCulture(derivedTypeFullName));

this.Write("\r\n \'\'\' </summary>\r\n \'\'\' <param name=\"source\">source entity</param>\r" +
"\n <Global.System.Runtime.CompilerServices.Extension()>\r\n Public Fu" +
"nction CastTo");
"\n <Global.System.Runtime.CompilerServices.Extension()>\r\n Public " +
"Function CastTo");

this.Write(this.ToStringHelper.ToStringWithCulture(derivedTypeName));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@
<Property Name="Name" Type="String" MaxLength="30" Nullable="false" />
<Property Name="City" Type="String" MaxLength="30" Nullable="false"/>
<Property Name="State" Type="String" MaxLength="30" Nullable="false" />
<Property Name="Country" Type="String" MaxLength="30" Nullable="false" />
<Property Name="CountryOrRegion" Type="String" MaxLength="30" Nullable="false" />
<NavigationProperty Name="Students" Relationship="Aruba.FK_Students_College" FromRole="College" ToRole="Students" />
</EntityType>
<EntityType Name="University" BaseType="Aruba.College">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@
<Property Name="Name" Type="String" MaxLength="30" Nullable="false" />
<Property Name="City" Type="String" MaxLength="30" Nullable="false"/>
<Property Name="State" Type="String" MaxLength="30" Nullable="false" />
<Property Name="Country" Type="String" MaxLength="30" Nullable="false" />
<Property Name="CountryOrRegion" Type="String" MaxLength="30" Nullable="false" />
<NavigationProperty Name="Students" Relationship="Aruba.FK_Students_College" FromRole="College" ToRole="Students" />
</EntityType>
<EntityType Name="University" BaseType="Aruba.College">
Expand Down
Binary file modified test/FunctionalTests/Framework/Workspaces/Databases/Aruba.sql
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<Property Name="City" Type="String" />
<Property Name="Region" Type="String" />
<Property Name="PostalCode" Type="String" />
<Property Name="Country" Type="String" />
<Property Name="CountryOrRegion" Type="String" />
<Property Name="Phone" Type="String" />
<Property Name="Fax" Type="String" />
<NavigationProperty Name="Orders" Relationship="northwind.FK_Orders_Customers" FromRole="Customers" ToRole="Orders" />
Expand All @@ -123,7 +123,7 @@
<Property Name="City" Type="String" />
<Property Name="Region" Type="String" />
<Property Name="PostalCode" Type="String" />
<Property Name="Country" Type="String" />
<Property Name="CountryOrRegion" Type="String" />
<Property Name="HomePhone" Type="String" />
<Property Name="Extension" Type="String" />
<Property Name="Photo" Type="Binary" />
Expand Down Expand Up @@ -212,7 +212,7 @@
<Property Name="City" Type="String" />
<Property Name="Region" Type="String" />
<Property Name="PostalCode" Type="String" />
<Property Name="Country" Type="String" />
<Property Name="CountryOrRegion" Type="String" />
<Property Name="Phone" Type="String" />
<Property Name="Fax" Type="String" />
<Property Name="HomePage" Type="String" />
Expand Down
Binary file not shown.
34 changes: 34 additions & 0 deletions tools/PoliCheck/RunPoliCheck.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
param(
[string]$BuildSourceDir,
[string]$folderName,
[string]$branchName,
[string]$resultRoot,
[string]$PoliCheckPath
)

#
#Example:
# RunPoliCheck.ps1 -BuildSourceDir "C:\BuildAgent\_work\32\s"
# -folderName "src"
# -branchName "odata.net-master"
# -resultRoot "C:\Users\ODatabld\Documents\PoliCheck\LatestRunResult"
# -PoliCheckPath "C:\Program Files (x86)\Microsoft\PoliCheck\"
#

$targetPath= "${BuildSourceDir}\${folderName}"
Write-Output "targetPath: ${targetPath}"
$result="${resultRoot}\${branchName}\poli_result_${folderName}.xml"

cd "${PoliCheckPath}"

.\Policheck.exe /F:$targetPath /T:9 /Sev:"1|2" /PE:2 /O:$result

$FileContent = Get-Content $result
$PassResult = Select-String -InputObject $FileContent -Pattern "<TermTbl />"

If ($PassResult.Matches.Count -eq 0) {
Write-Error "PoliCheck failed for target ${targetPath}. For details, please check this result file on build machine: ${result}: section <Result TotalOccurences=...>."
exit 1
}

Write-Output "PoliCheck pass for target ${targetPath}"

0 comments on commit f80e6ee

Please sign in to comment.