-
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 2.44 KB
/
end2end-smoke-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
on:
- push
jobs:
smoke-test:
runs-on: ubuntu-latest
steps:
- name: Set up the Ocaml toolchain
run: |
sudo apt-get install bubblewrap
echo "" | bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
echo "1" | opam init
opam install dune
- name: Fetching the generator sources
uses: actions/checkout@v4
with:
path: generator
- name: Getting the hash of the riscv sail model to fetch
id: sail-riscv-model-get-hash
run: echo "h=$(cat sail.hash.txt)" >> "$GITHUB_OUTPUT"
- name: Fetching the riscv sail model
uses: actions/checkout@v4
with:
repository: riscv/sail-riscv
ref: ${{ steps.sail-riscv-model-get-hash.outputs.h }}
path: sail-riscv/
sparse-checkout: model
- name: Running the generator
run: |
cd generator
source ~/.bash_profile
export OPAMCONFIRMLEVEL=yes
export OCAMLRUNPARAM=b
opam install . --deps-only
opam install sail=0.17.1
sudo apt-get install z3
mv riscv_ast.gen.inc old_riscv_ast.gen.inc
mv riscv_decode.gen.inc old_riscv_decode.gen.inc
dune exec --profile release -- riscv_disasm_from_sail -f sail.filepaths.txt
echo '#include "riscv_decode.gen.inc" \n void main() {}' > test_main.c
gcc test_main.c || echo "Failure: Trying to compile the tool-generated C code failed."
if diff -q riscv_ast.gen.inc old_riscv_ast.gen.inc > /dev/null 2>&1; then
if diff -q riscv_decode.gen.inc old_riscv_decode.gen.inc > /dev/null 2>&1; then
echo "Success: The tool generates compiling C code that is identical to the files committed."
else
echo "Failure: The tool-generated decoding logic differ from that committed in the repo."
exit 1
fi
else
echo "Failure: The tool-generated ast definition differ from the one committed in the repo."
exit 1
fi