-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_all_tests.sh
More file actions
executable file
·233 lines (189 loc) · 6.91 KB
/
Copy pathrun_all_tests.sh
File metadata and controls
executable file
·233 lines (189 loc) · 6.91 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/bin/bash
# Copyright (c) 2026 Stefan. Licensed under Apache-2.0
# See LICENSE file for full license details.
################################################################################
# WindowsBridge – Integration Test Suite
#
# Beschreibung: Führt alle Test-Skripte nacheinander aus
# - test_system.sh
# - test_wine.sh
# - test_gaming.sh
# - Zusammenfassung und Reportage
#
# Verwendung: bash run_all_tests.sh [--verbose]
#
# Autor: WindowsBridge Team
# Datum: 2026
################################################################################
# Nicht mit 'set -e' verwenden, da wir fehler abfangen möchten
set +e
# Farben
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
NC='\033[0m'
VERBOSE=false
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODULES_DIR="$SCRIPT_DIR/modules"
LOG_DIR="${HOME}/.config/windowsbridge"
# Test-Ergebnisse
SYSTEM_PASS=0
WINE_PASS=0
GAMING_PASS=0
################################################################################
# Hilfsfunktionen
################################################################################
print_header() {
echo ""
echo -e "${PURPLE}════════════════════════════════════════════${NC}"
echo -e "${PURPLE} $1${NC}"
echo -e "${PURPLE}════════════════════════════════════════════${NC}"
echo ""
}
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[✓]${NC} $1"
}
log_error() {
echo -e "${RED}[✗]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[⚠]${NC} $1"
}
check_script_exists() {
if [ ! -f "$1" ]; then
log_error "Skript nicht gefunden: $1"
exit 1
fi
if [ ! -x "$1" ]; then
log_warning "Skript nicht ausführbar, setze Permissions: $1"
chmod +x "$1"
fi
}
################################################################################
# Test-Durchführung
################################################################################
run_system_tests() {
print_header "Phase 1: System-Tests"
check_script_exists "$MODULES_DIR/test_system.sh"
if [ "$VERBOSE" = true ]; then
bash "$MODULES_DIR/test_system.sh" --verbose && SYSTEM_PASS=1 || SYSTEM_PASS=0
else
bash "$MODULES_DIR/test_system.sh" && SYSTEM_PASS=1 || SYSTEM_PASS=0
fi
}
run_wine_tests() {
print_header "Phase 2: Wine-Tests"
check_script_exists "$MODULES_DIR/test_wine.sh"
if [ "$VERBOSE" = true ]; then
bash "$MODULES_DIR/test_wine.sh" --verbose && WINE_PASS=1 || WINE_PASS=0
else
bash "$MODULES_DIR/test_wine.sh" && WINE_PASS=1 || WINE_PASS=0
fi
}
run_gaming_tests() {
print_header "Phase 3: Gaming-Tests"
check_script_exists "$MODULES_DIR/test_gaming.sh"
if [ "$VERBOSE" = true ]; then
bash "$MODULES_DIR/test_gaming.sh" --verbose && GAMING_PASS=1 || GAMING_PASS=0
else
bash "$MODULES_DIR/test_gaming.sh" && GAMING_PASS=1 || GAMING_PASS=0
fi
}
print_summary() {
print_header "Test-Zusammenfassung"
local total_tests=3
local passed_tests=$((SYSTEM_PASS + WINE_PASS + GAMING_PASS))
local percentage=$((passed_tests * 100 / total_tests))
echo ""
echo -e "System Tests: $([ $SYSTEM_PASS -eq 1 ] && echo -e "${GREEN}✓ BESTANDEN${NC}" || echo -e "${RED}✗ FEHLER${NC}")"
echo -e "Wine Tests: $([ $WINE_PASS -eq 1 ] && echo -e "${GREEN}✓ BESTANDEN${NC}" || echo -e "${RED}✗ FEHLER${NC}")"
echo -e "Gaming Tests: $([ $GAMING_PASS -eq 1 ] && echo -e "${GREEN}✓ BESTANDEN${NC}" || echo -e "${RED}✗ FEHLER${NC}")"
echo ""
echo -e "Gesamtergebnis: ${BLUE}$passed_tests/$total_tests Test-Suites erfolgreich ($percentage%)${NC}"
echo ""
echo -e "${YELLOW}Hinweis: Ein erfolgreicher Test-Suite-Durchlauf hängt davon ab,"
echo -e "ob alle notwendigen Komponenten installiert sind.${NC}"
echo ""
if [ $SYSTEM_PASS -eq 1 ] && [ $WINE_PASS -eq 1 ] && [ $GAMING_PASS -eq 1 ]; then
echo -e "${GREEN}════════════════════════════════════════════${NC}"
echo -e "${GREEN}✓ ALLE TEST-SUITES BESTANDEN!${NC}"
echo -e "${GREEN}════════════════════════════════════════════${NC}"
echo ""
log_success "WindowsBridge ist vollständig und einsatzbereit"
echo ""
return 0
else
echo -e "${RED}════════════════════════════════════════════${NC}"
echo -e "${RED}⚠ EINIGE TEST-SUITES SIND FEHLGESCHLAGEN${NC}"
echo -e "${RED}════════════════════════════════════════════${NC}"
echo ""
if [ $SYSTEM_PASS -eq 0 ]; then
log_error "System-Tests fehlgeschlagen - Führe aus:"
echo " sudo bash $MODULES_DIR/system_setup.sh"
fi
if [ $WINE_PASS -eq 0 ]; then
log_error "Wine-Tests fehlgeschlagen - Führe aus:"
echo " bash $MODULES_DIR/wine_setup.sh"
fi
if [ $GAMING_PASS -eq 0 ]; then
log_error "Gaming-Tests fehlgeschlagen - Führe aus:"
echo " bash $MODULES_DIR/gaming_setup.sh"
fi
echo ""
return 1
fi
}
print_log_info() {
echo -e "${BLUE}Log-Dateien:${NC}"
echo ""
if [ -d "$LOG_DIR" ]; then
ls -lht "$LOG_DIR"/*.log 2>/dev/null | head -10 | awk '{print " " $NF}'
else
log_warning "Log-Verzeichnis nicht gefunden: $LOG_DIR"
fi
echo ""
echo -e "${BLUE}Vollständige Logs anzeigen:${NC}"
echo " tail -f $LOG_DIR/test_*.log"
}
################################################################################
# Hauptprogramm
################################################################################
parse_arguments() {
while [[ $# -gt 0 ]]; do
case $1 in
--verbose)
VERBOSE=true
shift
;;
*)
shift
;;
esac
done
}
main() {
parse_arguments "$@"
print_header "WindowsBridge – Komplette Test Suite"
log_info "Skriptverzeichnis: $SCRIPT_DIR"
log_info "Module-Verzeichnis: $MODULES_DIR"
log_info "Log-Verzeichnis: $LOG_DIR"
if [ "$VERBOSE" = true ]; then
log_info "VERBOSE MODE aktiviert"
fi
run_system_tests
run_wine_tests
run_gaming_tests
if print_summary; then
print_log_info
exit 0
else
print_log_info
exit 1
fi
}
main "$@"