diff --git a/.github/workflows/build-apps-job/build-apps.sh b/.github/workflows/build-apps-job/build-apps.sh deleted file mode 100755 index c7a47d2a5..000000000 --- a/.github/workflows/build-apps-job/build-apps.sh +++ /dev/null @@ -1,104 +0,0 @@ -#! /usr/bin/bash - -# Some colors are defined to help debugging in the GitHub console. -WHITE="\033[37;1m" -RED="\033[31;1m" -GREEN="\033[32;1m" -RESET="\033[0m" - -# Some delimiters are defined to assist the process of detecting each app in the console. -LONG_G="${GREEN}================================================================================${RESET}" -LONG_R="${RED}================================================================================${RESET}" -LONG_W="${WHITE}================================================================================${RESET}" - -# Error vars are not defined if there is problem! -APPS_GCC=$(\ls sw/applications/) &&\ - -# Applications that should only be compiled with GCC -ONLY_GCC="example_cpp" - -# Initialize APPS_CLANG with the same content as APPS_GCC -APPS_CLANG="$APPS_GCC" - -# Loop through ONLY_GCC to filter out the specified applications from APPS_CLANG -for app in $ONLY_GCC; do - # Remove the app from APPS_CLANG - APPS_CLANG=${APPS_CLANG//$app/} -done - -declare -i FAILURES=0 &&\ -FAILED='' &&\ - -echo -e ${LONG_W} -echo -e "Will try building the following apps:${RESET}" -echo -e "----> GCC" -echo -e $APPS_GCC | tr " " "\n" -echo -e "----> CLANG" -echo -e $APPS_CLANG | tr " " "\n" -echo -e ${LONG_W} - -if [ -z "$APPS_GCC" ]; then - echo -e ${LONG_R} - echo -e "${RED}No apps found${RESET}" - echo -e ${LONG_R} - exit 2 -fi - -for APP in $APPS_GCC -do - - # Build the app with GCC - make app-clean - if make app PROJECT=$APP ; then - echo -e ${LONG_G} - echo -e "${GREEN}Successfully built $APP using GCC${RESET}" - echo -e ${LONG_G} - else - echo -e ${LONG_R} - echo -e "${RED}Failure building $APP using GCC${RESET}" - echo -e ${LONG_R} - FAILURES=$(( FAILURES + 1 )) - FAILED="$FAILED(gcc)\t$APP " - fi -done - -for APP in $APPS_CLANG -do - # Build the app with Clang - make app-clean - if make app PROJECT=$APP COMPILER=clang ; then - echo -e ${LONG_G} - echo -e "${GREEN}Successfully built $APP using Clang${RESET}" - echo -e ${LONG_G} - else - echo -e ${LONG_R} - echo -e "${RED}Failure building $APP using Clang${RESET}" - echo -e ${LONG_R} - FAILURES=$(( FAILURES + 1 )) - FAILED="$FAILED(clang)\t$APP " - fi -done - - -# Present the results - -if [ $FAILURES -gt 0 ]; then - - echo -e ${LONG_R} - echo -e ${LONG_R} - echo -e "${RED}FAIL: $FAILURES APPS COULD NOT BE BUILT${RESET}" - echo -e $FAILED | tr " " "\n" - echo -e ${LONG_R} - echo -e ${LONG_R} - exit 1 -else - - echo -e ${LONG_G} - echo -e ${LONG_G} - echo -e "${WHITE}THE OPERATION SUCCEEDED${RESET}" - echo -e ${LONG_G} - echo -e ${LONG_G} - exit 0 -fi - - diff --git a/.github/workflows/build-apps-job/setup.sh b/.github/workflows/build-apps-job/setup.sh deleted file mode 100755 index dd29e72b7..000000000 --- a/.github/workflows/build-apps-job/setup.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /usr/bin/bash -echo ======================================== -echo ======================================== -echo Applications will be tested by trying to -echo build each one of them. -echo ======================================== -echo ======================================== - -# Create the virtual environment and install the requirements. -conda init bash -source /root/.bashrc -conda activate core-v-mini-mcu - -echo ======================================== -echo ======================================== -echo Some previous configurations... -echo ======================================== -echo ======================================== - -# The variable could also be obtained from the container. -export RISCV='/tools/riscv' &&\ - -# All peripherals are included to make sure all apps can be built. -sed 's/is_included: "no",/is_included: "yes",/' -i mcu_cfg.hjson -# The MCU is generated with various memory banks to avoid example code not fitting. -make mcu-gen X_HEEP_CFG=configs/ci.hjson - -echo ======================================== -echo ======================================== -echo Starting building script -echo ======================================== -echo ======================================== - -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -chmod u+x $SCRIPT_DIR/build-apps.sh -$SCRIPT_DIR/build-apps.sh - diff --git a/.github/workflows/sim-apps-job/test_apps.py b/.github/workflows/sim-apps-job/test_apps.py deleted file mode 100755 index d22b876bd..000000000 --- a/.github/workflows/sim-apps-job/test_apps.py +++ /dev/null @@ -1,188 +0,0 @@ -""" -This script compiles and runs all the apps in the sw/applications directory -""" - -import os -import subprocess -import re - - -class BColors: - """ - Class to define colors in the terminal output. - """ - HEADER = "\033[95m" - OKBLUE = "\033[94m" - OKCYAN = "\033[96m" - OKGREEN = "\033[92m" - WARNING = "\033[93m" - FAIL = "\033[91m" - ENDC = "\033[0m" - BOLD = "\033[1m" - UNDERLINE = "\033[4m" - - -# Define parameters for the test_apps.py script -SIMULATOR = "verilator" -SIM_TIMEOUT_S = 600 -LINKER = "on_chip" -COMPILER = "gcc" - -# Blacklist of apps to skip -blacklist = [ - "example_spi_read", - "example_spidma_powergate", - "example_spi_write", -] - -app_list = [app for app in os.listdir("sw/applications")] - -print(BColors.OKCYAN + "Apps to test:" + BColors.ENDC) -for app in app_list: - if app not in blacklist: - print(BColors.OKCYAN + f" - {app}" + BColors.ENDC) - -apps = {app: {"building": "", "simulation": ""} for app in app_list} - - -# Compile the {SIMULATOR} model and suppress the output -print(BColors.OKBLUE + f"Generating {SIMULATOR} model of X-HEEP..." + BColors.ENDC) -try: - simulation_build_output = subprocess.run( - ["make", f"{SIMULATOR}-sim"], capture_output=True, check=False - ) -except subprocess.CalledProcessError as exc: - print(BColors.FAIL + "=====================================" + BColors.ENDC) - print(BColors.FAIL + "Error building verilated model!" + BColors.ENDC) - print(BColors.FAIL + "=====================================" + BColors.ENDC) - print(str(exc.stderr.decode("utf-8"))) - exit(1) -else: - print( - BColors.OKGREEN - + f"Generated {SIMULATOR} model of X-HEEP successfully!" - + BColors.ENDC - ) - -error_pattern = r"Program Finished with value (\d+)" - -# Compile every app and run the simulator -for an_app in apps.keys(): - if an_app not in blacklist: - apps[an_app] = {"building": "OK", "simulation": "OK"} - print(BColors.OKBLUE + f"Compiling {an_app}..." + BColors.ENDC) - try: - compile_output = subprocess.run( - [ - "make", - "app", - f"PROJECT={an_app}", - f"COMPILER={COMPILER}", - f"LINKER={LINKER}", - ], - capture_output=True, - check=True, - ) - except subprocess.CalledProcessError as exc: - print(BColors.FAIL + f"Error compiling {an_app}!" + BColors.ENDC) - print(exc.stderr.decode("utf-8")) - apps[an_app] = {"building": "Failed", "simulation": "Skipped"} - else: - apps[an_app] = {"building": "OK", "simulation": "Skipped"} - print(BColors.OKGREEN + f"Compiled successfully {an_app}!" + BColors.ENDC) - print( - BColors.OKBLUE - + f"Running {SIMULATOR} simulation of {an_app}..." - + BColors.ENDC - ) - try: - run_output = subprocess.run( - ["./Vtestharness", "+firmware=../../../sw/build/main.hex"], - cwd="build/openhwgroup.org_systems_core-v-mini-mcu_0/sim-verilator", - capture_output=True, - timeout=SIM_TIMEOUT_S, - check=False, - ) - except subprocess.TimeoutExpired: - print( - BColors.FAIL + f"Simulation of {an_app} timed out!" + BColors.ENDC - ) - apps[an_app] = {"building": "OK", "simulation": "Timed out"} - else: - match = re.search(error_pattern, str(run_output.stdout.decode("utf-8"))) - if ( - "Error" in str(run_output.stdout.decode("utf-8")) - or match.group(1) != "0" - ): - print( - BColors.FAIL - + str(run_output.stdout.decode("utf-8")) - + BColors.ENDC - ) - uart_output = open( - "build/openhwgroup.org_systems_core-v-mini-mcu_0/sim-verilator/uart0.log", - "r", - encoding="utf-8", - ) - print(BColors.FAIL + "UART output:" + BColors.ENDC) - print(BColors.FAIL + uart_output.read() + BColors.ENDC) - uart_output.close() - apps[an_app] = {"building": "OK", "simulation": "Failed"} - else: - apps[an_app] = {"building": "OK", "simulation": "OK"} - print( - BColors.OKGREEN + f"Ran {an_app} successfully!" + BColors.ENDC - ) - print(BColors.OKBLUE + f"Finished running {an_app}." + BColors.ENDC) - else: - print(BColors.WARNING + f"Skipping {an_app}..." + BColors.ENDC) - apps[an_app] = {"building": "Skipped", "simulation": "Skipped"} - -# Print the results -print(BColors.BOLD + "=================================" + BColors.ENDC) -print(BColors.BOLD + "Results:" + BColors.ENDC) -print(BColors.BOLD + "=================================" + BColors.ENDC) - -# Filter the dictionary by values -ok_apps = [ - app - for app, status in apps.items() - if (status["simulation"] == "OK" and status["building"] == "OK") -] -no_build_apps = [app for app, status in apps.items() if status["building"] == "Failed"] -no_sim_apps = [app for app, status in apps.items() if status["simulation"] == "Failed"] -skipped_apps = [ - app - for app, status in apps.items() - if (status["simulation"] == "Skipped" or status["building"] == "Skipped") -] -timed_out_apps = [ - app for app, status in apps.items() if status["simulation"] == "Timed out" -] - -# Print the filtered results -print( - BColors.OKGREEN - + f"{len(ok_apps)} out of {len(app_list)} apps compiled and ran successfully!" - + BColors.ENDC -) -if len(no_build_apps) > 0: - print(BColors.FAIL + f"{len(no_build_apps)} apps failed to build!" + BColors.ENDC) - for failed_build_app in no_build_apps: - print(BColors.FAIL + f" - {failed_build_app}" + BColors.ENDC) -if len(no_sim_apps) > 0: - print(BColors.FAIL + f"{len(no_sim_apps)} apps failed to run!" + BColors.ENDC) - for failed_run_app in no_sim_apps: - print(BColors.FAIL + f" - {failed_run_app}" + BColors.ENDC) -if len(skipped_apps) > 0: - print(BColors.WARNING + f"{len(skipped_apps)} apps were skipped!" + BColors.ENDC) - for skipped_app in skipped_apps: - print(BColors.WARNING + f" - {skipped_app}" + BColors.ENDC) -if len(timed_out_apps) > 0: - print(BColors.FAIL + f"{len(timed_out_apps)} apps timed out!" + BColors.ENDC) - for timed_out_app in timed_out_apps: - print(BColors.FAIL + f" - {timed_out_app}" + BColors.ENDC) -print(BColors.BOLD + "=================================" + BColors.ENDC) - -if len(no_build_apps) > 0 or len(no_sim_apps) > 0: - exit(1) diff --git a/.github/workflows/test-apps/test_apps.py b/.github/workflows/test-apps/test_apps.py index 823c597fc..2c8358638 100644 --- a/.github/workflows/test-apps/test_apps.py +++ b/.github/workflows/test-apps/test_apps.py @@ -3,8 +3,6 @@ FUTURE WORK: - The current setup only uses the on_chip linker. -- The current setup only allows for the compilation with one compiler for - each application. """ import argparse