-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Avimitin <[email protected]>
- Loading branch information
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: T1 MMIO Check | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
- labeled | ||
env: | ||
USER: runner | ||
|
||
# Cancel the current workflow when new commit pushed | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-emulators: | ||
name: "Build Emulators" | ||
runs-on: [self-hosted, linux, nixos, BIGRAM] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: ["blastoise"] | ||
ip: ["t1rocketemu", "t1emu"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Build vcs emulator" | ||
run: | | ||
set -o pipefail | ||
set -o errexit | ||
passWith() { | ||
local msg="$1"; shift | ||
echo | ||
printf ">> PASS: $msg\n" "$@" | ||
echo | ||
} | ||
failWith() { | ||
local msg="$1"; shift | ||
echo | ||
printf ">> FAIL: $msg\n" "$@" >&2 | ||
echo | ||
exit 1 | ||
} | ||
nix develop -c t1-helper run \ | ||
--config ${{ matrix.config }} --ip ${{ matrix.ip }} --emu vcs-emu \ | ||
emurt-test.simple | ||
# Test 1: Test mmio-event.jsonl file exists | ||
mmioResultFile="$(realpath $PWD/./t1-sim-result/result/mmio-event.jsonl)" | ||
if [[ ! -r "$mmioResultFile" ]]; then | ||
failWith "mmio-event.jsonl not found" | ||
fi | ||
passWith "mmio-result file found ($mmioResultFile)" | ||
# Test 2: Test output is expected String | ||
mmioOutput=$(jq -r 'select(.event == "uart-write") | .value' "$mmioResultFile" \ | ||
| awk '{ printf "%c", $1}') | ||
expectResult="Hello, World" | ||
if [[ "$mmioOutput" != "$expectResult" ]]; then | ||
failWith "Expect '$expectResult', got '$mmioOutput'" | ||
fi | ||
passWith "mmio-result is expected ($mmioOutput)" | ||
# Test 3: Test program instrument did work | ||
calculator=$(realpath ./nix/t1/run/calculate-cycle.py) | ||
cd $(dirname "$mmioResultFile") | ||
cycles=$(python3 "$calculator") | ||
total_cycles=$(nix run '.#jq' -- .total_cycles perf.json) | ||
if (( $cycles < 0 || $cycles > $total_cycles )); then | ||
failWith "invalid program instrument $cycles found" | ||
fi | ||
passWith "program instrument cycles is valid ($cycles)" |