Skip to content

Commit

Permalink
Adjust GitHub actions CI for microarchitectural tests
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Kurc <[email protected]>
  • Loading branch information
mkurc-ant committed Sep 20, 2023
1 parent 0ae72ae commit 37ccf73
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions .github/workflows/test-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -85,42 +83,57 @@ 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}
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
for COVERAGE in branch toggle all; do
WEBPAGE_DIR=webpage_${TEST_NAME}_${COVERAGE}
mkdir -p $WEBPAGE_DIR
# TODO: This is a mockup empty page. Ultimately we want it to contain
# a report based on the XUnit XML files generated by cocotb.
echo "<!DOCTYPE html><html><body></body></html>" >${WEBPAGE_DIR}/${TEST_NAME}_${COVERAGE}.html
done
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 ${FILES}; 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:
Expand Down

0 comments on commit 37ccf73

Please sign in to comment.