Skip to content

Commit

Permalink
Add github action for running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe0606 committed Jun 18, 2024
1 parent 8161660 commit ce41604
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 6 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/runtest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Compile and Run
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [ghaction]

permissions:
actions: read
security-events: write

jobs:
CI_test_run:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install system packages
run: |
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install libpython3.9 libtinfo5
- name: Activate vcpkg
uses: ARM-software/cmsis-actions/vcpkg@v1

- name: Activate Arm tool license
uses: ARM-software/cmsis-actions/armlm@v1

- name: Prepare framework
run: |
cd Testing/board
echo "Install missing python packages"
pip install -r requirements.txt
echo "Generate reference patterns"
python runall.py --gen --norun --nobuild
echo "Load missing pack"
csolution list packs -s cmsiscv.csolution -m > required_packs.txt
cat required_packs.txt
cpackget add -f required_packs.txt
- name: Execute
run: |
cd Testing/board
echo "Running tests"
python runall.py -avh $AVH_FVP_PLUGINS/../bin
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: test-report
path: Testing/board/summary.html


- name: Check error
run: |
cd Testing/board
echo "Checking output..."
test "$(grep "Error" summary.html | wc -l)" -eq 0
46 changes: 40 additions & 6 deletions Testing/board/runall.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import os
import glob
import sys
from os import environ


# Description of all configurations compiler / cores are defined
# in this file
Expand All @@ -27,6 +29,11 @@
Path("inputs").mkdir(parents=True, exist_ok=True)
Path("results/img").mkdir(parents=True, exist_ok=True)

GHACTION = False

if "AVH_FVP_PLUGINS" in os.environ:
GHACTION = True

parser = argparse.ArgumentParser(description='Parse test description')
parser.add_argument('-avh', nargs='?',type = str, default="C:/Keil_v5/ARM/VHT", help="AVH folder")
parser.add_argument('-d', action='store_true', help="Debug log for command launch")
Expand Down Expand Up @@ -140,7 +147,19 @@ def run(*args,mustPrint=False,dumpStdErr=True,live=None):
# Windows executable
# (At some point this script will also support
# unix)
avhExe={
avhUnixExe={
"CS310":"FVP_Corstone_SSE-310_Ethos-U65",
"CS300":"FVP_Corstone_SSE-300_Ethos-U55",
"M55":"FVP_MPS2_Cortex-M55",
"M33_DSP_FP":"FVP_MPS2_Cortex-M33",
"M7DP":"FVP_MPS2_Cortex-M7",
"M4FP":"FVP_MPS2_Cortex-M4",
"M3":"FVP_MPS2_Cortex-M3",
"M23":"FVP_MPS2_Cortex-M23",
"M0plus":"FVP_MPS2_Cortex-M0plus",
}

avhWindowsExe={
"CS310":"VHT_Corstone_SSE-310.exe",
"CS300":"VHT_Corstone_SSE-300_Ethos-U55.exe",
"M55":"VHT_MPS2_Cortex-M55.exe",
Expand All @@ -164,7 +183,18 @@ def runAVH(live,build,core):
if os.path.exists(elf):
app = elf
config = os.path.join("fvp_configs",configFiles[core])
avh = os.path.join(AVHROOT,avhExe[core])

if AVHROOT:
avhAttempt = os.path.join(AVHROOT,avhWindowsExe[core])
if os.path.exists(avhAttempt):
avh = avhAttempt

avhAttempt = os.path.join(AVHROOT,avhUnixExe[core])
if os.path.exists(avhAttempt):
avh = avhAttempt
else:
avh = avhUnixExe[core]

res=run(avh,"-f",config,app,live=live)
return(res)

Expand Down Expand Up @@ -363,10 +393,14 @@ def gen_table(the_list):
# Refresh cursor
oldprint('\033[?25h', end="")

if ERROR_OCCURED:
sys.exit("Error occurred")
else:
sys.exit(0)
# When github action, error is tested by greping the summary html
# like that the github action is not interrupted before uploading the
# test report as an artifact.
if not GHACTION:
if ERROR_OCCURED:
sys.exit("Error occurred")
else:
sys.exit(0)



0 comments on commit ce41604

Please sign in to comment.