Skip to content

Commit 8e8b0ff

Browse files
committed
fix dry-run
1 parent 801b1bf commit 8e8b0ff

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

scripts/bash/run-tests.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ declare -r renamed_results_dir
3434
if [[ -d "$ARTIFACTS_DIR" && "$(ls -A "$ARTIFACTS_DIR")" ]]; then
3535
choice=$(choose \
3636
"The test results directory '$ARTIFACTS_DIR' already exists. What do you want to do?" \
37-
"Delete the directory and continue" \
38-
"Rename the directory to '$renamed_results_dir' and continue" \
39-
"Exit the script") || exit $?
37+
"Delete the directory and continue" \
38+
"Rename the directory to '$renamed_results_dir' and continue" \
39+
"Exit the script") || exit $?
4040

4141
trace "User selected option: $choice"
4242
case $choice in
@@ -91,7 +91,7 @@ execute dotnet test "$test_project" \
9191
--coverage-output-format cobertura \
9292
--coverage-output "$coverage_source_path"
9393

94-
if [[ ! "$dry_run" ]]; then
94+
if [[ $dry_run != "true" ]]; then
9595
f=$(find "$(pwd)" -type f -path "*/$coverage_source_fileName" -print -quit || true)
9696
if [ -z "$f" ]; then
9797
echo "Coverage file not found." >&2
@@ -124,7 +124,7 @@ if [[ "$uninstall_reportgenerator" = "true" ]]; then
124124
execute rm -rf ./tools
125125
fi
126126

127-
if [[ ! "$dry_run" ]]; then
127+
if [[ $dry_run != "true" ]]; then
128128
if [ ! -s "$coverage_reports_path" ]; then
129129
echo "Coverage summary not found." >&2
130130
exit 2
@@ -138,7 +138,7 @@ execute mv "$coverage_reports_dir" "$coverage_summary_html_dir"
138138

139139
# Extract the coverage percentage from the summary file
140140
trace "Extracting coverage percentage from '$coverage_summary_path'..."
141-
if [[ ! "$dry_run" ]]; then
141+
if [[ $dry_run != "true" ]]; then
142142
pct=$(sed -nE 's/Method coverage: ([0-9]+)(\.[0-9]+)?%.*/\1/p' "$coverage_summary_path" | head -n1)
143143
if [ -z "$pct" ]; then
144144
echo "Could not parse coverage percent from $coverage_summary_path" >&2
@@ -152,6 +152,6 @@ if [[ ! "$dry_run" ]]; then
152152
echo "Coverage $pct% is below threshold $min_coverage_pct%" >&2
153153
exit 2
154154
else
155-
echo "Coverage $pct% meets threshold $min_coverage_pct%" >&2
155+
echo "Coverage $pct% meets threshold $min_coverage_pct%"; flush_stdout
156156
fi
157157
fi

0 commit comments

Comments
 (0)