Adjust GitHub actions CI for microarchitectural tests #1
Workflow file for this run
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
name: VeeR-EL2 verification | ||
on: | ||
workflow_call: | ||
env: | ||
VERILATOR_VERSION: v5.010 | ||
jobs: | ||
tests: | ||
name: Verification tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
test: ["block/pic", "block/pic_gw"] | ||
env: | ||
CCACHE_DIR: "/opt/verification/.cache/" | ||
VERILATOR_VERSION: v5.010 | ||
DEBIAN_FRONTEND: "noninteractive" | ||
steps: | ||
- name: Setup repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Setup Cache Metadata | ||
id: cache_metadata | ||
run: | | ||
date=$(date +"%Y_%m_%d") | ||
time=$(date +"%Y%m%d_%H%M%S_%N") | ||
cache_verilator_restore_key=cache_verilator_ | ||
cache_verilator_key=${cache_verilator_restore_key}${{ env.VERILATOR_VERSION }} | ||
cache_test_restore_key=${{ matrix.test }}_${{ matrix.coverage }}_ | ||
cache_test_key=${cache_test_restore_key}${time} | ||
echo "date=$date" | tee -a "$GITHUB_ENV" | ||
echo "time=$time" | tee -a "$GITHUB_ENV" | ||
echo "cache_verilator_restore_key=$cache_verilator_restore_key" | tee -a "$GITHUB_ENV" | ||
echo "cache_verilator_key=$cache_verilator_key" | tee -a "$GITHUB_ENV" | ||
echo "cache_test_restore_key=$cache_test_restore_key" | tee -a "$GITHUB_ENV" | ||
echo "cache_test_key=$cache_test_key" | tee -a "$GITHUB_ENV" | ||
- name: Restore verilator cache | ||
id: cache-verilator-restore | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
/opt/verilator | ||
/opt/verilator/.cache | ||
key: ${{ env.cache_verilator_key }} | ||
restore-keys: ${{ env.cache_verilator_restore_key }} | ||
- name: Setup tests cache | ||
uses: actions/cache@v3 | ||
id: cache-test-setup | ||
with: | ||
path: | | ||
${{ env.CCACHE_DIR }} | ||
key: ${{ env.cache_test_key }} | ||
restore-keys: ${{ env.cache_test_restore_key }} | ||
- name: Install prerequisities | ||
run: | | ||
sudo apt -qqy update && sudo apt -qqy --no-install-recommends install \ | ||
autoconf automake autotools-dev \ | ||
bc bison build-essential \ | ||
ccache cpanminus curl \ | ||
flex \ | ||
gawk gcc-riscv64-unknown-elf git gperf \ | ||
help2man \ | ||
libexpat-dev libfl-dev libfl2 libgmp-dev \ | ||
libmpc-dev libmpfr-dev libpython3-all-dev libtool \ | ||
ninja-build \ | ||
patchutils python3 python3-dev python3-pip \ | ||
texinfo \ | ||
zlib1g zlib1g-dev | ||
sudo cpanm Bit::Vector | ||
- name: Setup environment | ||
run: | | ||
echo "/opt/verilator/bin" >> $GITHUB_PATH | ||
RV_ROOT=`pwd` | ||
echo "RV_ROOT=$RV_ROOT" >> $GITHUB_ENV | ||
PYTHONUNBUFFERED=1 | ||
echo "PYTHONUNBUFFERED=$PYTHONUNBUFFERED" >> $GITHUB_ENV | ||
TEST_TYPE=`echo ${{ matrix.test }} | cut -d'/' -f1` | ||
TEST_NAME=`echo ${{ matrix.test }} | cut -d'/' -f2` | ||
TEST_PATH=$RV_ROOT/verification/${TEST_TYPE} | ||
echo "TEST_TYPE=$TEST_TYPE" >> $GITHUB_ENV | ||
echo "TEST_NAME=$TEST_NAME" >> $GITHUB_ENV | ||
echo "TEST_PATH=$TEST_PATH" >> $GITHUB_ENV | ||
pip3 install meson nox | ||
pip3 install -r ${RV_ROOT}/verification/${TEST_TYPE}/requirements.txt | ||
- name: Run ${{ matrix.test }} | ||
run: | | ||
pushd ${TEST_PATH} | ||
nox -s ${TEST_NAME}_verify | ||
popd | ||
# - name: Prepare pytest-html data | ||
# run: | | ||
# pushd ${{ github.workspace }} | ||
# WEBPAGE_DIR=webpage_${{ matrix.test }}_${{ matrix.COVERAGE }} | ||
# mkdir -p $WEBPAGE_DIR | ||
# mv ${TEST_PATH}/${{ matrix.test }}_${{ matrix.COVERAGE }}.html $WEBPAGE_DIR | ||
# mv ${TEST_PATH}/assets $WEBPAGE_DIR | ||
# JS_SCRIPT_DIR=${{ github.workspace }}/.github/scripts/pytest/script | ||
# mv $JS_SCRIPT_DIR $WEBPAGE_DIR | ||
# popd | ||
- name: Prepare coverage data | ||
run: | | ||
pushd ${{ github.workspace }} | ||
mkdir -p results/coverage_${TEST_NAME} | ||
for COVERAGE in branch toggle all; do | ||
FILES=`find ${TEST_PATH}/${TEST_NAME}/coverage_test_*_${COVERAGE}.dat` | ||
if ! [ -z "${FILES}" ]; then | ||
for DAT_FILE in ; do | ||
INFO_FILE=`basename ${DAT_FILE} .dat` | ||
INFO_FILE=${INFO_FILE/coverage_test_/} | ||
INFO_FILE=${INFO_FILE/_${COVERAGE}/} | ||
INFO_FILE=${{ github.workspace }}/results/coverage_${TEST_NAME}_${COVERAGE}.info | ||
echo "Converting '${DAT_FILE}' to '${INFO_FILE}'" | ||
verilator_coverage --write-info ${INFO_FILE} ${DAT_FILE} | ||
done | ||
fi | ||
done | ||
# mv ${TEST_PATH}/${TEST_NAME}/coverage_test_${TEST_NAME}_coverage.dat coverage_${{ matrix.test }}/ | ||
# .github/scripts/convert_coverage_data.sh ${{ matrix.COVERAGE }} ${{ github.workspace }}/coverage_${{ matrix.test }} ${{ github.workspace }}/results coverage_${{ matrix.test }} | ||
# echo "convert_coverage_data.sh exited with RET_CODE = "$? | ||
popd | ||
# - name: Upload pytest-html artifacts | ||
# if: always() | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: verification_dashboard | ||
# path: | | ||
# webpage_* | ||
- name: Upload coverage artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: verification_tests_coverage_data | ||
path: ./results/*.info |