@@ -111,15 +111,16 @@ stages:
111111 cwd = sys.argv[1]
112112 bin_install_dir = os.path.join(cwd, 'bin')
113113 os.environ['GOBIN'] = bin_install_dir
114+ coverage_out = os.environ['COVERAGE_OUT']
115+ report_dir = os.environ['REPORT_DIR']
116+ report_xml = os.path.join(report_dir, 'report.xml')
114117
115118 # Install the go-junit-report tool
116119 subprocess.check_call(['go', 'install', 'github.com/jstemmer/go-junit-report/v2@latest'])
117120 junit_report_bin = os.path.join(bin_install_dir, 'go-junit-report')
118121
119122 # Create report directory and touch report XML file
120- report_dir = os.environ['REPORT_DIR']
121123 os.makedirs(report_dir, exist_ok=True)
122- report_xml = os.path.join(report_dir, 'report.xml')
123124 open(report_xml, 'a').close()
124125
125126 # Run make tools
@@ -135,20 +136,19 @@ stages:
135136
136137 # Write output to report XML using go-junit-report
137138 with open(report_xml, 'w') as report_file:
138- junit_process = subprocess.Popen(
139+ with open('windows-coverage.out', 'r') as cov_out_file:
140+ subprocess.run(
139141 [junit_report_bin],
140- stdin=subprocess.PIPE,
141- stdout=report_file
142+ stdin=cov_out_file,
143+ stdout=report_file,
144+ check=True
142145 )
143- junit_process.communicate(input=report_file)
144-
145146 sys.exit(test_exit_code)
146147
147148 # Run the test function
148149 run_test()
149150
150151 # Move coverage output file
151- coverage_out = os.environ['COVERAGE_OUT']
152152 shutil.move('windows-coverage.out', coverage_out)
153153
154154 # List report directory contents again
0 commit comments