@@ -25,13 +25,73 @@ stages:
2525 } 3>&1;
2626 } | { read xs; exit $xs; }
2727 } 4>&1
28+
29+ mv coverage-all.out linux-coverage.out
2830 retryCountOnTaskFailure: 3
2931 name: "Test"
3032 displayName: "Run Tests"
33+ - task : PublishPipelineArtifact@1
34+ inputs :
35+ targetPath : ' linux-coverage.out'
36+ artifactName : ' linux-coverage'
37+
38+ - stage : test_windows
39+ displayName : Test ACN Windows
40+ dependsOn :
41+ - setup
42+ jobs :
43+ - job : test
44+ displayName : Run Tests
45+ variables :
46+ STORAGE_ID : $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.StorageID'] ]
47+ pool :
48+ name : " $(BUILD_POOL_NAME_DEFAULT_WINDOWS_ALT)"
49+ steps :
50+ # Only run one go test per script
51+ - script : |
52+ cd azure-container-networking/
53+ go test -timeout 30m -covermode atomic -coverprofile=windows-coverage.out ./npm/... ./cni/... ./platform/...
54+ go tool cover -func=windows-coverage.out
55+ retryCountOnTaskFailure: 3
56+ name: "TestWindows"
57+ displayName: "Run Windows Tests"
58+ - task : PublishPipelineArtifact@1
59+ inputs :
60+ targetPath : ' windows-coverage.out'
61+ artifactName : ' windows-coverage'
62+
63+ - stage : code_coverage
64+ displayName : Code Coverage Check
65+ dependsOn :
66+ - test
67+ - test_windows
68+ jobs :
69+ - job : coverage
70+ displayName : Check Coverage
71+ pool :
72+ name : " $(BUILD_POOL_NAME_DEFAULT)"
73+ steps :
74+ - task : DownloadPipelineArtifact@2
75+ inputs :
76+ artifact : ' linux-coverage'
77+ path : ' ./'
78+ - task : DownloadPipelineArtifact@2
79+ inputs :
80+ artifact : ' windows-coverage'
81+ path : ' ./'
3182 - bash : |
83+ make tools
3284 sudo ln -s $(pwd)/build/tools/bin/gocov /usr/local/bin/gocov
3385 sudo ln -s $(pwd)/build/tools/bin/gocov-xml /usr/local/bin/gocov-xml
34- gocov convert coverage-all.out > total_ut_coverage.json
86+
87+ sed -i "1d" linux-coverage.out
88+ sed -i "1d" windows-coverage.out
89+
90+ echo "mode: atomic" > total_ut_coverage.out
91+ cat linux-coverage.out >> total_ut_coverage.out
92+ cat windows-coverage.out >> total_ut_coverage.out
93+
94+ gocov convert total_ut_coverage.out > total_ut_coverage.json
3595 gocov-xml < total_ut_coverage.json > total_ut_coverage.xml
3696 name: "Coverage"
3797 displayName: "Generate Coverage Report"
@@ -52,23 +112,3 @@ stages:
52112 baseBranchRef : " master"
53113 allowCoverageVariance : true
54114 coverageVariance : 0.25
55-
56- - stage : test_windows
57- displayName : Test ACN Windows
58- dependsOn :
59- - setup
60- jobs :
61- - job : test
62- displayName : Run Tests
63- variables :
64- STORAGE_ID : $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.StorageID'] ]
65- pool :
66- name : " $(BUILD_POOL_NAME_DEFAULT_WINDOWS_ALT)"
67- steps :
68- # Only run one go test per script
69- - script : |
70- cd azure-container-networking/
71- go test -timeout 30m ./npm/... ./cni/... ./platform/...
72- retryCountOnTaskFailure: 3
73- name: "TestWindows"
74- displayName: "Run Windows Tests"
0 commit comments