Skip to content

Commit dd49e19

Browse files
committed
Add KMScube & WestonSimpleEGL Test for Graphics Public CI
Signed-off-by: Maheswara Pappula <maheswa@qti.qualcomm.com>
1 parent 8ba9498 commit dd49e19

File tree

5 files changed

+336
-58
lines changed

5 files changed

+336
-58
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
3+
#SPDX-License-Identifier: BSD-3-Clause-Clear
4+
# KMSCube GraphicsTest Scripts for RB3 Gen2 (Yocto)
5+
# Overview
6+
7+
Graphics scripts automates the validation of Graphics OpenGL ES 2.0 capabilities on the Qualcomm RB3 Gen2 platform running a Yocto-based Linux system. It utilizes kmscube test app which is publicly available at https://gitlab.freedesktop.org/mesa/kmscube
8+
9+
## Features
10+
11+
- Primarily uses OpenGL ES 2.0, but recent versions include headers for OpenGL ES 3.0 for compatibility
12+
- Uses Kernel Mode Setting (KMS) and Direct Rendering Manager (DRM) to render directly to the screen without a display server
13+
- Designed to be lightweight and minimal, making it ideal for embedded systems and validation environments.
14+
- Can be used to measure GPU performance or validate rendering pipelines in embedded Linux systems
15+
16+
## Prerequisites
17+
18+
Ensure the following components are present in the target Yocto build:
19+
20+
- kmscube (Binary Available in /usr/bin) - this test app can be compiled from https://gitlab.freedesktop.org/mesa/kmscube
21+
- Weston should be killed while running KMSCube Test
22+
- Write access to root filesystem (for environment setup)
23+
24+
## Directory Structure
25+
26+
```
27+
bash
28+
Runner/
29+
├── suites/
30+
│ ├── Multimedia/
31+
│ │ ├── Graphics/
32+
│ │ │ ├── KMSCube/
33+
│ │ │ │ ├── run.sh
34+
```
35+
36+
## Usage
37+
38+
1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to the /var directory on the target device.
39+
40+
2. Verify Transfer: Ensure that the repo have been successfully copied to the /var directory on the target device.
41+
42+
3. Run Scripts: Navigate to the /var directory on the target device and execute the scripts as needed.
43+
44+
Run a Graphics KMSCube test using:
45+
---
46+
#### Quick Example
47+
```
48+
git clone <this-repo>
49+
cd <this-repo>
50+
scp -r common Runner user@target_device_ip:/var
51+
ssh user@target_device_ip
52+
cd /var/Runner && ./run-test.sh KMSCube
53+
```
54+
#### Sample output:
55+
```
56+
sh-5.2# cd /var/Runner && ./run-test.sh KMSCube
57+
[Executing test case: KMSCube] 2025-01-09 00:34:15 -
58+
[INFO] 2025-01-09 00:34:15 - -------------------------------------------------------------------
59+
[INFO] 2025-01-09 00:34:15 - ------------------- Starting kmscube Testcase -------------------
60+
[INFO] 2025-01-09 00:34:15 - Weston is running. Attempting to stop it...
61+
[INFO] 2025-01-09 00:34:17 - Weston stopped successfully.
62+
[INFO] 2025-01-09 00:34:17 - Running kmscube test with --count=999...
63+
[PASS] 2025-01-09 00:34:34 - kmscube : Test Passed
64+
[INFO] 2025-01-09 00:34:34 - ------------------- Completed kmscube Testcase ------------------
65+
[PASS] 2025-01-09 00:34:34 - KMSCube passed
66+
67+
[INFO] 2025-01-09 00:34:34 - ========== Test Summary ==========
68+
PASSED:
69+
KMSCube
70+
71+
FAILED:
72+
None
73+
[INFO] 2025-01-09 00:34:34 - ==================================
74+
sh-5.2#
75+
```
76+
## Notes
77+
78+
- It validates the graphics gles2 functionalities.
79+
- If any critical tool is missing, the script exits with an error message.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/sh
2+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
3+
# SPDX-License-Identifier: BSD-3-Clause-Clear
4+
5+
# KMSCube Validator Script (Yocto-Compatible)
6+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
7+
INIT_ENV=""
8+
SEARCH="$SCRIPT_DIR"
9+
while [ "$SEARCH" != "/" ]; do
10+
if [ -f "$SEARCH/init_env" ]; then
11+
INIT_ENV="$SEARCH/init_env"
12+
break
13+
fi
14+
SEARCH=$(dirname "$SEARCH")
15+
done
16+
17+
if [ -z "$INIT_ENV" ]; then
18+
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
19+
exit 1
20+
fi
21+
22+
if [ -z "$__INIT_ENV_LOADED" ]; then
23+
# shellcheck disable=SC1090
24+
. "$INIT_ENV"
25+
fi
26+
27+
# shellcheck disable=SC1090,SC1091
28+
. "$TOOLS/functestlib.sh"
29+
30+
TESTNAME="kmscube"
31+
FRAME_COUNT=999
32+
EXPECTED_FRAMES=$((FRAME_COUNT - 1))
33+
test_path=$(find_test_case_by_name "$TESTNAME")
34+
cd "$test_path" || exit 1
35+
RES_FILE="./$TESTNAME.res"
36+
LOG_FILE="./${TESTNAME}_run.log"
37+
rm -f "$RES_FILE" "$LOG_FILE"
38+
39+
log_info "-------------------------------------------------------------------"
40+
log_info "------------------- Starting $TESTNAME Testcase -------------------"
41+
42+
if check_dependencies kmscube; then
43+
log_fail "$TESTNAME : kmscube binary not found"
44+
echo "$TESTNAME SKIP" > "$RES_FILE"
45+
exit 1
46+
fi
47+
48+
if pgrep -x "weston" >/dev/null 2>&1; then
49+
log_info "Weston is running. Attempting to stop it..."
50+
killall weston
51+
sleep 2
52+
if pgrep -x "weston" >/dev/null 2>&1; then
53+
log_error "Failed to stop Weston. It may interfere with kmscube."
54+
else
55+
log_info "Weston stopped successfully."
56+
fi
57+
else
58+
log_info "Weston is not running."
59+
fi
60+
61+
log_info "Running kmscube test with --count=$FRAME_COUNT..."
62+
if kmscube --count="$FRAME_COUNT" > "$LOG_FILE" 2>&1; then
63+
if grep -q "Rendered $EXPECTED_FRAMES frames" "$LOG_FILE"; then
64+
log_pass "$TESTNAME : Test Passed"
65+
echo "$TESTNAME PASS" > "$RES_FILE"
66+
else
67+
log_fail "$TESTNAME : Expected output not found (Rendered $EXPECTED_FRAMES frames)"
68+
echo "$TESTNAME FAIL" > "$RES_FILE"
69+
fi
70+
else
71+
log_fail "$TESTNAME : Execution failed (non-zero exit code)"
72+
echo "$TESTNAME FAIL" > "$RES_FILE"
73+
fi
74+
75+
log_info "------------------- Completed $TESTNAME Testcase ------------------"
76+
exit 0
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
3+
#SPDX-License-Identifier: BSD-3-Clause-Clear
4+
# WestonSimpleEGL GraphicsTest Scripts for RB3 Gen2 (Yocto)
5+
# Overview
6+
7+
Graphics scripts automates the validation of Graphics OpenGL ES 2.0 capabilities on the Qualcomm RB3 Gen2 platform running a Yocto-based Linux system. It utilizes Weston-Simple-EGL test app which is publicly available at https://github.com/krh/weston
8+
9+
## Features
10+
11+
- Wayland Client Integration , Uses wl_compositor, wl_shell, wl_seat, and wl_shm interfaces
12+
- OpenGL ES 2.0 Rendering
13+
- EGL Context Initialization
14+
15+
## Prerequisites
16+
17+
Ensure the following components are present in the target Yocto build:
18+
19+
- `WestonSimpleEGL` (Binary Available in /usr/bin) be default
20+
- Write access to root filesystem (for environment setup)
21+
22+
## Directory Structure
23+
24+
```
25+
bash
26+
Runner/
27+
├── suites/
28+
│ ├── Multimedia/
29+
│ │ ├── Graphics/
30+
│ │ │ ├── WestonSimpleEGL/
31+
│ │ │ │ ├── run.sh
32+
```
33+
34+
## Usage
35+
36+
1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to the /var directory on the target device.
37+
38+
2. Verify Transfer: Ensure that the repo have been successfully copied to the /var directory on the target device.
39+
40+
3. Run Scripts: Navigate to the /var directory on the target device and execute the scripts as needed.
41+
42+
Run Graphics WestonSimpleEGL using:
43+
---
44+
#### Quick Example
45+
```
46+
git clone <this-repo>
47+
cd <this-repo>
48+
scp -r common Runner user@target_device_ip:/var
49+
ssh user@target_device_ip
50+
cd /var/Runner && ./run-test.sh WestonSimpleEGL
51+
```
52+
53+
#### Sample output:
54+
```
55+
sh-5.2# sh run-test.sh westonsimpleegl
56+
[Executing test case: WestonSimpleEGL] 2025-01-09 00:35:19 -
57+
[INFO] 2025-01-09 00:35:19 - --------------------------------------------------------------------------
58+
[INFO] 2025-01-09 00:35:19 - ------------------- Starting weston-simple-egl Testcase --------------------------
59+
[INFO] 2025-01-09 00:35:19 - Running weston-simple-egl for 30 seconds...
60+
QUALCOMM build : 05b958b3c9, Ia7470d0c4c
61+
Build Date : 03/27/25
62+
OpenGL ES Shader Compiler Version:
63+
Local Branch :
64+
Remote Branch :
65+
Remote Branch :
66+
Reconstruct Branch :
67+
Build Config : G ESX_C_COMPILER_OPT 3.3.0 AArch64
68+
Driver Path : /usr/lib/libGLESv2_adreno.so.2
69+
Driver Version : 0808.0.6
70+
Process Name : weston-simple-egl
71+
PFP: 0x016dc112, ME: 0x00000000
72+
Pre-rotation disabled !!!
73+
EGL updater thread started
74+
MSM_GEM_NEW returned handle[1] for drm_fd=5 buffer flag=65536 buffer size=266240
75+
Get fd[7] from GEM HANDLE[1]
76+
MSM_GEM_NEW returned handle[2] for drm_fd=5 buffer flag=65536 buffer size=266240
77+
Get fd[7] from GEM HANDLE[2]
78+
MSM_GEM_NEW returned handle[3] for drm_fd=5 buffer flag=65536 buffer size=266240
79+
Get fd[7] from GEM HANDLE[3]
80+
MSM_GEM_NEW returned handle[4] for drm_fd=5 buffer flag=65536 buffer size=266240
81+
Get fd[7] from GEM HANDLE[4]
82+
303 frames in 5 seconds: 60.599998 fps
83+
300 frames in 5 seconds: 60.000000 fps
84+
299 frames in 5 seconds: 59.799999 fps
85+
300 frames in 5 seconds: 60.000000 fps
86+
300 frames in 5 seconds: 60.000000 fps
87+
[PASS] 2025-01-09 00:35:51 - weston-simple-egl : Test Passed
88+
[INFO] 2025-01-09 00:35:51 - ------------------- Completed weston-simple-egl Testcase ------------------------
89+
[PASS] 2025-01-09 00:35:51 - WestonSimpleEGL passed
90+
91+
[INFO] 2025-01-09 00:35:51 - ========== Test Summary ==========
92+
PASSED:
93+
WestonSimpleEGL
94+
95+
FAILED:
96+
None
97+
[INFO] 2025-01-09 00:35:51 - ==================================
98+
sh-5.2#
99+
```
100+
## Notes
101+
102+
- It validates the graphics gles2 functionalities.
103+
- If any critical tool is missing, the script exits with an error message.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: BSD-3-Clause-Clear
3+
# Description: Script to test the 'weston-simple-egl' Wayland client for 30 seconds and log the result.
4+
5+
# Robustly find and source init_env
6+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
7+
INIT_ENV=""
8+
SEARCH="$SCRIPT_DIR"
9+
while [ "$SEARCH" != "/" ]; do
10+
if [ -f "$SEARCH/init_env" ]; then
11+
INIT_ENV="$SEARCH/init_env"
12+
break
13+
fi
14+
SEARCH=$(dirname "$SEARCH")
15+
done
16+
17+
if [ -z "$INIT_ENV" ]; then
18+
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
19+
exit 1
20+
fi
21+
22+
# Only source if not already loaded (idempotent)
23+
if [ -z "$__INIT_ENV_LOADED" ]; then
24+
# shellcheck disable=SC1090
25+
. "$INIT_ENV"
26+
fi
27+
28+
# Always source functestlib.sh, using $TOOLS exported by init_env
29+
# shellcheck disable=SC1090,SC1091
30+
. "$TOOLS/functestlib.sh"
31+
32+
TESTNAME="weston-simple-egl"
33+
XDG_RUNTIME_DIR="/dev/socket/weston"
34+
WAYLAND_DISPLAY="wayland-1"
35+
export XDG_RUNTIME_DIR WAYLAND_DISPLAY
36+
37+
mkdir -p "$XDG_RUNTIME_DIR"
38+
chmod 0700 "$XDG_RUNTIME_DIR"
39+
40+
test_path=$(find_test_case_by_name "$TESTNAME")
41+
cd "$test_path" || exit 1
42+
RES_FILE="./$TESTNAME.res"
43+
LOG_FILE="./${TESTNAME}_run.log"
44+
rm -f "$RES_FILE" "$LOG_FILE"
45+
46+
log_info "--------------------------------------------------------------------------"
47+
log_info "------------------- Starting $TESTNAME Testcase --------------------------"
48+
49+
if ! pgrep -x "weston" >/dev/null 2>&1; then
50+
log_fail "$TESTNAME : Weston not running"
51+
echo "$TESTNAME SKIP" > "$RES_FILE"
52+
exit 1
53+
fi
54+
55+
if check_dependencies weston-simple-egl; then
56+
log_fail "$TESTNAME : weston-simple-egl binary not found"
57+
echo "$TESTNAME SKIP" > "$RES_FILE"
58+
exit 1
59+
fi
60+
61+
log_info "Running weston-simple-egl for 30 seconds..."
62+
script -q -c "weston-simple-egl" "$LOG_FILE" 2>/dev/null &
63+
EGL_PID=$!
64+
sleep 30
65+
kill "$EGL_PID" 2>/dev/null
66+
wait "$EGL_PID" 2>/dev/null
67+
68+
count=$(grep -i -o "5 seconds" "$LOG_FILE" | wc -l)
69+
if [ "$count" -ge 5 ]; then
70+
log_pass "$TESTNAME : Test Passed"
71+
echo "$TESTNAME PASS" > "$RES_FILE"
72+
else
73+
log_fail "$TESTNAME : Test Failed"
74+
echo "$TESTNAME FAIL" > "$RES_FILE"
75+
fi
76+
77+
log_info "------------------- Completed $TESTNAME Testcase ------------------------"
78+
exit 0

Runner/suites/Multimedia/Graphics/run.sh

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)