-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI resources based on Robot-Framework
* Include Docker setup and scripts (`Dockerfile`, `install-requirements.sh`, `podman-compose.sh`, `prepare-board.sh`). * Add initial Robot Framework resources, tests, and test setup files. * Integrate scripts for touch events and video performance testing with Robot Framework. * Add `conf/nginx.conf` for NGINX configuration and `docker-compose.yml` for environment setup. * Provide a comprehensive `README.md` for project setup and usage instructions. Also: * Add `.gitattributes` configuration for handling large files with Git LFS. * Include `.github/scripts/` with various sanitizer scripts (`run-all-sanatizers`, `sanatizer-pycodestyle`, `sanatizer-pyflake8`, `sanatizer-shellcheck`) for automated code quality checks. * Add GitHub Actions workflow (`sanatizers.yml`) to run sanitizers on pull requests. * Add `.gitignore` with entries for backup files, virtual environments, and testing artifacts.
- Loading branch information
Showing
34 changed files
with
1,183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
A Robot Framework tests suite for automating the validation of the | ||
meta-wpe-image images. | ||
|
||
# Installation | ||
|
||
We have the `install-requirements.sh` and `podman-compose.sh` scripts in the | ||
project.The first one is a convenient script for installing the Podman | ||
requirements. The second, is a wrapper for execute the podman-compose command | ||
but with the environment variables defined in the setup-env.sh. | ||
|
||
``` sh | ||
./install-requirements.sh | ||
cp setup-env-local.sh.sample setup-env-local.sh # Use an editor for adapt the content | ||
``` | ||
|
||
A sample environment setup file (`setup-env-local.sh.sample`) is provided to | ||
guide the initial configuration. It sets the variables for the test board and | ||
network configurations adapted to your environment. | ||
|
||
## How It Works | ||
|
||
To set up the testing environment, run: | ||
|
||
```sh | ||
./podman-compose.sh up --force-recreate --always-recreate-deps --build -d -t 4 | ||
``` | ||
|
||
Once the environment is running, you can trigger the tests with the | ||
`./run-tests.sh` launcher: | ||
|
||
```sh | ||
./run-tests.sh | ||
``` | ||
### Services Setup | ||
|
||
The `./podman-compose.sh up` command initializes the following services: | ||
|
||
- **webserver**: Runs an NGINX container, exposing port **8008** for HTTP | ||
requests. | ||
- **robot**: Runs a Python-based container configured for executing tests | ||
using the Robot Framework. | ||
|
||
### Running Tests | ||
|
||
To execute the tests, use: | ||
|
||
```sh | ||
./run-tests.sh [options] | ||
``` | ||
|
||
Options: | ||
|
||
- `--force-recreate` : Recreate and build containers before running tests. | ||
- `--help` : Display the help message for available options. | ||
|
||
### Stopping the Containers | ||
|
||
To stop the Podman containers, use: | ||
|
||
```sh | ||
./podman-compose.sh down -t 4 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
server { | ||
listen 8008; | ||
listen [::]:8008; | ||
server_name localhost; | ||
|
||
#access_log /var/log/nginx/host.access.log main; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
} | ||
|
||
location /robot_framework/html/ { | ||
root /; | ||
autoindex on; | ||
} | ||
|
||
location /tests_results/ { | ||
root /; | ||
autoindex on; | ||
} | ||
|
||
#error_page 404 /404.html; | ||
|
||
# redirect server error pages to the static page | ||
# /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: '3' | ||
services: | ||
webserver: | ||
image: nginx:latest | ||
network_mode: host | ||
volumes: | ||
- ./conf/nginx.conf:/etc/nginx/conf.d/default.conf | ||
- ./robot_framework/html:/robot_framework/html | ||
- ./tests_results:/tests_results | ||
robot: | ||
build: docker/robot/ | ||
network_mode: host | ||
volumes: | ||
- .:/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM python:3-slim | ||
|
||
WORKDIR /app | ||
|
||
CMD ["robot_framework/init-robot.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#! /bin/sh -e | ||
|
||
# Identify the Linux distribution | ||
if [ -f /etc/os-release ]; then | ||
. /etc/os-release | ||
else | ||
echo "Distribution identification file /etc/os-release is missing." | ||
exit 1 | ||
fi | ||
|
||
# Function to install podman-compose on Fedora | ||
install_fedora() { | ||
echo "Installing podman-compose on Fedora..." | ||
sudo yum install -y podman-compose pycodestyle python3-pyflakes shellcheck | ||
} | ||
|
||
# Function to install podman-compose on Debian or Ubuntu | ||
install_debian_ubuntu() { | ||
echo "Installing podman-compose on $NAME..." | ||
sudo apt update | ||
sudo apt install -y podman-compose pycodestyle pyflakes3 shellcheck | ||
} | ||
|
||
# Installation process based on the identified distribution | ||
case $ID in | ||
fedora) | ||
install_fedora | ||
;; | ||
ubuntu | debian) | ||
install_debian_ubuntu | ||
;; | ||
*) | ||
echo "Your distribution ($ID) is not supported by this script." | ||
exit 2 | ||
;; | ||
esac | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#! /bin/sh | ||
|
||
set -e | ||
|
||
if [ ! -e ./setup-env.sh ] | ||
then | ||
echo "Please, create a ./setup-env.sh to run this command" | ||
exit 1 | ||
fi | ||
|
||
. ./setup-env.sh | ||
exec podman-compose "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#! /bin/bash | ||
|
||
set -e | ||
|
||
BASEPATH="$(dirname "$(readlink -f "$0")")" | ||
|
||
SETUPENV="${BASEPATH}/setup-env.sh" | ||
|
||
if [ ! -e "${SETUPENV}" ] | ||
then | ||
echo "Please, create a ${SETUPENV} to run this command" | ||
exit 1 | ||
fi | ||
|
||
# shellcheck source=./setup-env.sh | ||
. "${SETUPENV}" | ||
|
||
sshi() { | ||
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "root@${TEST_BOARD_IP}" "$@" | ||
} | ||
|
||
scpi() { | ||
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r "$@" "root@${TEST_BOARD_IP}": | ||
} | ||
|
||
pushd "${BASEPATH}" || exit 1 | ||
scpi scripts | ||
popd || exit 1 | ||
|
||
sshi "/usr/bin/kill-demo || true" |
3 changes: 3 additions & 0 deletions
3
.ci/robot_framework/html/bbb_sunflower_1080p_30fps_normal.mp4
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Alternating Color Blocks</title> | ||
<style> | ||
/* Style for blocks */ | ||
.block { | ||
width: 100%; | ||
height: 135px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: 24px; | ||
font-weight: bold; | ||
color: black; | ||
} | ||
/* Alternate colors for blocks */ | ||
.block:nth-child(odd) { | ||
background-color: yellow; | ||
} | ||
.block:nth-child(even) { | ||
background-color: white; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<!-- Container for blocks --> | ||
<div class="container"> | ||
<!-- Generate blocks 1 to 64 --> | ||
<div class="block">1</div> | ||
<div class="block">2</div> | ||
<div class="block">3</div> | ||
<div class="block">4</div> | ||
<div class="block">5</div> | ||
<div class="block">6</div> | ||
<div class="block">7</div> | ||
<div class="block">8</div> | ||
<div class="block">9</div> | ||
<div class="block">10</div> | ||
<div class="block">11</div> | ||
<div class="block">12</div> | ||
<div class="block">13</div> | ||
<div class="block">14</div> | ||
<div class="block">15</div> | ||
<div class="block">16</div> | ||
<div class="block">17</div> | ||
<div class="block">18</div> | ||
<div class="block">19</div> | ||
<div class="block">20</div> | ||
<div class="block">21</div> | ||
<div class="block">22</div> | ||
<div class="block">23</div> | ||
<div class="block">24</div> | ||
<div class="block">25</div> | ||
<div class="block">26</div> | ||
<div class="block">27</div> | ||
<div class="block">28</div> | ||
<div class="block">29</div> | ||
<div class="block">30</div> | ||
<div class="block">31</div> | ||
<div class="block">32</div> | ||
<div class="block">33</div> | ||
<div class="block">34</div> | ||
<div class="block">35</div> | ||
<div class="block">36</div> | ||
<div class="block">37</div> | ||
<div class="block">38</div> | ||
<div class="block">39</div> | ||
<div class="block">40</div> | ||
<div class="block">41</div> | ||
<div class="block">42</div> | ||
<div class="block">43</div> | ||
<div class="block">44</div> | ||
<div class="block">45</div> | ||
<div class="block">46</div> | ||
<div class="block">47</div> | ||
<div class="block">48</div> | ||
<div class="block">49</div> | ||
<div class="block">50</div> | ||
<div class="block">51</div> | ||
<div class="block">52</div> | ||
<div class="block">53</div> | ||
<div class="block">54</div> | ||
<div class="block">55</div> | ||
<div class="block">56</div> | ||
<div class="block">57</div> | ||
<div class="block">58</div> | ||
<div class="block">59</div> | ||
<div class="block">60</div> | ||
<div class="block">61</div> | ||
<div class="block">62</div> | ||
<div class="block">63</div> | ||
<div class="block">64</div> | ||
</div> | ||
|
||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>FPS Display Video</title> | ||
<style> | ||
/* Styles for the FPS display */ | ||
#fps { | ||
position: absolute; | ||
top: 10px; | ||
left: 10px; | ||
background-color: black; | ||
color: white; | ||
padding: 5px; | ||
font-size: 16px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<!-- Video element --> | ||
<video id="myVideo" autoplay muted controls width="100%"> | ||
<source src="bbb_sunflower_1080p_30fps_normal.mp4" type="video/mp4"> | ||
</video> | ||
|
||
<!-- FPS display element --> | ||
<div id="fps">FPS: 0</div> | ||
|
||
<script> | ||
const video = document.getElementById("myVideo"); | ||
const fpsDisplay = document.getElementById("fps"); | ||
|
||
let totalFrames = 0; | ||
let startTime = 0; | ||
|
||
/** | ||
* Callback function to calculate the average FPS and update the display. | ||
* @param {DOMHighResTimeStamp} now - Current high-resolution timestamp. | ||
* @param {VideoFrameMetadata} metadata - Metadata for the video frame. | ||
*/ | ||
function updateFPS(now, metadata) { | ||
if (startTime === 0) startTime = metadata.mediaTime; | ||
|
||
// Increment the total frame count | ||
totalFrames = metadata.presentedFrames; | ||
|
||
// Calculate elapsed time since start | ||
const elapsedTime = metadata.mediaTime - startTime; | ||
const avgFPS = (totalFrames / elapsedTime).toFixed(2); | ||
|
||
// Update the FPS display every second | ||
fpsDisplay.textContent = `FPS: ${avgFPS}`; | ||
|
||
// Request the next frame callback | ||
video.requestVideoFrameCallback(updateFPS); | ||
} | ||
|
||
// Start the video frame callback loop | ||
video.requestVideoFrameCallback(updateFPS); | ||
</script> | ||
</body> | ||
</html> | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.