Debian Codegraph @

debian/tests/greeter

raw symbols SCIP
1 #!/bin/bash
2
3 has_primary_gpu=false
4 for dev in $(udevadm trigger --dry-run --verbose --sysname-match="card*" --subsystem-match=drm --tag-match=master-of-seat |
5 grep -v platform-simple-framebuffer); do
6 if udevadm info -a -p "$dev" | grep -Eq 'ATTRS{boot_(vga|display)}=="1"'; then
7 has_primary_gpu=true
8 break
9 fi
10 done
11
12 if [ $has_primary_gpu = false ]; then
13 echo "Skipped because kernel reports no primary GPU"
14 exit 77
15 fi
16
17
18
19 DBUS_LOG="${AUTOPKGTEST_ARTIFACTS}/dbus-log"
20 JOURNAL_LOG="${AUTOPKGTEST_ARTIFACTS}/journal"
21 GDM_CFG_FILE=/etc/gdm3/daemon.conf
22 if dpkg-vendor --is Ubuntu; then
23 GDM_CFG_FILE=/etc/gdm3/custom.conf
24 fi
25
26 trap log EXIT
27
28 # shellcheck disable=SC2317
29 log() {
30 journalctl -b > "$JOURNAL_LOG"
31 }
32
33 count_calls() {
34 method="$1"
35 awk "\$1 == \"mc\" && \$8 == \"$method\"" < "$DBUS_LOG" | wc -l
36 }
37
38 check() {
39 if [ "$(count_calls RegisterDisplay)" -ne 1 ]; then
40 return 1
41 fi
42 if [ "$(count_calls RegisterSession)" -ne 1 ]; then
43 return 1
44 fi
45 if [ "$(count_calls OpenSession)" -ne 1 ]; then
46 return 1
47 fi
48 return 0
49 }
50
51 python3 -c "from gi.repository import GLib; \
52 cfg = GLib.KeyFile(); \
53 cfg.load_from_file('$GDM_CFG_FILE', GLib.KeyFileFlags.KEEP_COMMENTS); \
54 cfg.set_string('debug', 'Enable', 'true'); \
55 cfg.save_to_file('$GDM_CFG_FILE')"
56
57 dbus-monitor --system --profile interface=org.gnome.DisplayManager.Manager | tee "$DBUS_LOG" &
58 systemctl start gdm3
59
60 TIMEOUT=120
61 SECONDS=0
62 while [ $SECONDS -lt $TIMEOUT ]; do
63 sleep 1
64 if check; then
65 exit 0
66 fi
67 done
68
69 echo "Timed out waiting for greeter to display"
70 exit 1