diff --git a/.github/workflows/runtest.yaml b/.github/workflows/runtest.yaml new file mode 100644 index 0000000..58cfd77 --- /dev/null +++ b/.github/workflows/runtest.yaml @@ -0,0 +1,72 @@ +name: Compile and Run +on: + workflow_dispatch: + pull_request: + branches: [main] + push: + branches: [main] + +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.yml -m > required_packs.txt + + cat required_packs.txt + cpackget add -a -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 diff --git a/Testing/board/runall.py b/Testing/board/runall.py index 72b76a1..be809d1 100644 --- a/Testing/board/runall.py +++ b/Testing/board/runall.py @@ -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 @@ -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") @@ -82,6 +89,7 @@ def getError(l,s): def getMessage(l,s): return(f"\n[bold cyan]{s}[/bold cyan]") + class Result: def __init__(self,msg,error=False): self._error = error @@ -140,7 +148,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", @@ -164,7 +184,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) @@ -245,6 +276,11 @@ def gen_table(the_list): # Run the tests and log the result # in a summary.html file +# + +def live_display(live,latest): + if not GHACTION: + live.update(renderable=gen_table(latest)) MAX_ROWS=4 latest=[] @@ -307,25 +343,25 @@ def gen_table(the_list): #live.console.print("Incremental build") msg += " Incremental build" latest[-1][-1]=msg - live.update(renderable=gen_table(latest)) + live_display(live,latest) res=run("cbuild","-O" ,"cprj",'cmsiscv.csolution.yml',"--toolchain" ,c,"-c",buildFile,live=live) else: #live.console.print("Rebuild all (and RTE update)") msg += " Rebuild all (and RTE update)" latest[-1][-1]=msg - live.update(renderable=gen_table(latest)) + live_display(live,latest) res=run("cbuild","-O" ,"cprj",'cmsiscv.csolution.yml',"--update-rte","-r","--toolchain" ,c,"-c",buildFile,live=live) else: #live.console.print("Incremental build") msg += " Incremental build" latest[-1][-1]=msg - live.update(renderable=gen_table(latest)) + live_display(live,latest) res=run("cbuild","-O" ,"cprj",'cmsiscv.csolution.yml',"--toolchain" ,c,"-c",buildFile,live=live) if res.error: latest[-1][-1]="[red]Error cbuild" - live.update(renderable=gen_table(latest)) + live_display(live,latest) #printError(live,"Error cbuild") print(f'

Error building {testSuite["name"]}

',file=f)
                               print(res.msg,file=f)
@@ -333,15 +369,15 @@ def gen_table(the_list):
                               continue
                        if not args.norun and (not core is None):
                            latest[-1][-1]="Run AVH"
-                           live.update(renderable=gen_table(latest))
+                           live_display(live,latest)
                            #printSubTitle(live,"Run AVH")
                            clean_old_results()
                            res=runAVH(live,build,core)
                            if res.error:
                                latest[-1][-1]="[red]Error running AVH"
-                               live.update(renderable=gen_table(latest))
+                               live_display(live,latest)
                                #printError(live,"Error running AVH")
-                               print(f'

Error running {testSuite["name"]} with {avhExe[core]}

',file=f)
+                               print(f'

Error running {testSuite["name"]} with {avhUnixExe[core]}

',file=f)
                                print(res.msg,file=f)
                                print("
",file=f) continue @@ -350,12 +386,12 @@ def gen_table(the_list): if had_error: ERROR_OCCURED = True latest[-1][-1]="[red]Failed" - live.update(renderable=gen_table(latest)) + live_display(live,latest) continue # In case of no issue, we drop the status # Status table only contain failure latest=latest[:-1] - live.update(renderable=gen_table(latest)) + live_display(live,latest) print(HTMLFOOTER,file=f) @@ -363,10 +399,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) diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..efd106f --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,19 @@ +{ + "registries": [ + { + "name": "arm", + "kind": "artifact", + "location": "https://artifacts.tools.arm.com/vcpkg-registry" + } + ], + "requires": { + "arm:tools/open-cmsis-pack/cmsis-toolbox": "2.4.0", + "arm:tools/kitware/cmake": "3.28.4", + "arm:tools/ninja-build/ninja": "1.12.0", + "arm:compilers/arm/armclang": "6.22.0", + "arm:compilers/arm/arm-none-eabi-gcc": "^13.2.1", + "arm:models/arm/avh-fvp": "^11.22.39", + "arm:debuggers/arm/armdbg": "6.1.2" + } +} +