blob: b5696db75fbe7cc7ec0f1865eb976aa123515af1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/bash
# Transport-independent polling and reporting for archsetup test runners.
archsetup_process_running() { # <transport-function>
local transport="$1"
"$transport" "pgrep -f '[b]ash archsetup' > /dev/null" 2>/dev/null
}
wait_for_archsetup() { # <transport> <max-polls> <seconds> <progress-every> [callback]
local transport="$1" max_polls="$2" poll_seconds="$3"
local progress_every="$4" progress_callback="${5:-}"
ARCHSETUP_POLL_COUNT=0
while [ "$ARCHSETUP_POLL_COUNT" -lt "$max_polls" ]; do
archsetup_process_running "$transport" || return 0
sleep "$poll_seconds"
ARCHSETUP_POLL_COUNT=$((ARCHSETUP_POLL_COUNT + 1))
if [ "$progress_every" -gt 0 ] \
&& [ $((ARCHSETUP_POLL_COUNT % progress_every)) -eq 0 ] \
&& [ -n "$progress_callback" ]; then
"$progress_callback" "$ARCHSETUP_POLL_COUNT"
fi
done
return 124
}
write_archsetup_test_report() {
local file="$1" title="$2" test_id="$3" method="$4" context="$5"
local completed="$6" passed="$7" count_passed="$8" count_failed="$9"
shift 9
local count_warnings="$1" artifacts="$2" validation="FAILED"
[ "$passed" = "true" ] && validation="PASSED"
{
echo "========================================"
echo "$title"
echo "========================================"
echo
echo "Test ID: $test_id"
echo "Date: $(date +'%Y-%m-%d %H:%M:%S')"
echo "Test Method: $method"
if [ -n "$context" ]; then
echo
printf '%s\n' "$context"
fi
echo
echo "Results:"
echo " ArchSetup Completed: $completed (completion marker, not the installer's exit code)"
echo " Validation: $validation"
echo
echo "Validation Summary:"
echo " Passed: $count_passed"
echo " Failed: $count_failed"
echo " Warnings: $count_warnings"
if [ -n "$artifacts" ]; then
echo
printf '%s\n' "$artifacts"
fi
echo
} > "$file"
}
|