From 1d1e6b6fe869083eb76ec0e71537923477b04565 Mon Sep 17 00:00:00 2001 From: Maciej Kurc Date: Tue, 19 Sep 2023 15:32:53 +0200 Subject: [PATCH] Adjust GitHub actions CI for microarchitectural tests Signed-off-by: Maciej Kurc --- .github/workflows/test-verification.yml | 60 +++++++++++-------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/.github/workflows/test-verification.yml b/.github/workflows/test-verification.yml index 2059b41490e..63547c90a41 100644 --- a/.github/workflows/test-verification.yml +++ b/.github/workflows/test-verification.yml @@ -12,8 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - test: ["test_pyuvm"] - coverage: ["branch", "toggle"] #TODO: add functional coverage + test: ["block/pic", "block/pic_gw"] env: CCACHE_DIR: "/opt/verification/.cache/" VERILATOR_VERSION: v5.010 @@ -41,7 +40,6 @@ jobs: 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 @@ -85,49 +83,43 @@ jobs: echo "RV_ROOT=$RV_ROOT" >> $GITHUB_ENV PYTHONUNBUFFERED=1 echo "PYTHONUNBUFFERED=$PYTHONUNBUFFERED" >> $GITHUB_ENV - TEST_PATH=$RV_ROOT/verification/top/${{ matrix.test }} + + 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: | - pip3 install meson - pip3 install -r $RV_ROOT/verification/top/requirements.txt - PYTEST_STYLE_SRC_DIR=${{ github.workspace }}/.github/scripts/pytest/ - PYTEST_CSS=${PYTEST_STYLE_SRC_DIR}/css/styles.css - HTML_FILE=${{ matrix.test }}_${{ matrix.COVERAGE }}.html pushd ${TEST_PATH} - python -m pytest ${{ matrix.test }}.py -sv --coverage=${{ matrix.COVERAGE }} --html=$HTML_FILE --md=$GITHUB_STEP_SUMMARY --css=$PYTEST_CSS - bash ${PYTEST_STYLE_SRC_DIR}/style_pytest_report.sh ${PYTEST_STYLE_SRC_DIR} ${TEST_PATH} ${HTML_FILE} - 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 + nox -s ${TEST_NAME}_verify popd - name: Prepare coverage data run: | pushd ${{ github.workspace }} - mkdir -p coverage_${{ matrix.test }} - mv ${TEST_PATH}/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 = "$? + mkdir -p results/coverage_${TEST_NAME} + for COVERAGE in branch toggle all; do + FILES=`find ${TEST_PATH}/${TEST_NAME}/ -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 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